xref: /reactos/sdk/include/psdk/winioctl.h (revision 2196a06f)
1 #ifndef _WINIOCTL_
2 #define _WINIOCTL_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #ifdef _MSC_VER
9 #pragma warning(push)
10 #pragma warning(disable:4201)
11 #pragma warning(disable:4820)
12 #endif
13 
14 #define HIST_NO_OF_BUCKETS               24
15 #define HISTOGRAM_BUCKET_SIZE            sizeof(HISTOGRAM_BUCKET)
16 #define DISK_HISTOGRAM_SIZE              sizeof(DISK_HISTOGRAM)
17 
18 #ifndef _NTDDSTOR_H_
19 #define IOCTL_STORAGE_BASE               FILE_DEVICE_MASS_STORAGE
20 #define IOCTL_STORAGE_CHECK_VERIFY       CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
21 #define IOCTL_STORAGE_CHECK_VERIFY2      CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
22 #define IOCTL_STORAGE_MEDIA_REMOVAL      CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
23 #define IOCTL_STORAGE_EJECT_MEDIA        CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
24 #define IOCTL_STORAGE_LOAD_MEDIA         CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
25 #define IOCTL_STORAGE_LOAD_MEDIA2        CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
26 #define IOCTL_STORAGE_RESERVE            CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
27 #define IOCTL_STORAGE_RELEASE            CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
28 #define IOCTL_STORAGE_FIND_NEW_DEVICES   CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
29 #define IOCTL_STORAGE_EJECTION_CONTROL   CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
30 #define IOCTL_STORAGE_MCN_CONTROL        CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
31 #define IOCTL_STORAGE_GET_MEDIA_TYPES    CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
32 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
33 #define IOCTL_STORAGE_RESET_BUS          CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_STORAGE_RESET_DEVICE       CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_STORAGE_GET_DEVICE_NUMBER  CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
36 #define IOCTL_STORAGE_PREDICT_FAILURE    CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
37 #endif
38 
39 #define IOCTL_DISK_BASE                  FILE_DEVICE_DISK
40 #define IOCTL_DISK_GET_DRIVE_GEOMETRY    CTL_CODE(IOCTL_DISK_BASE,0,METHOD_BUFFERED, FILE_ANY_ACCESS)
41 #define IOCTL_DISK_GET_PARTITION_INFO    CTL_CODE(IOCTL_DISK_BASE,1,METHOD_BUFFERED,FILE_READ_ACCESS)
42 #define IOCTL_DISK_SET_PARTITION_INFO    CTL_CODE(IOCTL_DISK_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
43 #define IOCTL_DISK_GET_DRIVE_LAYOUT      CTL_CODE(IOCTL_DISK_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS)
44 #define IOCTL_DISK_SET_DRIVE_LAYOUT      CTL_CODE(IOCTL_DISK_BASE,4,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
45 #define IOCTL_DISK_VERIFY                CTL_CODE(IOCTL_DISK_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS)
46 #define IOCTL_DISK_FORMAT_TRACKS         CTL_CODE(IOCTL_DISK_BASE,6,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
47 #define IOCTL_DISK_REASSIGN_BLOCKS       CTL_CODE(IOCTL_DISK_BASE,7,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
48 #define IOCTL_DISK_PERFORMANCE           CTL_CODE(IOCTL_DISK_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
49 #define IOCTL_DISK_IS_WRITABLE           CTL_CODE(IOCTL_DISK_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS)
50 #define IOCTL_DISK_LOGGING               CTL_CODE(IOCTL_DISK_BASE,10,METHOD_BUFFERED,FILE_ANY_ACCESS)
51 #define IOCTL_DISK_FORMAT_TRACKS_EX      CTL_CODE(IOCTL_DISK_BASE,11,METHOD_BUFFERED,FILE_READ_ACCESS|FILE_WRITE_ACCESS)
52 #define IOCTL_DISK_HISTOGRAM_STRUCTURE   CTL_CODE(IOCTL_DISK_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
53 #define IOCTL_DISK_HISTOGRAM_DATA        CTL_CODE(IOCTL_DISK_BASE,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
54 #define IOCTL_DISK_HISTOGRAM_RESET       CTL_CODE(IOCTL_DISK_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
55 #define IOCTL_DISK_REQUEST_STRUCTURE     CTL_CODE(IOCTL_DISK_BASE,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
56 #define IOCTL_DISK_REQUEST_DATA          CTL_CODE(IOCTL_DISK_BASE,16,METHOD_BUFFERED,FILE_ANY_ACCESS)
57 #define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x12,METHOD_BUFFERED,FILE_ANY_ACCESS)
58 #define IOCTL_DISK_SET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x13,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
59 #define IOCTL_DISK_GET_DRIVE_LAYOUT_EX   CTL_CODE(IOCTL_DISK_BASE,0x14,METHOD_BUFFERED,FILE_ANY_ACCESS)
60 #define IOCTL_DISK_SET_DRIVE_LAYOUT_EX   CTL_CODE(IOCTL_DISK_BASE,0x15,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
61 #define IOCTL_DISK_CREATE_DISK           CTL_CODE(IOCTL_DISK_BASE,0x16,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
62 #define IOCTL_DISK_GET_LENGTH_INFO       CTL_CODE(IOCTL_DISK_BASE,0x17,METHOD_BUFFERED,FILE_READ_ACCESS)
63 #define IOCTL_DISK_PERFORMANCE_OFF       CTL_CODE(IOCTL_DISK_BASE,0x18,METHOD_BUFFERED,FILE_ANY_ACCESS)
64 #define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE,0x28,METHOD_BUFFERED,FILE_ANY_ACCESS)
65 #define IOCTL_DISK_GROW_PARTITION        CTL_CODE(IOCTL_DISK_BASE,0x34,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
66 #define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x35,METHOD_BUFFERED,FILE_READ_ACCESS)
67 #define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x36,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
68 #define IOCTL_DISK_DELETE_DRIVE_LAYOUT   CTL_CODE(IOCTL_DISK_BASE,0x40,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
69 #define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x50,METHOD_BUFFERED,FILE_ANY_ACCESS)
70 #define IOCTL_DISK_CHECK_VERIFY      CTL_CODE(IOCTL_DISK_BASE,0x200,METHOD_BUFFERED,FILE_READ_ACCESS)
71 #define IOCTL_DISK_MEDIA_REMOVAL     CTL_CODE(IOCTL_DISK_BASE,0x201,METHOD_BUFFERED,FILE_READ_ACCESS)
72 #define IOCTL_DISK_EJECT_MEDIA       CTL_CODE(IOCTL_DISK_BASE,0x202,METHOD_BUFFERED,FILE_READ_ACCESS)
73 #define IOCTL_DISK_LOAD_MEDIA        CTL_CODE(IOCTL_DISK_BASE,0x203,METHOD_BUFFERED,FILE_READ_ACCESS)
74 #define IOCTL_DISK_RESERVE           CTL_CODE(IOCTL_DISK_BASE,0x204,METHOD_BUFFERED,FILE_READ_ACCESS)
75 #define IOCTL_DISK_RELEASE           CTL_CODE(IOCTL_DISK_BASE,0x205,METHOD_BUFFERED,FILE_READ_ACCESS)
76 #define IOCTL_DISK_FIND_NEW_DEVICES  CTL_CODE(IOCTL_DISK_BASE,0x206,METHOD_BUFFERED,FILE_READ_ACCESS)
77 #define IOCTL_DISK_REMOVE_DEVICE     CTL_CODE(IOCTL_DISK_BASE,0x207,METHOD_BUFFERED,FILE_READ_ACCESS)
78 #define IOCTL_DISK_GET_MEDIA_TYPES   CTL_CODE(IOCTL_DISK_BASE,0x300,METHOD_BUFFERED,FILE_ANY_ACCESS)
79 #define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE, 0x0032, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
80 #define IOCTL_SERIAL_LSRMST_INSERT   CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
81 #define IOCTL_VOLUME_BASE ((DWORD)'V')
82 #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
83 #define FSCTL_LOCK_VOLUME            CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS)
84 #define FSCTL_UNLOCK_VOLUME          CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS)
85 #define FSCTL_PIPE_IMPERSONATE       CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
86 #define FSCTL_DISMOUNT_VOLUME        CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
87 #define FSCTL_MOUNT_DBLS_VOLUME      CTL_CODE(FILE_DEVICE_FILE_SYSTEM,13,METHOD_BUFFERED,FILE_ANY_ACCESS)
88 #define FSCTL_GET_COMPRESSION        CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
89 #define FSCTL_SET_COMPRESSION        CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA|FILE_WRITE_DATA)
90 #define FSCTL_READ_COMPRESSION       CTL_CODE(FILE_DEVICE_FILE_SYSTEM,17,METHOD_NEITHER,FILE_READ_DATA)
91 #define FSCTL_WRITE_COMPRESSION      CTL_CODE(FILE_DEVICE_FILE_SYSTEM,18,METHOD_NEITHER,FILE_WRITE_DATA)
92 #define FSCTL_GET_NTFS_VOLUME_DATA   CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
93 #define FSCTL_GET_NTFS_FILE_RECORD   CTL_CODE(FILE_DEVICE_FILE_SYSTEM,26,METHOD_BUFFERED,FILE_ANY_ACCESS)
94 #define FSCTL_GET_VOLUME_BITMAP      CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS)
95 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS)
96 #define FSCTL_MOVE_FILE              CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_ANY_ACCESS)
97 #define FSCTL_GET_REPARSE_POINT      CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
98 #define FSCTL_SET_REPARSE_POINT      CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS)
99 #define FSCTL_DELETE_REPARSE_POINT   CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_ANY_ACCESS)
100 #define FSCTL_SET_SPARSE             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
101 
102 #ifndef _DEVIOCTL_
103 #define _DEVIOCTL_
104 
105 #define DEVICE_TYPE DWORD
106 
107 #define FILE_DEVICE_BEEP              1
108 #define FILE_DEVICE_CD_ROM            2
109 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 3
110 #define FILE_DEVICE_CONTROLLER        4
111 #define FILE_DEVICE_DATALINK          5
112 #define FILE_DEVICE_DFS               6
113 #define FILE_DEVICE_DISK              7
114 #define FILE_DEVICE_DISK_FILE_SYSTEM  8
115 #define FILE_DEVICE_FILE_SYSTEM       9
116 #define FILE_DEVICE_INPORT_PORT       10
117 #define FILE_DEVICE_KEYBOARD          11
118 #define FILE_DEVICE_MAILSLOT          12
119 #define FILE_DEVICE_MIDI_IN           13
120 #define FILE_DEVICE_MIDI_OUT          14
121 #define FILE_DEVICE_MOUSE             15
122 #define FILE_DEVICE_MULTI_UNC_PROVIDER 16
123 #define FILE_DEVICE_NAMED_PIPE        17
124 #define FILE_DEVICE_NETWORK           18
125 #define FILE_DEVICE_NETWORK_BROWSER   19
126 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 20
127 #define FILE_DEVICE_NULL              21
128 #define FILE_DEVICE_PARALLEL_PORT     22
129 #define FILE_DEVICE_PHYSICAL_NETCARD  23
130 #define FILE_DEVICE_PRINTER           24
131 #define FILE_DEVICE_SCANNER           25
132 #define FILE_DEVICE_SERIAL_MOUSE_PORT 26
133 #define FILE_DEVICE_SERIAL_PORT       27
134 #define FILE_DEVICE_SCREEN            28
135 #define FILE_DEVICE_SOUND             29
136 #define FILE_DEVICE_STREAMS           30
137 #define FILE_DEVICE_TAPE              31
138 #define FILE_DEVICE_TAPE_FILE_SYSTEM  32
139 #define FILE_DEVICE_TRANSPORT         33
140 #define FILE_DEVICE_UNKNOWN           34
141 #define FILE_DEVICE_VIDEO             35
142 #define FILE_DEVICE_VIRTUAL_DISK      36
143 #define FILE_DEVICE_WAVE_IN           37
144 #define FILE_DEVICE_WAVE_OUT          38
145 #define FILE_DEVICE_8042_PORT         39
146 #define FILE_DEVICE_NETWORK_REDIRECTOR 40
147 #define FILE_DEVICE_BATTERY           41
148 #define FILE_DEVICE_BUS_EXTENDER      42
149 #define FILE_DEVICE_MODEM             43
150 #define FILE_DEVICE_VDM               44
151 #define FILE_DEVICE_MASS_STORAGE      45
152 #define FILE_DEVICE_SMB               46
153 #define FILE_DEVICE_KS                47
154 #define FILE_DEVICE_CHANGER           48
155 #define FILE_DEVICE_SMARTCARD         49
156 #define FILE_DEVICE_ACPI              50
157 #define FILE_DEVICE_DVD               51
158 #define FILE_DEVICE_FULLSCREEN_VIDEO  52
159 #define FILE_DEVICE_DFS_FILE_SYSTEM   53
160 #define FILE_DEVICE_DFS_VOLUME        54
161 #define FILE_DEVICE_SERENUM           55
162 #define FILE_DEVICE_TERMSRV           56
163 #define FILE_DEVICE_KSEC              57
164 #define FILE_DEVICE_FIPS              58
165 #define FILE_DEVICE_INFINIBAND        59
166 #define FILE_DEVICE_VMBUS             62
167 #define FILE_DEVICE_CRYPT_PROVIDER    63
168 #define FILE_DEVICE_WPD               64
169 #define FILE_DEVICE_BLUETOOTH         65
170 #define FILE_DEVICE_MT_COMPOSITE      66
171 #define FILE_DEVICE_MT_TRANSPORT      67
172 #define FILE_DEVICE_BIOMETRIC         68
173 #define FILE_DEVICE_PMI               69
174 #define FILE_DEVICE_EHSTOR            70
175 #define FILE_DEVICE_DEVAPI            71
176 #define FILE_DEVICE_GPIO              72
177 #define FILE_DEVICE_USBEX             73
178 #define FILE_DEVICE_CONSOLE           80
179 #define FILE_DEVICE_NFP               81
180 #define FILE_DEVICE_SYSENV            82
181 #define FILE_DEVICE_VIRTUAL_BLOCK     83
182 #define FILE_DEVICE_POINT_OF_SERVICE  84
183 #define FILE_DEVICE_STORAGE_REPLICATION 85
184 #define FILE_DEVICE_TRUST_ENV         86
185 #define FILE_DEVICE_UCM               87
186 #define FILE_DEVICE_UCMTCPCI          88
187 #define FILE_DEVICE_PERSISTENT_MEMORY 89
188 #define FILE_DEVICE_NVDIMM            90
189 #define FILE_DEVICE_HOLOGRAPHIC       91
190 #define FILE_DEVICE_SDFXHCI           92
191 #define FILE_DEVICE_UCMUCSI           93
192 
193 /*  Also in ddk/winddk.h */
194 #define FILE_ANY_ACCESS        0x00000000
195 #define FILE_SPECIAL_ACCESS    FILE_ANY_ACCESS
196 #define FILE_READ_ACCESS       0x00000001
197 #define FILE_WRITE_ACCESS      0x00000002
198 
199 #define METHOD_BUFFERED               0
200 #define METHOD_IN_DIRECT              1
201 #define METHOD_OUT_DIRECT             2
202 #define METHOD_NEITHER                3
203 
204 #define CTL_CODE(t,f,m,a)                (((t)<<16)|((a)<<14)|((f)<<2)|(m))
205 #define DEVICE_TYPE_FROM_CTL_CODE(c)     (((DWORD)((c)&0xffff0000))>>16)
206 
207 #endif /* _DEVIOCTL_ */
208 
209 #define PARTITION_ENTRY_UNUSED        0
210 #define PARTITION_FAT_12              1
211 #define PARTITION_XENIX_1             2
212 #define PARTITION_XENIX_2             3
213 #define PARTITION_FAT_16              4
214 #define PARTITION_EXTENDED            5
215 #define PARTITION_HUGE                6
216 #define PARTITION_IFS                 7
217 #define PARTITION_FAT32               0x0B
218 #define PARTITION_FAT32_XINT13        0x0C
219 #define PARTITION_XINT13              0x0E
220 #define PARTITION_XINT13_EXTENDED     0x0F
221 #define PARTITION_PREP                0x41
222 #define PARTITION_LDM                 0x42
223 #define PARTITION_UNIX                0x63
224 #define PARTITION_NTFT                0x80
225 #define VALID_NTFT                    0xC0
226 #ifdef __REACTOS__
227 #define PARTITION_OLD_LINUX               0x43
228 #define PARTITION_LINUX                   0x83
229 #define PARTITION_FREEBSD                 0xA5
230 #define PARTITION_OPENBSD                 0xA6
231 #define PARTITION_NETBSD                  0xA9
232 #endif
233 #define SERIAL_LSRMST_ESCAPE          0
234 #define SERIAL_LSRMST_LSR_DATA        1
235 #define SERIAL_LSRMST_LSR_NODATA      2
236 #define SERIAL_LSRMST_MST             3
237 /* Device GUIDs */
238 #ifdef DEFINE_GUID
239 
240 DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089,
241  0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73);
242 DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325,
243  0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
244 
245 /* obsolete GUID names */
246 #define GUID_CLASS_COMPORT          GUID_DEVINTERFACE_COMPORT
247 #define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR
248 
249 #endif /* DEFINE_GUID */
250 
251 #define DISK_LOGGING_START   0
252 #define DISK_LOGGING_STOP    1
253 #define DISK_LOGGING_DUMP    2
254 #define DISK_BINNING         3
255 typedef WORD BAD_TRACK_NUMBER,*PBAD_TRACK_NUMBER;
256 typedef enum _BIN_TYPES {RequestSize,RequestLocation} BIN_TYPES;
257 typedef struct _BIN_RANGE {
258     LARGE_INTEGER StartValue;
259     LARGE_INTEGER Length;
260 } BIN_RANGE,*PBIN_RANGE;
261 typedef struct _BIN_COUNT {
262     BIN_RANGE BinRange;
263     DWORD BinCount;
264 } BIN_COUNT,*PBIN_COUNT;
265 typedef struct _BIN_RESULTS {
266     DWORD NumberOfBins;
267     BIN_COUNT BinCounts[1];
268 } BIN_RESULTS,*PBIN_RESULTS;
269 
270 typedef enum _MEDIA_TYPE {
271   Unknown,
272   F5_1Pt2_512,
273   F3_1Pt44_512,
274   F3_2Pt88_512,
275   F3_20Pt8_512,
276   F3_720_512,
277   F5_360_512,
278   F5_320_512,
279   F5_320_1024,
280   F5_180_512,
281   F5_160_512,
282   RemovableMedia,
283   FixedMedia,
284   F3_120M_512,
285   F3_640_512,
286   F5_640_512,
287   F5_720_512,
288   F3_1Pt2_512,
289   F3_1Pt23_1024,
290   F5_1Pt23_1024,
291   F3_128Mb_512,
292   F3_230Mb_512,
293   F8_256_128,
294   F3_200Mb_512,
295   F3_240M_512,
296   F3_32M_512
297 } MEDIA_TYPE, *PMEDIA_TYPE;
298 
299 typedef struct _DISK_GEOMETRY {
300   LARGE_INTEGER Cylinders;
301   MEDIA_TYPE MediaType;
302   DWORD TracksPerCylinder;
303   DWORD SectorsPerTrack;
304   DWORD BytesPerSector;
305 } DISK_GEOMETRY, *PDISK_GEOMETRY;
306 typedef struct _PARTITION_INFORMATION {
307   LARGE_INTEGER StartingOffset;
308   LARGE_INTEGER PartitionLength;
309   DWORD HiddenSectors;
310   DWORD PartitionNumber;
311   BYTE PartitionType;
312   BOOLEAN BootIndicator;
313   BOOLEAN RecognizedPartition;
314   BOOLEAN RewritePartition;
315 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
316 typedef struct _DRIVE_LAYOUT_INFORMATION {
317   DWORD PartitionCount;
318   DWORD Signature;
319   PARTITION_INFORMATION PartitionEntry[1];
320 } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
321 typedef struct _SET_PARTITION_INFORMATION {
322   BYTE PartitionType;
323 } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
324 
325 #if (_WIN32_WINNT >= 0x0500)
326 /* Actually it should be > 0x0500, since this is not present in Windows 2000;
327  * however we keep >= 0x0500 for compatibility with MS PSDK. */
328 
329 typedef enum _PARTITION_STYLE {
330   PARTITION_STYLE_MBR,
331   PARTITION_STYLE_GPT,
332   PARTITION_STYLE_RAW
333 } PARTITION_STYLE;
334 
335 typedef struct _CREATE_DISK_GPT {
336   GUID DiskId;
337   DWORD MaxPartitionCount;
338 } CREATE_DISK_GPT, *PCREATE_DISK_GPT;
339 typedef struct _CREATE_DISK_MBR {
340   DWORD Signature;
341 } CREATE_DISK_MBR, *PCREATE_DISK_MBR;
342 typedef struct _CREATE_DISK {
343   PARTITION_STYLE PartitionStyle;
344   _ANONYMOUS_UNION union {
345     CREATE_DISK_MBR Mbr;
346     CREATE_DISK_GPT Gpt;
347   };
348 } CREATE_DISK, *PCREATE_DISK;
349 
350 typedef enum _DETECTION_TYPE {
351   DetectNone,
352   DetectInt13,
353   DetectExInt13
354 } DETECTION_TYPE;
355 typedef struct _DISK_INT13_INFO {
356   WORD DriveSelect;
357   DWORD MaxCylinders;
358   WORD SectorsPerTrack;
359   WORD MaxHeads;
360   WORD NumberDrives;
361 } DISK_INT13_INFO, *PDISK_INT13_INFO;
362 typedef struct _DISK_EX_INT13_INFO {
363   WORD ExBufferSize;
364   WORD ExFlags;
365   DWORD ExCylinders;
366   DWORD ExHeads;
367   DWORD ExSectorsPerTrack;
368   DWORD64 ExSectorsPerDrive;
369   WORD ExSectorSize;
370   WORD ExReserved;
371 } DISK_EX_INT13_INFO, *PDISK_EX_INT13_INFO;
372 typedef struct _DISK_DETECTION_INFO {
373   DWORD SizeOfDetectInfo;
374   DETECTION_TYPE DetectionType;
375   _ANONYMOUS_UNION union {
376     _ANONYMOUS_STRUCT struct {
377       DISK_INT13_INFO Int13;
378       DISK_EX_INT13_INFO ExInt13;
379     };
380   };
381 } DISK_DETECTION_INFO, *PDISK_DETECTION_INFO;
382 typedef struct _DISK_PARTITION_INFO {
383   DWORD SizeOfPartitionInfo;
384   PARTITION_STYLE PartitionStyle;
385   _ANONYMOUS_UNION union {
386     struct {
387       DWORD Signature;
388       DWORD CheckSum;
389     } Mbr;
390     struct {
391       GUID DiskId;
392     } Gpt;
393   };
394 } DISK_PARTITION_INFO, *PDISK_PARTITION_INFO;
395 typedef struct _DISK_GEOMETRY_EX {
396   DISK_GEOMETRY Geometry;
397   LARGE_INTEGER DiskSize;
398   BYTE Data[1];
399 } DISK_GEOMETRY_EX, *PDISK_GEOMETRY_EX;
400 
401 #if (NTDDI_VERSION < NTDDI_WS03)
402 #define DiskGeometryGetPartition(Geometry) \
403    ((PDISK_PARTITION_INFO)((Geometry) + 1))
404 
405 #define DiskGeometryGetDetect(Geometry)\
406  ((PDISK_DETECTION_INFO)(((PBYTE)DiskGeometryGetPartition(Geometry) + \
407   DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
408 #else
409 #define DiskGeometryGetPartition(Geometry) \
410    ((PDISK_PARTITION_INFO)((Geometry)->Data))
411 
412 #define DiskGeometryGetDetect(Geometry)\
413  ((PDISK_DETECTION_INFO)(((ULONG_PTR)DiskGeometryGetPartition(Geometry) + \
414   DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
415 #endif
416 
417 typedef struct _PARTITION_INFORMATION_GPT {
418   GUID PartitionType;
419   GUID PartitionId;
420   DWORD64 Attributes;
421   WCHAR Name[36];
422 } PARTITION_INFORMATION_GPT, *PPARTITION_INFORMATION_GPT;
423 typedef struct _PARTITION_INFORMATION_MBR {
424   BYTE PartitionType;
425   BOOLEAN BootIndicator;
426   BOOLEAN RecognizedPartition;
427   DWORD HiddenSectors;
428 } PARTITION_INFORMATION_MBR, *PPARTITION_INFORMATION_MBR;
429 typedef struct _PARTITION_INFORMATION_EX {
430   PARTITION_STYLE PartitionStyle;
431   LARGE_INTEGER StartingOffset;
432   LARGE_INTEGER PartitionLength;
433   DWORD PartitionNumber;
434   BOOLEAN RewritePartition;
435 #if (NTDDI_VERSION >= NTDDI_WIN10_RS3)
436   BOOLEAN  IsServicePartition;
437 #endif
438   _ANONYMOUS_UNION union {
439     PARTITION_INFORMATION_MBR Mbr;
440     PARTITION_INFORMATION_GPT Gpt;
441   };
442 } PARTITION_INFORMATION_EX, *PPARTITION_INFORMATION_EX;
443 
444 typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
445   GUID DiskId;
446   LARGE_INTEGER StartingUsableOffset;
447   LARGE_INTEGER UsableLength;
448   DWORD MaxPartitionCount;
449 } DRIVE_LAYOUT_INFORMATION_GPT, *PDRIVE_LAYOUT_INFORMATION_GPT;
450 typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
451   DWORD Signature;
452 #if (NTDDI_VERSION >= NTDDI_WIN10_RS1)
453   DWORD CheckSum;
454 #endif
455 } DRIVE_LAYOUT_INFORMATION_MBR, *PDRIVE_LAYOUT_INFORMATION_MBR;
456 typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
457   DWORD PartitionStyle;
458   DWORD PartitionCount;
459   _ANONYMOUS_UNION union {
460     DRIVE_LAYOUT_INFORMATION_MBR Mbr;
461     DRIVE_LAYOUT_INFORMATION_GPT Gpt;
462   };
463   PARTITION_INFORMATION_EX PartitionEntry[1];
464 } DRIVE_LAYOUT_INFORMATION_EX, *PDRIVE_LAYOUT_INFORMATION_EX;
465 
466 typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
467 typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
468 
469 typedef struct _SET_PARTITION_INFORMATION_EX {
470   PARTITION_STYLE  PartitionStyle;
471   _ANONYMOUS_UNION union {
472     SET_PARTITION_INFORMATION_MBR  Mbr;
473     SET_PARTITION_INFORMATION_GPT  Gpt;
474   } DUMMYUNIONNAME;
475 } SET_PARTITION_INFORMATION_EX, *PSET_PARTITION_INFORMATION_EX;
476 
477 #endif // (_WIN32_WINNT >= 0x0500)
478 
479 typedef struct _DISK_GROW_PARTITION {
480   DWORD PartitionNumber;
481   LARGE_INTEGER BytesToGrow;
482 } DISK_GROW_PARTITION, *PDISK_GROW_PARTITION;
483 typedef enum {
484   EqualPriority,
485   KeepPrefetchedData,
486   KeepReadData
487 } DISK_CACHE_RETENTION_PRIORITY;
488 typedef struct _DISK_CACHE_INFORMATION {
489   BOOLEAN ParametersSavable;
490   BOOLEAN ReadCacheEnabled;
491   BOOLEAN WriteCacheEnabled;
492   DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
493   DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
494   WORD DisablePrefetchTransferLength;
495   BOOLEAN PrefetchScalar;
496   _ANONYMOUS_UNION union {
497     struct {
498       WORD Minimum;
499       WORD Maximum;
500       WORD MaximumBlocks;
501     } ScalarPrefetch;
502     struct {
503       WORD Minimum;
504       WORD Maximum;
505     } BlockPrefetch;
506   };
507 } DISK_CACHE_INFORMATION,*PDISK_CACHE_INFORMATION;
508 
509 typedef struct _DISK_PERFORMANCE {
510     LARGE_INTEGER BytesRead;
511     LARGE_INTEGER BytesWritten;
512     LARGE_INTEGER ReadTime;
513     LARGE_INTEGER WriteTime;
514     LARGE_INTEGER IdleTime;
515     DWORD ReadCount;
516     DWORD WriteCount;
517     DWORD QueueDepth;
518     DWORD SplitCount;
519     LARGE_INTEGER QueryTime;
520     DWORD   StorageDeviceNumber;
521     WCHAR   StorageManagerName[8];
522 } DISK_PERFORMANCE, *PDISK_PERFORMANCE;
523 typedef struct _DISK_RECORD {
524   LARGE_INTEGER ByteOffset;
525   LARGE_INTEGER StartTime;
526   LARGE_INTEGER EndTime;
527   PVOID VirtualAddress;
528   DWORD NumberOfBytes;
529   BYTE DeviceNumber;
530   BOOLEAN ReadRequest;
531 } DISK_RECORD,*PDISK_RECORD;
532 typedef struct _DISK_LOGGING {
533   BYTE Function;
534   PVOID BufferAddress;
535   DWORD BufferSize;
536 } DISK_LOGGING,*PDISK_LOGGING;
537 typedef struct DiskQuotaUserInformation {
538   LONGLONG QuotaUsed;
539   LONGLONG QuotaThreshold;
540   LONGLONG QuotaLimit;
541 } DISKQUOTA_USER_INFORMATION,*PDISKQUOTA_USER_INFORMATION;
542 typedef struct _FORMAT_PARAMETERS {
543   MEDIA_TYPE MediaType;
544   DWORD StartCylinderNumber;
545   DWORD EndCylinderNumber;
546   DWORD StartHeadNumber;
547   DWORD EndHeadNumber;
548 } FORMAT_PARAMETERS,*PFORMAT_PARAMETERS;
549 typedef struct _FORMAT_EX_PARAMETERS {
550   MEDIA_TYPE MediaType;
551   DWORD StartCylinderNumber;
552   DWORD EndCylinderNumber;
553   DWORD StartHeadNumber;
554   DWORD EndHeadNumber;
555   WORD FormatGapLength;
556   WORD SectorsPerTrack;
557   WORD SectorNumber[1];
558 } FORMAT_EX_PARAMETERS,*PFORMAT_EX_PARAMETERS;
559 typedef struct {
560   LARGE_INTEGER Length;
561 } GET_LENGTH_INFORMATION;
562 typedef struct _HISTOGRAM_BUCKET {
563   DWORD Reads;
564   DWORD Writes;
565 } HISTOGRAM_BUCKET,*PHISTOGRAM_BUCKET;
566 typedef struct _DISK_HISTOGRAM {
567   LARGE_INTEGER DiskSize;
568   LARGE_INTEGER Start;
569   LARGE_INTEGER End;
570   LARGE_INTEGER Average;
571   LARGE_INTEGER AverageRead;
572   LARGE_INTEGER AverageWrite;
573   DWORD Granularity;
574   DWORD Size;
575   DWORD ReadCount;
576   DWORD WriteCount;
577   PHISTOGRAM_BUCKET Histogram;
578 } DISK_HISTOGRAM,*PDISK_HISTOGRAM;
579 typedef struct _DISK_EXTENT {
580   DWORD DiskNumber;
581   LARGE_INTEGER StartingOffset;
582   LARGE_INTEGER ExtentLength;
583 } DISK_EXTENT,*PDISK_EXTENT;
584 typedef struct _VOLUME_DISK_EXTENTS {
585   DWORD NumberOfDiskExtents;
586   DISK_EXTENT Extents[1];
587 } VOLUME_DISK_EXTENTS,*PVOLUME_DISK_EXTENTS;
588 typedef struct {
589   HANDLE FileHandle;
590   LARGE_INTEGER StartingVcn;
591   LARGE_INTEGER StartingLcn;
592   DWORD ClusterCount;
593 } MOVE_FILE_DATA,*PMOVE_FILE_DATA;
594 typedef struct _PERF_BIN {
595   DWORD NumberOfBins;
596   DWORD TypeOfBin;
597   BIN_RANGE BinsRanges[1];
598 } PERF_BIN,*PPERF_BIN;
599 
600 #ifndef _NTDDSTOR_H_
601 typedef struct _PREVENT_MEDIA_REMOVAL {
602   BOOLEAN PreventMediaRemoval;
603 } PREVENT_MEDIA_REMOVAL,*PPREVENT_MEDIA_REMOVAL;
604 #endif
605 
606 typedef struct RETRIEVAL_POINTERS_BUFFER {
607   DWORD ExtentCount;
608   LARGE_INTEGER StartingVcn;
609   struct {
610     LARGE_INTEGER NextVcn;
611     LARGE_INTEGER Lcn;
612   } Extents[1];
613 } RETRIEVAL_POINTERS_BUFFER,*PRETRIEVAL_POINTERS_BUFFER;
614 typedef struct _REASSIGN_BLOCKS {
615   WORD Reserved;
616   WORD Count;
617   DWORD BlockNumber[1];
618 } REASSIGN_BLOCKS,*PREASSIGN_BLOCKS;
619 typedef struct {
620   LARGE_INTEGER StartingLcn;
621 } STARTING_LCN_INPUT_BUFFER,*PSTARTING_LCN_INPUT_BUFFER;
622 typedef struct {
623   LARGE_INTEGER StartingVcn;
624 } STARTING_VCN_INPUT_BUFFER,*PSTARTING_VCN_INPUT_BUFFER;
625 typedef struct _VERIFY_INFORMATION {
626   LARGE_INTEGER StartingOffset;
627   DWORD Length;
628 } VERIFY_INFORMATION,*PVERIFY_INFORMATION;
629 typedef struct {
630   LARGE_INTEGER StartingLcn;
631   LARGE_INTEGER BitmapSize;
632   BYTE Buffer[1];
633 } VOLUME_BITMAP_BUFFER,*PVOLUME_BITMAP_BUFFER;
634 typedef struct {
635   LARGE_INTEGER VolumeSerialNumber;
636   LARGE_INTEGER NumberSectors;
637   LARGE_INTEGER TotalClusters;
638   LARGE_INTEGER FreeClusters;
639   LARGE_INTEGER TotalReserved;
640   DWORD BytesPerSector;
641   DWORD BytesPerCluster;
642   DWORD BytesPerFileRecordSegment;
643   DWORD ClustersPerFileRecordSegment;
644   LARGE_INTEGER MftValidDataLength;
645   LARGE_INTEGER MftStartLcn;
646   LARGE_INTEGER Mft2StartLcn;
647   LARGE_INTEGER MftZoneStart;
648   LARGE_INTEGER MftZoneEnd;
649 } NTFS_VOLUME_DATA_BUFFER, *PNTFS_VOLUME_DATA_BUFFER;
650 typedef struct {
651   ULONG ByteCount;
652   USHORT MajorVersion;
653   USHORT MinorVersion;
654 } NTFS_EXTENDED_VOLUME_DATA, *PNTFS_EXTENDED_VOLUME_DATA;
655 typedef struct {
656   LARGE_INTEGER FileReferenceNumber;
657 } NTFS_FILE_RECORD_INPUT_BUFFER, *PNTFS_FILE_RECORD_INPUT_BUFFER;
658 typedef struct {
659   LARGE_INTEGER FileReferenceNumber;
660   ULONG FileRecordLength;
661   UCHAR FileRecordBuffer[1];
662 } NTFS_FILE_RECORD_OUTPUT_BUFFER, *PNTFS_FILE_RECORD_OUTPUT_BUFFER;
663 
664 #ifdef __REACTOS__
665 #define IsRecognizedPartition(t)\
666   (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\
667     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\
668     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\
669     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\
670     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\
671     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\
672     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\
673     ((t)==PARTITION_FAT_12)||\
674     ((t)==PARTITION_FAT_16)||\
675     ((t)==PARTITION_IFS)||\
676     ((t)==PARTITION_HUGE)||\
677     ((t)==PARTITION_FAT32)||\
678     ((t)==PARTITION_FAT32_XINT13)||\
679     ((t)==PARTITION_XINT13)||\
680     ((t)==PARTITION_LINUX)||\
681     ((t)==PARTITION_OLD_LINUX)||\
682     ((t)==PARTITION_FREEBSD)||\
683     ((t)==PARTITION_OPENBSD)||\
684     ((t)==PARTITION_NETBSD))
685 #else
686 #define IsRecognizedPartition(t)\
687   (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_12))||\
688     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT_16))||\
689     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_IFS))||\
690     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_HUGE))||\
691     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32))||\
692     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_FAT32_XINT13))||\
693     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13))||\
694     ((t)==PARTITION_FAT_12)||\
695     ((t)==PARTITION_FAT_16)||\
696     ((t)==PARTITION_IFS)||\
697     ((t)==PARTITION_HUGE)||\
698     ((t)==PARTITION_FAT32)||\
699     ((t)==PARTITION_FAT32_XINT13)||\
700     ((t)==PARTITION_XINT13))
701 #endif
702 #define IsContainerPartition(t)\
703   (((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_EXTENDED))||\
704     ((t&PARTITION_NTFT)&&((t&~VALID_NTFT)==PARTITION_XINT13_EXTENDED))||\
705     ((t)==PARTITION_EXTENDED)||\
706     ((t)==PARTITION_XINT13_EXTENDED))
707 
708 #ifndef _FILESYSTEMFSCTL_
709 #define _FILESYSTEMFSCTL_
710 
711 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
712 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
713 #if (_WIN32_WINNT >= _WIN32_WINNT_NT4)
714 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
715 #endif
716 
717 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
718 #define FSCTL_GET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 159, METHOD_BUFFERED, FILE_ANY_ACCESS)
719 #define FSCTL_SET_INTEGRITY_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 160, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
720 #endif
721 
722 #if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE)
723 #define FSCTL_DUPLICATE_EXTENTS_TO_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 209, METHOD_BUFFERED, FILE_WRITE_DATA)
724 #endif
725 
726 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
727 #define VOLUME_IS_DIRTY                  (0x00000001)
728 #define VOLUME_UPGRADE_SCHEDULED         (0x00000002)
729 #define VOLUME_SESSION_OPEN              (0x00000004)
730 #endif
731 
732 typedef struct _FILESYSTEM_STATISTICS {
733   USHORT FileSystemType;
734   USHORT Version;
735   ULONG SizeOfCompleteStructure;
736   ULONG UserFileReads;
737   ULONG UserFileReadBytes;
738   ULONG UserDiskReads;
739   ULONG UserFileWrites;
740   ULONG UserFileWriteBytes;
741   ULONG UserDiskWrites;
742   ULONG MetaDataReads;
743   ULONG MetaDataReadBytes;
744   ULONG MetaDataDiskReads;
745   ULONG MetaDataWrites;
746   ULONG MetaDataWriteBytes;
747   ULONG MetaDataDiskWrites;
748 } FILESYSTEM_STATISTICS, *PFILESYSTEM_STATISTICS;
749 
750 #define FILESYSTEM_STATISTICS_TYPE_NTFS     1
751 #define FILESYSTEM_STATISTICS_TYPE_FAT      2
752 #define FILESYSTEM_STATISTICS_TYPE_EXFAT    3
753 
754 typedef struct _FAT_STATISTICS {
755   ULONG CreateHits;
756   ULONG SuccessfulCreates;
757   ULONG FailedCreates;
758   ULONG NonCachedReads;
759   ULONG NonCachedReadBytes;
760   ULONG NonCachedWrites;
761   ULONG NonCachedWriteBytes;
762   ULONG NonCachedDiskReads;
763   ULONG NonCachedDiskWrites;
764 } FAT_STATISTICS, *PFAT_STATISTICS;
765 
766 typedef struct _EXFAT_STATISTICS {
767   ULONG CreateHits;
768   ULONG SuccessfulCreates;
769   ULONG FailedCreates;
770   ULONG NonCachedReads;
771   ULONG NonCachedReadBytes;
772   ULONG NonCachedWrites;
773   ULONG NonCachedWriteBytes;
774   ULONG NonCachedDiskReads;
775   ULONG NonCachedDiskWrites;
776 } EXFAT_STATISTICS, *PEXFAT_STATISTICS;
777 
778 typedef struct _NTFS_STATISTICS {
779   ULONG LogFileFullExceptions;
780   ULONG OtherExceptions;
781   ULONG MftReads;
782   ULONG MftReadBytes;
783   ULONG MftWrites;
784   ULONG MftWriteBytes;
785   struct {
786     USHORT Write;
787     USHORT Create;
788     USHORT SetInfo;
789     USHORT Flush;
790   } MftWritesUserLevel;
791   USHORT MftWritesFlushForLogFileFull;
792   USHORT MftWritesLazyWriter;
793   USHORT MftWritesUserRequest;
794   ULONG Mft2Writes;
795   ULONG Mft2WriteBytes;
796   struct {
797     USHORT Write;
798     USHORT Create;
799     USHORT SetInfo;
800     USHORT Flush;
801   } Mft2WritesUserLevel;
802   USHORT Mft2WritesFlushForLogFileFull;
803   USHORT Mft2WritesLazyWriter;
804   USHORT Mft2WritesUserRequest;
805   ULONG RootIndexReads;
806   ULONG RootIndexReadBytes;
807   ULONG RootIndexWrites;
808   ULONG RootIndexWriteBytes;
809   ULONG BitmapReads;
810   ULONG BitmapReadBytes;
811   ULONG BitmapWrites;
812   ULONG BitmapWriteBytes;
813   USHORT BitmapWritesFlushForLogFileFull;
814   USHORT BitmapWritesLazyWriter;
815   USHORT BitmapWritesUserRequest;
816   struct {
817     USHORT Write;
818     USHORT Create;
819     USHORT SetInfo;
820   } BitmapWritesUserLevel;
821   ULONG MftBitmapReads;
822   ULONG MftBitmapReadBytes;
823   ULONG MftBitmapWrites;
824   ULONG MftBitmapWriteBytes;
825   USHORT MftBitmapWritesFlushForLogFileFull;
826   USHORT MftBitmapWritesLazyWriter;
827   USHORT MftBitmapWritesUserRequest;
828   struct {
829     USHORT Write;
830     USHORT Create;
831     USHORT SetInfo;
832     USHORT Flush;
833   } MftBitmapWritesUserLevel;
834   ULONG UserIndexReads;
835   ULONG UserIndexReadBytes;
836   ULONG UserIndexWrites;
837   ULONG UserIndexWriteBytes;
838   ULONG LogFileReads;
839   ULONG LogFileReadBytes;
840   ULONG LogFileWrites;
841   ULONG LogFileWriteBytes;
842   struct {
843     ULONG Calls;
844     ULONG Clusters;
845     ULONG Hints;
846     ULONG RunsReturned;
847     ULONG HintsHonored;
848     ULONG HintsClusters;
849     ULONG Cache;
850     ULONG CacheClusters;
851     ULONG CacheMiss;
852     ULONG CacheMissClusters;
853   } Allocate;
854 } NTFS_STATISTICS, *PNTFS_STATISTICS;
855 
856 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8)
857 typedef struct _FSCTL_GET_INTEGRITY_INFORMATION_BUFFER {
858   WORD ChecksumAlgorithm;
859   WORD Reserved;
860   DWORD Flags;
861   DWORD ChecksumChunkSizeInBytes;
862   DWORD ClusterSizeInBytes;
863 } FSCTL_GET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_GET_INTEGRITY_INFORMATION_BUFFER;
864 
865 typedef struct _FSCTL_SET_INTEGRITY_INFORMATION_BUFFER {
866   WORD ChecksumAlgorithm;
867   WORD Reserved;
868   DWORD Flags;
869 } FSCTL_SET_INTEGRITY_INFORMATION_BUFFER, *PFSCTL_SET_INTEGRITY_INFORMATION_BUFFER;
870 #endif
871 
872 #if (_WIN32_WINNT >= _WIN32_WINNT_WINBLUE)
873 typedef struct _DUPLICATE_EXTENTS_DATA {
874     HANDLE FileHandle;
875     LARGE_INTEGER SourceFileOffset;
876     LARGE_INTEGER TargetFileOffset;
877     LARGE_INTEGER ByteCount;
878 } DUPLICATE_EXTENTS_DATA, *PDUPLICATE_EXTENTS_DATA;
879 
880 #endif
881 
882 #endif
883 
884 #ifdef _MSC_VER
885 #pragma warning(pop)
886 #endif
887 
888 #ifdef __cplusplus
889 }
890 #endif
891 #endif /* _WINIOCTL_ */
892