154{
158 PWSTR findFileName = EnumCtx->findData.cFileName;
159 PWSTR pFilePart = EnumCtx->FullPathBuffer + offFilePart;
160 size_t cchRemaining = EnumCtx->cchBuffer - offFilePart;
161
162
164 {
165
168 {
170 {
171
172
173
174 }
175
176 ConPrintf(
StdErr,
L"Directory level too deep: %s\n", EnumCtx->FullPathBuffer);
178 }
179
180 hFind =
FindFirstFileW(EnumCtx->FullPathBuffer, &EnumCtx->findData);
182 {
187 {
189 }
191 }
192
193 do
194 {
196 size_t offNewFilePart;
197
199 continue;
200
202 continue;
203
204
206 if (bIsReparse)
207 {
208 if (EnumCtx->uReparseLevel < 2)
209 EnumCtx->uReparseLevel++;
210 else
211 continue;
212 }
213
215 NULL, &offNewFilePart, 0,
216 L"%s\\", findFileName);
217
218 offNewFilePart = EnumCtx->cchBuffer - offNewFilePart;
219
221
222
223
224 pFilePart = EnumCtx->FullPathBuffer + offFilePart;
225 cchRemaining = EnumCtx->cchBuffer - offFilePart;
226
227
228 if (bIsReparse)
229 EnumCtx->uReparseLevel--;
230 }
233 }
234
235
236 hRes =
StringCchCopyW(pFilePart, cchRemaining, EnumCtx->FileName);
237
238
239 hFind =
FindFirstFileW(EnumCtx->FullPathBuffer, &EnumCtx->findData);
241 return bFound;
242
243 do
244 {
246 BOOL bExactMatch = (
wcsicmp(findFileName, EnumCtx->FileName) == 0);
247
249 continue;
250
252 continue;
253
254
255
257 continue;
258
260 EnumCtx->Callback(&EnumCtx->findData, EnumCtx->FullPathBuffer, EnumCtx->Context);
262 }
265
266 return bFound;
267}
static VOID ErrorMessage(_In_ DWORD dwErrorCode, _In_opt_ PCWSTR pszMsg,...)
#define ALL_FILES_PATTERN
void ConPrintf(FILE *fp, LPCWSTR psz,...)
#define INVALID_HANDLE_VALUE
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
#define ERROR_FILE_NOT_FOUND
#define FILE_ATTRIBUTE_DIRECTORY
#define FILE_ATTRIBUTE_REPARSE_POINT
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
STRSAFEAPI StringCchPrintfExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
#define STRSAFE_E_INSUFFICIENT_BUFFER
DWORD WINAPI GetLastError(void)
#define ERROR_SHARING_VIOLATION