cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

file.h (19105B)


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