1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! ApiSet Contract for api-ms-win-core-file-l1
7 use shared::minwindef::{
8     BOOL, DWORD, FILETIME, LPCVOID, LPDWORD, LPFILETIME, LPVOID, PDWORD, PUCHAR, UCHAR, UINT,
9     ULONG, WORD,
10 };
11 use um::minwinbase::{
12     FILE_INFO_BY_HANDLE_CLASS, FINDEX_INFO_LEVELS, FINDEX_SEARCH_OPS, GET_FILEEX_INFO_LEVELS,
13     LPOVERLAPPED, LPOVERLAPPED_COMPLETION_ROUTINE, LPSECURITY_ATTRIBUTES, LPWIN32_FIND_DATAA,
14     LPWIN32_FIND_DATAW
15 };
16 use um::winnt::{
17     BOOLEAN, CCHAR, FILE_ID_128, FILE_SEGMENT_ELEMENT, HANDLE, LARGE_INTEGER, LONG, LONGLONG,
18     LPCSTR, LPCWSTR, LPSTR, LPWCH, LPWSTR, PLARGE_INTEGER, PLONG, PULARGE_INTEGER, PWSTR,
19     ULONGLONG, WCHAR,
20 };
21 pub const CREATE_NEW: DWORD = 1;
22 pub const CREATE_ALWAYS: DWORD = 2;
23 pub const OPEN_EXISTING: DWORD = 3;
24 pub const OPEN_ALWAYS: DWORD = 4;
25 pub const TRUNCATE_EXISTING: DWORD = 5;
26 pub const INVALID_FILE_SIZE: DWORD = 0xFFFFFFFF;
27 pub const INVALID_SET_FILE_POINTER: DWORD = 0xFFFFFFFF;
28 pub const INVALID_FILE_ATTRIBUTES: DWORD = 0xFFFFFFFF;
29 STRUCT!{struct WIN32_FILE_ATTRIBUTE_DATA {
30     dwFileAttributes: DWORD,
31     ftCreationTime: FILETIME,
32     ftLastAccessTime: FILETIME,
33     ftLastWriteTime: FILETIME,
34     nFileSizeHigh: DWORD,
35     nFileSizeLow: DWORD,
36 }}
37 pub type LPWIN32_FILE_ATTRIBUTE_DATA = *mut WIN32_FILE_ATTRIBUTE_DATA;
38 STRUCT!{struct BY_HANDLE_FILE_INFORMATION {
39     dwFileAttributes: DWORD,
40     ftCreationTime: FILETIME,
41     ftLastAccessTime: FILETIME,
42     ftLastWriteTime: FILETIME,
43     dwVolumeSerialNumber: DWORD,
44     nFileSizeHigh: DWORD,
45     nFileSizeLow: DWORD,
46     nNumberOfLinks: DWORD,
47     nFileIndexHigh: DWORD,
48     nFileIndexLow: DWORD,
49 }}
50 pub type PBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION;
51 pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION;
52 STRUCT!{struct CREATEFILE2_EXTENDED_PARAMETERS {
53     dwSize: DWORD,
54     dwFileAttributes: DWORD,
55     dwFileFlags: DWORD,
56     dwSecurityQosFlags: DWORD,
57     lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
58     hTemplateFile: HANDLE,
59 }}
60 pub type PCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS;
61 pub type LPCREATEFILE2_EXTENDED_PARAMETERS = *mut CREATEFILE2_EXTENDED_PARAMETERS;
62 ENUM!{enum PRIORITY_HINT {
63     IoPriorityHintVeryLow = 0,
64     IoPriorityHintLow = 1,
65     IoPriorityHintNormal = 2,
66     MaximumIoPriorityHintType = 3,
67 }}
68 STRUCT!{struct FILE_BASIC_INFO {
69     CreationTime: LARGE_INTEGER,
70     LastAccessTime: LARGE_INTEGER,
71     LastWriteTime: LARGE_INTEGER,
72     ChangeTime: LARGE_INTEGER,
73     FileAttributes: DWORD,
74 }}
75 STRUCT!{struct FILE_STANDARD_INFO {
76     AllocationSize: LARGE_INTEGER,
77     EndOfFile: LARGE_INTEGER,
78     NumberOfLinks: DWORD,
79     DeletePending: BOOLEAN,
80     Directory: BOOLEAN,
81 }}
82 STRUCT!{struct FILE_NAME_INFO {
83     FileNameLength: DWORD,
84     FileName: [WCHAR; 1],
85 }}
86 STRUCT!{struct FILE_RENAME_INFO {
87     ReplaceIfExists: BOOL,
88     RootDirectory: HANDLE,
89     FileNameLength: DWORD,
90     FileName: [WCHAR; 1],
91 }}
92 STRUCT!{struct FILE_DISPOSITION_INFO {
93     DeleteFile: BOOLEAN,
94 }}
95 STRUCT!{struct FILE_ALLOCATION_INFO {
96     AllocationSize: LARGE_INTEGER,
97 }}
98 STRUCT!{struct FILE_END_OF_FILE_INFO {
99     EndOfFile: LARGE_INTEGER,
100 }}
101 STRUCT!{struct FILE_STREAM_INFO {
102     NextEntryOffset: DWORD,
103     StreamNameLength: DWORD,
104     StreamSize: LARGE_INTEGER,
105     StreamAllocationSize: LARGE_INTEGER,
106     StreamName: [WCHAR; 1],
107 }}
108 STRUCT!{struct FILE_COMPRESSION_INFO {
109     CompressedFileSize: LARGE_INTEGER,
110     CompressionFormat: WORD,
111     CompressionUnitShift: UCHAR,
112     ChunkShift: UCHAR,
113     ClusterShift: UCHAR,
114     Reserved: [UCHAR; 3],
115 }}
116 STRUCT!{struct FILE_ATTRIBUTE_TAG_INFO {
117     NextEntryOffset: DWORD,
118     ReparseTag: DWORD,
119 }}
120 STRUCT!{struct FILE_ID_BOTH_DIR_INFO {
121     NextEntryOffset: DWORD,
122     FileIndex: DWORD,
123     CreationTime: LARGE_INTEGER,
124     LastAccessTime: LARGE_INTEGER,
125     LastWriteTime: LARGE_INTEGER,
126     ChangeTime: LARGE_INTEGER,
127     EndOfFile: LARGE_INTEGER,
128     AllocationSize: LARGE_INTEGER,
129     FileAttributes: DWORD,
130     FileNameLength: DWORD,
131     EaSize: DWORD,
132     ShortNameLength: CCHAR,
133     ShortName: [WCHAR; 12],
134     FileId: LARGE_INTEGER,
135     FileName: [WCHAR; 1],
136 }}
137 STRUCT!{struct FILE_IO_PRIORITY_HINT_INFO {
138     PriorityHint: PRIORITY_HINT,
139 }}
140 STRUCT!{struct FILE_FULL_DIR_INFO {
141     NextEntryOffset: ULONG,
142     FileIndex: ULONG,
143     CreationTime: LARGE_INTEGER,
144     LastAccessTime: LARGE_INTEGER,
145     LastWriteTime: LARGE_INTEGER,
146     ChangeTime: LARGE_INTEGER,
147     EndOfFile: LARGE_INTEGER,
148     AllocationSize: LARGE_INTEGER,
149     FileAttributes: ULONG,
150     FileNameLength: ULONG,
151     EaSize: ULONG,
152     FileName: [WCHAR; 1],
153 }}
154 STRUCT!{struct FILE_STORAGE_INFO {
155     LogicalBytesPerSector: ULONG,
156     PhysicalBytesPerSectorForAtomicity: ULONG,
157     PhysicalBytesPerSectorForPerformance: ULONG,
158     FileSystemEffectivePhysicalBytesPerSectorForAtomicity: ULONG,
159     Flags: ULONG,
160     ByteOffsetForSectorAlignment: ULONG,
161     ByteOffsetForPartitionAlignment: ULONG,
162 }}
163 STRUCT!{struct FILE_ALIGNMENT_INFO {
164     AlignmentRequirement: ULONG,
165 }}
166 STRUCT!{struct FILE_ID_INFO {
167     VolumeSerialNumber: ULONGLONG,
168     FileId: FILE_ID_128,
169 }}
170 extern "system" {
CompareFileTime( lpFileTime1: *const FILETIME, lpFileTime2: *const FILETIME, ) -> LONG171     pub fn CompareFileTime(
172         lpFileTime1: *const FILETIME,
173         lpFileTime2: *const FILETIME,
174     ) -> LONG;
CreateDirectoryA( lpPathName: LPCSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, ) -> BOOL175     pub fn CreateDirectoryA(
176         lpPathName: LPCSTR,
177         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
178     ) -> BOOL;
CreateDirectoryW( lpPathName: LPCWSTR, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, ) -> BOOL179     pub fn CreateDirectoryW(
180         lpPathName: LPCWSTR,
181         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
182     ) -> BOOL;
CreateFileA( lpFileName: LPCSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, ) -> HANDLE183     pub fn CreateFileA(
184         lpFileName: LPCSTR,
185         dwDesiredAccess: DWORD,
186         dwShareMode: DWORD,
187         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
188         dwCreationDisposition: DWORD,
189         dwFlagsAndAttributes: DWORD,
190         hTemplateFile: HANDLE,
191     ) -> HANDLE;
CreateFileW( lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, lpSecurityAttributes: LPSECURITY_ATTRIBUTES, dwCreationDisposition: DWORD, dwFlagsAndAttributes: DWORD, hTemplateFile: HANDLE, ) -> HANDLE192     pub fn CreateFileW(
193         lpFileName: LPCWSTR,
194         dwDesiredAccess: DWORD,
195         dwShareMode: DWORD,
196         lpSecurityAttributes: LPSECURITY_ATTRIBUTES,
197         dwCreationDisposition: DWORD,
198         dwFlagsAndAttributes: DWORD,
199         hTemplateFile: HANDLE,
200     ) -> HANDLE;
DefineDosDeviceW( dwFlags: DWORD, lpDeviceName: LPCWSTR, lpTargetPath: LPCWSTR, ) -> BOOL201     pub fn DefineDosDeviceW(
202         dwFlags: DWORD,
203         lpDeviceName: LPCWSTR,
204         lpTargetPath: LPCWSTR,
205     ) -> BOOL;
DeleteFileA( lpFileName: LPCSTR, ) -> BOOL206     pub fn DeleteFileA(
207         lpFileName: LPCSTR,
208     ) -> BOOL;
DeleteFileW( lpFileName: LPCWSTR, ) -> BOOL209     pub fn DeleteFileW(
210         lpFileName: LPCWSTR,
211     ) -> BOOL;
DeleteVolumeMountPointW( lpszVolumeMountPoint: LPCWSTR, ) -> BOOL212     pub fn DeleteVolumeMountPointW(
213         lpszVolumeMountPoint: LPCWSTR,
214     ) -> BOOL;
FileTimeToLocalFileTime( lpFileTime: *const FILETIME, lpLocalFileTime: LPFILETIME, ) -> BOOL215     pub fn FileTimeToLocalFileTime(
216         lpFileTime: *const FILETIME,
217         lpLocalFileTime: LPFILETIME,
218     ) -> BOOL;
FindClose( hFindFile: HANDLE, ) -> BOOL219     pub fn FindClose(
220         hFindFile: HANDLE,
221     ) -> BOOL;
FindCloseChangeNotification( hChangeHandle: HANDLE, ) -> BOOL222     pub fn FindCloseChangeNotification(
223         hChangeHandle: HANDLE,
224     ) -> BOOL;
FindFirstChangeNotificationA( lpPathName: LPCSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, ) -> HANDLE225     pub fn FindFirstChangeNotificationA(
226         lpPathName: LPCSTR,
227         bWatchSubtree: BOOL,
228         dwNotifyFilter: DWORD,
229     ) -> HANDLE;
FindFirstChangeNotificationW( lpPathName: LPCWSTR, bWatchSubtree: BOOL, dwNotifyFilter: DWORD, ) -> HANDLE230     pub fn FindFirstChangeNotificationW(
231         lpPathName: LPCWSTR,
232         bWatchSubtree: BOOL,
233         dwNotifyFilter: DWORD,
234     ) -> HANDLE;
FindFirstFileA( lpFileName: LPCSTR, lpFindFileData: LPWIN32_FIND_DATAA, ) -> HANDLE235     pub fn FindFirstFileA(
236         lpFileName: LPCSTR,
237         lpFindFileData: LPWIN32_FIND_DATAA,
238     ) -> HANDLE;
FindFirstFileW( lpFileName: LPCWSTR, lpFindFileData: LPWIN32_FIND_DATAW, ) -> HANDLE239     pub fn FindFirstFileW(
240         lpFileName: LPCWSTR,
241         lpFindFileData: LPWIN32_FIND_DATAW,
242     ) -> HANDLE;
FindFirstFileExA( lpFileName: LPCSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, ) -> HANDLE243     pub fn FindFirstFileExA(
244         lpFileName: LPCSTR,
245         fInfoLevelId: FINDEX_INFO_LEVELS,
246         lpFindFileData: LPVOID,
247         fSearchOp: FINDEX_SEARCH_OPS,
248         lpSearchFilter: LPVOID,
249         dwAdditionalFlags: DWORD,
250     ) -> HANDLE;
FindFirstFileExW( lpFileName: LPCWSTR, fInfoLevelId: FINDEX_INFO_LEVELS, lpFindFileData: LPVOID, fSearchOp: FINDEX_SEARCH_OPS, lpSearchFilter: LPVOID, dwAdditionalFlags: DWORD, ) -> HANDLE251     pub fn FindFirstFileExW(
252         lpFileName: LPCWSTR,
253         fInfoLevelId: FINDEX_INFO_LEVELS,
254         lpFindFileData: LPVOID,
255         fSearchOp: FINDEX_SEARCH_OPS,
256         lpSearchFilter: LPVOID,
257         dwAdditionalFlags: DWORD,
258     ) -> HANDLE;
FindFirstVolumeW( lpszVolumeName: LPWSTR, cchBufferLength: DWORD, ) -> HANDLE259     pub fn FindFirstVolumeW(
260         lpszVolumeName: LPWSTR,
261         cchBufferLength: DWORD,
262     ) -> HANDLE;
FindNextChangeNotification( hChangeHandle: HANDLE, ) -> BOOL263     pub fn FindNextChangeNotification(
264         hChangeHandle: HANDLE,
265     ) -> BOOL;
FindNextFileA( hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAA, ) -> BOOL266     pub fn FindNextFileA(
267         hFindFile: HANDLE,
268         lpFindFileData: LPWIN32_FIND_DATAA,
269     ) -> BOOL;
FindNextFileW( hFindFile: HANDLE, lpFindFileData: LPWIN32_FIND_DATAW, ) -> BOOL270     pub fn FindNextFileW(
271         hFindFile: HANDLE,
272         lpFindFileData: LPWIN32_FIND_DATAW,
273     ) -> BOOL;
FindNextVolumeW( hFindVolume: HANDLE, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, ) -> BOOL274     pub fn FindNextVolumeW(
275         hFindVolume: HANDLE,
276         lpszVolumeName: LPWSTR,
277         cchBufferLength: DWORD,
278     ) -> BOOL;
FindVolumeClose( hFindVolume: HANDLE, ) -> BOOL279     pub fn FindVolumeClose(
280         hFindVolume: HANDLE,
281     ) -> BOOL;
FlushFileBuffers( hFile: HANDLE, ) -> BOOL282     pub fn FlushFileBuffers(
283         hFile: HANDLE,
284     ) -> BOOL;
GetDiskFreeSpaceA( lpRootPathName: LPCSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, ) -> BOOL285     pub fn GetDiskFreeSpaceA(
286         lpRootPathName: LPCSTR,
287         lpSectorsPerCluster: LPDWORD,
288         lpBytesPerSector: LPDWORD,
289         lpNumberOfFreeClusters: LPDWORD,
290         lpTotalNumberOfClusters: LPDWORD,
291     ) -> BOOL;
GetDiskFreeSpaceW( lpRootPathName: LPCWSTR, lpSectorsPerCluster: LPDWORD, lpBytesPerSector: LPDWORD, lpNumberOfFreeClusters: LPDWORD, lpTotalNumberOfClusters: LPDWORD, ) -> BOOL292     pub fn GetDiskFreeSpaceW(
293         lpRootPathName: LPCWSTR,
294         lpSectorsPerCluster: LPDWORD,
295         lpBytesPerSector: LPDWORD,
296         lpNumberOfFreeClusters: LPDWORD,
297         lpTotalNumberOfClusters: LPDWORD,
298     ) -> BOOL;
GetDiskFreeSpaceExA( lpDirectoryName: LPCSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, ) -> BOOL299     pub fn GetDiskFreeSpaceExA(
300         lpDirectoryName: LPCSTR,
301         lpFreeBytesAvailableToCaller: PULARGE_INTEGER,
302         lpTotalNumberOfBytes: PULARGE_INTEGER,
303         lpTotalNumberOfFreeBytes: PULARGE_INTEGER,
304     ) -> BOOL;
GetDiskFreeSpaceExW( lpDirectoryName: LPCWSTR, lpFreeBytesAvailableToCaller: PULARGE_INTEGER, lpTotalNumberOfBytes: PULARGE_INTEGER, lpTotalNumberOfFreeBytes: PULARGE_INTEGER, ) -> BOOL305     pub fn GetDiskFreeSpaceExW(
306         lpDirectoryName: LPCWSTR,
307         lpFreeBytesAvailableToCaller: PULARGE_INTEGER,
308         lpTotalNumberOfBytes: PULARGE_INTEGER,
309         lpTotalNumberOfFreeBytes: PULARGE_INTEGER,
310     ) -> BOOL;
GetDriveTypeA( lpRootPathName: LPCSTR, ) -> UINT311     pub fn GetDriveTypeA(
312         lpRootPathName: LPCSTR,
313     ) -> UINT;
GetDriveTypeW( lpRootPathName: LPCWSTR, ) -> UINT314     pub fn GetDriveTypeW(
315         lpRootPathName: LPCWSTR,
316     ) -> UINT;
GetFileAttributesA( lpFileName: LPCSTR, ) -> DWORD317     pub fn GetFileAttributesA(
318         lpFileName: LPCSTR,
319     ) -> DWORD;
GetFileAttributesW( lpFileName: LPCWSTR, ) -> DWORD320     pub fn GetFileAttributesW(
321         lpFileName: LPCWSTR,
322     ) -> DWORD;
GetFileAttributesExA( lpFileName: LPCSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, ) -> BOOL323     pub fn GetFileAttributesExA(
324         lpFileName: LPCSTR,
325         fInfoLevelId: GET_FILEEX_INFO_LEVELS,
326         lpFileInformation: LPVOID,
327     ) -> BOOL;
GetFileAttributesExW( lpFileName: LPCWSTR, fInfoLevelId: GET_FILEEX_INFO_LEVELS, lpFileInformation: LPVOID, ) -> BOOL328     pub fn GetFileAttributesExW(
329         lpFileName: LPCWSTR,
330         fInfoLevelId: GET_FILEEX_INFO_LEVELS,
331         lpFileInformation: LPVOID,
332     ) -> BOOL;
GetFileInformationByHandle( hFile: HANDLE, lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, ) -> BOOL333     pub fn GetFileInformationByHandle(
334         hFile: HANDLE,
335         lpFileInformation: LPBY_HANDLE_FILE_INFORMATION,
336     ) -> BOOL;
GetFileSize( hFile: HANDLE, lpFileSizeHigh: LPDWORD, ) -> DWORD337     pub fn GetFileSize(
338         hFile: HANDLE,
339         lpFileSizeHigh: LPDWORD,
340     ) -> DWORD;
GetFileSizeEx( hFile: HANDLE, lpFileSize: PLARGE_INTEGER, ) -> BOOL341     pub fn GetFileSizeEx(
342         hFile: HANDLE,
343         lpFileSize: PLARGE_INTEGER,
344     ) -> BOOL;
GetFileType( hFile: HANDLE, ) -> DWORD345     pub fn GetFileType(
346         hFile: HANDLE,
347     ) -> DWORD;
GetFinalPathNameByHandleA( hFile: HANDLE, lpszFilePath: LPSTR, cchFilePath: DWORD, dwFlags: DWORD, ) -> DWORD348     pub fn GetFinalPathNameByHandleA(
349         hFile: HANDLE,
350         lpszFilePath: LPSTR,
351         cchFilePath: DWORD,
352         dwFlags: DWORD,
353     ) -> DWORD;
GetFinalPathNameByHandleW( hFile: HANDLE, lpszFilePath: LPWSTR, cchFilePath: DWORD, dwFlags: DWORD, ) -> DWORD354     pub fn GetFinalPathNameByHandleW(
355         hFile: HANDLE,
356         lpszFilePath: LPWSTR,
357         cchFilePath: DWORD,
358         dwFlags: DWORD,
359     ) -> DWORD;
GetFileTime( hFile: HANDLE, lpCreationTime: LPFILETIME, lpLastAccessTime: LPFILETIME, lpLastWriteTime: LPFILETIME, ) -> BOOL360     pub fn GetFileTime(
361         hFile: HANDLE,
362         lpCreationTime: LPFILETIME,
363         lpLastAccessTime: LPFILETIME,
364         lpLastWriteTime: LPFILETIME,
365     ) -> BOOL;
GetFullPathNameW( lpFileName: LPCWSTR, nBufferLength: DWORD, lpBuffer: LPWSTR, lpFilePart: *mut LPWSTR, ) -> DWORD366     pub fn GetFullPathNameW(
367         lpFileName: LPCWSTR,
368         nBufferLength: DWORD,
369         lpBuffer: LPWSTR,
370         lpFilePart: *mut LPWSTR,
371     ) -> DWORD;
GetFullPathNameA( lpFileName: LPCSTR, nBufferLength: DWORD, lpBuffer: LPSTR, lpFilePart: *mut LPSTR, ) -> DWORD372     pub fn GetFullPathNameA(
373         lpFileName: LPCSTR,
374         nBufferLength: DWORD,
375         lpBuffer: LPSTR,
376         lpFilePart: *mut LPSTR,
377     ) -> DWORD;
GetLogicalDrives() -> DWORD378     pub fn GetLogicalDrives() -> DWORD;
GetLogicalDriveStringsW( nBufferLength: DWORD, lpBuffer: LPWSTR, ) -> DWORD379     pub fn GetLogicalDriveStringsW(
380         nBufferLength: DWORD,
381         lpBuffer: LPWSTR,
382     ) -> DWORD;
GetLongPathNameA( lpszShortPath: LPCSTR, lpszLongPath: LPSTR, cchBuffer: DWORD, ) -> DWORD383     pub fn GetLongPathNameA(
384         lpszShortPath: LPCSTR,
385         lpszLongPath: LPSTR,
386         cchBuffer: DWORD,
387     ) -> DWORD;
GetLongPathNameW( lpszShortPath: LPCWSTR, lpszLongPath: LPWSTR, cchBuffer: DWORD, ) -> DWORD388     pub fn GetLongPathNameW(
389         lpszShortPath: LPCWSTR,
390         lpszLongPath: LPWSTR,
391         cchBuffer: DWORD,
392     ) -> DWORD;
GetShortPathNameW( lpszLongPath: LPCWSTR, lpszShortPath: LPWSTR, cchBuffer: DWORD, ) -> DWORD393     pub fn GetShortPathNameW(
394         lpszLongPath: LPCWSTR,
395         lpszShortPath: LPWSTR,
396         cchBuffer: DWORD,
397     ) -> DWORD;
GetTempFileNameW( lpPathName: LPCWSTR, lpPrefixString: LPCWSTR, uUnique: UINT, lpTempFileName: LPWSTR, ) -> UINT398     pub fn GetTempFileNameW(
399         lpPathName: LPCWSTR,
400         lpPrefixString: LPCWSTR,
401         uUnique: UINT,
402         lpTempFileName: LPWSTR,
403     ) -> UINT;
GetVolumeInformationByHandleW( hFile: HANDLE, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, ) -> BOOL404     pub fn GetVolumeInformationByHandleW(
405         hFile: HANDLE,
406         lpVolumeNameBuffer: LPWSTR,
407         nVolumeNameSize: DWORD,
408         lpVolumeSerialNumber: LPDWORD,
409         lpMaximumComponentLength: LPDWORD,
410         lpFileSystemFlags: LPDWORD,
411         lpFileSystemNameBuffer: LPWSTR,
412         nFileSystemNameSize: DWORD,
413     ) -> BOOL;
GetVolumeInformationW( lpRootPathName: LPCWSTR, lpVolumeNameBuffer: LPWSTR, nVolumeNameSize: DWORD, lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPWSTR, nFileSystemNameSize: DWORD, ) -> BOOL414     pub fn GetVolumeInformationW(
415         lpRootPathName: LPCWSTR,
416         lpVolumeNameBuffer: LPWSTR,
417         nVolumeNameSize: DWORD,
418         lpVolumeSerialNumber: LPDWORD,
419         lpMaximumComponentLength: LPDWORD,
420         lpFileSystemFlags: LPDWORD,
421         lpFileSystemNameBuffer: LPWSTR,
422         nFileSystemNameSize: DWORD,
423     ) -> BOOL;
GetVolumePathNameW( lpszFileName: LPCWSTR, lpszVolumePathName: LPWSTR, cchBufferLength: DWORD, ) -> BOOL424     pub fn GetVolumePathNameW(
425         lpszFileName: LPCWSTR,
426         lpszVolumePathName: LPWSTR,
427         cchBufferLength: DWORD,
428     ) -> BOOL;
LocalFileTimeToFileTime( lpLocalFileTime: *const FILETIME, lpFileTime: LPFILETIME, ) -> BOOL429     pub fn LocalFileTimeToFileTime(
430         lpLocalFileTime: *const FILETIME,
431         lpFileTime: LPFILETIME,
432     ) -> BOOL;
LockFile( hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, nNumberOfBytesToLockLow: DWORD, nNumberOfBytesToLockHigh: DWORD, ) -> BOOL433     pub fn LockFile(
434         hFile: HANDLE,
435         dwFileOffsetLow: DWORD,
436         dwFileOffsetHigh: DWORD,
437         nNumberOfBytesToLockLow: DWORD,
438         nNumberOfBytesToLockHigh: DWORD,
439     ) -> BOOL;
LockFileEx( hFile: HANDLE, dwFlags: DWORD, dwReserved: DWORD, nNumberOfBytesToLockLow: DWORD, nNumberOfBytesToLockHigh: DWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL440     pub fn LockFileEx(
441         hFile: HANDLE,
442         dwFlags: DWORD,
443         dwReserved: DWORD,
444         nNumberOfBytesToLockLow: DWORD,
445         nNumberOfBytesToLockHigh: DWORD,
446         lpOverlapped: LPOVERLAPPED,
447     ) -> BOOL;
QueryDosDeviceW( lpDeviceName: LPCWSTR, lpTargetPath: LPWSTR, ucchMax: DWORD, ) -> DWORD448     pub fn QueryDosDeviceW(
449         lpDeviceName: LPCWSTR,
450         lpTargetPath: LPWSTR,
451         ucchMax: DWORD,
452     ) -> DWORD;
ReadFile( hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpNumberOfBytesRead: LPDWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL453     pub fn ReadFile(
454         hFile: HANDLE,
455         lpBuffer: LPVOID,
456         nNumberOfBytesToRead: DWORD,
457         lpNumberOfBytesRead: LPDWORD,
458         lpOverlapped: LPOVERLAPPED,
459     ) -> BOOL;
ReadFileEx( hFile: HANDLE, lpBuffer: LPVOID, nNumberOfBytesToRead: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, ) -> BOOL460     pub fn ReadFileEx(
461         hFile: HANDLE,
462         lpBuffer: LPVOID,
463         nNumberOfBytesToRead: DWORD,
464         lpOverlapped: LPOVERLAPPED,
465         lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
466     ) -> BOOL;
ReadFileScatter( hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToRead: DWORD, lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL467     pub fn ReadFileScatter(
468         hFile: HANDLE,
469         aSegmentArray: *mut FILE_SEGMENT_ELEMENT,
470         nNumberOfBytesToRead: DWORD,
471         lpReserved: LPDWORD,
472         lpOverlapped: LPOVERLAPPED,
473     ) -> BOOL;
RemoveDirectoryA( lpPathName: LPCSTR, ) -> BOOL474     pub fn RemoveDirectoryA(
475         lpPathName: LPCSTR,
476     ) -> BOOL;
RemoveDirectoryW( lpPathName: LPCWSTR, ) -> BOOL477     pub fn RemoveDirectoryW(
478         lpPathName: LPCWSTR,
479     ) -> BOOL;
SetEndOfFile( hFile: HANDLE, ) -> BOOL480     pub fn SetEndOfFile(
481         hFile: HANDLE,
482     ) -> BOOL;
SetFileAttributesA( lpFileName: LPCSTR, dwFileAttributes: DWORD, ) -> BOOL483     pub fn SetFileAttributesA(
484         lpFileName: LPCSTR,
485         dwFileAttributes: DWORD,
486     ) -> BOOL;
SetFileAttributesW( lpFileName: LPCWSTR, dwFileAttributes: DWORD, ) -> BOOL487     pub fn SetFileAttributesW(
488         lpFileName: LPCWSTR,
489         dwFileAttributes: DWORD,
490     ) -> BOOL;
SetFileInformationByHandle( hFile: HANDLE, FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, lpFileInformation: LPVOID, dwBufferSize: DWORD, ) -> BOOL491     pub fn SetFileInformationByHandle(
492         hFile: HANDLE,
493         FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
494         lpFileInformation: LPVOID,
495         dwBufferSize: DWORD,
496     ) -> BOOL;
SetFilePointer( hFile: HANDLE, lDistanceToMove: LONG, lpDistanceToMoveHigh: PLONG, dwMoveMethod: DWORD, ) -> DWORD497     pub fn SetFilePointer(
498         hFile: HANDLE,
499         lDistanceToMove: LONG,
500         lpDistanceToMoveHigh: PLONG,
501         dwMoveMethod: DWORD,
502     ) -> DWORD;
SetFilePointerEx( hFile: HANDLE, liDistanceToMove: LARGE_INTEGER, lpNewFilePointer: PLARGE_INTEGER, dwMoveMethod: DWORD, ) -> BOOL503     pub fn SetFilePointerEx(
504         hFile: HANDLE,
505         liDistanceToMove: LARGE_INTEGER,
506         lpNewFilePointer: PLARGE_INTEGER,
507         dwMoveMethod: DWORD,
508     ) -> BOOL;
SetFileTime( hFile: HANDLE, lpCreationTime: *const FILETIME, lpLastAccessTime: *const FILETIME, lpLastWriteTime: *const FILETIME, ) -> BOOL509     pub fn SetFileTime(
510         hFile: HANDLE,
511         lpCreationTime: *const FILETIME,
512         lpLastAccessTime: *const FILETIME,
513         lpLastWriteTime: *const FILETIME,
514     ) -> BOOL;
SetFileValidData( hFile: HANDLE, ValidDataLength: LONGLONG, ) -> BOOL515     pub fn SetFileValidData(
516         hFile: HANDLE,
517         ValidDataLength: LONGLONG,
518     ) -> BOOL;
UnlockFile( hFile: HANDLE, dwFileOffsetLow: DWORD, dwFileOffsetHigh: DWORD, nNumberOfBytesToUnlockLow: DWORD, nNumberOfBytesToUnlockHigh: DWORD, ) -> BOOL519     pub fn UnlockFile(
520         hFile: HANDLE,
521         dwFileOffsetLow: DWORD,
522         dwFileOffsetHigh: DWORD,
523         nNumberOfBytesToUnlockLow: DWORD,
524         nNumberOfBytesToUnlockHigh: DWORD,
525     ) -> BOOL;
UnlockFileEx( hFile: HANDLE, dwReserved: DWORD, nNumberOfBytesToUnlockLow: DWORD, nNumberOfBytesToUnlockHigh: DWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL526     pub fn UnlockFileEx(
527         hFile: HANDLE,
528         dwReserved: DWORD,
529         nNumberOfBytesToUnlockLow: DWORD,
530         nNumberOfBytesToUnlockHigh: DWORD,
531         lpOverlapped: LPOVERLAPPED,
532     ) -> BOOL;
WriteFile( hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, lpNumberOfBytesWritten: LPDWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL533     pub fn WriteFile(
534         hFile: HANDLE,
535         lpBuffer: LPCVOID,
536         nNumberOfBytesToWrite: DWORD,
537         lpNumberOfBytesWritten: LPDWORD,
538         lpOverlapped: LPOVERLAPPED,
539     ) -> BOOL;
WriteFileEx( hFile: HANDLE, lpBuffer: LPCVOID, nNumberOfBytesToWrite: DWORD, lpOverlapped: LPOVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, ) -> BOOL540     pub fn WriteFileEx(
541         hFile: HANDLE,
542         lpBuffer: LPCVOID,
543         nNumberOfBytesToWrite: DWORD,
544         lpOverlapped: LPOVERLAPPED,
545         lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
546     ) -> BOOL;
WriteFileGather( hFile: HANDLE, aSegmentArray: *mut FILE_SEGMENT_ELEMENT, nNumberOfBytesToWrite: DWORD, lpReserved: LPDWORD, lpOverlapped: LPOVERLAPPED, ) -> BOOL547     pub fn WriteFileGather(
548         hFile: HANDLE,
549         aSegmentArray: *mut FILE_SEGMENT_ELEMENT,
550         nNumberOfBytesToWrite: DWORD,
551         lpReserved: LPDWORD,
552         lpOverlapped: LPOVERLAPPED,
553     ) -> BOOL;
GetTempPathW( nBufferLength: DWORD, lpBuffer: LPWSTR, ) -> DWORD554     pub fn GetTempPathW(
555         nBufferLength: DWORD,
556         lpBuffer: LPWSTR,
557     ) -> DWORD;
GetVolumeNameForVolumeMountPointW( lpszVolumeMountPoint: LPCWSTR, lpszVolumeName: LPWSTR, cchBufferLength: DWORD, ) -> BOOL558     pub fn GetVolumeNameForVolumeMountPointW(
559         lpszVolumeMountPoint: LPCWSTR,
560         lpszVolumeName: LPWSTR,
561         cchBufferLength: DWORD,
562     ) -> BOOL;
GetVolumePathNamesForVolumeNameW( lpszVolumeName: LPCWSTR, lpszVolumePathNames: LPWCH, cchBufferLength: DWORD, lpcchReturnLength: PDWORD, ) -> BOOL563     pub fn GetVolumePathNamesForVolumeNameW(
564         lpszVolumeName: LPCWSTR,
565         lpszVolumePathNames: LPWCH,
566         cchBufferLength: DWORD,
567         lpcchReturnLength: PDWORD,
568     ) -> BOOL;
CreateFile2( lpFileName: LPCWSTR, dwDesiredAccess: DWORD, dwShareMode: DWORD, dwCreationDisposition: DWORD, pCreateExParams: LPCREATEFILE2_EXTENDED_PARAMETERS, ) -> HANDLE569     pub fn CreateFile2(
570         lpFileName: LPCWSTR,
571         dwDesiredAccess: DWORD,
572         dwShareMode: DWORD,
573         dwCreationDisposition: DWORD,
574         pCreateExParams: LPCREATEFILE2_EXTENDED_PARAMETERS,
575     ) -> HANDLE;
SetFileIoOverlappedRange( FileHandle: HANDLE, OverlappedRangeStart: PUCHAR, Length: ULONG, ) -> BOOL576     pub fn SetFileIoOverlappedRange(
577         FileHandle: HANDLE,
578         OverlappedRangeStart: PUCHAR,
579         Length: ULONG,
580     ) -> BOOL;
GetCompressedFileSizeA( lpFileName: LPCSTR, lpFileSizeHigh: LPDWORD, ) -> DWORD581     pub fn GetCompressedFileSizeA(
582         lpFileName: LPCSTR,
583         lpFileSizeHigh: LPDWORD,
584     ) -> DWORD;
GetCompressedFileSizeW( lpFileName: LPCWSTR, lpFileSizeHigh: LPDWORD, ) -> DWORD585     pub fn GetCompressedFileSizeW(
586         lpFileName: LPCWSTR,
587         lpFileSizeHigh: LPDWORD,
588     ) -> DWORD;
589 }
590 ENUM!{enum STREAM_INFO_LEVELS {
591     FindStreamInfoStandard,
592     FindStreamInfoMaxInfoLevel,
593 }}
594 extern "system" {
FindFirstStreamW( lpFileName: LPCWSTR, InfoLevel: STREAM_INFO_LEVELS, lpFindStreamData: LPVOID, dwFlags: DWORD, ) -> HANDLE595     pub fn FindFirstStreamW(
596         lpFileName: LPCWSTR,
597         InfoLevel: STREAM_INFO_LEVELS,
598         lpFindStreamData: LPVOID,
599         dwFlags: DWORD,
600     ) -> HANDLE;
FindNextStreamW( hFindStream: HANDLE, lpFindStreamData: LPVOID, ) -> BOOL601     pub fn FindNextStreamW(
602         hFindStream: HANDLE,
603         lpFindStreamData: LPVOID,
604     ) -> BOOL;
AreFileApisANSI() -> BOOL605     pub fn AreFileApisANSI() -> BOOL;
GetTempPathA( nBufferLength: DWORD, lpBuffer: LPSTR, ) -> DWORD606     pub fn GetTempPathA(
607         nBufferLength: DWORD,
608         lpBuffer: LPSTR,
609     ) -> DWORD;
FindFirstFileNameW( lpFileName: LPCWSTR, dwFlags: DWORD, StringLength: LPDWORD, LinkName: PWSTR, ) -> HANDLE610     pub fn FindFirstFileNameW(
611         lpFileName: LPCWSTR,
612         dwFlags: DWORD,
613         StringLength: LPDWORD,
614         LinkName: PWSTR,
615     ) -> HANDLE;
FindNextFileNameW( hFindStream: HANDLE, StringLength: LPDWORD, LinkName: PWSTR, ) -> BOOL616     pub fn FindNextFileNameW(
617         hFindStream: HANDLE,
618         StringLength: LPDWORD,
619         LinkName: PWSTR,
620     ) -> BOOL;
GetVolumeInformationA( lpRootPathName: LPCSTR, lpVolumeNameBuffer: LPSTR, nVolumeNameSize: DWORD, lpVolumeSerialNumber: LPDWORD, lpMaximumComponentLength: LPDWORD, lpFileSystemFlags: LPDWORD, lpFileSystemNameBuffer: LPSTR, nFileSystemNameSize: DWORD, ) -> BOOL621     pub fn GetVolumeInformationA(
622         lpRootPathName: LPCSTR,
623         lpVolumeNameBuffer: LPSTR,
624         nVolumeNameSize: DWORD,
625         lpVolumeSerialNumber: LPDWORD,
626         lpMaximumComponentLength: LPDWORD,
627         lpFileSystemFlags: LPDWORD,
628         lpFileSystemNameBuffer: LPSTR,
629         nFileSystemNameSize: DWORD,
630     ) -> BOOL;
GetTempFileNameA( lpPathName: LPCSTR, lpPrefixString: LPCSTR, uUnique: UINT, lpTempFileName: LPSTR, ) -> UINT631     pub fn GetTempFileNameA(
632         lpPathName: LPCSTR,
633         lpPrefixString: LPCSTR,
634         uUnique: UINT,
635         lpTempFileName: LPSTR,
636     ) -> UINT;
SetFileApisToOEM()637     pub fn SetFileApisToOEM();
SetFileApisToANSI()638     pub fn SetFileApisToANSI();
639 }
640