FreeRDP
winpr/include/winpr/file.h
1 
21 #ifndef WINPR_FILE_H
22 #define WINPR_FILE_H
23 
24 #include <winpr/winpr.h>
25 #include <winpr/wtypes.h>
26 
27 #include <winpr/nt.h>
28 #include <winpr/io.h>
29 #include <winpr/error.h>
30 #include <winpr/handle.h>
31 
32 #ifndef _WIN32
33 
34 #include <stdio.h>
35 
36 #ifndef MAX_PATH
37 #define MAX_PATH 260
38 #endif
39 
40 #define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1)
41 #define INVALID_FILE_SIZE ((DWORD)0xFFFFFFFF)
42 #define INVALID_SET_FILE_POINTER ((DWORD)-1)
43 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
44 
45 #define FILE_ATTRIBUTE_READONLY 0x00000001u
46 #define FILE_ATTRIBUTE_HIDDEN 0x00000002u
47 #define FILE_ATTRIBUTE_SYSTEM 0x00000004u
48 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010u
49 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020u
50 #define FILE_ATTRIBUTE_DEVICE 0x00000040u
51 #define FILE_ATTRIBUTE_NORMAL 0x00000080u
52 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100u
53 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200u
54 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400u
55 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800u
56 #define FILE_ATTRIBUTE_OFFLINE 0x00001000u
57 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000u
58 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000u
59 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000u
60 
61 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
62 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
63 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
64 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
65 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
66 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
67 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
68 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
69 
70 #define FILE_ACTION_ADDED 0x00000001
71 #define FILE_ACTION_REMOVED 0x00000002
72 #define FILE_ACTION_MODIFIED 0x00000003
73 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
74 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
75 
76 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
77 #define FILE_CASE_PRESERVED_NAMES 0x00000002
78 #define FILE_UNICODE_ON_DISK 0x00000004
79 #define FILE_PERSISTENT_ACLS 0x00000008
80 #define FILE_FILE_COMPRESSION 0x00000010
81 #define FILE_VOLUME_QUOTAS 0x00000020
82 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
83 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
84 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
85 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
86 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
87 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
88 #define FILE_NAMED_STREAMS 0x00040000
89 #define FILE_READ_ONLY_VOLUME 0x00080000
90 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
91 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000
92 #define FILE_SUPPORTS_HARD_LINKS 0x00400000
93 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
94 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
95 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000
96 
97 #define FILE_FLAG_WRITE_THROUGH 0x80000000
98 #define FILE_FLAG_OVERLAPPED 0x40000000
99 #define FILE_FLAG_NO_BUFFERING 0x20000000
100 #define FILE_FLAG_RANDOM_ACCESS 0x10000000
101 #define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000
102 #define FILE_FLAG_DELETE_ON_CLOSE 0x04000000
103 #define FILE_FLAG_BACKUP_SEMANTICS 0x02000000
104 #define FILE_FLAG_POSIX_SEMANTICS 0x01000000
105 #define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000
106 #define FILE_FLAG_OPEN_NO_RECALL 0x00100000
107 #define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
108 
109 #define PAGE_NOACCESS 0x00000001
110 #define PAGE_READONLY 0x00000002
111 #define PAGE_READWRITE 0x00000004
112 #define PAGE_WRITECOPY 0x00000008
113 #define PAGE_EXECUTE 0x00000010
114 #define PAGE_EXECUTE_READ 0x00000020
115 #define PAGE_EXECUTE_READWRITE 0x00000040
116 #define PAGE_EXECUTE_WRITECOPY 0x00000080
117 #define PAGE_GUARD 0x00000100
118 #define PAGE_NOCACHE 0x00000200
119 #define PAGE_WRITECOMBINE 0x00000400
120 
121 #define MEM_COMMIT 0x00001000
122 #define MEM_RESERVE 0x00002000
123 #define MEM_DECOMMIT 0x00004000
124 #define MEM_RELEASE 0x00008000
125 #define MEM_FREE 0x00010000
126 #define MEM_PRIVATE 0x00020000
127 #define MEM_MAPPED 0x00040000
128 #define MEM_RESET 0x00080000
129 #define MEM_TOP_DOWN 0x00100000
130 #define MEM_WRITE_WATCH 0x00200000
131 #define MEM_PHYSICAL 0x00400000
132 #define MEM_4MB_PAGES 0x80000000
133 #define MEM_IMAGE SEC_IMAGE
134 
135 #define SEC_NO_CHANGE 0x00400000
136 #define SEC_FILE 0x00800000
137 #define SEC_IMAGE 0x01000000
138 #define SEC_VLM 0x02000000
139 #define SEC_RESERVE 0x04000000
140 #define SEC_COMMIT 0x08000000
141 #define SEC_NOCACHE 0x10000000
142 #define SEC_WRITECOMBINE 0x40000000
143 #define SEC_LARGE_PAGES 0x80000000
144 
145 #define SECTION_MAP_EXECUTE_EXPLICIT 0x00020
146 #define SECTION_EXTEND_SIZE 0x00010
147 #define SECTION_MAP_READ 0x00004
148 #define SECTION_MAP_WRITE 0x00002
149 #define SECTION_QUERY 0x00001
150 #define SECTION_MAP_EXECUTE 0x00008
151 #define SECTION_ALL_ACCESS 0xF001F
152 
153 #define FILE_MAP_COPY SECTION_QUERY
154 #define FILE_MAP_WRITE SECTION_MAP_WRITE
155 #define FILE_MAP_READ SECTION_MAP_READ
156 #define FILE_MAP_ALL_ACCESS SECTION_ALL_ACCESS
157 #define FILE_MAP_EXECUTE SECTION_MAP_EXECUTE_EXPLICIT
158 
159 #define CREATE_NEW 1
160 #define CREATE_ALWAYS 2
161 #define OPEN_EXISTING 3
162 #define OPEN_ALWAYS 4
163 #define TRUNCATE_EXISTING 5
164 
165 #define FIND_FIRST_EX_CASE_SENSITIVE 0x1
166 #define FIND_FIRST_EX_LARGE_FETCH 0x2
167 
168 #define STD_INPUT_HANDLE (DWORD) - 10
169 #define STD_OUTPUT_HANDLE (DWORD) - 11
170 #define STD_ERROR_HANDLE (DWORD) - 12
171 
172 #define FILE_BEGIN 0
173 #define FILE_CURRENT 1
174 #define FILE_END 2
175 
176 #define LOCKFILE_FAIL_IMMEDIATELY 1
177 #define LOCKFILE_EXCLUSIVE_LOCK 2
178 
179 #define MOVEFILE_REPLACE_EXISTING 0x1
180 #define MOVEFILE_COPY_ALLOWED 0x2
181 #define MOVEFILE_DELAY_UNTIL_REBOOT 0x4
182 #define MOVEFILE_WRITE_THROUGH 0x8
183 #define MOVEFILE_CREATE_HARDLINK 0x10
184 #define MOVEFILE_FAIL_IF_NOT_TRACKABLE 0x20
185 
186 typedef union
187 {
188  PVOID64 Buffer;
189  ULONGLONG Alignment;
191 
192 typedef struct
193 {
194  DWORD dwFileAttributes;
195  FILETIME ftCreationTime;
196  FILETIME ftLastAccessTime;
197  FILETIME ftLastWriteTime;
198  DWORD nFileSizeHigh;
199  DWORD nFileSizeLow;
200  DWORD dwReserved0;
201  DWORD dwReserved1;
202  CHAR cFileName[MAX_PATH];
203  CHAR cAlternateFileName[14];
205 
206 typedef struct
207 {
208  DWORD dwFileAttributes;
209  FILETIME ftCreationTime;
210  FILETIME ftLastAccessTime;
211  FILETIME ftLastWriteTime;
212  DWORD nFileSizeHigh;
213  DWORD nFileSizeLow;
214  DWORD dwReserved0;
215  DWORD dwReserved1;
216  WCHAR cFileName[MAX_PATH];
217  WCHAR cAlternateFileName[14];
219 
220 typedef struct
221 {
222  DWORD dwFileAttributes;
223  FILETIME ftCreationTime;
224  FILETIME ftLastAccessTime;
225  FILETIME ftLastWriteTime;
226  DWORD dwVolumeSerialNumber;
227  DWORD nFileSizeHigh;
228  DWORD nFileSizeLow;
229  DWORD nNumberOfLinks;
230  DWORD nFileIndexHigh;
231  DWORD nFileIndexLow;
233 
234 typedef enum
235 {
236  FindExInfoStandard,
237  FindExInfoMaxInfoLevel
238 } FINDEX_INFO_LEVELS;
239 
240 typedef enum
241 {
242  FindExSearchNameMatch,
243  FindExSearchLimitToDirectories,
244  FindExSearchLimitToDevices,
245  FindExSearchMaxSearchOp
246 } FINDEX_SEARCH_OPS;
247 
248 typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered,
249  LPOVERLAPPED lpOverlapped);
250 
251 #ifdef UNICODE
252 #define WIN32_FIND_DATA WIN32_FIND_DATAW
253 #define PWIN32_FIND_DATA PWIN32_FIND_DATAW
254 #define LPWIN32_FIND_DATA LPWIN32_FIND_DATAW
255 #else
256 #define WIN32_FIND_DATA WIN32_FIND_DATAA
257 #define PWIN32_FIND_DATA PWIN32_FIND_DATAA
258 #define LPWIN32_FIND_DATA LPWIN32_FIND_DATAA
259 #endif
260 
261 #ifdef __cplusplus
262 extern "C"
263 {
264 #endif
265 
266  WINPR_ATTR_MALLOC(CloseHandle, 1)
267  WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
268  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
269  DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
270  HANDLE hTemplateFile);
271 
272  WINPR_ATTR_MALLOC(CloseHandle, 1)
273  WINPR_API HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
274  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
275  DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
276  HANDLE hTemplateFile);
277 
278  WINPR_API BOOL DeleteFileA(LPCSTR lpFileName);
279 
280  WINPR_API BOOL DeleteFileW(LPCWSTR lpFileName);
281 
282  WINPR_API BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
283  LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped);
284 
285  WINPR_API BOOL ReadFileEx(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
286  LPOVERLAPPED lpOverlapped,
287  LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
288 
289  WINPR_API BOOL ReadFileScatter(HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
290  DWORD nNumberOfBytesToRead, LPDWORD lpReserved,
291  LPOVERLAPPED lpOverlapped);
292 
293  WINPR_API BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
294  LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
295 
296  WINPR_API BOOL WriteFileEx(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
297  LPOVERLAPPED lpOverlapped,
298  LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine);
299 
300  WINPR_API BOOL WriteFileGather(HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[],
301  DWORD nNumberOfBytesToWrite, LPDWORD lpReserved,
302  LPOVERLAPPED lpOverlapped);
303 
304  WINPR_API BOOL FlushFileBuffers(HANDLE hFile);
305 
306  typedef struct
307  {
308  DWORD dwFileAttributes;
309  FILETIME ftCreationTime;
310  FILETIME ftLastAccessTime;
311  FILETIME ftLastWriteTime;
312  DWORD nFileSizeHigh;
313  DWORD nFileSizeLow;
315 
316  typedef enum
317  {
318  GetFileExInfoStandard,
319  GetFileExMaxInfoLevel
320  } GET_FILEEX_INFO_LEVELS;
321 
322  WINPR_API BOOL GetFileAttributesExA(LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId,
323  LPVOID lpFileInformation);
324 
325  WINPR_API DWORD GetFileAttributesA(LPCSTR lpFileName);
326 
327  WINPR_API BOOL GetFileAttributesExW(LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId,
328  LPVOID lpFileInformation);
329 
330  WINPR_API DWORD GetFileAttributesW(LPCWSTR lpFileName);
331 
332  WINPR_API BOOL GetFileInformationByHandle(HANDLE hFile,
333  LPBY_HANDLE_FILE_INFORMATION lpFileInformation);
334 
335  WINPR_API BOOL SetFileAttributesA(LPCSTR lpFileName, DWORD dwFileAttributes);
336 
337  WINPR_API BOOL SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes);
338 
339  WINPR_API BOOL SetEndOfFile(HANDLE hFile);
340 
341  WINPR_API DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
342 
343  WINPR_API DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,
344  DWORD dwMoveMethod);
345 
346  WINPR_API BOOL SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove,
347  PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod);
348 
349  WINPR_API BOOL LockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
350  DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh);
351 
352  WINPR_API BOOL LockFileEx(HANDLE hFile, DWORD dwFlags, DWORD dwReserved,
353  DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh,
354  LPOVERLAPPED lpOverlapped);
355 
356  WINPR_API BOOL UnlockFile(HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh,
357  DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh);
358 
359  WINPR_API BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow,
360  DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped);
361 
362  WINPR_API BOOL SetFileTime(HANDLE hFile, const FILETIME* lpCreationTime,
363  const FILETIME* lpLastAccessTime, const FILETIME* lpLastWriteTime);
364 
365  WINPR_API BOOL FindClose(HANDLE hFindFile);
366 
367  WINPR_ATTR_MALLOC(FindClose, 1)
368  WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
369 
370  WINPR_ATTR_MALLOC(FindClose, 1)
371  WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
372 
373  WINPR_ATTR_MALLOC(FindClose, 1)
374  WINPR_API HANDLE FindFirstFileExA(LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId,
375  LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp,
376  LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
377 
378  WINPR_ATTR_MALLOC(FindClose, 1)
379  WINPR_API HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId,
380  LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp,
381  LPVOID lpSearchFilter, DWORD dwAdditionalFlags);
382 
383  WINPR_API BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData);
384  WINPR_API BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData);
385 
386  WINPR_API BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
387  WINPR_API BOOL CreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
388 
389  WINPR_API BOOL RemoveDirectoryA(LPCSTR lpPathName);
390  WINPR_API BOOL RemoveDirectoryW(LPCWSTR lpPathName);
391 
392  WINPR_API HANDLE GetStdHandle(DWORD nStdHandle);
393  WINPR_API BOOL SetStdHandle(DWORD nStdHandle, HANDLE hHandle);
394  WINPR_API BOOL SetStdHandleEx(DWORD dwStdHandle, HANDLE hNewHandle, HANDLE* phOldHandle);
395 
396  WINPR_API BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
397  LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
398  LPDWORD lpTotalNumberOfClusters);
399 
400  WINPR_API BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
401  LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
402  LPDWORD lpTotalNumberOfClusters);
403 
404  WINPR_API BOOL MoveFileExA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags);
405 
406  WINPR_API BOOL MoveFileExW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags);
407 
408  WINPR_API BOOL MoveFileA(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
409 
410  WINPR_API BOOL MoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
411 
412 #ifdef __cplusplus
413 }
414 #endif
415 
416 #ifdef UNICODE
417 #define CreateFile CreateFileW
418 #define DeleteFile DeleteFileW
419 #define FindFirstFile FindFirstFileW
420 #define FindFirstFileEx FindFirstFileExW
421 #define FindNextFile FindNextFileW
422 #define CreateDirectory CreateDirectoryW
423 #define RemoveDirectory RemoveDirectoryW
424 #define GetFileAttributesEx GetFileAttributesExW
425 #define GetFileAttributes GetFileAttributesW
426 #define SetFileAttributes SetFileAttributesW
427 #define GetDiskFreeSpace GetDiskFreeSpaceW
428 #define MoveFileEx MoveFileExW
429 #define MoveFile MoveFileW
430 #else
431 #define CreateFile CreateFileA
432 #define DeleteFile DeleteFileA
433 #define FindFirstFile FindFirstFileA
434 #define FindFirstFileEx FindFirstFileExA
435 #define FindNextFile FindNextFileA
436 #define CreateDirectory CreateDirectoryA
437 #define RemoveDirectory RemoveDirectoryA
438 #define GetFileAttributesEx GetFileAttributesExA
439 #define GetFileAttributes GetFileAttributesA
440 #define SetFileAttributes SetFileAttributesA
441 #define GetDiskFreeSpace GetDiskFreeSpaceA
442 #define MoveFileEx MoveFileExA
443 #define MoveFile MoveFileA
444 #endif
445 
446 /* Extra Functions */
447 
448 typedef BOOL (*pcIsFileHandled)(LPCSTR lpFileName);
449 typedef HANDLE (*pcCreateFileA)(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
450  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
451  DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
452  HANDLE hTemplateFile);
453 
454 typedef struct
455 {
456  pcIsFileHandled IsHandled;
457  pcCreateFileA CreateFileA;
459 
460 #endif /* _WIN32 */
461 
462 WINPR_API BOOL ValidFileNameComponent(LPCWSTR lpFileName);
463 
464 #ifdef _UWP
465 
466 #ifdef __cplusplus
467 extern "C"
468 {
469 #endif
470 
471  WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
472  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
473  DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
474  HANDLE hTemplateFile);
475 
476  WINPR_API HANDLE CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
477  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
478  DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
479  HANDLE hTemplateFile);
480 
481  WINPR_API DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh);
482 
483  WINPR_API DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh,
484  DWORD dwMoveMethod);
485 
486  WINPR_API HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData);
487  WINPR_API HANDLE FindFirstFileW(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData);
488 
489  WINPR_API DWORD GetFullPathNameA(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer,
490  LPSTR* lpFilePart);
491 
492  WINPR_API BOOL GetDiskFreeSpaceA(LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
493  LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
494  LPDWORD lpTotalNumberOfClusters);
495 
496  WINPR_API BOOL GetDiskFreeSpaceW(LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster,
497  LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters,
498  LPDWORD lpTotalNumberOfClusters);
499 
500  WINPR_API DWORD GetLogicalDriveStringsA(DWORD nBufferLength, LPSTR lpBuffer);
501 
502  WINPR_API DWORD GetLogicalDriveStringsW(DWORD nBufferLength, LPWSTR lpBuffer);
503 
504  WINPR_API BOOL PathIsDirectoryEmptyA(LPCSTR pszPath);
505 
506  WINPR_API UINT GetACP(void);
507 
508 #ifdef UNICODE
509 #define CreateFile CreateFileW
510 #define FindFirstFile FindFirstFileW
511 #else
512 #define CreateFile CreateFileA
513 #define FindFirstFile FindFirstFileA
514 #endif
515 
516 #ifdef __cplusplus
517 }
518 #endif
519 
520 #ifdef UNICODE
521 #define FindFirstFile FindFirstFileW
522 #else
523 #define FindFirstFile FindFirstFileA
524 #endif
525 
526 #endif
527 
528 #define WILDCARD_STAR 0x00000001
529 #define WILDCARD_QM 0x00000002
530 #define WILDCARD_DOS 0x00000100
531 #define WILDCARD_DOS_STAR 0x00000110
532 #define WILDCARD_DOS_QM 0x00000120
533 #define WILDCARD_DOS_DOT 0x00000140
534 
535 #ifdef __cplusplus
536 extern "C"
537 {
538 #endif
539 
540  WINPR_API BOOL FilePatternMatchA(LPCSTR lpFileName, LPCSTR lpPattern);
541  WINPR_API LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD* pFlags);
542 
543  WINPR_API int UnixChangeFileMode(const char* filename, int flags);
544 
545  WINPR_API BOOL IsNamedPipeFileNameA(LPCSTR lpName);
546  WINPR_API char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName);
547  WINPR_API char* GetNamedPipeUnixDomainSocketBaseFilePathA(void);
548  WINPR_API char* GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName);
549 
550  WINPR_API int GetNamePipeFileDescriptor(HANDLE hNamedPipe);
551  WINPR_API HANDLE GetFileHandleForFileDescriptor(int fd);
552 
553  WINPR_ATTR_MALLOC(fclose, 1)
554  WINPR_API FILE* winpr_fopen(const char* path, const char* mode);
555 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 #endif /* WINPR_FILE_H */