1 /** 2 * This file is part of the mingw-w64 runtime package. 3 * No warranty is given; refer to the file DISCLAIMER within this package. 4 */ 5 #ifndef _APISETFILE_ 6 #define _APISETFILE_ 7 8 #include <apiset.h> 9 #include <apisetcconv.h> 10 #include <minwindef.h> 11 #include <minwinbase.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP) 18 #define CREATE_NEW 1 19 #define CREATE_ALWAYS 2 20 #define OPEN_EXISTING 3 21 #define OPEN_ALWAYS 4 22 #define TRUNCATE_EXISTING 5 23 24 #define INVALID_FILE_SIZE ((DWORD)0xffffffff) 25 #define INVALID_SET_FILE_POINTER ((DWORD)-1) 26 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) 27 #endif 28 29 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10 30 WINBASEAPI HANDLE WINAPI CreateFileW (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); 31 #define CreateFile __MINGW_NAME_AW(CreateFile) 32 WINBASEAPI DWORD WINAPI GetFileAttributesW (LPCWSTR lpFileName); 33 #define GetFileAttributes __MINGW_NAME_AW(GetFileAttributes) 34 WINBASEAPI DWORD WINAPI GetFileSize (HANDLE hFile, LPDWORD lpFileSizeHigh); 35 WINBASEAPI DWORD WINAPI SetFilePointer (HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod); 36 #endif 37 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) 38 typedef struct _BY_HANDLE_FILE_INFORMATION { 39 DWORD dwFileAttributes; 40 FILETIME ftCreationTime; 41 FILETIME ftLastAccessTime; 42 FILETIME ftLastWriteTime; 43 DWORD dwVolumeSerialNumber; 44 DWORD nFileSizeHigh; 45 DWORD nFileSizeLow; 46 DWORD nNumberOfLinks; 47 DWORD nFileIndexHigh; 48 DWORD nFileIndexLow; 49 } BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION, 50 *LPBY_HANDLE_FILE_INFORMATION; 51 52 WINBASEAPI HANDLE WINAPI CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); 53 WINBASEAPI WINBOOL WINAPI DefineDosDeviceW (DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath); 54 WINBASEAPI WINBOOL WINAPI FindCloseChangeNotification (HANDLE hChangeHandle); 55 WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationA (LPCSTR lpPathName, WINBOOL bWatchSubtree, DWORD dwNotifyFilter); 56 WINBASEAPI HANDLE WINAPI FindFirstChangeNotificationW (LPCWSTR lpPathName, WINBOOL bWatchSubtree, DWORD dwNotifyFilter); 57 WINBASEAPI HANDLE WINAPI FindFirstVolumeW (LPWSTR lpszVolumeName, DWORD cchBufferLength); 58 WINBASEAPI WINBOOL WINAPI FindNextChangeNotification (HANDLE hChangeHandle); 59 WINBASEAPI WINBOOL WINAPI FindNextVolumeW (HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength); 60 WINBASEAPI WINBOOL WINAPI FindVolumeClose (HANDLE hFindVolume); 61 WINBASEAPI WINBOOL WINAPI GetFileInformationByHandle (HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation); 62 #endif 63 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || _WIN32_WINNT >= _WIN32_WINNT_WIN10 64 WINBASEAPI LONG WINAPI CompareFileTime (CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2); 65 WINBASEAPI WINBOOL WINAPI DeleteVolumeMountPointW (LPCWSTR lpszVolumeMountPoint); 66 WINBASEAPI WINBOOL WINAPI FileTimeToLocalFileTime (CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime); 67 WINBASEAPI HANDLE WINAPI FindFirstFileA (LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData); 68 WINBASEAPI HANDLE WINAPI FindFirstFileW (LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData); 69 WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceA (LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters); 70 WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceW (LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters); 71 WINBASEAPI UINT WINAPI GetDriveTypeA (LPCSTR lpRootPathName); 72 WINBASEAPI UINT WINAPI GetDriveTypeW (LPCWSTR lpRootPathName); 73 WINBASEAPI DWORD WINAPI GetFileAttributesA (LPCSTR lpFileName); 74 WINBASEAPI WINBOOL WINAPI GetFileSizeEx (HANDLE hFile, PLARGE_INTEGER lpFileSize); 75 WINBASEAPI WINBOOL WINAPI GetFileTime (HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime); 76 WINBASEAPI DWORD WINAPI GetFileType (HANDLE hFile); 77 WINBASEAPI DWORD WINAPI GetFullPathNameA (LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR *lpFilePart); 78 WINBASEAPI DWORD WINAPI GetFullPathNameW (LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart); 79 WINBASEAPI DWORD WINAPI GetLogicalDrives (VOID); 80 #endif 81 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) 82 WINBASEAPI DWORD WINAPI GetLogicalDriveStringsW (DWORD nBufferLength, LPWSTR lpBuffer); 83 WINBASEAPI DWORD WINAPI GetLongPathNameA (LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer); 84 WINBASEAPI DWORD WINAPI GetLongPathNameW (LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer); 85 WINBASEAPI DWORD WINAPI GetShortPathNameW (LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer); 86 WINBASEAPI UINT WINAPI GetTempFileNameA (LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName); 87 WINBASEAPI UINT WINAPI GetTempFileNameW (LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName); 88 WINBASEAPI WINBOOL WINAPI GetVolumeInformationW (LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize); 89 WINBASEAPI WINBOOL WINAPI GetVolumePathNameW (LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength); 90 WINBASEAPI WINBOOL WINAPI LocalFileTimeToFileTime (CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime); 91 WINBASEAPI WINBOOL WINAPI LockFile (HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh); 92 WINBASEAPI DWORD WINAPI QueryDosDeviceW (LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax); 93 WINBASEAPI WINBOOL WINAPI ReadFileEx (HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); 94 WINBASEAPI WINBOOL WINAPI ReadFileScatter (HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped); 95 WINBASEAPI WINBOOL WINAPI SetFileTime (HANDLE hFile, CONST FILETIME *lpCreationTime, CONST FILETIME *lpLastAccessTime, CONST FILETIME *lpLastWriteTime); 96 WINBASEAPI WINBOOL WINAPI SetFileValidData (HANDLE hFile, LONGLONG ValidDataLength); 97 WINBASEAPI WINBOOL WINAPI UnlockFile (HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh); 98 WINBASEAPI WINBOOL WINAPI WriteFileEx (HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine); 99 WINBASEAPI WINBOOL WINAPI WriteFileGather (HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped); 100 WINBASEAPI WINBOOL WINAPI GetVolumeNameForVolumeMountPointW (LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength); 101 WINBASEAPI WINBOOL WINAPI GetVolumePathNamesForVolumeNameW (LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength); 102 WINBASEAPI DWORD WINAPI GetTempPathA (DWORD nBufferLength, LPSTR lpBuffer); 103 WINBASEAPI DWORD WINAPI GetTempPathW (DWORD nBufferLength, LPWSTR lpBuffer); 104 105 #ifdef UNICODE 106 #define DefineDosDevice DefineDosDeviceW 107 #define DeleteVolumeMountPoint DeleteVolumeMountPointW 108 #define FindFirstVolume FindFirstVolumeW 109 #define FindNextVolume FindNextVolumeW 110 #define GetLogicalDriveStrings GetLogicalDriveStringsW 111 #define GetShortPathName GetShortPathNameW 112 #define GetVolumeInformation GetVolumeInformationW 113 #define GetVolumePathName GetVolumePathNameW 114 #define QueryDosDevice QueryDosDeviceW 115 #define GetVolumeNameForVolumeMountPoint GetVolumeNameForVolumeMountPointW 116 #define GetVolumePathNamesForVolumeName GetVolumePathNamesForVolumeNameW 117 #endif 118 #define FindFirstChangeNotification __MINGW_NAME_AW(FindFirstChangeNotification) 119 #define FindFirstFile __MINGW_NAME_AW(FindFirstFile) 120 #define GetDiskFreeSpace __MINGW_NAME_AW(GetDiskFreeSpace) 121 #define GetDriveType __MINGW_NAME_AW(GetDriveType) 122 #define GetFullPathName __MINGW_NAME_AW(GetFullPathName) 123 #define GetLongPathName __MINGW_NAME_AW(GetLongPathName) 124 #define GetTempPath __MINGW_NAME_AW(GetTempPath) 125 #define GetTempFileName __MINGW_NAME_AW(GetTempFileName) 126 127 128 #if _WIN32_WINNT >= 0x0600 129 WINBASEAPI DWORD WINAPI GetFinalPathNameByHandleA (HANDLE hFile, LPSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags); 130 WINBASEAPI DWORD WINAPI GetFinalPathNameByHandleW (HANDLE hFile, LPWSTR lpszFilePath, DWORD cchFilePath, DWORD dwFlags); 131 WINBASEAPI WINBOOL WINAPI GetVolumeInformationByHandleW (HANDLE hFile, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize); 132 133 #define GetFinalPathNameByHandle __MINGW_NAME_AW(GetFinalPathNameByHandle) 134 #endif 135 #endif 136 137 #if WINAPI_FAMILY_PARTITION (WINAPI_FAMILY_DESKTOP_APP) 138 typedef struct _WIN32_FILE_ATTRIBUTE_DATA { 139 DWORD dwFileAttributes; 140 FILETIME ftCreationTime; 141 FILETIME ftLastAccessTime; 142 FILETIME ftLastWriteTime; 143 DWORD nFileSizeHigh; 144 DWORD nFileSizeLow; 145 } WIN32_FILE_ATTRIBUTE_DATA, *LPWIN32_FILE_ATTRIBUTE_DATA; 146 147 #if _WIN32_WINNT >= 0x0602 148 typedef struct _CREATEFILE2_EXTENDED_PARAMETERS { 149 DWORD dwSize; 150 DWORD dwFileAttributes; 151 DWORD dwFileFlags; 152 DWORD dwSecurityQosFlags; 153 LPSECURITY_ATTRIBUTES lpSecurityAttributes; 154 HANDLE hTemplateFile; 155 } CREATEFILE2_EXTENDED_PARAMETERS, *PCREATEFILE2_EXTENDED_PARAMETERS, 156 *LPCREATEFILE2_EXTENDED_PARAMETERS; 157 #endif 158 159 WINBASEAPI WINBOOL WINAPI CreateDirectoryA (LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes); 160 WINBASEAPI WINBOOL WINAPI CreateDirectoryW (LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes); 161 WINBASEAPI WINBOOL WINAPI DeleteFileA (LPCSTR lpFileName); 162 WINBASEAPI WINBOOL WINAPI DeleteFileW (LPCWSTR lpFileName); 163 WINBASEAPI WINBOOL WINAPI FindClose (HANDLE hFindFile); 164 WINBASEAPI HANDLE WINAPI FindFirstFileExA (LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags); 165 WINBASEAPI HANDLE WINAPI FindFirstFileExW (LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags); 166 WINBASEAPI WINBOOL WINAPI FindNextFileA (HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData); 167 WINBASEAPI WINBOOL WINAPI FindNextFileW (HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData); 168 WINBASEAPI WINBOOL WINAPI FlushFileBuffers (HANDLE hFile); 169 WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExA (LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes); 170 WINBASEAPI WINBOOL WINAPI GetDiskFreeSpaceExW (LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes); 171 WINBASEAPI DWORD WINAPI GetFileType (HANDLE hFile); 172 WINBASEAPI WINBOOL WINAPI GetFileAttributesExA (LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation); 173 WINBASEAPI WINBOOL WINAPI GetFileAttributesExW (LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation); 174 WINBASEAPI WINBOOL WINAPI LockFileEx (HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped); 175 WINBASEAPI WINBOOL WINAPI ReadFile (HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); 176 WINBASEAPI WINBOOL WINAPI RemoveDirectoryA (LPCSTR lpPathName); 177 WINBASEAPI WINBOOL WINAPI RemoveDirectoryW (LPCWSTR lpPathName); 178 WINBASEAPI WINBOOL WINAPI SetEndOfFile (HANDLE hFile); 179 WINBASEAPI WINBOOL WINAPI SetFileAttributesA (LPCSTR lpFileName, DWORD dwFileAttributes); 180 WINBASEAPI WINBOOL WINAPI SetFileAttributesW (LPCWSTR lpFileName, DWORD dwFileAttributes); 181 WINBASEAPI WINBOOL WINAPI SetFilePointerEx (HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod); 182 WINBASEAPI WINBOOL WINAPI UnlockFileEx (HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped); 183 WINBASEAPI WINBOOL WINAPI WriteFile (HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped); 184 185 #define CreateDirectory __MINGW_NAME_AW(CreateDirectory) 186 #define DeleteFile __MINGW_NAME_AW(DeleteFile) 187 #define FindFirstFileEx __MINGW_NAME_AW(FindFirstFileEx) 188 #define FindNextFile __MINGW_NAME_AW(FindNextFile) 189 #define GetDiskFreeSpaceEx __MINGW_NAME_AW(GetDiskFreeSpaceEx) 190 #define GetFileAttributesEx __MINGW_NAME_AW(GetFileAttributesEx) 191 #define RemoveDirectory __MINGW_NAME_AW(RemoveDirectory) 192 #define SetFileAttributes __MINGW_NAME_AW(SetFileAttributes) 193 194 #if _WIN32_WINNT >= 0x0600 195 WINBASEAPI WINBOOL WINAPI SetFileInformationByHandle (HANDLE hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, LPVOID lpFileInformation, DWORD dwBufferSize); 196 #endif 197 #if _WIN32_WINNT >= 0x0602 198 WINBASEAPI HANDLE WINAPI CreateFile2 (LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwCreationDisposition, LPCREATEFILE2_EXTENDED_PARAMETERS pCreateExParams); 199 #endif 200 #endif 201 202 #ifdef __cplusplus 203 } 204 #endif 205 #endif 206