23#define FIND_DATA_SIZE 0x4000
24#define FIND_DEVICE_HANDLE ((HANDLE)0x1)
134 sizeof(lpFindFileData->cFileName),
150#define ULARGE_INTEGER_2_FILETIME(ft, ul) \
152 (ft).dwHighDateTime = (ul).u.HighPart; \
153 (ft).dwLowDateTime = (ul).u.LowPart ; \
160 lpFindFileData->dwFileAttributes = DirInfo.FullDirInfo->FileAttributes;
166 lpFindFileData->nFileSizeHigh = DirInfo.FullDirInfo->EndOfFile.u.HighPart;
167 lpFindFileData->nFileSizeLow = DirInfo.FullDirInfo->EndOfFile.u.LowPart;
171 lpFindFileData->dwReserved0 = DirInfo.FullDirInfo->EaSize;
173 lpFindFileData->dwReserved0 = 0;
176 lpFindFileData->dwReserved1 = 0;
181 sizeof(lpFindFileData->cFileName),
182 DirInfo.BothDirInfo->FileName,
183 DirInfo.BothDirInfo->FileNameLength);
186 sizeof(lpFindFileData->cAlternateFileName),
187 DirInfo.BothDirInfo->ShortName,
188 DirInfo.BothDirInfo->ShortNameLength);
193 sizeof(lpFindFileData->cFileName),
194 DirInfo.FullDirInfo->FileName,
195 DirInfo.FullDirInfo->FileNameLength);
215 OUT PWIN32_FIND_STREAM_DATA lpFindStreamData)
219 ASSERT(FindStreamData->CurrentInfo);
221 switch (FindStreamData->InfoLevel)
223 case FindStreamInfoStandard:
225 ULONG StreamNameLen =
min(FindStreamData->CurrentInfo->StreamNameLength,
226 sizeof(lpFindStreamData->cStreamName) -
sizeof(
WCHAR));
230 lpFindStreamData->StreamSize.QuadPart = FindStreamData->CurrentInfo->StreamSize.QuadPart;
232 FindStreamData->CurrentInfo->StreamName,
288 Ansi.
Buffer = lpFindFileData->cFileName;
300 Ansi.
Buffer = lpFindFileData->cAlternateFileName;
302 Ansi.
MaximumLength =
sizeof(lpFindFileData->cAlternateFileName);
352 Ansi.
Buffer = lpFindFileData->cFileName;
363 Ansi.
Buffer = lpFindFileData->cAlternateFileName;
365 Ansi.
MaximumLength =
sizeof(lpFindFileData->cAlternateFileName);
388 TRACE(
"FindNextFileW(%p, 0x%p)\n", hFindFile, lpFindFileData);
418 sizeof(FindFileData->
Buffer),
450 ? NextDirInfo.BothDirInfo->FileName
451 : NextDirInfo.FullDirInfo->FileName);
455 BufferEnd < (
ULONG_PTR)&NextDirInfo.FullDirInfo->FileNameLength +
sizeof(NextDirInfo.FullDirInfo->FileNameLength) ||
504 TRACE(
"FindClose(hFindFile %p)\n", hFindFile);
520 switch (FindDataHandle->
Type)
551 RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
586 dwAdditionalFlags & ~FIND_FIRST_EX_CASE_SENSITIVE )
680 ULONG DeviceNameInfo = 0;
713 DPRINT(
"FilePattern.Buffer = '%S'\n", FilePattern.
Buffer);
716 DPRINT(
"NtPath - Before = '%wZ'\n", &NtPath);
719 NtPathBuffer = NtPath.
Buffer;
731 if (DeviceNameInfo != 0)
778 DPRINT(
"NtPath - After = '%wZ'\n", &NtPath);
779 DPRINT(
"FilePattern = '%wZ'\n", &FilePattern);
814 if (FilePattern.
Length == 0)
825 if (FilePattern.
Length == 6 &&
834 while (PatternIndex < FilePattern.
Length /
sizeof(
WCHAR))
836 if (PatternIndex > 0)
838 if (FilePattern.
Buffer[PatternIndex] ==
L'.' &&
839 FilePattern.
Buffer[PatternIndex - 1] ==
L'*')
841 FilePattern.
Buffer[PatternIndex - 1] =
L'<';
845 if (FilePattern.
Buffer[PatternIndex] ==
L'?')
847 FilePattern.
Buffer[PatternIndex] =
L'>';
848 if (PatternIndex > 0)
850 if (FilePattern.
Buffer[PatternIndex - 1] ==
L'.')
852 FilePattern.
Buffer[PatternIndex - 1] =
L'\"';
856 else if (FilePattern.
Buffer[PatternIndex] ==
L'*')
858 if (PatternIndex > 0)
860 if (FilePattern.
Buffer[PatternIndex - 1] ==
L'.')
862 FilePattern.
Buffer[PatternIndex - 1] =
L'\"';
884 sizeof(DirectoryInfo),
925 FindFileData->
Handle = hDirectory;
936 RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
942 return (
HANDLE)FindDataHandle;
958 IN STREAM_INFO_LEVELS InfoLevel,
971 if (
dwFlags != 0 || InfoLevel != FindStreamInfoStandard ||
972 lpFindStreamData ==
NULL)
1011 if (!FindDataHandle)
1029 RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
1090 RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
1100 return (
HANDLE)FindDataHandle;
#define FILE_DIRECTORY_FILE
#define DEBUG_CHANNEL(args)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define ERROR_NOT_SUPPORTED
#define ERROR_INVALID_HANDLE
struct _FIND_FILE_DATA FIND_FILE_DATA
struct _FIND_STREAM_DATA FIND_STREAM_DATA
struct _FIND_STREAM_DATA * PFIND_STREAM_DATA
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
struct _FIND_DATA_HANDLE * PFIND_DATA_HANDLE
#define ULARGE_INTEGER_2_FILETIME(ft, ul)
BOOL WINAPI FindNextStreamW(IN HANDLE hFindStream, OUT LPVOID lpFindStreamData)
HANDLE WINAPI FindFirstFileA(IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
HANDLE WINAPI FindFirstStreamW(IN LPCWSTR lpFileName, IN STREAM_INFO_LEVELS InfoLevel, OUT LPVOID lpFindStreamData, IN DWORD dwFlags)
BOOL WINAPI FindClose(HANDLE hFindFile)
struct _FIND_DATA_HANDLE FIND_DATA_HANDLE
#define FIND_DEVICE_HANDLE
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
enum _FIND_DATA_TYPE FIND_DATA_TYPE
static VOID CopyDeviceFindData(OUT LPWIN32_FIND_DATAW lpFindFileData, IN LPCWSTR lpFileName, IN ULONG DeviceNameInfo)
struct _FIND_FILE_DATA * PFIND_FILE_DATA
HANDLE WINAPI FindFirstFileExW(IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
static VOID CopyFindData(OUT LPWIN32_FIND_DATAW lpFindFileData, IN FINDEX_INFO_LEVELS fInfoLevelId, IN DIR_INFORMATION DirInfo)
union _DIR_INFORMATION DIR_INFORMATION
static VOID CopyStreamData(IN OUT PFIND_STREAM_DATA FindStreamData, OUT PWIN32_FIND_STREAM_DATA lpFindStreamData)
HANDLE WINAPI FindFirstFileExA(IN LPCSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
BOOL WINAPI FindNextFileA(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
PRTL_CONVERT_STRINGA BasepUnicodeStringTo8BitString
PUNICODE_STRING WINAPI Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
static const WCHAR Cleanup[]
#define RtlCompareMemory(s1, s2, l)
struct _FileName FileName
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
@ FileFullDirectoryInformation
@ FileBothDirectoryInformation
#define FILE_SYNCHRONOUS_IO_NONALERT
#define EXCEPTION_EXECUTE_HANDLER
#define OBJ_CASE_INSENSITIVE
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
NTSTATUS NTAPI NtQueryDirectoryFile(IN HANDLE FileHandle, IN HANDLE EventHandle OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass, IN BOOLEAN ReturnSingleEntry, IN PUNICODE_STRING FileName OPTIONAL, IN BOOLEAN RestartScan)
#define ERROR_FILE_NOT_FOUND
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI ULONG NTAPI RtlIsDosDeviceName_U(_In_ PCWSTR Name)
VOID NTAPI RtlReleaseRelativeName(_In_ PRTL_RELATIVE_NAME_U RelativeName)
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
#define FILE_LIST_DIRECTORY
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_SHARE_DELETE
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define FILE_ATTRIBUTE_ARCHIVE
#define FILE_ATTRIBUTE_DIRECTORY
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define DECLSPEC_ALIGN(x)
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define FILE_ATTRIBUTE_REPARSE_POINT
#define STATUS_OBJECT_TYPE_MISMATCH
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_YIELD(__stmt)
DWORD BaseSetLastNTError(IN NTSTATUS Status)
#define STATUS_BUFFER_TOO_SMALL
#define STATUS_BUFFER_OVERFLOW
PFIND_FILE_DATA FindFileData
RTL_CRITICAL_SECTION Lock
union _FIND_DATA_HANDLE::@458 u
PFIND_STREAM_DATA FindStreamData
FINDEX_INFO_LEVELS InfoLevel
FINDEX_SEARCH_OPS SearchOp
DIR_INFORMATION NextDirInfo
BYTE Buffer[FIND_DATA_SIZE]
PFILE_STREAM_INFORMATION FileStreamInfo
PFILE_STREAM_INFORMATION CurrentInfo
STREAM_INFO_LEVELS InfoLevel
UNICODE_STRING RelativeName
HANDLE ContainingDirectory
CHAR cAlternateFileName[14]
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_OBJECT_NAME_NOT_FOUND
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
enum _FINDEX_SEARCH_OPS FINDEX_SEARCH_OPS
struct _WIN32_FIND_DATAA * LPWIN32_FIND_DATAA
@ FindExSearchLimitToDevices
@ FindExSearchLimitToDirectories
#define FIND_FIRST_EX_CASE_SENSITIVE
enum _FINDEX_INFO_LEVELS FINDEX_INFO_LEVELS
struct _WIN32_FIND_DATAW * LPWIN32_FIND_DATAW
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define ERROR_PATH_NOT_FOUND
#define ERROR_NO_MORE_FILES