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