ReactOS  0.4.13-dev-249-gcba1a2f
find.c File Reference
#include <k32.h>
#include <ntstrsafe.h>
#include <debug.h>
Include dependency graph for find.c:

Go to the source code of this file.

Classes

union  _DIR_INFORMATION
 
struct  _FIND_FILE_DATA
 
struct  _FIND_STREAM_DATA
 
struct  _FIND_DATA_HANDLE
 

Macros

#define NDEBUG
 
#define FIND_DATA_SIZE   0x4000
 
#define FIND_DEVICE_HANDLE   ((HANDLE)0x1)
 
#define ULARGE_INTEGER_2_FILETIME(ft, ul)
 

Typedefs

typedef enum _FIND_DATA_TYPE FIND_DATA_TYPE
 
typedef union _DIR_INFORMATION DIR_INFORMATION
 
typedef struct _FIND_FILE_DATA FIND_FILE_DATA
 
typedef struct _FIND_FILE_DATAPFIND_FILE_DATA
 
typedef struct _FIND_STREAM_DATA FIND_STREAM_DATA
 
typedef struct _FIND_STREAM_DATAPFIND_STREAM_DATA
 
typedef struct _FIND_DATA_HANDLE FIND_DATA_HANDLE
 
typedef struct _FIND_DATA_HANDLEPFIND_DATA_HANDLE
 

Enumerations

enum  _FIND_DATA_TYPE { FindFile = 1, FindStream = 2 }
 

Functions

 DEBUG_CHANNEL (kernel32file)
 
static VOID CopyDeviceFindData (OUT LPWIN32_FIND_DATAW lpFindFileData, IN LPCWSTR lpFileName, IN ULONG DeviceNameInfo)
 
static VOID CopyFindData (OUT LPWIN32_FIND_DATAW lpFindFileData, IN FINDEX_INFO_LEVELS fInfoLevelId, IN DIR_INFORMATION DirInfo)
 
static VOID CopyStreamData (IN OUT PFIND_STREAM_DATA FindStreamData, OUT PWIN32_FIND_STREAM_DATA lpFindStreamData)
 
HANDLE WINAPI FindFirstFileA (IN LPCSTR lpFileName, OUT LPWIN32_FIND_DATAA lpFindFileData)
 
HANDLE WINAPI FindFirstFileW (IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
 
BOOL WINAPI FindNextFileA (IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAA lpFindFileData)
 
BOOL WINAPI FindNextFileW (IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
 
BOOL WINAPI FindClose (HANDLE hFindFile)
 
HANDLE WINAPI FindFirstFileExA (IN LPCSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
 
HANDLE WINAPI FindFirstFileExW (IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
 
HANDLE WINAPI FindFirstStreamW (IN LPCWSTR lpFileName, IN STREAM_INFO_LEVELS InfoLevel, OUT LPVOID lpFindStreamData, IN DWORD dwFlags)
 
BOOL WINAPI FindNextStreamW (IN HANDLE hFindStream, OUT LPVOID lpFindStreamData)
 

Macro Definition Documentation

◆ FIND_DATA_SIZE

#define FIND_DATA_SIZE   0x4000

Definition at line 23 of file find.c.

◆ FIND_DEVICE_HANDLE

#define FIND_DEVICE_HANDLE   ((HANDLE)0x1)

Definition at line 24 of file find.c.

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file find.c.

◆ ULARGE_INTEGER_2_FILETIME

#define ULARGE_INTEGER_2_FILETIME (   ft,
  ul 
)
Value:
do { \
(ft).dwHighDateTime = (ul).u.HighPart; \
(ft).dwLowDateTime = (ul).u.LowPart ; \
} while(0)

Typedef Documentation

◆ DIR_INFORMATION

◆ FIND_DATA_HANDLE

◆ FIND_DATA_TYPE

◆ FIND_FILE_DATA

◆ FIND_STREAM_DATA

◆ PFIND_DATA_HANDLE

◆ PFIND_FILE_DATA

◆ PFIND_STREAM_DATA

Enumeration Type Documentation

◆ _FIND_DATA_TYPE

Enumerator
FindFile 
FindStream 

Definition at line 26 of file find.c.

27 {
28  FindFile = 1,
29  FindStream = 2
enum _FIND_DATA_TYPE FIND_DATA_TYPE
Definition: find.c:28

Function Documentation

◆ CopyDeviceFindData()

static VOID CopyDeviceFindData ( OUT LPWIN32_FIND_DATAW  lpFindFileData,
IN LPCWSTR  lpFileName,
IN ULONG  DeviceNameInfo 
)
static

Definition at line 117 of file find.c.

120 {
122  SIZE_T Length;
123 
124  _SEH2_TRY
125  {
126  /* DeviceNameInfo == { USHORT Offset; USHORT Length } */
127  Length = (SIZE_T)(DeviceNameInfo & 0xFFFF);
128  DeviceName = (LPCWSTR)((ULONG_PTR)lpFileName + ((DeviceNameInfo >> 16) & 0xFFFF));
129 
130  /* Return the data */
131  RtlZeroMemory(lpFindFileData, sizeof(*lpFindFileData));
132  lpFindFileData->dwFileAttributes = FILE_ATTRIBUTE_ARCHIVE;
133  RtlStringCbCopyNW(lpFindFileData->cFileName,
134  sizeof(lpFindFileData->cFileName),
135  DeviceName, Length);
136  }
138  {
139  }
140  _SEH2_END;
141 
142  return;
143 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WCHAR DeviceName[]
Definition: adapter.cpp:21
_SEH2_TRY
Definition: create.c:4250
uint32_t ULONG_PTR
Definition: typedefs.h:63
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
Definition: ntstrsafe.h:411
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_SEH2_END
Definition: create.c:4424
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_In_ LPCSTR lpFileName
Definition: winbase.h:3011

Referenced by FindFirstFileExW().

◆ CopyFindData()

static VOID CopyFindData ( OUT LPWIN32_FIND_DATAW  lpFindFileData,
IN FINDEX_INFO_LEVELS  fInfoLevelId,
IN DIR_INFORMATION  DirInfo 
)
static

Definition at line 146 of file find.c.

149 {
150 #define ULARGE_INTEGER_2_FILETIME(ft, ul) \
151 do { \
152  (ft).dwHighDateTime = (ul).u.HighPart; \
153  (ft).dwLowDateTime = (ul).u.LowPart ; \
154 } while(0)
155 
156  _SEH2_TRY
157  {
158  RtlZeroMemory(lpFindFileData, sizeof(*lpFindFileData));
159 
160  lpFindFileData->dwFileAttributes = DirInfo.FullDirInfo->FileAttributes;
161 
162  ULARGE_INTEGER_2_FILETIME(lpFindFileData->ftCreationTime, DirInfo.FullDirInfo->CreationTime);
163  ULARGE_INTEGER_2_FILETIME(lpFindFileData->ftLastAccessTime, DirInfo.FullDirInfo->LastAccessTime);
164  ULARGE_INTEGER_2_FILETIME(lpFindFileData->ftLastWriteTime, DirInfo.FullDirInfo->LastWriteTime);
165 
166  lpFindFileData->nFileSizeHigh = DirInfo.FullDirInfo->EndOfFile.u.HighPart;
167  lpFindFileData->nFileSizeLow = DirInfo.FullDirInfo->EndOfFile.u.LowPart;
168 
169  /* dwReserved0 contains the NTFS reparse point tag, if any. */
170  if (DirInfo.FullDirInfo->FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
171  lpFindFileData->dwReserved0 = DirInfo.FullDirInfo->EaSize;
172  else
173  lpFindFileData->dwReserved0 = 0;
174 
175  /* Unused dwReserved1 field */
176  lpFindFileData->dwReserved1 = 0;
177 
178  if (fInfoLevelId == FindExInfoStandard)
179  {
180  RtlStringCbCopyNW(lpFindFileData->cFileName,
181  sizeof(lpFindFileData->cFileName),
182  DirInfo.BothDirInfo->FileName,
183  DirInfo.BothDirInfo->FileNameLength);
184 
185  RtlStringCbCopyNW(lpFindFileData->cAlternateFileName,
186  sizeof(lpFindFileData->cAlternateFileName),
187  DirInfo.BothDirInfo->ShortName,
188  DirInfo.BothDirInfo->ShortNameLength);
189  }
190  else if (fInfoLevelId == FindExInfoBasic)
191  {
192  RtlStringCbCopyNW(lpFindFileData->cFileName,
193  sizeof(lpFindFileData->cFileName),
194  DirInfo.FullDirInfo->FileName,
195  DirInfo.FullDirInfo->FileNameLength);
196 
197  lpFindFileData->cAlternateFileName[0] = UNICODE_NULL;
198  }
199  else
200  {
201  /* Invalid InfoLevelId */
202  ASSERT(FALSE);
203  }
204  }
206  {
207  }
208  _SEH2_END;
209 
210  return;
211 }
_SEH2_TRY
Definition: create.c:4250
#define UNICODE_NULL
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
Definition: ntstrsafe.h:411
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#define ULARGE_INTEGER_2_FILETIME(ft, ul)
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_SEH2_END
Definition: create.c:4424
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by FindFirstFileExW(), and FindNextFileW().

◆ CopyStreamData()

static VOID CopyStreamData ( IN OUT PFIND_STREAM_DATA  FindStreamData,
OUT PWIN32_FIND_STREAM_DATA  lpFindStreamData 
)
static

Definition at line 214 of file find.c.

216 {
217  _SEH2_TRY
218  {
219  ASSERT(FindStreamData->CurrentInfo);
220 
221  switch (FindStreamData->InfoLevel)
222  {
223  case FindStreamInfoStandard:
224  {
225  ULONG StreamNameLen = min(FindStreamData->CurrentInfo->StreamNameLength,
226  sizeof(lpFindStreamData->cStreamName) - sizeof(WCHAR));
227 
228  RtlZeroMemory(lpFindStreamData, sizeof(*lpFindStreamData));
229 
230  lpFindStreamData->StreamSize.QuadPart = FindStreamData->CurrentInfo->StreamSize.QuadPart;
231  RtlCopyMemory(lpFindStreamData->cStreamName,
232  FindStreamData->CurrentInfo->StreamName,
233  StreamNameLen);
234  lpFindStreamData->cStreamName[StreamNameLen / sizeof(WCHAR)] = UNICODE_NULL;
235 
236  break;
237  }
238 
239  default:
240  {
241  /* Invalid InfoLevel */
242  ASSERT(FALSE);
243  break;
244  }
245  }
246  }
248  {
249  }
250  _SEH2_END;
251 
252  return;
253 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
_SEH2_TRY
Definition: create.c:4250
#define UNICODE_NULL
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
__wchar_t WCHAR
Definition: xmlstorage.h:180
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_SEH2_END
Definition: create.c:4424
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by FindFirstStreamW(), and FindNextStreamW().

◆ DEBUG_CHANNEL()

DEBUG_CHANNEL ( kernel32file  )

◆ FindClose()

BOOL WINAPI FindClose ( HANDLE  hFindFile)

Definition at line 502 of file find.c.

503 {
504  TRACE("FindClose(hFindFile %p)\n", hFindFile);
505 
506  if (hFindFile == FIND_DEVICE_HANDLE)
507  return TRUE;
508 
509  if (!hFindFile || hFindFile == INVALID_HANDLE_VALUE)
510  {
512  return FALSE;
513  }
514 
515  /* Protect with SEH against closing attempts on invalid handles. */
516  _SEH2_TRY
517  {
518  PFIND_DATA_HANDLE FindDataHandle = (PFIND_DATA_HANDLE)hFindFile;
519 
520  switch (FindDataHandle->Type)
521  {
522  case FindFile:
523  {
524  RtlEnterCriticalSection(&FindDataHandle->Lock);
525  NtClose(FindDataHandle->u.FindFileData->Handle);
526  RtlLeaveCriticalSection(&FindDataHandle->Lock);
527  RtlDeleteCriticalSection(&FindDataHandle->Lock);
528  break;
529  }
530 
531  case FindStream:
532  {
533  RtlEnterCriticalSection(&FindDataHandle->Lock);
534  if (FindDataHandle->u.FindStreamData->FileStreamInfo != NULL)
535  {
536  RtlFreeHeap(RtlGetProcessHeap(), 0,
537  FindDataHandle->u.FindStreamData->FileStreamInfo);
538  }
539  RtlLeaveCriticalSection(&FindDataHandle->Lock);
540  RtlDeleteCriticalSection(&FindDataHandle->Lock);
541  break;
542  }
543 
544  default:
545  {
547  _SEH2_YIELD(return FALSE);
548  }
549  }
550 
551  RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
552  }
554  {
556  _SEH2_YIELD(return FALSE);
557  }
558  _SEH2_END;
559 
560  return TRUE;
561 }
#define TRUE
Definition: types.h:120
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
PFIND_STREAM_DATA FindStreamData
Definition: find.c:108
_SEH2_TRY
Definition: create.c:4250
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
RTL_CRITICAL_SECTION Lock
Definition: find.c:99
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
FIND_DATA_TYPE Type
Definition: find.c:98
#define TRACE(s)
Definition: solgame.cpp:4
PFILE_STREAM_INFORMATION FileStreamInfo
Definition: find.c:92
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
PFIND_FILE_DATA FindFileData
Definition: find.c:107
HANDLE Handle
Definition: find.c:70
#define SetLastError(x)
Definition: compat.h:409
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
struct _FIND_DATA_HANDLE * PFIND_DATA_HANDLE
union _FIND_DATA_HANDLE::@435 u
_SEH2_END
Definition: create.c:4424
#define FIND_DEVICE_HANDLE
Definition: find.c:24
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
Definition: find.c:28

Referenced by _FileOpCount(), _findclose(), _ILCreateFromPathW(), _RunRemoteTest(), _tWinMain(), ACTION_RecurseSearchDirectory(), add_favs_to_menu(), AddDesktopItemW(), AddItemW(), AddWallpapersFromDirectory(), aexpand(), apply_patch(), AutoStartupApplications(), ChangeACLsOfFiles(), ChangeACLsOfFilesInCurDir(), ChangeAttribute(), cmd_copy(), cmd_move(), cmd_rename(), compat_dirclose(), CompleteFilename(), Control_DoWindow(), ConvertPathCase(), copy_file(), copy_folder(), CopyDirectory(), CFileDefExt::CountFolderAndFiles(), CControlPanelEnum::CreateCPanelEnumList(), CCabinet::CreateSimpleCabinet(), CryptCATAdminEnumCatalogFromHash(), CryptCATAdminReleaseContext(), delete_file(), delete_folder(), CAvailableApps::DeleteCurrentAppsDB(), DeleteFiles(), DeleteFolder(), DELNODE_recurse_dirtree(), demFileFindFirst(), demFileFindNext(), DirList(), do_searchW(), CAvailableApps::Enum(), enum_gac_assemblies(), enum_gac_assembly_dirs(), EnumColorProfilesA(), EnumColorProfilesW(), EnumDirs(), EnumFilesInDirectory(), EnumThemes(), ExecuteIf(), exists_path(), expand(), expect_files(), file_get_Size(), filecoll_enumvariant_Release(), filecoll_enumvariant_Reset(), filecoll_get_Count(), FILEDLG95_InitControls(), FileExists(), FileQueryFiles(), filesys_GetAbsolutePathName(), fill_datafile(), fill_directory(), FindFirstFileA(), FindFirstFileExA(), foldercoll_enumvariant_Release(), foldercoll_enumvariant_Reset(), foldercoll_get_Count(), ForDir(), ForRecursive(), fsbd_GetFindData_valid(), get_long_path_name(), get_number_of_folders(), GetDirectoryStructure(), GetEnhancedVar(), GetLongPathNameW(), GetPathCase(), GetShortPathNameW(), gl_local_filename_completion_proc(), HasSubFolder(), have_profile(), CFileDefExt::InitFileAttr(), CFileSysEnum::Initialize(), InitializeGlobalJobList(), InitPropertiesDlg(), IntDeleteRecursive(), LISTBOX_Directory(), LoadSoundFiles(), main(), move_files_wildcard(), msi_dialog_update_directory_list(), MyFileExists(), OnClearRecentItems(), OpenUserEventLogFile(), fff_handle::operator=(), parse_wildcard_files(), PathIsDirectoryEmptyW(), pBuildFileList(), PrintAttribute(), PrintDaclsOfFiles(), ProcessDirectories(), ProcessDirectory(), ProcessFiles(), WinDirectory::read_directory(), ShellDirectory::read_directory(), read_directory_win(), recFindSubDirs(), recReplace(), RecursiveCreateDirectory(), RecursiveRemoveDir(), remove_dir(), DriveVolume::ScanDirectory(), SdbpBuildSignMediaId(), SearchDriverRecursive(), SearchScreenSavers(), SetupCopyOEMInfW(), SetupGetInfFileListW(), SHELL_DeleteDirectoryW(), SHFindAttrW(), SHNotifyDeleteFileW(), start_enumeration(), START_TEST(), test__lcreat(), test_DefineDosDeviceA(), test_filemodeT(), test_FindFirstFile_wildcards(), test_FindFirstFileA(), test_FindFirstFileExA(), test_FindNextFileA(), test_GetAbsolutePathName(), test_MoveFileA(), test_request_groups(), Test_ShortTests(), CAvailableApps::UpdateAppsDB(), wexpand(), wmain(), XCOPY_DoCopy(), CWineTest::~CWineTest(), and fff_handle::~fff_handle().

◆ FindFirstFileA()

HANDLE WINAPI FindFirstFileA ( IN LPCSTR  lpFileName,
OUT LPWIN32_FIND_DATAA  lpFindFileData 
)

Definition at line 263 of file find.c.

265 {
266  HANDLE hSearch;
268  ANSI_STRING Ansi;
269  UNICODE_STRING UTF8;
270  PUNICODE_STRING lpFileNameW;
271  WIN32_FIND_DATAW FindFileDataW;
272 
274  if (!lpFileNameW) return INVALID_HANDLE_VALUE;
275 
276  hSearch = FindFirstFileExW(lpFileNameW->Buffer,
278  &FindFileDataW,
280  NULL, 0);
281  if (hSearch == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE;
282 
283  RtlCopyMemory(lpFindFileData,
284  &FindFileDataW,
285  FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
286 
287  RtlInitUnicodeString(&UTF8, FindFileDataW.cFileName);
288  Ansi.Buffer = lpFindFileData->cFileName;
289  Ansi.Length = 0;
290  Ansi.MaximumLength = sizeof(lpFindFileData->cFileName);
292  if (!NT_SUCCESS(Status))
293  {
294  FindClose(hSearch);
296  return INVALID_HANDLE_VALUE;
297  }
298 
299  RtlInitUnicodeString(&UTF8, FindFileDataW.cAlternateFileName);
300  Ansi.Buffer = lpFindFileData->cAlternateFileName;
301  Ansi.Length = 0;
302  Ansi.MaximumLength = sizeof(lpFindFileData->cAlternateFileName);
304  if (!NT_SUCCESS(Status))
305  {
306  FindClose(hSearch);
308  return INVALID_HANDLE_VALUE;
309  }
310 
311  return hSearch;
312 }
PUNICODE_STRING WINAPI Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
Definition: utils.c:188
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PRTL_CONVERT_STRINGA BasepUnicodeStringTo8BitString
Definition: utils.c:27
HANDLE WINAPI FindFirstFileExW(IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
Definition: find.c:649
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
USHORT MaximumLength
Definition: env_spec_w32.h:377
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by aexpand(), apply_patch(), demFileFindFirst(), enum_gac_assemblies(), enum_gac_assembly_dirs(), EnumColorProfilesA(), expect_files(), get_long_path_name(), get_number_of_folders(), have_profile(), test__lcreat(), test_DefineDosDeviceA(), test_filemodeT(), test_FindFirstFile_wildcards(), test_FindFirstFileA(), test_FindNextFileA(), test_MoveFileA(), and test_request_groups().

◆ FindFirstFileExA()

HANDLE WINAPI FindFirstFileExA ( IN LPCSTR  lpFileName,
IN FINDEX_INFO_LEVELS  fInfoLevelId,
OUT LPVOID  lpFindFileData,
IN FINDEX_SEARCH_OPS  fSearchOp,
LPVOID  lpSearchFilter,
IN DWORD  dwAdditionalFlags 
)

Definition at line 569 of file find.c.

575 {
576  HANDLE hSearch;
578  ANSI_STRING Ansi;
579  UNICODE_STRING UTF8;
580  PUNICODE_STRING lpFileNameW;
581  WIN32_FIND_DATAW FindFileDataW;
582  LPWIN32_FIND_DATAA lpFindFileDataA = (LPWIN32_FIND_DATAA)lpFindFileData;
583 
584  if ((fInfoLevelId != FindExInfoStandard && fInfoLevelId != FindExInfoBasic) ||
585  fSearchOp == FindExSearchLimitToDevices ||
586  dwAdditionalFlags & ~FIND_FIRST_EX_CASE_SENSITIVE /* only supported flag for now */)
587  {
591  return INVALID_HANDLE_VALUE;
592  }
593 
595  if (!lpFileNameW) return INVALID_HANDLE_VALUE;
596 
597  hSearch = FindFirstFileExW(lpFileNameW->Buffer,
598  fInfoLevelId,
599  &FindFileDataW,
600  fSearchOp,
601  lpSearchFilter,
602  dwAdditionalFlags);
603  if (hSearch == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE;
604 
605  RtlCopyMemory(lpFindFileDataA,
606  &FindFileDataW,
607  FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
608 
609  RtlInitUnicodeString(&UTF8, FindFileDataW.cFileName);
610  Ansi.Buffer = lpFindFileDataA->cFileName;
611  Ansi.Length = 0;
612  Ansi.MaximumLength = sizeof(lpFindFileDataA->cFileName);
614  if (!NT_SUCCESS(Status))
615  {
616  FindClose(hSearch);
618  return INVALID_HANDLE_VALUE;
619  }
620 
621  if (fInfoLevelId != FindExInfoBasic)
622  {
623  RtlInitUnicodeString(&UTF8, FindFileDataW.cAlternateFileName);
624  Ansi.Buffer = lpFindFileDataA->cAlternateFileName;
625  Ansi.Length = 0;
626  Ansi.MaximumLength = sizeof(lpFindFileDataA->cAlternateFileName);
628  if (!NT_SUCCESS(Status))
629  {
630  FindClose(hSearch);
632  return INVALID_HANDLE_VALUE;
633  }
634  }
635  else
636  {
637  lpFindFileDataA->cAlternateFileName[0] = ANSI_NULL;
638  }
639 
640  return hSearch;
641 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
PUNICODE_STRING WINAPI Basep8BitStringToStaticUnicodeString(IN LPCSTR String)
Definition: utils.c:188
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
CHAR cFileName[MAX_PATH]
Definition: winbase.h:900
PRTL_CONVERT_STRINGA BasepUnicodeStringTo8BitString
Definition: utils.c:27
HANDLE WINAPI FindFirstFileExW(IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
Definition: find.c:649
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
struct _WIN32_FIND_DATAA * LPWIN32_FIND_DATAA
#define ANSI_NULL
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define FIND_FIRST_EX_CASE_SENSITIVE
Definition: winbase.h:231
USHORT MaximumLength
Definition: env_spec_w32.h:377
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
Status
Definition: gdiplustypes.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
CHAR cAlternateFileName[14]
Definition: winbase.h:901
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

◆ FindFirstFileExW()

HANDLE WINAPI FindFirstFileExW ( IN LPCWSTR  lpFileName,
IN FINDEX_INFO_LEVELS  fInfoLevelId,
OUT LPVOID  lpFindFileData,
IN FINDEX_SEARCH_OPS  fSearchOp,
LPVOID  lpSearchFilter,
IN DWORD  dwAdditionalFlags 
)

Definition at line 649 of file find.c.

655 {
656  TRACE("FindFirstFileExW(lpFileName %S)\n", lpFileName);
657 
658  if ((fInfoLevelId != FindExInfoStandard && fInfoLevelId != FindExInfoBasic) ||
659  fSearchOp == FindExSearchLimitToDevices ||
660  dwAdditionalFlags & ~FIND_FIRST_EX_CASE_SENSITIVE /* only supported flag for now */)
661  {
665  return INVALID_HANDLE_VALUE;
666  }
667 
668  if (fSearchOp == FindExSearchNameMatch ||
669  fSearchOp == FindExSearchLimitToDirectories)
670  {
671  LPWIN32_FIND_DATAW Win32FindData = (LPWIN32_FIND_DATAW)lpFindFileData;
672  PFIND_DATA_HANDLE FindDataHandle;
673  PFIND_FILE_DATA FindFileData;
674 
675  UNICODE_STRING NtPath, FilePattern, FileName;
676  PWSTR NtPathBuffer;
677  RTL_RELATIVE_NAME_U RelativePath;
678  ULONG DeviceNameInfo = 0;
679 
683  HANDLE hDirectory = NULL;
684 
685  BOOLEAN HadADot = FALSE;
686 
687  /*
688  * May represent many FILE_BOTH_DIR_INFORMATION
689  * or many FILE_FULL_DIR_INFORMATION structures.
690  */
691  BYTE DirectoryInfo[FIND_DATA_SIZE];
692  DIR_INFORMATION DirInfo = {&DirectoryInfo};
693 
694  /* The search filter is always unused */
695  if (lpSearchFilter)
696  {
698  return INVALID_HANDLE_VALUE;
699  }
700 
702  if (FileName.Length != 0 && FileName.Buffer[FileName.Length / sizeof(WCHAR) - 1] == L'.')
703  {
704  HadADot = TRUE;
705  }
706 
708  &NtPath,
709  (PCWSTR*)&FilePattern.Buffer,
710  &RelativePath))
711  {
713  return INVALID_HANDLE_VALUE;
714  }
715 
716  DPRINT("lpFileName = '%S'\n", lpFileName);
717  DPRINT("FilePattern.Buffer = '%S'\n", FilePattern.Buffer);
718  DPRINT("RelativePath.RelativeName = '%wZ'\n", &RelativePath.RelativeName);
719  DPRINT("NtPath.Buffer = '%S'\n", NtPath.Buffer);
720  DPRINT("NtPath - Before = '%wZ'\n", &NtPath);
721 
722  /* Save the buffer pointer for later, we need to free it! */
723  NtPathBuffer = NtPath.Buffer;
724 
725  /*
726  * Contrary to what Windows does, check NOW whether or not
727  * lpFileName is a DOS driver. Therefore we don't have to
728  * write broken code to check that.
729  */
730  if (!FilePattern.Buffer || !*FilePattern.Buffer)
731  {
732  /* No file pattern specified, or DOS device */
733 
734  DeviceNameInfo = RtlIsDosDeviceName_U(lpFileName);
735  if (DeviceNameInfo != 0)
736  {
737  RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
738 
739  /* OK, it's really a DOS device */
740  CopyDeviceFindData(Win32FindData, lpFileName, DeviceNameInfo);
741  return FIND_DEVICE_HANDLE;
742  }
743  }
744 
745  /* A file pattern was specified, or it was not a DOS device */
746 
747  /* If there is a file pattern then determine its length */
748  if (FilePattern.Buffer != NULL)
749  {
750  FilePattern.Length = NtPath.Length -
751  (USHORT)((ULONG_PTR)FilePattern.Buffer - (ULONG_PTR)NtPath.Buffer);
752  }
753  else
754  {
755  FilePattern.Length = 0;
756  }
757  FilePattern.MaximumLength = FilePattern.Length;
758 
759  if (RelativePath.RelativeName.Length != 0 &&
760  RelativePath.RelativeName.Buffer != FilePattern.Buffer)
761  {
762  if (FilePattern.Buffer != NULL)
763  {
764  /* This is a relative path to RelativePath.ContainingDirectory, adjust NtPath! */
765  NtPath.Length = NtPath.MaximumLength =
766  (USHORT)((ULONG_PTR)FilePattern.Buffer - (ULONG_PTR)RelativePath.RelativeName.Buffer);
767  NtPath.Buffer = RelativePath.RelativeName.Buffer;
768  }
769  }
770  else
771  {
772  /* This is an absolute path, NtPath receives the full path */
773  RelativePath.ContainingDirectory = NULL;
774  if (FilePattern.Buffer != NULL)
775  {
776  NtPath.Length = NtPath.MaximumLength =
777  (USHORT)((ULONG_PTR)FilePattern.Buffer - (ULONG_PTR)NtPath.Buffer);
778  }
779  }
780 
781  DPRINT("NtPath - After = '%wZ'\n", &NtPath);
782  DPRINT("FilePattern = '%wZ'\n", &FilePattern);
783  DPRINT("RelativeTo = 0x%p\n", RelativePath.ContainingDirectory);
784 
786  &NtPath,
787  (dwAdditionalFlags & FIND_FIRST_EX_CASE_SENSITIVE) ? 0 : OBJ_CASE_INSENSITIVE,
788  RelativePath.ContainingDirectory,
789  NULL);
790 
791  Status = NtOpenFile(&hDirectory,
794  &IoStatusBlock,
797 
798  if (!NT_SUCCESS(Status))
799  {
800  RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
801 
802  /* Adjust the last error codes */
807 
809  return INVALID_HANDLE_VALUE;
810  }
811 
812  /*
813  * Fail if there is not any file pattern,
814  * since we are not looking for a device.
815  */
816  if (FilePattern.Length == 0)
817  {
818  NtClose(hDirectory);
819  RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
820 
822  return INVALID_HANDLE_VALUE;
823  }
824 
825  /* Change pattern: "*.*" --> "*" */
826  if (FilePattern.Length == 6 &&
827  RtlCompareMemory(FilePattern.Buffer, L"*.*", 6) == 6)
828  {
829  FilePattern.Length = 2;
830  }
831  else
832  {
833  /* Translate wildcard from "real" world to DOS world for lower interpretation */
834  USHORT PatternIndex = 0;
835  while (PatternIndex < FilePattern.Length / sizeof(WCHAR))
836  {
837  if (PatternIndex > 0)
838  {
839  if (FilePattern.Buffer[PatternIndex] == L'.' &&
840  FilePattern.Buffer[PatternIndex - 1] == L'*')
841  {
842  FilePattern.Buffer[PatternIndex - 1] = L'<';
843  }
844  }
845 
846  if (FilePattern.Buffer[PatternIndex] == L'?')
847  {
848  FilePattern.Buffer[PatternIndex] = L'>';
849  if (PatternIndex > 0)
850  {
851  if (FilePattern.Buffer[PatternIndex - 1] == L'.')
852  {
853  FilePattern.Buffer[PatternIndex - 1] = L'\"';
854  }
855  }
856  }
857  else if (FilePattern.Buffer[PatternIndex] == L'*')
858  {
859  if (PatternIndex > 0)
860  {
861  if (FilePattern.Buffer[PatternIndex - 1] == L'.')
862  {
863  FilePattern.Buffer[PatternIndex - 1] = L'\"';
864  }
865  }
866  }
867 
868  PatternIndex++;
869  }
870 
871  /* Handle partial wc if our last dot was eaten */
872  if (HadADot)
873  {
874  if (FilePattern.Buffer[FilePattern.Length / sizeof(WCHAR) - 1] == L'*')
875  {
876  FilePattern.Buffer[FilePattern.Length / sizeof(WCHAR) - 1] = L'<';
877  }
878  }
879  }
880 
881  Status = NtQueryDirectoryFile(hDirectory,
882  NULL, NULL, NULL,
883  &IoStatusBlock,
884  DirInfo.DirInfo, // == &DirectoryInfo
885  sizeof(DirectoryInfo),
886  (fInfoLevelId == FindExInfoStandard
889  TRUE, /* Return a single entry */
890  &FilePattern,
891  TRUE);
892 
893  RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathBuffer);
894 
895  if (!NT_SUCCESS(Status))
896  {
897  NtClose(hDirectory);
899  return INVALID_HANDLE_VALUE;
900  }
901 
902  ASSERT(DirInfo.FullDirInfo->NextEntryOffset == 0);
903 
904  /* Return the information */
905  CopyFindData(Win32FindData, fInfoLevelId, DirInfo);
906 
907  /*
908  * Initialization of the search handle.
909  */
910  FindDataHandle = RtlAllocateHeap(RtlGetProcessHeap(),
912  sizeof(FIND_DATA_HANDLE) +
913  sizeof(FIND_FILE_DATA));
914  if (!FindDataHandle)
915  {
916  NtClose(hDirectory);
918  return INVALID_HANDLE_VALUE;
919  }
920 
921  FindDataHandle->Type = FindFile;
922  FindDataHandle->u.FindFileData = (PFIND_FILE_DATA)(FindDataHandle + 1);
923  FindFileData = FindDataHandle->u.FindFileData;
924 
925  FindFileData->Handle = hDirectory;
926  FindFileData->InfoLevel = fInfoLevelId;
927  FindFileData->SearchOp = fSearchOp;
928  FindFileData->HasMoreData = FALSE;
929  FindFileData->NextDirInfo.DirInfo = NULL;
930 
931  /* The critical section must always be initialized */
932  Status = RtlInitializeCriticalSection(&FindDataHandle->Lock);
933  if (!NT_SUCCESS(Status))
934  {
935  NtClose(hDirectory);
936  RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
937 
939  return INVALID_HANDLE_VALUE;
940  }
941 
942  return (HANDLE)FindDataHandle;
943  }
944  else
945  {
947  return INVALID_HANDLE_VALUE;
948  }
949 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
DIR_INFORMATION NextDirInfo
Definition: find.c:84
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
USHORT MaximumLength
Definition: env_spec_w32.h:370
FINDEX_INFO_LEVELS InfoLevel
Definition: find.c:71
BOOLEAN HasMoreData
Definition: find.c:78
uint16_t * PWSTR
Definition: typedefs.h:54
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
HANDLE ContainingDirectory
Definition: rtltypes.h:1375
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
static VOID CopyDeviceFindData(OUT LPWIN32_FIND_DATAW lpFindFileData, IN LPCWSTR lpFileName, IN ULONG DeviceNameInfo)
Definition: find.c:117
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
struct _FIND_FILE_DATA * PFIND_FILE_DATA
uint32_t ULONG_PTR
Definition: typedefs.h:63
static VOID CopyFindData(OUT LPWIN32_FIND_DATAW lpFindFileData, IN FINDEX_INFO_LEVELS fInfoLevelId, IN DIR_INFORMATION DirInfo)
Definition: find.c:146
RTL_CRITICAL_SECTION Lock
Definition: find.c:99
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
FIND_DATA_TYPE Type
Definition: find.c:98
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
#define FIND_FIRST_EX_CASE_SENSITIVE
Definition: winbase.h:231
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)
Definition: file.c:3951
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: ntstatus.h:259
#define TRACE(s)
Definition: solgame.cpp:4
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
FINDEX_SEARCH_OPS SearchOp
Definition: find.c:72
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PFIND_FILE_DATA FindFileData
Definition: find.c:107
HANDLE Handle
Definition: find.c:70
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define SetLastError(x)
Definition: compat.h:409
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
unsigned char BYTE
Definition: mem.h:68
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
union _FIND_DATA_HANDLE::@435 u
struct _FileName FileName
Definition: fatprocs.h:884
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
unsigned short USHORT
Definition: pedump.c:61
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
PVOID DirInfo
Definition: find.c:63
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define FIND_DATA_SIZE
Definition: find.c:23
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define ERROR_NOT_SUPPORTED
Definition: compat.h:90
#define FIND_DEVICE_HANDLE
Definition: find.c:24
struct _WIN32_FIND_DATAW * LPWIN32_FIND_DATAW
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define ULONG_PTR
Definition: config.h:101
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
UNICODE_STRING RelativeName
Definition: rtltypes.h:1374
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
PFILE_FULL_DIR_INFORMATION FullDirInfo
Definition: find.c:64
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)
Definition: iofunc.c:1976
NTSYSAPI ULONG NTAPI RtlIsDosDeviceName_U(_In_ PCWSTR Name)
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)
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465
_In_ LPCSTR lpFileName
Definition: winbase.h:3011
Definition: find.c:28

Referenced by FindFirstFileA(), FindFirstFileExA(), and FindFirstFileW().

◆ FindFirstFileW()

HANDLE WINAPI FindFirstFileW ( IN LPCWSTR  lpFileName,
OUT LPWIN32_FIND_DATAW  lpFindFileData 
)

Definition at line 320 of file find.c.

322 {
325  lpFindFileData,
327  NULL, 0);
328 }
HANDLE WINAPI FindFirstFileExW(IN LPCWSTR lpFileName, IN FINDEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFindFileData, IN FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, IN DWORD dwAdditionalFlags)
Definition: find.c:649
smooth NULL
Definition: ftsmooth.c:416
_In_ LPCSTR lpFileName
Definition: winbase.h:3011

Referenced by _FileOpCount(), _ILCreateFromPathW(), _RunRemoteTest(), _tWinMain(), ACTION_RecurseSearchDirectory(), add_favs_to_menu(), AddDesktopItemW(), AddItemW(), AutoStartupApplications(), compat_diropen(), Control_DoWindow(), copy_file(), copy_folder(), CopyDirectory(), CFileDefExt::CountFolderAndFiles(), create_snapshot(), CControlPanelEnum::CreateCPanelEnumList(), CryptCATAdminEnumCatalogFromHash(), delete_directory(), delete_file(), delete_folder(), CAvailableApps::DeleteCurrentAppsDB(), DELNODE_recurse_dirtree(), BtrfsPropSheet::do_search(), do_searchW(), CAvailableApps::Enum(), enum_gac_assemblies(), EnumColorProfilesW(), EnumThemes(), file_get_Size(), filecoll_get_Count(), FILEDLG95_InitControls(), FileExists(), FileQueryFiles(), filesys_GetAbsolutePathName(), fill_datafile(), fill_directory(), foldercoll_get_Count(), fsbd_GetFindData_valid(), GetDirectoryStructure(), GetListOfTestExes(), GetLongPathNameW(), CWineTest::GetNextFile(), GetNumberOfExesInFolder(), GetShortPathNameW(), HasSubFolder(), CFileDefExt::InitFileAttr(), CFileSysEnum::Initialize(), InitializeGlobalJobList(), InitPropertiesDlg(), IntDeleteRecursive(), BtrfsContextMenu::InvokeCommand(), LISTBOX_Directory(), LoadSoundFiles(), move_files_wildcard(), msi_dialog_update_directory_list(), MyFileExists(), OnClearRecentItems(), OpenUserEventLogFile(), parse_wildcard_files(), PathIsDirectoryEmptyW(), pBuildFileList(), read_directory_win(), RecursiveRemoveDir(), BtrfsContextMenu::reflink_copy(), reflink_copy2(), ReflinkCopyW(), DriveVolume::ScanDirectory(), SdbpBuildSignMediaId(), SearchDriverRecursive(), SetupCopyOEMInfW(), SetupGetInfFileListW(), SHELL_DeleteDirectoryW(), SHFindAttrW(), SHNotifyDeleteFileW(), start_enumeration(), START_TEST(), test_GetAbsolutePathName(), Test_NtGdiAddFontResourceW(), CAvailableApps::UpdateAppsDB(), wexpand(), wmain(), and XCOPY_DoCopy().

◆ FindFirstStreamW()

HANDLE WINAPI FindFirstStreamW ( IN LPCWSTR  lpFileName,
IN STREAM_INFO_LEVELS  InfoLevel,
OUT LPVOID  lpFindStreamData,
IN DWORD  dwFlags 
)

Definition at line 957 of file find.c.

961 {
962  PFIND_DATA_HANDLE FindDataHandle = NULL;
963  PFIND_STREAM_DATA FindStreamData;
966  UNICODE_STRING NtFilePath;
969  ULONG BufferSize = 0;
970 
971  if (dwFlags != 0 || InfoLevel != FindStreamInfoStandard ||
972  lpFindStreamData == NULL)
973  {
975  return INVALID_HANDLE_VALUE;
976  }
977 
978  /* Validate and translate the filename */
980  &NtFilePath,
981  NULL, NULL))
982  {
984  return INVALID_HANDLE_VALUE;
985  }
986 
987  /* Open the file */
989  &NtFilePath,
991  NULL,
992  NULL);
993 
995  0,
997  &IoStatusBlock,
998  NULL, 0,
1000  FILE_OPEN,
1001  0, NULL, 0);
1002  if (!NT_SUCCESS(Status)) goto Cleanup;
1003 
1004  /*
1005  * Initialization of the search handle.
1006  */
1007  FindDataHandle = RtlAllocateHeap(RtlGetProcessHeap(),
1009  sizeof(FIND_DATA_HANDLE) +
1010  sizeof(FIND_STREAM_DATA));
1011  if (!FindDataHandle)
1012  {
1014  goto Cleanup;
1015  }
1016 
1017  FindDataHandle->Type = FindStream;
1018  FindDataHandle->u.FindStreamData = (PFIND_STREAM_DATA)(FindDataHandle + 1);
1019  FindStreamData = FindDataHandle->u.FindStreamData;
1020 
1021  FindStreamData->InfoLevel = InfoLevel;
1022  FindStreamData->FileStreamInfo = NULL;
1023  FindStreamData->CurrentInfo = NULL;
1024 
1025  /* The critical section must always be initialized */
1026  Status = RtlInitializeCriticalSection(&FindDataHandle->Lock);
1027  if (!NT_SUCCESS(Status))
1028  {
1029  RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
1030  goto Cleanup;
1031  }
1032 
1033  /* Capture all information about the streams */
1034  do
1035  {
1036  BufferSize += 0x1000;
1037 
1038  if (FindStreamData->FileStreamInfo == NULL)
1039  {
1040  FindStreamData->FileStreamInfo = RtlAllocateHeap(RtlGetProcessHeap(),
1042  BufferSize);
1043  if (FindStreamData->FileStreamInfo == NULL)
1044  {
1046  break;
1047  }
1048  }
1049  else
1050  {
1052 
1053  pfsi = RtlReAllocateHeap(RtlGetProcessHeap(),
1054  0, // HEAP_ZERO_MEMORY,
1055  FindStreamData->FileStreamInfo,
1056  BufferSize);
1057  if (pfsi == NULL)
1058  {
1060  break;
1061  }
1062 
1063  FindStreamData->FileStreamInfo = pfsi;
1064  }
1065 
1067  &IoStatusBlock,
1068  FindStreamData->FileStreamInfo,
1069  BufferSize,
1071 
1072  } while (Status == STATUS_BUFFER_TOO_SMALL);
1073 
1074  if (NT_SUCCESS(Status))
1075  {
1076  /* Select the first stream and return the information */
1077  FindStreamData->CurrentInfo = FindStreamData->FileStreamInfo;
1078  CopyStreamData(FindStreamData, lpFindStreamData);
1079 
1080  /* All done */
1082  }
1083  else
1084  {
1085  if (FindStreamData->FileStreamInfo)
1086  {
1087  RtlFreeHeap(RtlGetProcessHeap(), 0, FindStreamData->FileStreamInfo);
1088  }
1089 
1090  RtlFreeHeap(RtlGetProcessHeap(), 0, FindDataHandle);
1091  }
1092 
1093 Cleanup:
1095 
1096  RtlFreeHeap(RtlGetProcessHeap(), 0, NtFilePath.Buffer);
1097 
1098  if (NT_SUCCESS(Status))
1099  {
1100  return (HANDLE)FindDataHandle;
1101  }
1102  else
1103  {
1105  return INVALID_HANDLE_VALUE;
1106  }
1107 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
PFILE_STREAM_INFORMATION CurrentInfo
Definition: find.c:93
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
PFIND_STREAM_DATA FindStreamData
Definition: find.c:108
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
Definition: heap.c:2561
#define FILE_SHARE_READ
Definition: compat.h:125
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
HANDLE FileHandle
Definition: stats.c:38
RTL_CRITICAL_SECTION Lock
Definition: find.c:99
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
FIND_DATA_TYPE Type
Definition: find.c:98
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
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)
PFILE_STREAM_INFORMATION FileStreamInfo
Definition: find.c:92
NTSYSAPI NTSTATUS NTAPI RtlInitializeCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
STREAM_INFO_LEVELS InfoLevel
Definition: find.c:91
#define BufferSize
Definition: classpnp.h:419
#define SetLastError(x)
Definition: compat.h:409
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
NTSTATUS NTAPI NtQueryInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
static const WCHAR Cleanup[]
Definition: register.c:80
Status
Definition: gdiplustypes.h:24
#define FILE_OPEN
Definition: from_kernel.h:54
union _FIND_DATA_HANDLE::@435 u
#define STATUS_NO_MEMORY
Definition: ntstatus.h:246
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
struct _FIND_STREAM_DATA * PFIND_STREAM_DATA
static VOID CopyStreamData(IN OUT PFIND_STREAM_DATA FindStreamData, OUT PWIN32_FIND_STREAM_DATA lpFindStreamData)
Definition: find.c:214
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
return STATUS_SUCCESS
Definition: btrfs.c:2745
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)
_In_ LPCSTR lpFileName
Definition: winbase.h:3011

Referenced by BtrfsContextMenu::reflink_copy(), and reflink_copy2().

◆ FindNextFileA()

BOOL WINAPI FindNextFileA ( IN HANDLE  hFindFile,
OUT LPWIN32_FIND_DATAA  lpFindFileData 
)

Definition at line 336 of file find.c.

338 {
340  ANSI_STRING Ansi;
341  UNICODE_STRING UTF8;
342  WIN32_FIND_DATAW FindFileDataW;
343 
344  if (!FindNextFileW(hFindFile, &FindFileDataW))
345  return FALSE;
346 
347  RtlCopyMemory(lpFindFileData,
348  &FindFileDataW,
349  FIELD_OFFSET(WIN32_FIND_DATAA, cFileName));
350 
351  RtlInitUnicodeString(&UTF8, FindFileDataW.cFileName);
352  Ansi.Buffer = lpFindFileData->cFileName;
353  Ansi.Length = 0;
354  Ansi.MaximumLength = sizeof(lpFindFileData->cFileName);
356  if (!NT_SUCCESS(Status))
357  {
359  return FALSE;
360  }
361 
362  RtlInitUnicodeString(&UTF8, FindFileDataW.cAlternateFileName);
363  Ansi.Buffer = lpFindFileData->cAlternateFileName;
364  Ansi.Length = 0;
365  Ansi.MaximumLength = sizeof(lpFindFileData->cAlternateFileName);
367  if (!NT_SUCCESS(Status))
368  {
370  return FALSE;
371  }
372 
373  return TRUE;
374 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PRTL_CONVERT_STRINGA BasepUnicodeStringTo8BitString
Definition: utils.c:27
LONG NTSTATUS
Definition: precomp.h:26
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
USHORT MaximumLength
Definition: env_spec_w32.h:377
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by aexpand(), demFileFindFirst(), demFileFindNext(), enum_gac_assemblies(), enum_gac_assembly_dirs(), EnumColorProfilesA(), expect_files(), get_number_of_folders(), test_FindFirstFile_wildcards(), test_FindFirstFileA(), test_FindFirstFileExA(), test_FindNextFileA(), test_MoveFileA(), and test_request_groups().

◆ FindNextFileW()

BOOL WINAPI FindNextFileW ( IN HANDLE  hFindFile,
OUT LPWIN32_FIND_DATAW  lpFindFileData 
)

Definition at line 382 of file find.c.

384 {
386  DIR_INFORMATION FoundFile = {NULL};
387 
388  TRACE("FindNextFileW(%p, 0x%p)\n", hFindFile, lpFindFileData);
389 
390  if (hFindFile != FIND_DEVICE_HANDLE)
391  {
392  PFIND_DATA_HANDLE FindDataHandle = (PFIND_DATA_HANDLE)hFindFile;
393  PFIND_FILE_DATA FindFileData;
394  FINDEX_INFO_LEVELS InfoLevel;
396  DIR_INFORMATION DirInfo = {NULL}, NextDirInfo = {NULL};
397 
398  if (hFindFile == NULL || hFindFile == INVALID_HANDLE_VALUE ||
399  FindDataHandle->Type != FindFile)
400  {
402  return FALSE;
403  }
404 
405  RtlEnterCriticalSection(&FindDataHandle->Lock);
406 
407  FindFileData = FindDataHandle->u.FindFileData;
408  InfoLevel = FindFileData->InfoLevel;
409 
410  do
411  {
412  if (FindFileData->NextDirInfo.DirInfo == NULL)
413  {
414  Status = NtQueryDirectoryFile(FindFileData->Handle,
415  NULL, NULL, NULL,
416  &IoStatusBlock,
417  &FindFileData->Buffer,
418  sizeof(FindFileData->Buffer),
419  (InfoLevel == FindExInfoStandard
422  FALSE,
423  NULL, /* Use the file pattern from the first call */
424  FALSE);
426  {
427  FindFileData->HasMoreData = TRUE;
429  }
430  else
431  {
432  if (!NT_SUCCESS(Status)) break;
433  FindFileData->HasMoreData = FALSE;
434  }
435 
436  FindFileData->NextDirInfo.DirInfo = &FindFileData->Buffer;
437  }
438 
439  DirInfo = FindFileData->NextDirInfo;
440 
441  if (DirInfo.FullDirInfo->NextEntryOffset != 0)
442  {
443  ULONG_PTR BufferEnd = (ULONG_PTR)&FindFileData->Buffer + sizeof(FindFileData->Buffer);
444  PWSTR pFileName;
445 
446  NextDirInfo.DirInfo = FindFileData->NextDirInfo.DirInfo =
447  (PVOID)((ULONG_PTR)DirInfo.DirInfo + DirInfo.FullDirInfo->NextEntryOffset);
448 
449  pFileName = (InfoLevel == FindExInfoStandard
450  ? NextDirInfo.BothDirInfo->FileName
451  : NextDirInfo.FullDirInfo->FileName);
452 
453  /* Be paranoid and make sure that the next entry is completely there */
454  if (BufferEnd < (ULONG_PTR)NextDirInfo.DirInfo ||
455  BufferEnd < (ULONG_PTR)&NextDirInfo.FullDirInfo->FileNameLength + sizeof(NextDirInfo.FullDirInfo->FileNameLength) ||
456  BufferEnd <= (ULONG_PTR)((ULONG_PTR)pFileName + NextDirInfo.FullDirInfo->FileNameLength))
457  {
458  FindFileData->NextDirInfo.DirInfo = NULL;
459  }
460  }
461  else
462  {
463  FindFileData->NextDirInfo.DirInfo = NULL;
464  }
465 
466  if ((FindFileData->SearchOp != FindExSearchLimitToDirectories) ||
468  {
469  FoundFile = DirInfo;
470  }
471  } while ( FoundFile.DirInfo == NULL && (FindFileData->NextDirInfo.DirInfo || FindFileData->HasMoreData) );
472 
473  if (FoundFile.DirInfo != NULL)
474  {
475  /* Return the information */
476  CopyFindData(lpFindFileData, InfoLevel, FoundFile);
477  }
478 
479  RtlLeaveCriticalSection(&FindDataHandle->Lock);
480  }
481 
482  if (!NT_SUCCESS(Status))
483  {
485  return FALSE;
486  }
487  else if (FoundFile.DirInfo == NULL)
488  {
490  return FALSE;
491  }
492 
493  return TRUE;
494 }
DIR_INFORMATION NextDirInfo
Definition: find.c:84
#define TRUE
Definition: types.h:120
FINDEX_INFO_LEVELS InfoLevel
Definition: find.c:71
BOOLEAN HasMoreData
Definition: find.c:78
uint16_t * PWSTR
Definition: typedefs.h:54
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
uint32_t ULONG_PTR
Definition: typedefs.h:63
static VOID CopyFindData(OUT LPWIN32_FIND_DATAW lpFindFileData, IN FINDEX_INFO_LEVELS fInfoLevelId, IN DIR_INFORMATION DirInfo)
Definition: find.c:146
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
RTL_CRITICAL_SECTION Lock
Definition: find.c:99
smooth NULL
Definition: ftsmooth.c:416
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
void * PVOID
Definition: retypes.h:9
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
FIND_DATA_TYPE Type
Definition: find.c:98
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define TRACE(s)
Definition: solgame.cpp:4
FINDEX_SEARCH_OPS SearchOp
Definition: find.c:72
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
PFIND_FILE_DATA FindFileData
Definition: find.c:107
HANDLE Handle
Definition: find.c:70
#define SetLastError(x)
Definition: compat.h:409
struct _FIND_DATA_HANDLE * PFIND_DATA_HANDLE
_In_ PUCHAR BufferEnd
Definition: usbdlib.h:176
Status
Definition: gdiplustypes.h:24
union _FIND_DATA_HANDLE::@435 u
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
PVOID DirInfo
Definition: find.c:63
#define FIND_DEVICE_HANDLE
Definition: find.c:24
#define ULONG_PTR
Definition: config.h:101
enum _FINDEX_INFO_LEVELS FINDEX_INFO_LEVELS
return STATUS_SUCCESS
Definition: btrfs.c:2745
PFILE_FULL_DIR_INFORMATION FullDirInfo
Definition: find.c:64
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)
Definition: iofunc.c:1976
Definition: find.c:28
BYTE Buffer[FIND_DATA_SIZE]
Definition: find.c:86

Referenced by _FileOpCount(), ACTION_RecurseSearchDirectory(), add_favs_to_menu(), AutoStartupApplications(), compat_nextdir(), compat_nextfile(), Control_DoWindow(), copy_file(), copy_folder(), CopyDirectory(), CFileDefExt::CountFolderAndFiles(), CControlPanelEnum::CreateCPanelEnumList(), CryptCATAdminEnumCatalogFromHash(), delete_directory(), delete_file(), delete_folder(), CAvailableApps::DeleteCurrentAppsDB(), DELNODE_recurse_dirtree(), BtrfsPropSheet::do_search(), do_searchW(), CAvailableApps::Enum(), enum_gac_assemblies(), EnumColorProfilesW(), EnumThemes(), filecoll_enumvariant_Next(), filecoll_enumvariant_Skip(), filecoll_get_Count(), FileQueryFiles(), fill_datafile(), fill_directory(), FindNextFileA(), foldercoll_enumvariant_Next(), foldercoll_enumvariant_Skip(), foldercoll_get_Count(), GetDirectoryStructure(), CWineTest::GetNextFile(), HasSubFolder(), CFileSysEnum::Initialize(), InitializeGlobalJobList(), IntDeleteRecursive(), LISTBOX_Directory(), LoadSoundFiles(), move_files_wildcard(), msi_dialog_update_directory_list(), OnClearRecentItems(), parse_wildcard_files(), PathIsDirectoryEmptyW(), pBuildFileList(), read_directory_win(), RecursiveRemoveDir(), BtrfsContextMenu::reflink_copy(), reflink_copy2(), ReflinkCopyW(), DriveVolume::ScanDirectory(), SdbpBuildSignMediaId(), SearchDriverRecursive(), SetupCopyOEMInfW(), SetupGetInfFileListW(), SHELL_DeleteDirectoryW(), SHFindAttrW(), start_enumeration(), wexpand(), wmain(), and XCOPY_DoCopy().

◆ FindNextStreamW()

BOOL WINAPI FindNextStreamW ( IN HANDLE  hFindStream,
OUT LPVOID  lpFindStreamData 
)

Definition at line 1115 of file find.c.

1117 {
1118  PFIND_DATA_HANDLE FindDataHandle = (PFIND_DATA_HANDLE)hFindStream;
1119  PFIND_STREAM_DATA FindStreamData;
1120 
1121  if (hFindStream == NULL || hFindStream == INVALID_HANDLE_VALUE ||
1122  FindDataHandle->Type != FindStream)
1123  {
1125  return FALSE;
1126  }
1127 
1128  RtlEnterCriticalSection(&FindDataHandle->Lock);
1129 
1130  FindStreamData = FindDataHandle->u.FindStreamData;
1131 
1132  /* Select next stream if possible */
1133  if (FindStreamData->CurrentInfo->NextEntryOffset != 0)
1134  {
1135  FindStreamData->CurrentInfo = (PFILE_STREAM_INFORMATION)((ULONG_PTR)FindStreamData->CurrentInfo +
1136  FindStreamData->CurrentInfo->NextEntryOffset);
1137 
1138  /* Return the information */
1139  CopyStreamData(FindStreamData, lpFindStreamData);
1140 
1141  RtlLeaveCriticalSection(&FindDataHandle->Lock);
1142  return TRUE;
1143  }
1144  else
1145  {
1146  RtlLeaveCriticalSection(&FindDataHandle->Lock);
1147 
1149  return FALSE;
1150  }
1151 }
#define TRUE
Definition: types.h:120
PFILE_STREAM_INFORMATION CurrentInfo
Definition: find.c:93
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
PFIND_STREAM_DATA FindStreamData
Definition: find.c:108
uint32_t ULONG_PTR
Definition: typedefs.h:63
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
RTL_CRITICAL_SECTION Lock
Definition: find.c:99
smooth NULL
Definition: ftsmooth.c:416
FIND_DATA_TYPE Type
Definition: find.c:98
#define SetLastError(x)
Definition: compat.h:409
struct _FIND_DATA_HANDLE * PFIND_DATA_HANDLE
union _FIND_DATA_HANDLE::@435 u
static VOID CopyStreamData(IN OUT PFIND_STREAM_DATA FindStreamData, OUT PWIN32_FIND_STREAM_DATA lpFindStreamData)
Definition: find.c:214
#define ERROR_HANDLE_EOF
Definition: winerror.h:140

Referenced by BtrfsContextMenu::reflink_copy(), and reflink_copy2().