source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/winioctl.h@ 1167

Last change on this file since 1167 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 112.9 KB
RevLine 
[1166]1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifdef DEFINE_GUID
7
8#ifndef FAR
9#define FAR
10#endif
11
12DEFINE_GUID(GUID_DEVINTERFACE_DISK,0x53f56307,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
13DEFINE_GUID(GUID_DEVINTERFACE_CDROM,0x53f56308,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
14DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,0x53f5630a,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
15DEFINE_GUID(GUID_DEVINTERFACE_TAPE,0x53f5630b,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
16DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,0x53f5630c,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
17DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,0x53f5630d,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
18DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,0x53f56310,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
19DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,0x53f56311,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
20DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,0x53f56312,0xb6bf,0x11d0,0x94,0xf2,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
21DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,0x2accfe60,0xc130,0x11d2,0xb0,0x82,0x00,0xa0,0xc9,0x1e,0xfb,0x8b);
22DEFINE_GUID(GUID_DEVINTERFACE_VMLUN,0x6f416619,0x9f29,0x42a5,0xb2,0x0b,0x37,0xe2,0x19,0xca,0x02,0xb0);
23DEFINE_GUID(GUID_DEVINTERFACE_SES,0x1790c9ec,0x47d5,0x4df3,0xb5,0xaf,0x9a,0xdf,0x3c,0xf2,0x3e,0x48);
24DEFINE_GUID(GUID_DEVINTERFACE_ZNSDISK,0xb87941c5,0xffdb,0x43c7,0xb6,0xb1,0x20,0xb6,0x32,0xf0,0xb1,0x09);
25#define WDI_STORAGE_PREDICT_FAILURE_DPS_GUID {0xe9f2d03a,0x747c,0x41c2,{0xbb,0x9a,0x02,0xc6,0x2b,0x6d,0x5f,0xcb}};
26
27DEFINE_GUID(GUID_DEVINTERFACE_SERVICE_VOLUME,0x6ead3d82,0x25ec,0x46bc,0xb7,0xfd,0xc1,0xf0,0xdf,0x8f,0x50,0x37);
28DEFINE_GUID(GUID_DEVINTERFACE_HIDDEN_VOLUME,0x7f108a28,0x9833,0x4b3b,0xb7,0x80,0x2c,0x6b,0x5f,0xa5,0xc0,0x62);
29DEFINE_GUID(GUID_DEVINTERFACE_UNIFIED_ACCESS_RPMB,0x27447c21,0xbcc3,0x4d07,0xa0,0x5b,0xa3,0x39,0x5b,0xb4,0xee,0xe7);
30DEFINE_GUID(GUID_DEVINTERFACE_SCM_PHYSICAL_DEVICE,0x4283609d,0x4dc2,0x43be,0xbb,0xb4,0x4f,0x15,0xdf,0xce,0x2c,0x61);
31DEFINE_GUID(GUID_SCM_PD_HEALTH_NOTIFICATION,0x9da2d386,0x72f5,0x4ee3,0x81,0x55,0xec,0xa0,0x67,0x8e,0x3b,0x6);
32DEFINE_GUID(GUID_SCM_PD_PASSTHROUGH_INVDIMM,0x4309ac30,0x0d11,0x11e4,0x91,0x91,0x08,0x00,0x20,0x0c,0x9a,0x66);
33DEFINE_GUID(GUID_DEVINTERFACE_COMPORT,0x86e0d1e0,0x8089,0x11d0,0x9c,0xe4,0x08,0x00,0x3e,0x30,0x1f,0x73);
34DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR,0x4D36E978,0xE325,0x11CE,0xBF,0xC1,0x08,0x00,0x2B,0xE1,0x03,0x18);
35
36#define DiskClassGuid GUID_DEVINTERFACE_DISK
37#define CdRomClassGuid GUID_DEVINTERFACE_CDROM
38#define PartitionClassGuid GUID_DEVINTERFACE_PARTITION
39#define TapeClassGuid GUID_DEVINTERFACE_TAPE
40#define WriteOnceDiskClassGuid GUID_DEVINTERFACE_WRITEONCEDISK
41#define VolumeClassGuid GUID_DEVINTERFACE_VOLUME
42#define MediumChangerClassGuid GUID_DEVINTERFACE_MEDIUMCHANGER
43#define FloppyClassGuid GUID_DEVINTERFACE_FLOPPY
44#define CdChangerClassGuid GUID_DEVINTERFACE_CDCHANGER
45#define StoragePortClassGuid GUID_DEVINTERFACE_STORAGEPORT
46#define HiddenVolumeClassGuid GUID_DEVINTERFACE_HIDDEN_VOLUME
47#define GUID_CLASS_COMPORT GUID_DEVINTERFACE_COMPORT
48#define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR
49#endif /* DEFINE_GUID */
50
51#ifdef DEFINE_DEVPROPKEY
52
53#ifndef __WRAPPED__
54#define __WRAPPED__
55#endif
56
57DEFINE_DEVPROPKEY(DEVPKEY_Storage_Portable,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,2);
58DEFINE_DEVPROPKEY(DEVPKEY_Storage_Removable_Media,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,3);
59DEFINE_DEVPROPKEY(DEVPKEY_Storage_System_Critical,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,4);
60DEFINE_DEVPROPKEY(DEVPKEY_Storage_Disk_Number,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,5);
61DEFINE_DEVPROPKEY(DEVPKEY_Storage_Partition_Number,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,6);
62DEFINE_DEVPROPKEY(DEVPKEY_Storage_Mbr_Type,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,7);
63DEFINE_DEVPROPKEY(DEVPKEY_Storage_Gpt_Type,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,8);
64DEFINE_DEVPROPKEY(DEVPKEY_Storage_Gpt_Name,0x4d1ebee8,0x803,0x4774,0x98,0x42,0xb7,0x7d,0xb5,0x2,0x65,0xe9,9);
65
66#endif /* DEFINE_DEVPROPKEY */
67
68#ifndef _WINIOCTL_
69#define _WINIOCTL_
70
71#ifndef _DEVIOCTL_
72#define _DEVIOCTL_
73
74#ifndef DEVICE_TYPE
75#define DEVICE_TYPE DWORD
76#endif
77
78#define FILE_DEVICE_BEEP 0x00000001
79#define FILE_DEVICE_CD_ROM 0x00000002
80#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
81#define FILE_DEVICE_CONTROLLER 0x00000004
82#define FILE_DEVICE_DATALINK 0x00000005
83#define FILE_DEVICE_DFS 0x00000006
84#define FILE_DEVICE_DISK 0x00000007
85#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
86#define FILE_DEVICE_FILE_SYSTEM 0x00000009
87#define FILE_DEVICE_INPORT_PORT 0x0000000a
88#define FILE_DEVICE_KEYBOARD 0x0000000b
89#define FILE_DEVICE_MAILSLOT 0x0000000c
90#define FILE_DEVICE_MIDI_IN 0x0000000d
91#define FILE_DEVICE_MIDI_OUT 0x0000000e
92#define FILE_DEVICE_MOUSE 0x0000000f
93#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
94#define FILE_DEVICE_NAMED_PIPE 0x00000011
95#define FILE_DEVICE_NETWORK 0x00000012
96#define FILE_DEVICE_NETWORK_BROWSER 0x00000013
97#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
98#define FILE_DEVICE_NULL 0x00000015
99#define FILE_DEVICE_PARALLEL_PORT 0x00000016
100#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
101#define FILE_DEVICE_PRINTER 0x00000018
102#define FILE_DEVICE_SCANNER 0x00000019
103#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
104#define FILE_DEVICE_SERIAL_PORT 0x0000001b
105#define FILE_DEVICE_SCREEN 0x0000001c
106#define FILE_DEVICE_SOUND 0x0000001d
107#define FILE_DEVICE_STREAMS 0x0000001e
108#define FILE_DEVICE_TAPE 0x0000001f
109#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
110#define FILE_DEVICE_TRANSPORT 0x00000021
111#define FILE_DEVICE_UNKNOWN 0x00000022
112#define FILE_DEVICE_VIDEO 0x00000023
113#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
114#define FILE_DEVICE_WAVE_IN 0x00000025
115#define FILE_DEVICE_WAVE_OUT 0x00000026
116#define FILE_DEVICE_8042_PORT 0x00000027
117#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
118#define FILE_DEVICE_BATTERY 0x00000029
119#define FILE_DEVICE_BUS_EXTENDER 0x0000002a
120#define FILE_DEVICE_MODEM 0x0000002b
121#define FILE_DEVICE_VDM 0x0000002c
122#define FILE_DEVICE_MASS_STORAGE 0x0000002d
123#define FILE_DEVICE_SMB 0x0000002e
124#define FILE_DEVICE_KS 0x0000002f
125#define FILE_DEVICE_CHANGER 0x00000030
126#define FILE_DEVICE_SMARTCARD 0x00000031
127#define FILE_DEVICE_ACPI 0x00000032
128#define FILE_DEVICE_DVD 0x00000033
129#define FILE_DEVICE_FULLSCREEN_VIDEO 0x00000034
130#define FILE_DEVICE_DFS_FILE_SYSTEM 0x00000035
131#define FILE_DEVICE_DFS_VOLUME 0x00000036
132#define FILE_DEVICE_SERENUM 0x00000037
133#define FILE_DEVICE_TERMSRV 0x00000038
134#define FILE_DEVICE_KSEC 0x00000039
135#define FILE_DEVICE_FIPS 0x0000003A
136#define FILE_DEVICE_INFINIBAND 0x0000003B
137#define FILE_DEVICE_VMBUS 0x0000003E
138#define FILE_DEVICE_CRYPT_PROVIDER 0x0000003F
139#define FILE_DEVICE_WPD 0x00000040
140#define FILE_DEVICE_BLUETOOTH 0x00000041
141#define FILE_DEVICE_MT_COMPOSITE 0x00000042
142#define FILE_DEVICE_MT_TRANSPORT 0x00000043
143#define FILE_DEVICE_BIOMETRIC 0x00000044
144#define FILE_DEVICE_PMI 0x00000045
145#define FILE_DEVICE_EHSTOR 0x00000046
146#define FILE_DEVICE_DEVAPI 0x00000047
147#define FILE_DEVICE_GPIO 0x00000048
148#define FILE_DEVICE_USBEX 0x00000049
149#define FILE_DEVICE_CONSOLE 0x00000050
150#define FILE_DEVICE_NFP 0x00000051
151#define FILE_DEVICE_SYSENV 0x00000052
152#define FILE_DEVICE_VIRTUAL_BLOCK 0x00000053
153#define FILE_DEVICE_POINT_OF_SERVICE 0x00000054
154#define FILE_DEVICE_STORAGE_REPLICATION 0x00000055
155#define FILE_DEVICE_TRUST_ENV 0x00000056
156#define FILE_DEVICE_UCM 0x00000057
157#define FILE_DEVICE_UCMTCPCI 0x00000058
158#define FILE_DEVICE_PERSISTENT_MEMORY 0x00000059
159#define FILE_DEVICE_NVDIMM 0x0000005a
160#define FILE_DEVICE_HOLOGRAPHIC 0x0000005b
161#define FILE_DEVICE_SDFXHCI 0x0000005c
162#define FILE_DEVICE_UCMUCSI 0x0000005d
163#define FILE_DEVICE_PRM 0x0000005e
164#define FILE_DEVICE_EVENT_COLLECTOR 0x0000005f
165#define FILE_DEVICE_USB4 0x00000060
166#define FILE_DEVICE_SOUNDWIRE 0x00000061
167
168#define CTL_CODE(DeviceType,Function,Method,Access) (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
169
170#define DEVICE_TYPE_FROM_CTL_CODE(ctrlCode) (((DWORD)(ctrlCode & 0xffff0000)) >> 16)
171#define METHOD_FROM_CTL_CODE(ctrlCode) ((DWORD)(ctrlCode & 3))
172
173#define METHOD_BUFFERED 0
174#define METHOD_IN_DIRECT 1
175#define METHOD_OUT_DIRECT 2
176#define METHOD_NEITHER 3
177
178#define METHOD_DIRECT_TO_HARDWARE METHOD_IN_DIRECT
179#define METHOD_DIRECT_FROM_HARDWARE METHOD_OUT_DIRECT
180
181#define FILE_ANY_ACCESS 0
182#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS)
183#define FILE_READ_ACCESS (0x0001)
184#define FILE_WRITE_ACCESS (0x0002)
185
186#endif /* _DEVIOCTL_ */
187
188
189#ifndef _NTDDSTOR_H_
190#define _NTDDSTOR_H_
191
192#ifdef __cplusplus
193extern "C" {
194#endif
195
196#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
197
198#define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE,0x0200,METHOD_BUFFERED,FILE_READ_ACCESS)
199#define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE,0x0200,METHOD_BUFFERED,FILE_ANY_ACCESS)
200#define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE,0x0201,METHOD_BUFFERED,FILE_READ_ACCESS)
201#define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE,0x0202,METHOD_BUFFERED,FILE_READ_ACCESS)
202#define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE,0x0203,METHOD_BUFFERED,FILE_READ_ACCESS)
203#define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE,0x0203,METHOD_BUFFERED,FILE_ANY_ACCESS)
204#define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE,0x0204,METHOD_BUFFERED,FILE_READ_ACCESS)
205#define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE,0x0205,METHOD_BUFFERED,FILE_READ_ACCESS)
206#define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE,0x0206,METHOD_BUFFERED,FILE_READ_ACCESS)
207
208#define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE,0x0250,METHOD_BUFFERED,FILE_ANY_ACCESS)
209#define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE,0x0251,METHOD_BUFFERED,FILE_ANY_ACCESS)
210
211#define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE,0x0300,METHOD_BUFFERED,FILE_ANY_ACCESS)
212#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE,0x0301,METHOD_BUFFERED,FILE_ANY_ACCESS)
213#define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE,0x0304,METHOD_BUFFERED,FILE_ANY_ACCESS)
214#define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE,0x0305,METHOD_BUFFERED,FILE_ANY_ACCESS)
215#define IOCTL_STORAGE_SET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE,0x0306,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
216
217#define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE,0x0400,METHOD_BUFFERED,FILE_READ_ACCESS)
218#define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE,0x0401,METHOD_BUFFERED,FILE_READ_ACCESS)
219#define IOCTL_STORAGE_BREAK_RESERVATION CTL_CODE(IOCTL_STORAGE_BASE,0x0405,METHOD_BUFFERED,FILE_READ_ACCESS)
220#define IOCTL_STORAGE_PERSISTENT_RESERVE_IN CTL_CODE(IOCTL_STORAGE_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS)
221#define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT CTL_CODE(IOCTL_STORAGE_BASE, 0x0407, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
222
223#define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE,0x0420,METHOD_BUFFERED,FILE_ANY_ACCESS)
224#define IOCTL_STORAGE_GET_DEVICE_NUMBER_EX CTL_CODE(IOCTL_STORAGE_BASE,0x0421,METHOD_BUFFERED,FILE_ANY_ACCESS)
225#define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE,0x0440,METHOD_BUFFERED,FILE_ANY_ACCESS)
226#define IOCTL_STORAGE_FAILURE_PREDICTION_CONFIG CTL_CODE(IOCTL_STORAGE_BASE,0x0441,METHOD_BUFFERED,FILE_ANY_ACCESS)
227#define IOCTL_STORAGE_GET_COUNTERS CTL_CODE(IOCTL_STORAGE_BASE,0x442,METHOD_BUFFERED,FILE_ANY_ACCESS)
228#define IOCTL_STORAGE_READ_CAPACITY CTL_CODE(IOCTL_STORAGE_BASE,0x0450,METHOD_BUFFERED,FILE_READ_ACCESS)
229
230#define IOCTL_STORAGE_GET_DEVICE_TELEMETRY CTL_CODE(IOCTL_STORAGE_BASE, 0x0470, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
231#define IOCTL_STORAGE_DEVICE_TELEMETRY_NOTIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0471, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
232#define IOCTL_STORAGE_DEVICE_TELEMETRY_QUERY_CAPS CTL_CODE(IOCTL_STORAGE_BASE, 0x0472, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
233#define IOCTL_STORAGE_GET_DEVICE_TELEMETRY_RAW CTL_CODE(IOCTL_STORAGE_BASE, 0x0473, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
234
235#define IOCTL_STORAGE_SET_TEMPERATURE_THRESHOLD CTL_CODE(IOCTL_STORAGE_BASE, 0x0480, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
236
237#define IOCTL_STORAGE_PROTOCOL_COMMAND CTL_CODE(IOCTL_STORAGE_BASE, 0x04F0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
238
239#define IOCTL_STORAGE_SET_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x04FF, METHOD_BUFFERED, FILE_WRITE_ACCESS)
240#define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
241#define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES CTL_CODE(IOCTL_STORAGE_BASE, 0x0501, METHOD_BUFFERED, FILE_WRITE_ACCESS)
242#define IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES CTL_CODE(IOCTL_STORAGE_BASE, 0x0502, METHOD_BUFFERED, FILE_READ_ACCESS)
243
244#define IOCTL_STORAGE_REINITIALIZE_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0590, METHOD_BUFFERED, FILE_WRITE_ACCESS)
245
246#define IOCTL_STORAGE_GET_BC_PROPERTIES CTL_CODE(IOCTL_STORAGE_BASE, 0x0600, METHOD_BUFFERED, FILE_READ_ACCESS)
247#define IOCTL_STORAGE_ALLOCATE_BC_STREAM CTL_CODE(IOCTL_STORAGE_BASE, 0x0601, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
248#define IOCTL_STORAGE_FREE_BC_STREAM CTL_CODE(IOCTL_STORAGE_BASE, 0x0602, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
249
250#define IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT CTL_CODE(IOCTL_STORAGE_BASE, 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS)
251
252#define IOCTL_STORAGE_START_DATA_INTEGRITY_CHECK CTL_CODE(IOCTL_STORAGE_BASE, 0x0621, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
253#define IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK CTL_CODE(IOCTL_STORAGE_BASE, 0x0622, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
254
255#define OBSOLETE_IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE,0x0400,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
256#define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE,0x0401,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
257
258#define IOCTL_STORAGE_FIRMWARE_GET_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0700, METHOD_BUFFERED, FILE_ANY_ACCESS)
259#define IOCTL_STORAGE_FIRMWARE_DOWNLOAD CTL_CODE(IOCTL_STORAGE_BASE, 0x0701, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
260#define IOCTL_STORAGE_FIRMWARE_ACTIVATE CTL_CODE(IOCTL_STORAGE_BASE, 0x0702, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
261
262#define IOCTL_STORAGE_ENABLE_IDLE_POWER CTL_CODE(IOCTL_STORAGE_BASE, 0x0720, METHOD_BUFFERED, FILE_ANY_ACCESS)
263#define IOCTL_STORAGE_GET_IDLE_POWERUP_REASON CTL_CODE(IOCTL_STORAGE_BASE, 0x0721, METHOD_BUFFERED, FILE_ANY_ACCESS)
264
265#define IOCTL_STORAGE_POWER_ACTIVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0722, METHOD_BUFFERED, FILE_ANY_ACCESS)
266#define IOCTL_STORAGE_POWER_IDLE CTL_CODE(IOCTL_STORAGE_BASE, 0x0723, METHOD_BUFFERED, FILE_ANY_ACCESS)
267
268#define IOCTL_STORAGE_EVENT_NOTIFICATION CTL_CODE(IOCTL_STORAGE_BASE, 0x0724, METHOD_BUFFERED, FILE_ANY_ACCESS)
269#define IOCTL_STORAGE_DEVICE_POWER_CAP CTL_CODE(IOCTL_STORAGE_BASE, 0x0725, METHOD_BUFFERED, FILE_ANY_ACCESS)
270#define IOCTL_STORAGE_RPMB_COMMAND CTL_CODE(IOCTL_STORAGE_BASE, 0x0726, METHOD_BUFFERED, FILE_ANY_ACCESS)
271#define IOCTL_STORAGE_ATTRIBUTE_MANAGEMENT CTL_CODE(IOCTL_STORAGE_BASE, 0x0727, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
272#define IOCTL_STORAGE_DIAGNOSTIC CTL_CODE(IOCTL_STORAGE_BASE, 0x0728, METHOD_BUFFERED, FILE_ANY_ACCESS)
273#define IOCTL_STORAGE_GET_PHYSICAL_ELEMENT_STATUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0729, METHOD_BUFFERED, FILE_ANY_ACCESS)
274#define IOCTL_STORAGE_REMOVE_ELEMENT_AND_TRUNCATE CTL_CODE(IOCTL_STORAGE_BASE, 0x0730, METHOD_BUFFERED, FILE_ANY_ACCESS)
275#define IOCTL_STORAGE_GET_DEVICE_INTERNAL_LOG CTL_CODE(IOCTL_STORAGE_BASE, 0x0731, METHOD_BUFFERED, FILE_ANY_ACCESS)
276
277typedef struct _STORAGE_READ_CAPACITY {
278 ULONG Version;
279 ULONG Size;
280 ULONG BlockLength;
281 LARGE_INTEGER NumberOfBlocks;
282 LARGE_INTEGER DiskLength;
283} STORAGE_READ_CAPACITY, *PSTORAGE_READ_CAPACITY;
284
285#define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES CTL_CODE(IOCTL_STORAGE_BASE, 0x0501, METHOD_BUFFERED, FILE_WRITE_ACCESS)
286#define DeviceDsmActionFlag_NonDestructive 0x80000000
287#define DeviceDsmAction_None 0
288#define DeviceDsmAction_Trim 1
289#define DeviceDsmAction_Notification (2 | DeviceDsmActionFlag_NonDestructive)
290
291#define IsDsmActionNonDestructive(x) ((BOOLEAN)(!!((x) & DeviceDsmActionFlag_NonDestructive)))
292
293#define DEVICE_DSM_FLAG_ENTIRE_DATA_SET_RANGE __MSABI_LONG(0x00000001)
294
295#define DEVICE_DSM_NOTIFY_FLAG_BEGIN 0x00000001
296#define DEVICE_DSM_NOTIFY_FLAG_END 0x00000002
297
298#define IOCTL_STORAGE_BC_VERSION 1
299
300#define STORAGE_PRIORITY_HINT_SUPPORTED 0x0001
301
302 typedef DWORD DEVICE_DATA_MANAGEMENT_SET_ACTION;
303 typedef struct _DEVICE_MANAGE_DATA_SET_ATTRIBUTES {
304 DWORD Size;
305 DEVICE_DATA_MANAGEMENT_SET_ACTION Action;
306 DWORD Flags;
307 DWORD ParameterBlockOffset;
308 DWORD ParameterBlockLength;
309 DWORD DataSetRangesOffset;
310 DWORD DataSetRangesLength;
311 } DEVICE_MANAGE_DATA_SET_ATTRIBUTES, *PDEVICE_MANAGE_DATA_SET_ATTRIBUTES;
312
313 typedef struct _DEVICE_DATA_SET_RANGE {
314 LONGLONG StartingOffset;
315 DWORDLONG LengthInBytes;
316 } DEVICE_DATA_SET_RANGE, *PDEVICE_DATA_SET_RANGE;
317
318 typedef struct _DEVICE_DSM_NOTIFICATION_PARAMETERS {
319 ULONG Size;
320 ULONG Flags;
321 ULONG NumFileTypeIDs;
322 GUID FileTypeID[1];
323 } DEVICE_DSM_NOTIFICATION_PARAMETERS, *PDEVICE_DSM_NOTIFICATION_PARAMETERS;
324
325 typedef struct _STORAGE_GET_BC_PROPERTIES_OUTPUT {
326 ULONG MaximumRequestsPerPeriod;
327 ULONG MinimumPeriod;
328 ULONGLONG MaximumRequestSize;
329 ULONG EstimatedTimePerRequest;
330 ULONG NumOutStandingRequests;
331 ULONGLONG RequestSize;
332 } STORAGE_GET_BC_PROPERTIES_OUTPUT, *PSTORAGE_GET_BC_PROPERTIES_OUTPUT;
333
334 typedef struct _STORAGE_ALLOCATE_BC_STREAM_INPUT {
335 ULONG Version;
336 ULONG RequestsPerPeriod;
337 ULONG Period;
338 BOOLEAN RetryFailures;
339 BOOLEAN Discardable;
340 BOOLEAN Reserved1[2];
341 ULONG AccessType;
342 ULONG AccessMode;
343 } STORAGE_ALLOCATE_BC_STREAM_INPUT, *PSTORAGE_ALLOCATE_BC_STREAM_INPUT;
344
345 typedef struct _STORAGE_ALLOCATE_BC_STREAM_OUTPUT {
346 ULONGLONG RequestSize;
347 ULONG NumOutStandingRequests;
348 } STORAGE_ALLOCATE_BC_STREAM_OUTPUT, *PSTORAGE_ALLOCATE_BC_STREAM_OUTPUT;
349
350 typedef struct _STORAGE_PRIORITY_HINT_SUPPORT {
351 ULONG SupportFlags;
352 } STORAGE_PRIORITY_HINT_SUPPORT, *PSTORAGE_PRIORITY_HINT_SUPPORT;
353
354#if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
355
356 typedef struct _STORAGE_MEDIA_SERIAL_NUMBER_DATA {
357 USHORT Reserved;
358 USHORT SerialNumberLength;
359 UCHAR SerialNumber[0];
360 } STORAGE_MEDIA_SERIAL_NUMBER_DATA, *PSTORAGE_MEDIA_SERIAL_NUMBER_DATA;
361
362 typedef struct _PERSISTENT_RESERVE_COMMAND {
363 ULONG Version;
364 ULONG Size;
365 __C89_NAMELESS union {
366 struct {
367 UCHAR ServiceAction:5;
368 UCHAR Reserved1:3;
369 USHORT AllocationLength;
370 } PR_IN;
371 struct {
372 UCHAR ServiceAction:5;
373 UCHAR Reserved1:3;
374 UCHAR Type:4;
375 UCHAR Scope:4;
376 UCHAR ParameterList[0];
377 } PR_OUT;
378 } DUMMYUNIONNAME;
379 } PERSISTENT_RESERVE_COMMAND, *PPERSISTENT_RESERVE_COMMAND;
380
381#endif /* defined(_MSC_EXTENSIONS) */
382
383 typedef struct _STORAGE_HOTPLUG_INFO {
384 DWORD Size;
385 BOOLEAN MediaRemovable;
386 BOOLEAN MediaHotplug;
387 BOOLEAN DeviceHotplug;
388 BOOLEAN WriteCacheEnableOverride;
389 } STORAGE_HOTPLUG_INFO,*PSTORAGE_HOTPLUG_INFO;
390
391 typedef struct _STORAGE_DEVICE_NUMBER {
392 DEVICE_TYPE DeviceType;
393 DWORD DeviceNumber;
394 DWORD PartitionNumber;
395 } STORAGE_DEVICE_NUMBER,*PSTORAGE_DEVICE_NUMBER;
396
397 typedef struct _STORAGE_DEVICE_NUMBERS {
398 DWORD Version;
399 DWORD Size;
400 DWORD NumberOfDevices;
401 STORAGE_DEVICE_NUMBER Devices[ANYSIZE_ARRAY];
402 } STORAGE_DEVICE_NUMBERS,*PSTORAGE_DEVICE_NUMBERS;
403
404#define STORAGE_DEVICE_FLAGS_RANDOM_DEVICEGUID_REASON_CONFLICT 0x1
405#define STORAGE_DEVICE_FLAGS_RANDOM_DEVICEGUID_REASON_NOHWID 0x2
406#define STORAGE_DEVICE_FLAGS_PAGE_83_DEVICEGUID 0x4
407
408 typedef struct _STORAGE_DEVICE_NUMBER_EX {
409 DWORD Version;
410 DWORD Size;
411 DWORD Flags;
412 DEVICE_TYPE DeviceType;
413 DWORD DeviceNumber;
414 GUID DeviceGuid;
415 DWORD PartitionNumber;
416 } STORAGE_DEVICE_NUMBER_EX,*PSTORAGE_DEVICE_NUMBER_EX;
417
418 typedef struct _STORAGE_BUS_RESET_REQUEST {
419 BYTE PathId;
420 } STORAGE_BUS_RESET_REQUEST,*PSTORAGE_BUS_RESET_REQUEST;
421
422 typedef struct STORAGE_BREAK_RESERVATION_REQUEST {
423 DWORD Length;
424 BYTE _unused;
425 BYTE PathId;
426 BYTE TargetId;
427 BYTE Lun;
428 } STORAGE_BREAK_RESERVATION_REQUEST,*PSTORAGE_BREAK_RESERVATION_REQUEST;
429
430 typedef struct _PREVENT_MEDIA_REMOVAL {
431 BOOLEAN PreventMediaRemoval;
432 } PREVENT_MEDIA_REMOVAL,*PPREVENT_MEDIA_REMOVAL;
433
434 typedef struct _CLASS_MEDIA_CHANGE_CONTEXT {
435 DWORD MediaChangeCount;
436 DWORD NewState;
437 } CLASS_MEDIA_CHANGE_CONTEXT,*PCLASS_MEDIA_CHANGE_CONTEXT;
438
439 typedef struct _TAPE_STATISTICS {
440 DWORD Version;
441 DWORD Flags;
442 LARGE_INTEGER RecoveredWrites;
443 LARGE_INTEGER UnrecoveredWrites;
444 LARGE_INTEGER RecoveredReads;
445 LARGE_INTEGER UnrecoveredReads;
446 BYTE CompressionRatioReads;
447 BYTE CompressionRatioWrites;
448 } TAPE_STATISTICS,*PTAPE_STATISTICS;
449
450#define RECOVERED_WRITES_VALID 0x00000001
451#define UNRECOVERED_WRITES_VALID 0x00000002
452#define RECOVERED_READS_VALID 0x00000004
453#define UNRECOVERED_READS_VALID 0x00000008
454#define WRITE_COMPRESSION_INFO_VALID 0x00000010
455#define READ_COMPRESSION_INFO_VALID 0x00000020
456
457 typedef struct _TAPE_GET_STATISTICS {
458 DWORD Operation;
459 } TAPE_GET_STATISTICS,*PTAPE_GET_STATISTICS;
460
461#define TAPE_RETURN_STATISTICS __MSABI_LONG(0)
462#define TAPE_RETURN_ENV_INFO __MSABI_LONG(1)
463#define TAPE_RESET_STATISTICS __MSABI_LONG(2)
464
465 typedef enum _STORAGE_MEDIA_TYPE {
466 DDS_4mm = 0x20,
467 MiniQic,
468 Travan,
469 QIC,
470 MP_8mm,
471 AME_8mm,
472 AIT1_8mm,
473 DLT,
474 NCTP,
475 IBM_3480,
476 IBM_3490E,
477 IBM_Magstar_3590,
478 IBM_Magstar_MP,
479 STK_DATA_D3,
480 SONY_DTF,
481 DV_6mm,
482 DMI,
483 SONY_D2,
484 CLEANER_CARTRIDGE,
485 CD_ROM,
486 CD_R,
487 CD_RW,
488 DVD_ROM,
489 DVD_R,
490 DVD_RW,
491 MO_3_RW,
492 MO_5_WO,
493 MO_5_RW,
494 MO_5_LIMDOW,
495 PC_5_WO,
496 PC_5_RW,
497 PD_5_RW,
498 ABL_5_WO,
499 PINNACLE_APEX_5_RW,
500 SONY_12_WO,
501 PHILIPS_12_WO,
502 HITACHI_12_WO,
503 CYGNET_12_WO,
504 KODAK_14_WO,
505 MO_NFR_525,
506 NIKON_12_RW,
507 IOMEGA_ZIP,
508 IOMEGA_JAZ,
509 SYQUEST_EZ135,
510 SYQUEST_EZFLYER,
511 SYQUEST_SYJET,
512 AVATAR_F2,
513 MP2_8mm,
514 DST_S,
515 DST_M,
516 DST_L,
517 VXATape_1,
518 VXATape_2,
519 STK_9840,
520 LTO_Ultrium,
521 LTO_Accelis,
522 DVD_RAM,
523 AIT_8mm,
524 ADR_1,
525 ADR_2,
526 STK_9940,
527 SAIT,
528 VXATape
529 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
530
531#define MEDIA_ERASEABLE 0x00000001
532#define MEDIA_WRITE_ONCE 0x00000002
533#define MEDIA_READ_ONLY 0x00000004
534#define MEDIA_READ_WRITE 0x00000008
535
536#define MEDIA_WRITE_PROTECTED 0x00000100
537#define MEDIA_CURRENTLY_MOUNTED 0x80000000
538
539 typedef enum _STORAGE_BUS_TYPE {
540 BusTypeUnknown = 0x00,
541 BusTypeScsi = 0x1,
542 BusTypeAtapi = 0x2,
543 BusTypeAta = 0x3,
544 BusType1394 = 0x4,
545 BusTypeSsa = 0x5,
546 BusTypeFibre = 0x6,
547 BusTypeUsb = 0x7,
548 BusTypeRAID = 0x8,
549#if (_WIN32_WINNT >= 0x0600)
550 BusTypeiScsi = 0x9,
551 BusTypeSas = 0xA,
552 BusTypeSata = 0xB,
553 BusTypeSd = 0xC,
554 BusTypeMmc = 0xD,
555#endif /*(_WIN32_WINNT >= 0x0600)*/
556#if (_WIN32_WINNT >= 0x0601)
557 BusTypeVirtual = 0xE,
558 BusTypeFileBackedVirtual = 0xF,
559 BusTypeSpaces = 0x10,
560 BusTypeNvme = 0x11,
561 BusTypeSCM = 0x12,
562 BusTypeUfs = 0x13,
563#endif /*(_WIN32_WINNT >= 0x0601)*/
564 BusTypeMax,
565 BusTypeMaxReserved = 0x7F
566 } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
567
568#define SupportsDeviceSharing(BusType) ((BusType == BusTypeScsi) || (BusType == BusTypeFibre) || (BusType == BusTypeiScsi) || (BusType == BusTypeSas) || (BusType == BusTypeSpaces))
569
570 typedef struct _DEVICE_MEDIA_INFO {
571 union {
572 struct {
573 LARGE_INTEGER Cylinders;
574 STORAGE_MEDIA_TYPE MediaType;
575 DWORD TracksPerCylinder;
576 DWORD SectorsPerTrack;
577 DWORD BytesPerSector;
578 DWORD NumberMediaSides;
579 DWORD MediaCharacteristics;
580 } DiskInfo;
581 struct {
582 LARGE_INTEGER Cylinders;
583 STORAGE_MEDIA_TYPE MediaType;
584 DWORD TracksPerCylinder;
585 DWORD SectorsPerTrack;
586 DWORD BytesPerSector;
587 DWORD NumberMediaSides;
588 DWORD MediaCharacteristics;
589 } RemovableDiskInfo;
590 struct {
591 STORAGE_MEDIA_TYPE MediaType;
592 DWORD MediaCharacteristics;
593 DWORD CurrentBlockSize;
594 STORAGE_BUS_TYPE BusType;
595 union {
596 struct {
597 BYTE MediumType;
598 BYTE DensityCode;
599 } ScsiInformation;
600 } BusSpecificData;
601 } TapeInfo;
602 } DeviceSpecific;
603 } DEVICE_MEDIA_INFO,*PDEVICE_MEDIA_INFO;
604
605 typedef struct _GET_MEDIA_TYPES {
606 DWORD DeviceType;
607 DWORD MediaInfoCount;
608 DEVICE_MEDIA_INFO MediaInfo[1];
609 } GET_MEDIA_TYPES,*PGET_MEDIA_TYPES;
610
611 typedef struct _STORAGE_PREDICT_FAILURE {
612 DWORD PredictFailure;
613 BYTE VendorSpecific[512];
614 } STORAGE_PREDICT_FAILURE,*PSTORAGE_PREDICT_FAILURE;
615
616 typedef struct _STORAGE_FAILURE_PREDICTION_CONFIG {
617 DWORD Version;
618 DWORD Size;
619 BOOLEAN Set;
620 BOOLEAN Enabled;
621 WORD Reserved;
622 } STORAGE_FAILURE_PREDICTION_CONFIG,*PSTORAGE_FAILURE_PREDICTION_CONFIG;
623
624#define STORAGE_FAILURE_PREDICTION_CONFIG_V1 1
625
626#ifdef __cplusplus
627}
628#endif
629#endif /* _NTDDSTOR_H_ */
630
631
632#ifndef _NTDDDISK_H_
633#define _NTDDDISK_H_
634
635#define IOCTL_DISK_BASE FILE_DEVICE_DISK
636#define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE,0x0000,METHOD_BUFFERED,FILE_ANY_ACCESS)
637#define IOCTL_DISK_GET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,0x0001,METHOD_BUFFERED,FILE_READ_ACCESS)
638#define IOCTL_DISK_SET_PARTITION_INFO CTL_CODE(IOCTL_DISK_BASE,0x0002,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
639#define IOCTL_DISK_GET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x0003,METHOD_BUFFERED,FILE_READ_ACCESS)
640#define IOCTL_DISK_SET_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x0004,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
641#define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x0005,METHOD_BUFFERED,FILE_ANY_ACCESS)
642#define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE,0x0006,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
643#define IOCTL_DISK_REASSIGN_BLOCKS CTL_CODE(IOCTL_DISK_BASE,0x0007,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
644#define IOCTL_DISK_PERFORMANCE CTL_CODE(IOCTL_DISK_BASE,0x0008,METHOD_BUFFERED,FILE_ANY_ACCESS)
645#define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE,0x0009,METHOD_BUFFERED,FILE_ANY_ACCESS)
646#define IOCTL_DISK_LOGGING CTL_CODE(IOCTL_DISK_BASE,0x000a,METHOD_BUFFERED,FILE_ANY_ACCESS)
647#define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE,0x000b,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
648#define IOCTL_DISK_HISTOGRAM_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,0x000c,METHOD_BUFFERED,FILE_ANY_ACCESS)
649#define IOCTL_DISK_HISTOGRAM_DATA CTL_CODE(IOCTL_DISK_BASE,0x000d,METHOD_BUFFERED,FILE_ANY_ACCESS)
650#define IOCTL_DISK_HISTOGRAM_RESET CTL_CODE(IOCTL_DISK_BASE,0x000e,METHOD_BUFFERED,FILE_ANY_ACCESS)
651#define IOCTL_DISK_REQUEST_STRUCTURE CTL_CODE(IOCTL_DISK_BASE,0x000f,METHOD_BUFFERED,FILE_ANY_ACCESS)
652#define IOCTL_DISK_REQUEST_DATA CTL_CODE(IOCTL_DISK_BASE,0x0010,METHOD_BUFFERED,FILE_ANY_ACCESS)
653#define IOCTL_DISK_PERFORMANCE_OFF CTL_CODE(IOCTL_DISK_BASE,0x0018,METHOD_BUFFERED,FILE_ANY_ACCESS)
654#define IOCTL_DISK_CONTROLLER_NUMBER CTL_CODE(IOCTL_DISK_BASE,0x0011,METHOD_BUFFERED,FILE_ANY_ACCESS)
655
656#define SMART_GET_VERSION CTL_CODE(IOCTL_DISK_BASE,0x0020,METHOD_BUFFERED,FILE_READ_ACCESS)
657#define SMART_SEND_DRIVE_COMMAND CTL_CODE(IOCTL_DISK_BASE,0x0021,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
658#define SMART_RCV_DRIVE_DATA CTL_CODE(IOCTL_DISK_BASE,0x0022,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
659
660#define IOCTL_DISK_GET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x0012,METHOD_BUFFERED,FILE_ANY_ACCESS)
661#define IOCTL_DISK_SET_PARTITION_INFO_EX CTL_CODE(IOCTL_DISK_BASE,0x0013,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
662#define IOCTL_DISK_GET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x0014,METHOD_BUFFERED,FILE_ANY_ACCESS)
663#define IOCTL_DISK_SET_DRIVE_LAYOUT_EX CTL_CODE(IOCTL_DISK_BASE,0x0015,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
664#define IOCTL_DISK_CREATE_DISK CTL_CODE(IOCTL_DISK_BASE,0x0016,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
665#define IOCTL_DISK_GET_LENGTH_INFO CTL_CODE(IOCTL_DISK_BASE,0x0017,METHOD_BUFFERED,FILE_READ_ACCESS)
666#define IOCTL_DISK_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_DISK_BASE,0x0028,METHOD_BUFFERED,FILE_ANY_ACCESS)
667
668#define IOCTL_DISK_REASSIGN_BLOCKS_EX CTL_CODE(IOCTL_DISK_BASE,0x0029,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
669#define IOCTL_DISK_UPDATE_DRIVE_SIZE CTL_CODE(IOCTL_DISK_BASE,0x0032,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
670#define IOCTL_DISK_GROW_PARTITION CTL_CODE(IOCTL_DISK_BASE,0x0034,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
671#define IOCTL_DISK_GET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x0035,METHOD_BUFFERED,FILE_READ_ACCESS)
672#define IOCTL_DISK_SET_CACHE_INFORMATION CTL_CODE(IOCTL_DISK_BASE,0x0036,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
673#define OBSOLETE_DISK_GET_WRITE_CACHE_STATE CTL_CODE(IOCTL_DISK_BASE,0x0037,METHOD_BUFFERED,FILE_READ_ACCESS)
674#define IOCTL_DISK_DELETE_DRIVE_LAYOUT CTL_CODE(IOCTL_DISK_BASE,0x0040,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
675#define IOCTL_DISK_UPDATE_PROPERTIES CTL_CODE(IOCTL_DISK_BASE,0x0050,METHOD_BUFFERED,FILE_ANY_ACCESS)
676#define IOCTL_DISK_RESET_SNAPSHOT_INFO CTL_CODE(IOCTL_DISK_BASE,0x0084,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
677#define IOCTL_DISK_FORMAT_DRIVE CTL_CODE(IOCTL_DISK_BASE,0x00f3,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
678#define IOCTL_DISK_SENSE_DEVICE CTL_CODE(IOCTL_DISK_BASE,0x00f8,METHOD_BUFFERED,FILE_ANY_ACCESS)
679#define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE,0x0200,METHOD_BUFFERED,FILE_READ_ACCESS)
680#define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE,0x0201,METHOD_BUFFERED,FILE_READ_ACCESS)
681#define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x0202,METHOD_BUFFERED,FILE_READ_ACCESS)
682#define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE,0x0203,METHOD_BUFFERED,FILE_READ_ACCESS)
683#define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE,0x0204,METHOD_BUFFERED,FILE_READ_ACCESS)
684#define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE,0x0205,METHOD_BUFFERED,FILE_READ_ACCESS)
685#define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE,0x0206,METHOD_BUFFERED,FILE_READ_ACCESS)
686#define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE,0x0300,METHOD_BUFFERED,FILE_ANY_ACCESS)
687#define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
688
689#define PARTITION_ENTRY_UNUSED 0x00
690#define PARTITION_FAT_12 0x01
691#define PARTITION_XENIX_1 0x02
692#define PARTITION_XENIX_2 0x03
693#define PARTITION_FAT_16 0x04
694#define PARTITION_EXTENDED 0x05
695#define PARTITION_HUGE 0x06
696#define PARTITION_IFS 0x07
697#define PARTITION_OS2BOOTMGR 0x0A
698#define PARTITION_FAT32 0x0B
699#define PARTITION_FAT32_XINT13 0x0C
700#define PARTITION_XINT13 0x0E
701#define PARTITION_XINT13_EXTENDED 0x0F
702#define PARTITION_PREP 0x41
703#define PARTITION_LDM 0x42
704#define PARTITION_UNIX 0x63
705
706#define VALID_NTFT 0xC0
707
708#define PARTITION_NTFT 0x80
709
710#define IsRecognizedPartition(PartitionType) (((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_FAT_12)) || ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_IFS)) || ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_HUGE)) || ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_FAT32)) || ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_FAT32_XINT13)) || ((PartitionType & PARTITION_NTFT) && ((PartitionType & ~0xC0)==PARTITION_XINT13)) || ((PartitionType)==PARTITION_FAT_12) || ((PartitionType)==PARTITION_FAT_16) || ((PartitionType)==PARTITION_IFS) || ((PartitionType)==PARTITION_HUGE) || ((PartitionType)==PARTITION_FAT32) || ((PartitionType)==PARTITION_FAT32_XINT13) || ((PartitionType)==PARTITION_XINT13))
711#define IsContainerPartition(PartitionType) ((PartitionType==PARTITION_EXTENDED) || (PartitionType==PARTITION_XINT13_EXTENDED))
712#define IsFTPartition(PartitionType) (((PartitionType)&PARTITION_NTFT) && IsRecognizedPartition(PartitionType))
713
714typedef enum _MEDIA_TYPE {
715 Unknown,F5_1Pt2_512,F3_1Pt44_512,F3_2Pt88_512,F3_20Pt8_512,F3_720_512,F5_360_512,F5_320_512,F5_320_1024,F5_180_512,F5_160_512,
716 RemovableMedia,FixedMedia,F3_120M_512,F3_640_512,F5_640_512,F5_720_512,F3_1Pt2_512,F3_1Pt23_1024,F5_1Pt23_1024,F3_128Mb_512,
717 F3_230Mb_512,F8_256_128,F3_200Mb_512,F3_240M_512,F3_32M_512
718} MEDIA_TYPE,*PMEDIA_TYPE;
719
720typedef struct _FORMAT_PARAMETERS {
721 MEDIA_TYPE MediaType;
722 DWORD StartCylinderNumber;
723 DWORD EndCylinderNumber;
724 DWORD StartHeadNumber;
725 DWORD EndHeadNumber;
726} FORMAT_PARAMETERS,*PFORMAT_PARAMETERS;
727
728typedef WORD BAD_TRACK_NUMBER;
729typedef WORD *PBAD_TRACK_NUMBER;
730
731typedef struct _FORMAT_EX_PARAMETERS {
732 MEDIA_TYPE MediaType;
733 DWORD StartCylinderNumber;
734 DWORD EndCylinderNumber;
735 DWORD StartHeadNumber;
736 DWORD EndHeadNumber;
737 WORD FormatGapLength;
738 WORD SectorsPerTrack;
739 WORD SectorNumber[1];
740} FORMAT_EX_PARAMETERS,*PFORMAT_EX_PARAMETERS;
741
742typedef struct _DISK_GEOMETRY {
743 LARGE_INTEGER Cylinders;
744 MEDIA_TYPE MediaType;
745 DWORD TracksPerCylinder;
746 DWORD SectorsPerTrack;
747 DWORD BytesPerSector;
748} DISK_GEOMETRY,*PDISK_GEOMETRY;
749
750#define WMI_DISK_GEOMETRY_GUID { 0x25007f51,0x57c2,0x11d1,{ 0xa5,0x28,0x0,0xa0,0xc9,0x6,0x29,0x10 } }
751
752typedef struct _PARTITION_INFORMATION {
753 LARGE_INTEGER StartingOffset;
754 LARGE_INTEGER PartitionLength;
755 DWORD HiddenSectors;
756 DWORD PartitionNumber;
757 BYTE PartitionType;
758 BOOLEAN BootIndicator;
759 BOOLEAN RecognizedPartition;
760 BOOLEAN RewritePartition;
761} PARTITION_INFORMATION,*PPARTITION_INFORMATION;
762
763typedef struct _SET_PARTITION_INFORMATION {
764 BYTE PartitionType;
765} SET_PARTITION_INFORMATION,*PSET_PARTITION_INFORMATION;
766
767typedef struct _DRIVE_LAYOUT_INFORMATION {
768 DWORD PartitionCount;
769 DWORD Signature;
770 PARTITION_INFORMATION PartitionEntry[1];
771} DRIVE_LAYOUT_INFORMATION,*PDRIVE_LAYOUT_INFORMATION;
772
773typedef struct _VERIFY_INFORMATION {
774 LARGE_INTEGER StartingOffset;
775 DWORD Length;
776} VERIFY_INFORMATION,*PVERIFY_INFORMATION;
777
778typedef struct _REASSIGN_BLOCKS {
779 WORD Reserved;
780 WORD Count;
781 DWORD BlockNumber[1];
782} REASSIGN_BLOCKS,*PREASSIGN_BLOCKS;
783
784#include <pshpack1.h>
785typedef struct _REASSIGN_BLOCKS_EX {
786 WORD Reserved;
787 WORD Count;
788 LARGE_INTEGER BlockNumber[1];
789} REASSIGN_BLOCKS_EX,*PREASSIGN_BLOCKS_EX;
790#include <poppack.h>
791
792typedef enum _PARTITION_STYLE {
793 PARTITION_STYLE_MBR,PARTITION_STYLE_GPT,PARTITION_STYLE_RAW
794} PARTITION_STYLE;
795
796typedef struct _PARTITION_INFORMATION_GPT {
797 GUID PartitionType;
798 GUID PartitionId;
799 DWORD64 Attributes;
800 WCHAR Name [36];
801} PARTITION_INFORMATION_GPT,*PPARTITION_INFORMATION_GPT;
802
803#define GPT_ATTRIBUTE_PLATFORM_REQUIRED (0x0000000000000001)
804
805#define GPT_BASIC_DATA_ATTRIBUTE_NO_DRIVE_LETTER (0x8000000000000000)
806#define GPT_BASIC_DATA_ATTRIBUTE_HIDDEN (0x4000000000000000)
807#define GPT_BASIC_DATA_ATTRIBUTE_SHADOW_COPY (0x2000000000000000)
808#define GPT_BASIC_DATA_ATTRIBUTE_READ_ONLY (0x1000000000000000)
809
810typedef struct _PARTITION_INFORMATION_MBR {
811 BYTE PartitionType;
812 BOOLEAN BootIndicator;
813 BOOLEAN RecognizedPartition;
814 DWORD HiddenSectors;
815#if NTDDI_VERSION > NTDDI_WINBLUE
816 GUID PartitionId;
817#endif
818} PARTITION_INFORMATION_MBR,*PPARTITION_INFORMATION_MBR;
819
820typedef SET_PARTITION_INFORMATION SET_PARTITION_INFORMATION_MBR;
821typedef PARTITION_INFORMATION_GPT SET_PARTITION_INFORMATION_GPT;
822
823typedef struct _SET_PARTITION_INFORMATION_EX {
824 PARTITION_STYLE PartitionStyle;
825 __C89_NAMELESS union {
826 SET_PARTITION_INFORMATION_MBR Mbr;
827 SET_PARTITION_INFORMATION_GPT Gpt;
828 } DUMMYUNIONNAME;
829} SET_PARTITION_INFORMATION_EX,*PSET_PARTITION_INFORMATION_EX;
830
831typedef struct _CREATE_DISK_GPT {
832 GUID DiskId;
833 DWORD MaxPartitionCount;
834} CREATE_DISK_GPT,*PCREATE_DISK_GPT;
835
836typedef struct _CREATE_DISK_MBR {
837 DWORD Signature;
838} CREATE_DISK_MBR,*PCREATE_DISK_MBR;
839
840typedef struct _CREATE_DISK {
841 PARTITION_STYLE PartitionStyle;
842 __C89_NAMELESS union {
843 CREATE_DISK_MBR Mbr;
844 CREATE_DISK_GPT Gpt;
845 } DUMMYUNIONNAME;
846} CREATE_DISK,*PCREATE_DISK;
847
848typedef struct _GET_LENGTH_INFORMATION {
849 LARGE_INTEGER Length;
850} GET_LENGTH_INFORMATION,*PGET_LENGTH_INFORMATION;
851
852typedef struct _PARTITION_INFORMATION_EX {
853 PARTITION_STYLE PartitionStyle;
854 LARGE_INTEGER StartingOffset;
855 LARGE_INTEGER PartitionLength;
856 DWORD PartitionNumber;
857 BOOLEAN RewritePartition;
858#if NTDDI_VERSION >= NTDDI_WIN10_RS3
859 BOOLEAN IsServicePartition;
860#endif
861 __C89_NAMELESS union {
862 PARTITION_INFORMATION_MBR Mbr;
863 PARTITION_INFORMATION_GPT Gpt;
864 } DUMMYUNIONNAME;
865} PARTITION_INFORMATION_EX,*PPARTITION_INFORMATION_EX;
866
867typedef struct _DRIVE_LAYOUT_INFORMATION_GPT {
868 GUID DiskId;
869 LARGE_INTEGER StartingUsableOffset;
870 LARGE_INTEGER UsableLength;
871 DWORD MaxPartitionCount;
872} DRIVE_LAYOUT_INFORMATION_GPT,*PDRIVE_LAYOUT_INFORMATION_GPT;
873
874typedef struct _DRIVE_LAYOUT_INFORMATION_MBR {
875 DWORD Signature;
876} DRIVE_LAYOUT_INFORMATION_MBR,*PDRIVE_LAYOUT_INFORMATION_MBR;
877
878typedef struct _DRIVE_LAYOUT_INFORMATION_EX {
879 DWORD PartitionStyle;
880 DWORD PartitionCount;
881 __C89_NAMELESS union {
882 DRIVE_LAYOUT_INFORMATION_MBR Mbr;
883 DRIVE_LAYOUT_INFORMATION_GPT Gpt;
884 } DUMMYUNIONNAME;
885 PARTITION_INFORMATION_EX PartitionEntry[1];
886} DRIVE_LAYOUT_INFORMATION_EX,*PDRIVE_LAYOUT_INFORMATION_EX;
887
888typedef enum _DETECTION_TYPE {
889 DetectNone,DetectInt13,DetectExInt13
890} DETECTION_TYPE;
891
892typedef struct _DISK_INT13_INFO {
893 WORD DriveSelect;
894 DWORD MaxCylinders;
895 WORD SectorsPerTrack;
896 WORD MaxHeads;
897 WORD NumberDrives;
898} DISK_INT13_INFO,*PDISK_INT13_INFO;
899
900typedef struct _DISK_EX_INT13_INFO {
901 WORD ExBufferSize;
902 WORD ExFlags;
903 DWORD ExCylinders;
904 DWORD ExHeads;
905 DWORD ExSectorsPerTrack;
906 DWORD64 ExSectorsPerDrive;
907 WORD ExSectorSize;
908 WORD ExReserved;
909} DISK_EX_INT13_INFO,*PDISK_EX_INT13_INFO;
910
911typedef struct _DISK_DETECTION_INFO {
912 DWORD SizeOfDetectInfo;
913 DETECTION_TYPE DetectionType;
914 __C89_NAMELESS union {
915 __C89_NAMELESS struct {
916 DISK_INT13_INFO Int13;
917 DISK_EX_INT13_INFO ExInt13;
918 } DUMMYSTRUCTNAME;
919 } DUMMYUNIONNAME;
920} DISK_DETECTION_INFO,*PDISK_DETECTION_INFO;
921
922typedef struct _DISK_PARTITION_INFO {
923 DWORD SizeOfPartitionInfo;
924 PARTITION_STYLE PartitionStyle;
925 __C89_NAMELESS union {
926 struct {
927 DWORD Signature;
928 DWORD CheckSum;
929 } Mbr;
930 struct {
931 GUID DiskId;
932 } Gpt;
933 } DUMMYUNIONNAME;
934} DISK_PARTITION_INFO,*PDISK_PARTITION_INFO;
935
936#define DiskGeometryGetPartition(Geometry) ((PDISK_PARTITION_INFO)((Geometry)->Data))
937#define DiskGeometryGetDetect(Geometry) ((PDISK_DETECTION_INFO)(((DWORD_PTR)DiskGeometryGetPartition(Geometry)+ DiskGeometryGetPartition(Geometry)->SizeOfPartitionInfo)))
938
939typedef struct _DISK_GEOMETRY_EX {
940 DISK_GEOMETRY Geometry;
941 LARGE_INTEGER DiskSize;
942 BYTE Data[1];
943} DISK_GEOMETRY_EX,*PDISK_GEOMETRY_EX;
944
945typedef struct _DISK_CONTROLLER_NUMBER {
946 DWORD ControllerNumber;
947 DWORD DiskNumber;
948} DISK_CONTROLLER_NUMBER,*PDISK_CONTROLLER_NUMBER;
949
950typedef enum {
951 EqualPriority,KeepPrefetchedData,KeepReadData
952} DISK_CACHE_RETENTION_PRIORITY;
953
954typedef struct _DISK_CACHE_INFORMATION {
955 BOOLEAN ParametersSavable;
956 BOOLEAN ReadCacheEnabled;
957 BOOLEAN WriteCacheEnabled;
958 DISK_CACHE_RETENTION_PRIORITY ReadRetentionPriority;
959 DISK_CACHE_RETENTION_PRIORITY WriteRetentionPriority;
960 WORD DisablePrefetchTransferLength;
961 BOOLEAN PrefetchScalar;
962 __C89_NAMELESS union {
963 struct {
964 WORD Minimum;
965 WORD Maximum;
966 WORD MaximumBlocks;
967 } ScalarPrefetch;
968 struct {
969 WORD Minimum;
970 WORD Maximum;
971 } BlockPrefetch;
972 } DUMMYUNIONNAME;
973} DISK_CACHE_INFORMATION,*PDISK_CACHE_INFORMATION;
974
975typedef struct _DISK_GROW_PARTITION {
976 DWORD PartitionNumber;
977 LARGE_INTEGER BytesToGrow;
978} DISK_GROW_PARTITION,*PDISK_GROW_PARTITION;
979
980#define HIST_NO_OF_BUCKETS 24
981
982typedef struct _HISTOGRAM_BUCKET {
983 DWORD Reads;
984 DWORD Writes;
985} HISTOGRAM_BUCKET,*PHISTOGRAM_BUCKET;
986
987#define HISTOGRAM_BUCKET_SIZE sizeof(HISTOGRAM_BUCKET)
988
989typedef struct _DISK_HISTOGRAM {
990 LARGE_INTEGER DiskSize;
991 LARGE_INTEGER Start;
992 LARGE_INTEGER End;
993 LARGE_INTEGER Average;
994 LARGE_INTEGER AverageRead;
995 LARGE_INTEGER AverageWrite;
996 DWORD Granularity;
997 DWORD Size;
998 DWORD ReadCount;
999 DWORD WriteCount;
1000 PHISTOGRAM_BUCKET Histogram;
1001} DISK_HISTOGRAM,*PDISK_HISTOGRAM;
1002
1003#define DISK_HISTOGRAM_SIZE sizeof(DISK_HISTOGRAM)
1004
1005typedef struct _DISK_PERFORMANCE {
1006 LARGE_INTEGER BytesRead;
1007 LARGE_INTEGER BytesWritten;
1008 LARGE_INTEGER ReadTime;
1009 LARGE_INTEGER WriteTime;
1010 LARGE_INTEGER IdleTime;
1011 DWORD ReadCount;
1012 DWORD WriteCount;
1013 DWORD QueueDepth;
1014 DWORD SplitCount;
1015 LARGE_INTEGER QueryTime;
1016 DWORD StorageDeviceNumber;
1017 WCHAR StorageManagerName[8];
1018} DISK_PERFORMANCE,*PDISK_PERFORMANCE;
1019
1020typedef struct _DISK_RECORD {
1021 LARGE_INTEGER ByteOffset;
1022 LARGE_INTEGER StartTime;
1023 LARGE_INTEGER EndTime;
1024 PVOID VirtualAddress;
1025 DWORD NumberOfBytes;
1026 BYTE DeviceNumber;
1027 BOOLEAN ReadRequest;
1028} DISK_RECORD,*PDISK_RECORD;
1029
1030typedef struct _DISK_LOGGING {
1031 BYTE Function;
1032 PVOID BufferAddress;
1033 DWORD BufferSize;
1034} DISK_LOGGING,*PDISK_LOGGING;
1035
1036#define DISK_LOGGING_START 0
1037#define DISK_LOGGING_STOP 1
1038#define DISK_LOGGING_DUMP 2
1039#define DISK_BINNING 3
1040
1041typedef enum _BIN_TYPES {
1042 RequestSize,RequestLocation
1043} BIN_TYPES;
1044
1045typedef struct _BIN_RANGE {
1046 LARGE_INTEGER StartValue;
1047 LARGE_INTEGER Length;
1048} BIN_RANGE,*PBIN_RANGE;
1049
1050typedef struct _PERF_BIN {
1051 DWORD NumberOfBins;
1052 DWORD TypeOfBin;
1053 BIN_RANGE BinsRanges[1];
1054} PERF_BIN,*PPERF_BIN;
1055
1056typedef struct _BIN_COUNT {
1057 BIN_RANGE BinRange;
1058 DWORD BinCount;
1059} BIN_COUNT,*PBIN_COUNT;
1060
1061typedef struct _BIN_RESULTS {
1062 DWORD NumberOfBins;
1063 BIN_COUNT BinCounts[1];
1064} BIN_RESULTS,*PBIN_RESULTS;
1065
1066#include <pshpack1.h>
1067typedef struct _GETVERSIONINPARAMS {
1068 BYTE bVersion;
1069 BYTE bRevision;
1070 BYTE bReserved;
1071 BYTE bIDEDeviceMap;
1072 DWORD fCapabilities;
1073 DWORD dwReserved[4];
1074} GETVERSIONINPARAMS,*PGETVERSIONINPARAMS,*LPGETVERSIONINPARAMS;
1075#include <poppack.h>
1076
1077#define CAP_ATA_ID_CMD 1
1078#define CAP_ATAPI_ID_CMD 2
1079#define CAP_SMART_CMD 4
1080
1081#include <pshpack1.h>
1082typedef struct _IDEREGS {
1083 BYTE bFeaturesReg;
1084 BYTE bSectorCountReg;
1085 BYTE bSectorNumberReg;
1086 BYTE bCylLowReg;
1087 BYTE bCylHighReg;
1088 BYTE bDriveHeadReg;
1089 BYTE bCommandReg;
1090 BYTE bReserved;
1091} IDEREGS,*PIDEREGS,*LPIDEREGS;
1092#include <poppack.h>
1093
1094#define ATAPI_ID_CMD 0xA1
1095#define ID_CMD 0xEC
1096#define SMART_CMD 0xB0
1097
1098#define SMART_CYL_LOW 0x4F
1099#define SMART_CYL_HI 0xC2
1100
1101#include <pshpack1.h>
1102typedef struct _SENDCMDINPARAMS {
1103 DWORD cBufferSize;
1104 IDEREGS irDriveRegs;
1105 BYTE bDriveNumber;
1106 BYTE bReserved[3];
1107 DWORD dwReserved[4];
1108 BYTE bBuffer[1];
1109} SENDCMDINPARAMS,*PSENDCMDINPARAMS,*LPSENDCMDINPARAMS;
1110#include <poppack.h>
1111
1112#include <pshpack1.h>
1113typedef struct _DRIVERSTATUS {
1114 BYTE bDriverError;
1115 BYTE bIDEError;
1116 BYTE bReserved[2];
1117 DWORD dwReserved[2];
1118} DRIVERSTATUS,*PDRIVERSTATUS,*LPDRIVERSTATUS;
1119#include <poppack.h>
1120
1121#define SMART_NO_ERROR 0
1122#define SMART_IDE_ERROR 1
1123#define SMART_INVALID_FLAG 2
1124#define SMART_INVALID_COMMAND 3
1125#define SMART_INVALID_BUFFER 4
1126#define SMART_INVALID_DRIVE 5
1127#define SMART_INVALID_IOCTL 6
1128#define SMART_ERROR_NO_MEM 7
1129#define SMART_INVALID_REGISTER 8
1130#define SMART_NOT_SUPPORTED 9
1131#define SMART_NO_IDE_DEVICE 10
1132
1133#define SMART_OFFLINE_ROUTINE_OFFLINE 0
1134#define SMART_SHORT_SELFTEST_OFFLINE 1
1135#define SMART_EXTENDED_SELFTEST_OFFLINE 2
1136#define SMART_ABORT_OFFLINE_SELFTEST 127
1137#define SMART_SHORT_SELFTEST_CAPTIVE 129
1138#define SMART_EXTENDED_SELFTEST_CAPTIVE 130
1139
1140#include <pshpack1.h>
1141typedef struct _SENDCMDOUTPARAMS {
1142 DWORD cBufferSize;
1143 DRIVERSTATUS DriverStatus;
1144 BYTE bBuffer[1];
1145} SENDCMDOUTPARAMS,*PSENDCMDOUTPARAMS,*LPSENDCMDOUTPARAMS;
1146#include <poppack.h>
1147
1148#define READ_ATTRIBUTE_BUFFER_SIZE 512
1149#define IDENTIFY_BUFFER_SIZE 512
1150#define READ_THRESHOLD_BUFFER_SIZE 512
1151#define SMART_LOG_SECTOR_SIZE 512
1152
1153#define READ_ATTRIBUTES 0xD0
1154#define READ_THRESHOLDS 0xD1
1155#define ENABLE_DISABLE_AUTOSAVE 0xD2
1156#define SAVE_ATTRIBUTE_VALUES 0xD3
1157#define EXECUTE_OFFLINE_DIAGS 0xD4
1158#define SMART_READ_LOG 0xD5
1159#define SMART_WRITE_LOG 0xd6
1160#define ENABLE_SMART 0xD8
1161#define DISABLE_SMART 0xD9
1162#define RETURN_SMART_STATUS 0xDA
1163#define ENABLE_DISABLE_AUTO_OFFLINE 0xDB
1164
1165#endif /* _NTDDDISK_H_ */
1166
1167
1168#define IOCTL_CHANGER_BASE FILE_DEVICE_CHANGER
1169#define IOCTL_CHANGER_GET_PARAMETERS CTL_CODE(IOCTL_CHANGER_BASE,0x0000,METHOD_BUFFERED,FILE_READ_ACCESS)
1170#define IOCTL_CHANGER_GET_STATUS CTL_CODE(IOCTL_CHANGER_BASE,0x0001,METHOD_BUFFERED,FILE_READ_ACCESS)
1171#define IOCTL_CHANGER_GET_PRODUCT_DATA CTL_CODE(IOCTL_CHANGER_BASE,0x0002,METHOD_BUFFERED,FILE_READ_ACCESS)
1172#define IOCTL_CHANGER_SET_ACCESS CTL_CODE(IOCTL_CHANGER_BASE,0x0004,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1173#define IOCTL_CHANGER_GET_ELEMENT_STATUS CTL_CODE(IOCTL_CHANGER_BASE,0x0005,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1174#define IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS CTL_CODE(IOCTL_CHANGER_BASE,0x0006,METHOD_BUFFERED,FILE_READ_ACCESS)
1175#define IOCTL_CHANGER_SET_POSITION CTL_CODE(IOCTL_CHANGER_BASE,0x0007,METHOD_BUFFERED,FILE_READ_ACCESS)
1176#define IOCTL_CHANGER_EXCHANGE_MEDIUM CTL_CODE(IOCTL_CHANGER_BASE,0x0008,METHOD_BUFFERED,FILE_READ_ACCESS)
1177#define IOCTL_CHANGER_MOVE_MEDIUM CTL_CODE(IOCTL_CHANGER_BASE,0x0009,METHOD_BUFFERED,FILE_READ_ACCESS)
1178#define IOCTL_CHANGER_REINITIALIZE_TRANSPORT CTL_CODE(IOCTL_CHANGER_BASE,0x000A,METHOD_BUFFERED,FILE_READ_ACCESS)
1179#define IOCTL_CHANGER_QUERY_VOLUME_TAGS CTL_CODE(IOCTL_CHANGER_BASE,0x000B,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
1180
1181#define MAX_VOLUME_ID_SIZE 36
1182#define MAX_VOLUME_TEMPLATE_SIZE 40
1183
1184#define VENDOR_ID_LENGTH 8
1185#define PRODUCT_ID_LENGTH 16
1186#define REVISION_LENGTH 4
1187#define SERIAL_NUMBER_LENGTH 32
1188
1189typedef enum _ELEMENT_TYPE {
1190 AllElements,ChangerTransport,ChangerSlot,ChangerIEPort,ChangerDrive,ChangerDoor,ChangerKeypad,ChangerMaxElement
1191} ELEMENT_TYPE,*PELEMENT_TYPE;
1192
1193typedef struct _CHANGER_ELEMENT {
1194 ELEMENT_TYPE ElementType;
1195 DWORD ElementAddress;
1196} CHANGER_ELEMENT,*PCHANGER_ELEMENT;
1197
1198typedef struct _CHANGER_ELEMENT_LIST {
1199 CHANGER_ELEMENT Element;
1200 DWORD NumberOfElements;
1201} CHANGER_ELEMENT_LIST ,*PCHANGER_ELEMENT_LIST;
1202
1203#define CHANGER_BAR_CODE_SCANNER_INSTALLED 0x00000001
1204#define CHANGER_INIT_ELEM_STAT_WITH_RANGE 0x00000002
1205#define CHANGER_CLOSE_IEPORT 0x00000004
1206#define CHANGER_OPEN_IEPORT 0x00000008
1207
1208#define CHANGER_STATUS_NON_VOLATILE 0x00000010
1209#define CHANGER_EXCHANGE_MEDIA 0x00000020
1210#define CHANGER_CLEANER_SLOT 0x00000040
1211#define CHANGER_LOCK_UNLOCK 0x00000080
1212
1213#define CHANGER_CARTRIDGE_MAGAZINE 0x00000100
1214#define CHANGER_MEDIUM_FLIP 0x00000200
1215#define CHANGER_POSITION_TO_ELEMENT 0x00000400
1216#define CHANGER_REPORT_IEPORT_STATE 0x00000800
1217
1218#define CHANGER_STORAGE_DRIVE 0x00001000
1219#define CHANGER_STORAGE_IEPORT 0x00002000
1220#define CHANGER_STORAGE_SLOT 0x00004000
1221#define CHANGER_STORAGE_TRANSPORT 0x00008000
1222
1223#define CHANGER_DRIVE_CLEANING_REQUIRED 0x00010000
1224
1225#define CHANGER_PREDISMOUNT_EJECT_REQUIRED 0x00020000
1226
1227#define CHANGER_CLEANER_ACCESS_NOT_VALID 0x00040000
1228#define CHANGER_PREMOUNT_EJECT_REQUIRED 0x00080000
1229
1230#define CHANGER_VOLUME_IDENTIFICATION 0x00100000
1231#define CHANGER_VOLUME_SEARCH 0x00200000
1232#define CHANGER_VOLUME_ASSERT 0x00400000
1233#define CHANGER_VOLUME_REPLACE 0x00800000
1234#define CHANGER_VOLUME_UNDEFINE 0x01000000
1235
1236#define CHANGER_SERIAL_NUMBER_VALID 0x04000000
1237
1238#define CHANGER_DEVICE_REINITIALIZE_CAPABLE 0x08000000
1239#define CHANGER_KEYPAD_ENABLE_DISABLE 0x10000000
1240#define CHANGER_DRIVE_EMPTY_ON_DOOR_ACCESS 0x20000000
1241
1242#define CHANGER_RESERVED_BIT 0x80000000
1243
1244#define CHANGER_PREDISMOUNT_ALIGN_TO_SLOT 0x80000001
1245#define CHANGER_PREDISMOUNT_ALIGN_TO_DRIVE 0x80000002
1246#define CHANGER_CLEANER_AUTODISMOUNT 0x80000004
1247#define CHANGER_TRUE_EXCHANGE_CAPABLE 0x80000008
1248#define CHANGER_SLOTS_USE_TRAYS 0x80000010
1249#define CHANGER_RTN_MEDIA_TO_ORIGINAL_ADDR 0x80000020
1250#define CHANGER_CLEANER_OPS_NOT_SUPPORTED 0x80000040
1251#define CHANGER_IEPORT_USER_CONTROL_OPEN 0x80000080
1252#define CHANGER_IEPORT_USER_CONTROL_CLOSE 0x80000100
1253#define CHANGER_MOVE_EXTENDS_IEPORT 0x80000200
1254#define CHANGER_MOVE_RETRACTS_IEPORT 0x80000400
1255
1256#define CHANGER_TO_TRANSPORT 0x01
1257#define CHANGER_TO_SLOT 0x02
1258#define CHANGER_TO_IEPORT 0x04
1259#define CHANGER_TO_DRIVE 0x08
1260
1261#define LOCK_UNLOCK_IEPORT 0x01
1262#define LOCK_UNLOCK_DOOR 0x02
1263#define LOCK_UNLOCK_KEYPAD 0x04
1264
1265typedef struct _GET_CHANGER_PARAMETERS {
1266 DWORD Size;
1267 WORD NumberTransportElements;
1268 WORD NumberStorageElements;
1269 WORD NumberCleanerSlots;
1270 WORD NumberIEElements;
1271 WORD NumberDataTransferElements;
1272 WORD NumberOfDoors;
1273 WORD FirstSlotNumber;
1274 WORD FirstDriveNumber;
1275 WORD FirstTransportNumber;
1276 WORD FirstIEPortNumber;
1277 WORD FirstCleanerSlotAddress;
1278 WORD MagazineSize;
1279 DWORD DriveCleanTimeout;
1280 DWORD Features0;
1281 DWORD Features1;
1282 BYTE MoveFromTransport;
1283 BYTE MoveFromSlot;
1284 BYTE MoveFromIePort;
1285 BYTE MoveFromDrive;
1286 BYTE ExchangeFromTransport;
1287 BYTE ExchangeFromSlot;
1288 BYTE ExchangeFromIePort;
1289 BYTE ExchangeFromDrive;
1290 BYTE LockUnlockCapabilities;
1291 BYTE PositionCapabilities;
1292 BYTE Reserved1[2];
1293 DWORD Reserved2[2];
1294} GET_CHANGER_PARAMETERS,*PGET_CHANGER_PARAMETERS;
1295
1296typedef struct _CHANGER_PRODUCT_DATA {
1297 BYTE VendorId[VENDOR_ID_LENGTH];
1298 BYTE ProductId[PRODUCT_ID_LENGTH];
1299 BYTE Revision[REVISION_LENGTH];
1300 BYTE SerialNumber[SERIAL_NUMBER_LENGTH];
1301 BYTE DeviceType;
1302} CHANGER_PRODUCT_DATA,*PCHANGER_PRODUCT_DATA;
1303
1304#define LOCK_ELEMENT 0
1305#define UNLOCK_ELEMENT 1
1306#define EXTEND_IEPORT 2
1307#define RETRACT_IEPORT 3
1308
1309typedef struct _CHANGER_SET_ACCESS {
1310 CHANGER_ELEMENT Element;
1311 DWORD Control;
1312} CHANGER_SET_ACCESS,*PCHANGER_SET_ACCESS;
1313
1314typedef struct _CHANGER_READ_ELEMENT_STATUS {
1315 CHANGER_ELEMENT_LIST ElementList;
1316 BOOLEAN VolumeTagInfo;
1317} CHANGER_READ_ELEMENT_STATUS,*PCHANGER_READ_ELEMENT_STATUS;
1318
1319typedef struct _CHANGER_ELEMENT_STATUS {
1320 CHANGER_ELEMENT Element;
1321 CHANGER_ELEMENT SrcElementAddress;
1322 DWORD Flags;
1323 DWORD ExceptionCode;
1324 BYTE TargetId;
1325 BYTE Lun;
1326 WORD Reserved;
1327 BYTE PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
1328 BYTE AlternateVolumeID[MAX_VOLUME_ID_SIZE];
1329} CHANGER_ELEMENT_STATUS,*PCHANGER_ELEMENT_STATUS;
1330
1331typedef struct _CHANGER_ELEMENT_STATUS_EX {
1332 CHANGER_ELEMENT Element;
1333 CHANGER_ELEMENT SrcElementAddress;
1334 DWORD Flags;
1335 DWORD ExceptionCode;
1336 BYTE TargetId;
1337 BYTE Lun;
1338 WORD Reserved;
1339 BYTE PrimaryVolumeID[MAX_VOLUME_ID_SIZE];
1340 BYTE AlternateVolumeID[MAX_VOLUME_ID_SIZE];
1341 BYTE VendorIdentification[VENDOR_ID_LENGTH];
1342 BYTE ProductIdentification[PRODUCT_ID_LENGTH];
1343 BYTE SerialNumber[SERIAL_NUMBER_LENGTH];
1344} CHANGER_ELEMENT_STATUS_EX,*PCHANGER_ELEMENT_STATUS_EX;
1345
1346#define ELEMENT_STATUS_FULL 0x00000001
1347#define ELEMENT_STATUS_IMPEXP 0x00000002
1348#define ELEMENT_STATUS_EXCEPT 0x00000004
1349#define ELEMENT_STATUS_ACCESS 0x00000008
1350#define ELEMENT_STATUS_EXENAB 0x00000010
1351#define ELEMENT_STATUS_INENAB 0x00000020
1352
1353#define ELEMENT_STATUS_PRODUCT_DATA 0x00000040
1354
1355#define ELEMENT_STATUS_LUN_VALID 0x00001000
1356#define ELEMENT_STATUS_ID_VALID 0x00002000
1357#define ELEMENT_STATUS_NOT_BUS 0x00008000
1358#define ELEMENT_STATUS_INVERT 0x00400000
1359#define ELEMENT_STATUS_SVALID 0x00800000
1360
1361#define ELEMENT_STATUS_PVOLTAG 0x10000000
1362#define ELEMENT_STATUS_AVOLTAG 0x20000000
1363
1364#define ERROR_LABEL_UNREADABLE 0x00000001
1365#define ERROR_LABEL_QUESTIONABLE 0x00000002
1366#define ERROR_SLOT_NOT_PRESENT 0x00000004
1367#define ERROR_DRIVE_NOT_INSTALLED 0x00000008
1368#define ERROR_TRAY_MALFUNCTION 0x00000010
1369#define ERROR_INIT_STATUS_NEEDED 0x00000011
1370#define ERROR_UNHANDLED_ERROR 0xFFFFFFFF
1371
1372typedef struct _CHANGER_INITIALIZE_ELEMENT_STATUS {
1373 CHANGER_ELEMENT_LIST ElementList;
1374 BOOLEAN BarCodeScan;
1375} CHANGER_INITIALIZE_ELEMENT_STATUS,*PCHANGER_INITIALIZE_ELEMENT_STATUS;
1376
1377typedef struct _CHANGER_SET_POSITION {
1378 CHANGER_ELEMENT Transport;
1379 CHANGER_ELEMENT Destination;
1380 BOOLEAN Flip;
1381} CHANGER_SET_POSITION,*PCHANGER_SET_POSITION;
1382
1383typedef struct _CHANGER_EXCHANGE_MEDIUM {
1384 CHANGER_ELEMENT Transport;
1385 CHANGER_ELEMENT Source;
1386 CHANGER_ELEMENT Destination1;
1387 CHANGER_ELEMENT Destination2;
1388 BOOLEAN Flip1;
1389 BOOLEAN Flip2;
1390} CHANGER_EXCHANGE_MEDIUM,*PCHANGER_EXCHANGE_MEDIUM;
1391
1392typedef struct _CHANGER_MOVE_MEDIUM {
1393 CHANGER_ELEMENT Transport;
1394 CHANGER_ELEMENT Source;
1395 CHANGER_ELEMENT Destination;
1396 BOOLEAN Flip;
1397} CHANGER_MOVE_MEDIUM,*PCHANGER_MOVE_MEDIUM;
1398
1399typedef struct _CHANGER_SEND_VOLUME_TAG_INFORMATION {
1400 CHANGER_ELEMENT StartingElement;
1401 DWORD ActionCode;
1402 BYTE VolumeIDTemplate[MAX_VOLUME_TEMPLATE_SIZE];
1403} CHANGER_SEND_VOLUME_TAG_INFORMATION,*PCHANGER_SEND_VOLUME_TAG_INFORMATION;
1404
1405typedef struct _READ_ELEMENT_ADDRESS_INFO {
1406 DWORD NumberOfElements;
1407 CHANGER_ELEMENT_STATUS ElementStatus[1];
1408} READ_ELEMENT_ADDRESS_INFO,*PREAD_ELEMENT_ADDRESS_INFO;
1409
1410#define SEARCH_ALL 0x0
1411#define SEARCH_PRIMARY 0x1
1412#define SEARCH_ALTERNATE 0x2
1413#define SEARCH_ALL_NO_SEQ 0x4
1414#define SEARCH_PRI_NO_SEQ 0x5
1415#define SEARCH_ALT_NO_SEQ 0x6
1416
1417#define ASSERT_PRIMARY 0x8
1418#define ASSERT_ALTERNATE 0x9
1419
1420#define REPLACE_PRIMARY 0xA
1421#define REPLACE_ALTERNATE 0xB
1422
1423#define UNDEFINE_PRIMARY 0xC
1424#define UNDEFINE_ALTERNATE 0xD
1425
1426typedef enum _CHANGER_DEVICE_PROBLEM_TYPE {
1427 DeviceProblemNone,DeviceProblemHardware,DeviceProblemCHMError,DeviceProblemDoorOpen,DeviceProblemCalibrationError,DeviceProblemTargetFailure,
1428 DeviceProblemCHMMoveError,DeviceProblemCHMZeroError,DeviceProblemCartridgeInsertError,DeviceProblemPositionError,DeviceProblemSensorError,
1429 DeviceProblemCartridgeEjectError,DeviceProblemGripperError,DeviceProblemDriveError
1430} CHANGER_DEVICE_PROBLEM_TYPE,*PCHANGER_DEVICE_PROBLEM_TYPE;
1431
1432#define IOCTL_SERIAL_LSRMST_INSERT CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
1433
1434#define IOCTL_SERENUM_EXPOSE_HARDWARE CTL_CODE(FILE_DEVICE_SERENUM,128,METHOD_BUFFERED,FILE_ANY_ACCESS)
1435#define IOCTL_SERENUM_REMOVE_HARDWARE CTL_CODE(FILE_DEVICE_SERENUM,129,METHOD_BUFFERED,FILE_ANY_ACCESS)
1436#define IOCTL_SERENUM_PORT_DESC CTL_CODE(FILE_DEVICE_SERENUM,130,METHOD_BUFFERED,FILE_ANY_ACCESS)
1437#define IOCTL_SERENUM_GET_PORT_NAME CTL_CODE(FILE_DEVICE_SERENUM,131,METHOD_BUFFERED,FILE_ANY_ACCESS)
1438
1439#define SERIAL_LSRMST_ESCAPE ((BYTE)0x00)
1440
1441#define SERIAL_LSRMST_LSR_DATA ((BYTE)0x01)
1442
1443#define SERIAL_LSRMST_LSR_NODATA ((BYTE)0x02)
1444
1445#define SERIAL_LSRMST_MST ((BYTE)0x03)
1446
1447#define SERIAL_IOC_FCR_FIFO_ENABLE ((DWORD)0x00000001)
1448#define SERIAL_IOC_FCR_RCVR_RESET ((DWORD)0x00000002)
1449#define SERIAL_IOC_FCR_XMIT_RESET ((DWORD)0x00000004)
1450#define SERIAL_IOC_FCR_DMA_MODE ((DWORD)0x00000008)
1451#define SERIAL_IOC_FCR_RES1 ((DWORD)0x00000010)
1452#define SERIAL_IOC_FCR_RES2 ((DWORD)0x00000020)
1453#define SERIAL_IOC_FCR_RCVR_TRIGGER_LSB ((DWORD)0x00000040)
1454#define SERIAL_IOC_FCR_RCVR_TRIGGER_MSB ((DWORD)0x00000080)
1455
1456#define SERIAL_IOC_MCR_DTR ((DWORD)0x00000001)
1457#define SERIAL_IOC_MCR_RTS ((DWORD)0x00000002)
1458#define SERIAL_IOC_MCR_OUT1 ((DWORD)0x00000004)
1459#define SERIAL_IOC_MCR_OUT2 ((DWORD)0x00000008)
1460#define SERIAL_IOC_MCR_LOOP ((DWORD)0x00000010)
1461
1462#ifndef _FILESYSTEMFSCTL_
1463#define _FILESYSTEMFSCTL_
1464
1465#define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM,0,METHOD_BUFFERED,FILE_ANY_ACCESS)
1466#define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM,1,METHOD_BUFFERED,FILE_ANY_ACCESS)
1467#define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM,2,METHOD_BUFFERED,FILE_ANY_ACCESS)
1468#define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,3,METHOD_BUFFERED,FILE_ANY_ACCESS)
1469#define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM,4,METHOD_BUFFERED,FILE_ANY_ACCESS)
1470#define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM,5,METHOD_BUFFERED,FILE_ANY_ACCESS)
1471#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,6,METHOD_BUFFERED,FILE_ANY_ACCESS)
1472#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,7,METHOD_BUFFERED,FILE_ANY_ACCESS)
1473#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
1474
1475#define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM,10,METHOD_BUFFERED,FILE_ANY_ACCESS)
1476#define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,11,METHOD_BUFFERED,FILE_ANY_ACCESS)
1477#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
1478
1479#define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,14,METHOD_NEITHER,FILE_ANY_ACCESS)
1480#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,15,METHOD_BUFFERED,FILE_ANY_ACCESS)
1481#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,16,METHOD_BUFFERED,FILE_READ_DATA | FILE_WRITE_DATA)
1482
1483#define FSCTL_SET_BOOTLOADER_ACCESSED CTL_CODE(FILE_DEVICE_FILE_SYSTEM,19,METHOD_NEITHER,FILE_ANY_ACCESS)
1484#define FSCTL_MARK_AS_SYSTEM_HIVE FSCTL_SET_BOOTLOADER_ACCESSED
1485#define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM,20,METHOD_BUFFERED,FILE_ANY_ACCESS)
1486#define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM,21,METHOD_BUFFERED,FILE_ANY_ACCESS)
1487#define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM,22,METHOD_BUFFERED,FILE_ANY_ACCESS)
1488#define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM,23,METHOD_BUFFERED,FILE_ANY_ACCESS)
1489#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,24,METHOD_BUFFERED,FILE_ANY_ACCESS)
1490#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,25,METHOD_BUFFERED,FILE_ANY_ACCESS)
1491#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM,26,METHOD_BUFFERED,FILE_ANY_ACCESS)
1492#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM,27,METHOD_NEITHER,FILE_ANY_ACCESS)
1493#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM,28,METHOD_NEITHER,FILE_ANY_ACCESS)
1494#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,29,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1495#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM,30,METHOD_BUFFERED,FILE_ANY_ACCESS)
1496#define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,32,METHOD_NEITHER,FILE_ANY_ACCESS)
1497#define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,35,METHOD_NEITHER,FILE_ANY_ACCESS)
1498#define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,38,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1499#define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,39,METHOD_BUFFERED,FILE_ANY_ACCESS)
1500#define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,40,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1501#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,41,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1502#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,42,METHOD_BUFFERED,FILE_ANY_ACCESS)
1503#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM,43,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1504#define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,44,METHOD_NEITHER,FILE_ANY_ACCESS)
1505#define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM,45,METHOD_NEITHER,FILE_READ_DATA)
1506#define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM,46,METHOD_NEITHER,FILE_ANY_ACCESS)
1507#define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM,47,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1508#define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM,48,METHOD_BUFFERED,FILE_ANY_ACCESS)
1509#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,49,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1510#define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,50,METHOD_BUFFERED,FILE_WRITE_DATA)
1511#define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM,51,METHOD_NEITHER,FILE_READ_DATA)
1512#define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,52,METHOD_BUFFERED,FILE_WRITE_DATA)
1513#define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,53,METHOD_NEITHER,FILE_ANY_ACCESS)
1514#define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,54,METHOD_NEITHER,FILE_ANY_ACCESS)
1515#define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM,55,METHOD_NEITHER,FILE_SPECIAL_ACCESS)
1516#define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM,56,METHOD_NEITHER,FILE_SPECIAL_ACCESS)
1517#define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM,57,METHOD_NEITHER,FILE_ANY_ACCESS)
1518#define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,58,METHOD_NEITHER,FILE_ANY_ACCESS)
1519#define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM,59,METHOD_NEITHER,FILE_ANY_ACCESS)
1520#define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,60,METHOD_BUFFERED,FILE_ANY_ACCESS)
1521#define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM,61,METHOD_BUFFERED,FILE_ANY_ACCESS)
1522#define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM,62,METHOD_BUFFERED,FILE_ANY_ACCESS)
1523#define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,63,METHOD_BUFFERED,FILE_ANY_ACCESS)
1524#define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,64,METHOD_BUFFERED,FILE_ANY_ACCESS)
1525#define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM,65,METHOD_BUFFERED,FILE_READ_DATA | FILE_WRITE_DATA)
1526#define FSCTL_HSM_MSG CTL_CODE(FILE_DEVICE_FILE_SYSTEM,66,METHOD_BUFFERED,FILE_READ_DATA | FILE_WRITE_DATA)
1527#define FSCTL_HSM_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM,68,METHOD_NEITHER,FILE_READ_DATA | FILE_WRITE_DATA)
1528#define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,69,METHOD_NEITHER,FILE_ANY_ACCESS)
1529#define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM,71,METHOD_OUT_DIRECT,FILE_READ_DATA)
1530#define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM,72,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
1531
1532typedef struct _PATHNAME_BUFFER {
1533 DWORD PathNameLength;
1534 WCHAR Name[1];
1535} PATHNAME_BUFFER,*PPATHNAME_BUFFER;
1536
1537typedef struct _FSCTL_QUERY_FAT_BPB_BUFFER {
1538 BYTE First0x24BytesOfBootSector[0x24];
1539} FSCTL_QUERY_FAT_BPB_BUFFER,*PFSCTL_QUERY_FAT_BPB_BUFFER;
1540
1541typedef struct {
1542 LARGE_INTEGER VolumeSerialNumber;
1543 LARGE_INTEGER NumberSectors;
1544 LARGE_INTEGER TotalClusters;
1545 LARGE_INTEGER FreeClusters;
1546 LARGE_INTEGER TotalReserved;
1547 DWORD BytesPerSector;
1548 DWORD BytesPerCluster;
1549 DWORD BytesPerFileRecordSegment;
1550 DWORD ClustersPerFileRecordSegment;
1551 LARGE_INTEGER MftValidDataLength;
1552 LARGE_INTEGER MftStartLcn;
1553 LARGE_INTEGER Mft2StartLcn;
1554 LARGE_INTEGER MftZoneStart;
1555 LARGE_INTEGER MftZoneEnd;
1556} NTFS_VOLUME_DATA_BUFFER,*PNTFS_VOLUME_DATA_BUFFER;
1557
1558typedef struct {
1559 DWORD ByteCount;
1560 WORD MajorVersion;
1561 WORD MinorVersion;
1562} NTFS_EXTENDED_VOLUME_DATA,*PNTFS_EXTENDED_VOLUME_DATA;
1563
1564typedef struct {
1565 LARGE_INTEGER StartingLcn;
1566} STARTING_LCN_INPUT_BUFFER,*PSTARTING_LCN_INPUT_BUFFER;
1567
1568typedef struct {
1569 LARGE_INTEGER StartingLcn;
1570 LARGE_INTEGER BitmapSize;
1571 BYTE Buffer[1];
1572} VOLUME_BITMAP_BUFFER,*PVOLUME_BITMAP_BUFFER;
1573
1574typedef struct {
1575 LARGE_INTEGER StartingVcn;
1576} STARTING_VCN_INPUT_BUFFER,*PSTARTING_VCN_INPUT_BUFFER;
1577
1578typedef struct RETRIEVAL_POINTERS_BUFFER {
1579 DWORD ExtentCount;
1580 LARGE_INTEGER StartingVcn;
1581 struct {
1582 LARGE_INTEGER NextVcn;
1583 LARGE_INTEGER Lcn;
1584 } Extents[1];
1585} RETRIEVAL_POINTERS_BUFFER,*PRETRIEVAL_POINTERS_BUFFER;
1586
1587typedef struct {
1588 LARGE_INTEGER FileReferenceNumber;
1589} NTFS_FILE_RECORD_INPUT_BUFFER,*PNTFS_FILE_RECORD_INPUT_BUFFER;
1590
1591typedef struct {
1592 LARGE_INTEGER FileReferenceNumber;
1593 DWORD FileRecordLength;
1594 BYTE FileRecordBuffer[1];
1595} NTFS_FILE_RECORD_OUTPUT_BUFFER,*PNTFS_FILE_RECORD_OUTPUT_BUFFER;
1596
1597typedef struct {
1598 HANDLE FileHandle;
1599 LARGE_INTEGER StartingVcn;
1600 LARGE_INTEGER StartingLcn;
1601 DWORD ClusterCount;
1602} MOVE_FILE_DATA,*PMOVE_FILE_DATA;
1603
1604typedef struct _MOVE_FILE_RECORD_DATA {
1605 HANDLE FileHandle;
1606 LARGE_INTEGER SourceFileRecord;
1607 LARGE_INTEGER TargetFileRecord;
1608} MOVE_FILE_RECORD_DATA, *PMOVE_FILE_RECORD_DATA;
1609
1610#ifdef _WIN64
1611typedef struct _MOVE_FILE_DATA32 {
1612 UINT32 FileHandle;
1613 LARGE_INTEGER StartingVcn;
1614 LARGE_INTEGER StartingLcn;
1615 DWORD ClusterCount;
1616} MOVE_FILE_DATA32,*PMOVE_FILE_DATA32;
1617#endif
1618
1619typedef struct {
1620 DWORD Restart;
1621 SID Sid;
1622} FIND_BY_SID_DATA,*PFIND_BY_SID_DATA;
1623
1624typedef struct {
1625 DWORD NextEntryOffset;
1626 DWORD FileIndex;
1627 DWORD FileNameLength;
1628 WCHAR FileName[1];
1629} FIND_BY_SID_OUTPUT,*PFIND_BY_SID_OUTPUT;
1630
1631typedef struct {
1632 DWORDLONG StartFileReferenceNumber;
1633 USN LowUsn;
1634 USN HighUsn;
1635} MFT_ENUM_DATA,*PMFT_ENUM_DATA;
1636
1637typedef struct {
1638 DWORDLONG MaximumSize;
1639 DWORDLONG AllocationDelta;
1640} CREATE_USN_JOURNAL_DATA,*PCREATE_USN_JOURNAL_DATA;
1641
1642typedef struct {
1643 USN StartUsn;
1644 DWORD ReasonMask;
1645 DWORD ReturnOnlyOnClose;
1646 DWORDLONG Timeout;
1647 DWORDLONG BytesToWaitFor;
1648 DWORDLONG UsnJournalID;
1649} READ_USN_JOURNAL_DATA,*PREAD_USN_JOURNAL_DATA;
1650
1651typedef struct {
1652 DWORD RecordLength;
1653 WORD MajorVersion;
1654 WORD MinorVersion;
1655 DWORDLONG FileReferenceNumber;
1656 DWORDLONG ParentFileReferenceNumber;
1657 USN Usn;
1658 LARGE_INTEGER TimeStamp;
1659 DWORD Reason;
1660 DWORD SourceInfo;
1661 DWORD SecurityId;
1662 DWORD FileAttributes;
1663 WORD FileNameLength;
1664 WORD FileNameOffset;
1665 WCHAR FileName[1];
1666} USN_RECORD,*PUSN_RECORD;
1667
1668#define USN_PAGE_SIZE (0x1000)
1669
1670#define USN_REASON_DATA_OVERWRITE (0x00000001)
1671#define USN_REASON_DATA_EXTEND (0x00000002)
1672#define USN_REASON_DATA_TRUNCATION (0x00000004)
1673#define USN_REASON_NAMED_DATA_OVERWRITE (0x00000010)
1674#define USN_REASON_NAMED_DATA_EXTEND (0x00000020)
1675#define USN_REASON_NAMED_DATA_TRUNCATION (0x00000040)
1676#define USN_REASON_FILE_CREATE (0x00000100)
1677#define USN_REASON_FILE_DELETE (0x00000200)
1678#define USN_REASON_EA_CHANGE (0x00000400)
1679#define USN_REASON_SECURITY_CHANGE (0x00000800)
1680#define USN_REASON_RENAME_OLD_NAME (0x00001000)
1681#define USN_REASON_RENAME_NEW_NAME (0x00002000)
1682#define USN_REASON_INDEXABLE_CHANGE (0x00004000)
1683#define USN_REASON_BASIC_INFO_CHANGE (0x00008000)
1684#define USN_REASON_HARD_LINK_CHANGE (0x00010000)
1685#define USN_REASON_COMPRESSION_CHANGE (0x00020000)
1686#define USN_REASON_ENCRYPTION_CHANGE (0x00040000)
1687#define USN_REASON_OBJECT_ID_CHANGE (0x00080000)
1688#define USN_REASON_REPARSE_POINT_CHANGE (0x00100000)
1689#define USN_REASON_STREAM_CHANGE (0x00200000)
1690#define USN_REASON_TRANSACTED_CHANGE (0x00400000)
1691
1692#define USN_REASON_CLOSE (0x80000000)
1693
1694typedef struct {
1695 DWORDLONG UsnJournalID;
1696 USN FirstUsn;
1697 USN NextUsn;
1698 USN LowestValidUsn;
1699 USN MaxUsn;
1700 DWORDLONG MaximumSize;
1701 DWORDLONG AllocationDelta;
1702} USN_JOURNAL_DATA,*PUSN_JOURNAL_DATA;
1703
1704typedef struct {
1705 DWORDLONG UsnJournalID;
1706 DWORD DeleteFlags;
1707} DELETE_USN_JOURNAL_DATA,*PDELETE_USN_JOURNAL_DATA;
1708
1709#define USN_DELETE_FLAG_DELETE (0x00000001)
1710#define USN_DELETE_FLAG_NOTIFY (0x00000002)
1711
1712#define USN_DELETE_VALID_FLAGS (0x00000003)
1713
1714typedef struct {
1715 DWORD UsnSourceInfo;
1716 HANDLE VolumeHandle;
1717 DWORD HandleInfo;
1718} MARK_HANDLE_INFO,*PMARK_HANDLE_INFO;
1719
1720#ifdef _WIN64
1721
1722typedef struct {
1723 DWORD UsnSourceInfo;
1724 UINT32 VolumeHandle;
1725 DWORD HandleInfo;
1726
1727} MARK_HANDLE_INFO32,*PMARK_HANDLE_INFO32;
1728#endif
1729
1730#define USN_SOURCE_DATA_MANAGEMENT (0x00000001)
1731#define USN_SOURCE_AUXILIARY_DATA (0x00000002)
1732#define USN_SOURCE_REPLICATION_MANAGEMENT (0x00000004)
1733
1734#define MARK_HANDLE_PROTECT_CLUSTERS (0x00000001)
1735#define MARK_HANDLE_TXF_SYSTEM_LOG (0x00000004)
1736#define MARK_HANDLE_NOT_TXF_SYSTEM_LOG (0x00000008)
1737#define MARK_HANDLE_REALTIME (0x00000020)
1738#define MARK_HANDLE_NOT_REALTIME (0x00000040)
1739
1740typedef struct {
1741 ACCESS_MASK DesiredAccess;
1742 DWORD SecurityIds[1];
1743} BULK_SECURITY_TEST_DATA,*PBULK_SECURITY_TEST_DATA;
1744
1745#define VOLUME_IS_DIRTY (0x00000001)
1746#define VOLUME_UPGRADE_SCHEDULED (0x00000002)
1747#define VOLUME_SESSION_OPEN (0x00000004)
1748
1749typedef struct _FILE_PREFETCH {
1750 DWORD Type;
1751 DWORD Count;
1752 DWORDLONG Prefetch[1];
1753} FILE_PREFETCH,*PFILE_PREFETCH;
1754
1755typedef struct _FILE_PREFETCH_EX {
1756 ULONG Type;
1757 ULONG Count;
1758 PVOID Context;
1759 ULONGLONG Prefetch[1];
1760} FILE_PREFETCH_EX, *PFILE_PREFETCH_EX;
1761
1762#define FILE_PREFETCH_TYPE_FOR_CREATE 0x1
1763#define FILE_PREFETCH_TYPE_FOR_DIRENUM 0x2
1764#define FILE_PREFETCH_TYPE_FOR_CREATE_EX 0x3
1765#define FILE_PREFETCH_TYPE_FOR_DIRENUM_EX 0x4
1766
1767#define FILE_PREFETCH_TYPE_MAX 0x4
1768
1769typedef struct _FILESYSTEM_STATISTICS {
1770 WORD FileSystemType;
1771 WORD Version;
1772 DWORD SizeOfCompleteStructure;
1773 DWORD UserFileReads;
1774 DWORD UserFileReadBytes;
1775 DWORD UserDiskReads;
1776 DWORD UserFileWrites;
1777 DWORD UserFileWriteBytes;
1778 DWORD UserDiskWrites;
1779 DWORD MetaDataReads;
1780 DWORD MetaDataReadBytes;
1781 DWORD MetaDataDiskReads;
1782 DWORD MetaDataWrites;
1783 DWORD MetaDataWriteBytes;
1784 DWORD MetaDataDiskWrites;
1785} FILESYSTEM_STATISTICS,*PFILESYSTEM_STATISTICS;
1786
1787#define FILESYSTEM_STATISTICS_TYPE_NTFS 1
1788#define FILESYSTEM_STATISTICS_TYPE_FAT 2
1789#define FILESYSTEM_STATISTICS_TYPE_EXFAT 3
1790
1791typedef struct _FAT_STATISTICS {
1792 DWORD CreateHits;
1793 DWORD SuccessfulCreates;
1794 DWORD FailedCreates;
1795 DWORD NonCachedReads;
1796 DWORD NonCachedReadBytes;
1797 DWORD NonCachedWrites;
1798 DWORD NonCachedWriteBytes;
1799 DWORD NonCachedDiskReads;
1800 DWORD NonCachedDiskWrites;
1801} FAT_STATISTICS,*PFAT_STATISTICS;
1802
1803typedef struct _EXFAT_STATISTICS {
1804 DWORD CreateHits;
1805 DWORD SuccessfulCreates;
1806 DWORD FailedCreates;
1807 DWORD NonCachedReads;
1808 DWORD NonCachedReadBytes;
1809 DWORD NonCachedWrites;
1810 DWORD NonCachedWriteBytes;
1811 DWORD NonCachedDiskReads;
1812 DWORD NonCachedDiskWrites;
1813} EXFAT_STATISTICS, *PEXFAT_STATISTICS;
1814
1815typedef struct _NTFS_STATISTICS {
1816 DWORD LogFileFullExceptions;
1817 DWORD OtherExceptions;
1818 DWORD MftReads;
1819 DWORD MftReadBytes;
1820 DWORD MftWrites;
1821 DWORD MftWriteBytes;
1822 struct {
1823 WORD Write;
1824 WORD Create;
1825 WORD SetInfo;
1826 WORD Flush;
1827 } MftWritesUserLevel;
1828 WORD MftWritesFlushForLogFileFull;
1829 WORD MftWritesLazyWriter;
1830 WORD MftWritesUserRequest;
1831 DWORD Mft2Writes;
1832 DWORD Mft2WriteBytes;
1833 struct {
1834 WORD Write;
1835 WORD Create;
1836 WORD SetInfo;
1837 WORD Flush;
1838 } Mft2WritesUserLevel;
1839 WORD Mft2WritesFlushForLogFileFull;
1840 WORD Mft2WritesLazyWriter;
1841 WORD Mft2WritesUserRequest;
1842 DWORD RootIndexReads;
1843 DWORD RootIndexReadBytes;
1844 DWORD RootIndexWrites;
1845 DWORD RootIndexWriteBytes;
1846 DWORD BitmapReads;
1847 DWORD BitmapReadBytes;
1848 DWORD BitmapWrites;
1849 DWORD BitmapWriteBytes;
1850 WORD BitmapWritesFlushForLogFileFull;
1851 WORD BitmapWritesLazyWriter;
1852 WORD BitmapWritesUserRequest;
1853 struct {
1854 WORD Write;
1855 WORD Create;
1856 WORD SetInfo;
1857 } BitmapWritesUserLevel;
1858 DWORD MftBitmapReads;
1859 DWORD MftBitmapReadBytes;
1860 DWORD MftBitmapWrites;
1861 DWORD MftBitmapWriteBytes;
1862 WORD MftBitmapWritesFlushForLogFileFull;
1863 WORD MftBitmapWritesLazyWriter;
1864 WORD MftBitmapWritesUserRequest;
1865 struct {
1866 WORD Write;
1867 WORD Create;
1868 WORD SetInfo;
1869 WORD Flush;
1870 } MftBitmapWritesUserLevel;
1871 DWORD UserIndexReads;
1872 DWORD UserIndexReadBytes;
1873 DWORD UserIndexWrites;
1874 DWORD UserIndexWriteBytes;
1875 DWORD LogFileReads;
1876 DWORD LogFileReadBytes;
1877 DWORD LogFileWrites;
1878 DWORD LogFileWriteBytes;
1879 struct {
1880 DWORD Calls;
1881 DWORD Clusters;
1882 DWORD Hints;
1883 DWORD RunsReturned;
1884 DWORD HintsHonored;
1885 DWORD HintsClusters;
1886 DWORD Cache;
1887 DWORD CacheClusters;
1888 DWORD CacheMiss;
1889 DWORD CacheMissClusters;
1890 } Allocate;
1891} NTFS_STATISTICS,*PNTFS_STATISTICS;
1892
1893typedef struct _FILE_OBJECTID_BUFFER {
1894 BYTE ObjectId[16];
1895 __C89_NAMELESS union {
1896 __C89_NAMELESS struct {
1897 BYTE BirthVolumeId[16];
1898 BYTE BirthObjectId[16];
1899 BYTE DomainId[16];
1900 } DUMMYSTRUCTNAME;
1901 BYTE ExtendedInfo[48];
1902 } DUMMYUNIONNAME;
1903} FILE_OBJECTID_BUFFER,*PFILE_OBJECTID_BUFFER;
1904
1905typedef struct _FILE_SET_SPARSE_BUFFER {
1906 BOOLEAN SetSparse;
1907} FILE_SET_SPARSE_BUFFER,*PFILE_SET_SPARSE_BUFFER;
1908
1909typedef struct _FILE_ZERO_DATA_INFORMATION {
1910 LARGE_INTEGER FileOffset;
1911 LARGE_INTEGER BeyondFinalZero;
1912} FILE_ZERO_DATA_INFORMATION,*PFILE_ZERO_DATA_INFORMATION;
1913
1914typedef struct _FILE_ALLOCATED_RANGE_BUFFER {
1915 LARGE_INTEGER FileOffset;
1916 LARGE_INTEGER Length;
1917} FILE_ALLOCATED_RANGE_BUFFER,*PFILE_ALLOCATED_RANGE_BUFFER;
1918
1919typedef struct _ENCRYPTION_BUFFER {
1920 DWORD EncryptionOperation;
1921 BYTE Private[1];
1922} ENCRYPTION_BUFFER,*PENCRYPTION_BUFFER;
1923
1924#define FILE_SET_ENCRYPTION 0x00000001
1925#define FILE_CLEAR_ENCRYPTION 0x00000002
1926#define STREAM_SET_ENCRYPTION 0x00000003
1927#define STREAM_CLEAR_ENCRYPTION 0x00000004
1928
1929#define MAXIMUM_ENCRYPTION_VALUE 0x00000004
1930
1931typedef struct _DECRYPTION_STATUS_BUFFER {
1932 BOOLEAN NoEncryptedStreams;
1933} DECRYPTION_STATUS_BUFFER,*PDECRYPTION_STATUS_BUFFER;
1934
1935#define ENCRYPTION_FORMAT_DEFAULT (0x01)
1936#define COMPRESSION_FORMAT_SPARSE (0x4000)
1937
1938typedef struct _REQUEST_RAW_ENCRYPTED_DATA {
1939 LONGLONG FileOffset;
1940 DWORD Length;
1941} REQUEST_RAW_ENCRYPTED_DATA,*PREQUEST_RAW_ENCRYPTED_DATA;
1942
1943typedef struct _ENCRYPTED_DATA_INFO {
1944 DWORDLONG StartingFileOffset;
1945 DWORD OutputBufferOffset;
1946 DWORD BytesWithinFileSize;
1947 DWORD BytesWithinValidDataLength;
1948 WORD CompressionFormat;
1949 BYTE DataUnitShift;
1950 BYTE ChunkShift;
1951 BYTE ClusterShift;
1952 BYTE EncryptionFormat;
1953 WORD NumberOfDataBlocks;
1954 DWORD DataBlockSize[ANYSIZE_ARRAY];
1955} ENCRYPTED_DATA_INFO;
1956typedef ENCRYPTED_DATA_INFO *PENCRYPTED_DATA_INFO;
1957
1958typedef struct _PLEX_READ_DATA_REQUEST {
1959 LARGE_INTEGER ByteOffset;
1960 DWORD ByteLength;
1961 DWORD PlexNumber;
1962} PLEX_READ_DATA_REQUEST,*PPLEX_READ_DATA_REQUEST;
1963
1964typedef struct _SI_COPYFILE {
1965 DWORD SourceFileNameLength;
1966 DWORD DestinationFileNameLength;
1967 DWORD Flags;
1968 WCHAR FileNameBuffer[1];
1969} SI_COPYFILE,*PSI_COPYFILE;
1970
1971#define COPYFILE_SIS_LINK 0x0001
1972#define COPYFILE_SIS_REPLACE 0x0002
1973#define COPYFILE_SIS_FLAGS 0x0003
1974
1975typedef struct _STORAGE_DESCRIPTOR_HEADER {
1976 DWORD Version;
1977 DWORD Size;
1978} STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
1979
1980typedef enum _STORAGE_PROPERTY_ID {
1981 StorageDeviceProperty = 0,
1982 StorageAdapterProperty,
1983 StorageDeviceIdProperty,
1984 StorageDeviceUniqueIdProperty,
1985 StorageDeviceWriteCacheProperty,
1986 StorageMiniportProperty,
1987 StorageAccessAlignmentProperty,
1988 StorageDeviceSeekPenaltyProperty,
1989 StorageDeviceTrimProperty,
1990 StorageDeviceWriteAggregationProperty,
1991 StorageDeviceDeviceTelemetryProperty,
1992 StorageDeviceLBProvisioningProperty,
1993 StorageDevicePowerProperty,
1994 StorageDeviceCopyOffloadProperty,
1995 StorageDeviceResiliencyProperty,
1996 StorageDeviceMediumProductType,
1997 StorageAdapterRpmbProperty,
1998 StorageAdapterCryptoProperty,
1999 StorageDeviceIoCapabilityProperty = 48,
2000 StorageAdapterProtocolSpecificProperty,
2001 StorageDeviceProtocolSpecificProperty,
2002 StorageAdapterTemperatureProperty,
2003 StorageDeviceTemperatureProperty,
2004 StorageAdapterPhysicalTopologyProperty,
2005 StorageDevicePhysicalTopologyProperty,
2006 StorageDeviceAttributesProperty,
2007 StorageDeviceManagementStatus,
2008 StorageAdapterSerialNumberProperty,
2009 StorageDeviceLocationProperty,
2010 StorageDeviceNumaProperty,
2011 StorageDeviceZonedDeviceProperty,
2012 StorageDeviceUnsafeShutdownCount,
2013 StorageDeviceEnduranceProperty,
2014 StorageDeviceLedStateProperty,
2015 StorageDeviceSelfEncryptionProperty = 64,
2016 StorageFruIdProperty
2017} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
2018
2019typedef enum _STORAGE_QUERY_TYPE {
2020 PropertyStandardQuery = 0,
2021 PropertyExistsQuery = 1,
2022 PropertyMaskQuery = 2,
2023 PropertyQueryMaxDefined = 3
2024} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
2025
2026typedef enum _STORAGE_SET_TYPE {
2027 PropertyStandardSet = 0,
2028 PropertyExistsSet,
2029 PropertySetMaxDefined
2030} STORAGE_SET_TYPE, *PSTORAGE_SET_TYPE;
2031
2032typedef struct _STORAGE_PROPERTY_QUERY {
2033 STORAGE_PROPERTY_ID PropertyId;
2034 STORAGE_QUERY_TYPE QueryType;
2035 BYTE AdditionalParameters[1];
2036} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
2037
2038typedef struct _STORAGE_PROPERTY_SET {
2039 STORAGE_PROPERTY_ID PropertyId;
2040 STORAGE_SET_TYPE SetType;
2041 BYTE AdditionalParameters[1];
2042} STORAGE_PROPERTY_SET, *PSTORAGE_PROPERTY_SET;
2043
2044typedef struct _STORAGE_DEVICE_DESCRIPTOR {
2045 DWORD Version;
2046 DWORD Size;
2047 BYTE DeviceType;
2048 BYTE DeviceTypeModifier;
2049 BOOLEAN RemovableMedia;
2050 BOOLEAN CommandQueueing;
2051 DWORD VendorIdOffset;
2052 DWORD ProductIdOffset;
2053 DWORD ProductRevisionOffset;
2054 DWORD SerialNumberOffset;
2055 STORAGE_BUS_TYPE BusType;
2056 DWORD RawPropertiesLength;
2057 BYTE RawDeviceProperties[1];
2058} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
2059
2060typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
2061 DWORD Version;
2062 DWORD Size;
2063 DWORD MaximumTransferLength;
2064 DWORD MaximumPhysicalPages;
2065 DWORD AlignmentMask;
2066 BOOLEAN AdapterUsesPio;
2067 BOOLEAN AdapterScansDown;
2068 BOOLEAN CommandQueueing;
2069 BOOLEAN AcceleratedTransfer;
2070 BYTE BusType;
2071 WORD BusMajorVersion;
2072 WORD BusMinorVersion;
2073#if NTDDI_VERSION >= NTDDI_WIN8
2074 BYTE SrbType;
2075 BYTE AddressType;
2076#endif
2077} STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
2078
2079#if NTDDI_VERSION >= NTDDI_WIN8
2080
2081#define NO_SRBTYPE_ADAPTER_DESCRIPTOR_SIZE UFIELD_OFFSET(STORAGE_ADAPTER_DESCRIPTOR, SrbType)
2082
2083#ifndef SRB_TYPE_SCSI_REQUEST_BLOCK
2084#define SRB_TYPE_SCSI_REQUEST_BLOCK 0
2085#endif
2086
2087#ifndef SRB_TYPE_STORAGE_REQUEST_BLOCK
2088#define SRB_TYPE_STORAGE_REQUEST_BLOCK 1
2089#endif
2090
2091#ifndef STORAGE_ADDRESS_TYPE_BTL8
2092#define STORAGE_ADDRESS_TYPE_BTL8 0
2093#endif
2094
2095#endif
2096
2097typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
2098 DWORD Version;
2099 DWORD Size;
2100 DWORD NumberOfIdentifiers;
2101 BYTE Identifiers[1];
2102} STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
2103
2104typedef struct _VOLUME_GET_GPT_ATTRIBUTES_INFORMATION {
2105 ULONGLONG GptAttributes;
2106} VOLUME_GET_GPT_ATTRIBUTES_INFORMATION, *PVOLUME_GET_GPT_ATTRIBUTES_INFORMATION;
2107
2108#if (_WIN32_WINNT >= 0x0600)
2109#define FSCTL_MAKE_MEDIA_COMPATIBLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 76, METHOD_BUFFERED, FILE_WRITE_DATA)
2110#define FSCTL_SET_DEFECT_MANAGEMENT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, METHOD_BUFFERED, FILE_WRITE_DATA)
2111#define FSCTL_QUERY_SPARING_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS)
2112#define FSCTL_QUERY_ON_DISK_VOLUME_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS)
2113#define FSCTL_SET_VOLUME_COMPRESSION_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,80, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
2114#define FSCTL_TXFS_MODIFY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM,81, METHOD_BUFFERED, FILE_WRITE_DATA)
2115#define FSCTL_TXFS_QUERY_RM_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,82, METHOD_BUFFERED, FILE_READ_DATA)
2116#define FSCTL_TXFS_ROLLFORWARD_REDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,84, METHOD_BUFFERED, FILE_WRITE_DATA)
2117#define FSCTL_TXFS_ROLLFORWARD_UNDO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,85, METHOD_BUFFERED, FILE_WRITE_DATA)
2118#define FSCTL_TXFS_START_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM,86, METHOD_BUFFERED, FILE_WRITE_DATA)
2119#define FSCTL_TXFS_SHUTDOWN_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 87, METHOD_BUFFERED, FILE_WRITE_DATA)
2120#define FSCTL_TXFS_READ_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,88, METHOD_BUFFERED, FILE_READ_DATA)
2121#define FSCTL_TXFS_WRITE_BACKUP_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,89, METHOD_BUFFERED, FILE_WRITE_DATA)
2122#define FSCTL_TXFS_CREATE_SECONDARY_RM CTL_CODE(FILE_DEVICE_FILE_SYSTEM,90,METHOD_BUFFERED, FILE_WRITE_DATA)
2123#define FSCTL_TXFS_GET_METADATA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,91, METHOD_BUFFERED, FILE_READ_DATA)
2124#define FSCTL_TXFS_GET_TRANSACTED_VERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,92, METHOD_BUFFERED, FILE_READ_DATA)
2125#define FSCTL_TXFS_SAVEPOINT_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,94, METHOD_BUFFERED, FILE_WRITE_DATA)
2126#define FSCTL_TXFS_CREATE_MINIVERSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 95, METHOD_BUFFERED, FILE_WRITE_DATA)
2127#define FSCTL_TXFS_TRANSACTION_ACTIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,99, METHOD_BUFFERED, FILE_READ_DATA)
2128#define FSCTL_SET_ZERO_ON_DEALLOCATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,101, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
2129#define FSCTL_SET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 102, METHOD_BUFFERED, FILE_ANY_ACCESS)
2130#define FSCTL_GET_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 103, METHOD_BUFFERED, FILE_ANY_ACCESS)
2131#define FSCTL_WAIT_FOR_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 104, METHOD_BUFFERED, FILE_ANY_ACCESS)
2132#define FSCTL_INITIATE_REPAIR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 106, METHOD_BUFFERED, FILE_ANY_ACCESS)
2133#define FSCTL_CSC_INTERNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 107, METHOD_NEITHER, FILE_ANY_ACCESS)
2134#define FSCTL_SHRINK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 108, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
2135#define FSCTL_SET_SHORT_NAME_BEHAVIOR CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS)
2136#define FSCTL_DFSR_SET_GHOST_HANDLE_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 110, METHOD_BUFFERED, FILE_ANY_ACCESS)
2137#define FSCTL_TXFS_LIST_TRANSACTION_LOCKED_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_READ_DATA)
2138#define FSCTL_TXFS_LIST_TRANSACTIONS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 121, METHOD_BUFFERED, FILE_READ_DATA)
2139#define FSCTL_QUERY_PAGEFILE_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 122, METHOD_BUFFERED, FILE_ANY_ACCESS)
2140#define FSCTL_RESET_VOLUME_ALLOCATION_HINTS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 123, METHOD_BUFFERED, FILE_ANY_ACCESS)
2141#define FSCTL_TXFS_READ_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 126, METHOD_BUFFERED, FILE_ANY_ACCESS)
2142
2143#define SET_REPAIR_ENABLED 0x00000001
2144#define SET_REPAIR_VOLUME_BITMAP_SCAN 0x00000002
2145#define SET_REPAIR_DELETE_CROSSLINK 0x00000004
2146#define SET_REPAIR_WARN_ABOUT_DATA_LOSS 0x00000008
2147#define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT 0x00000010
2148
2149typedef struct _FILE_MAKE_COMPATIBLE_BUFFER {
2150 BOOLEAN CloseDisc;
2151} FILE_MAKE_COMPATIBLE_BUFFER, *PFILE_MAKE_COMPATIBLE_BUFFER;
2152
2153typedef struct _FILE_SET_DEFECT_MGMT_BUFFER {
2154 BOOLEAN Disable;
2155} FILE_SET_DEFECT_MGMT_BUFFER, *PFILE_SET_DEFECT_MGMT_BUFFER;
2156
2157typedef struct _FILE_QUERY_SPARING_BUFFER {
2158 ULONG SparingUnitBytes;
2159 BOOLEAN SoftwareSparing;
2160 ULONG TotalSpareBlocks;
2161 ULONG FreeSpareBlocks;
2162} FILE_QUERY_SPARING_BUFFER, *PFILE_QUERY_SPARING_BUFFER;
2163
2164typedef struct _FILE_QUERY_ON_DISK_VOL_INFO_BUFFER {
2165 LARGE_INTEGER DirectoryCount;
2166 LARGE_INTEGER FileCount;
2167 WORD FsFormatMajVersion;
2168 WORD FsFormatMinVersion;
2169 WCHAR FsFormatName[12];
2170 LARGE_INTEGER FormatTime;
2171 LARGE_INTEGER LastUpdateTime;
2172 WCHAR CopyrightInfo[34];
2173 WCHAR AbstractInfo[34];
2174 WCHAR FormattingImplementationInfo[34];
2175 WCHAR LastModifyingImplementationInfo[34];
2176} FILE_QUERY_ON_DISK_VOL_INFO_BUFFER, *PFILE_QUERY_ON_DISK_VOL_INFO_BUFFER;
2177
2178#define SET_REPAIR_ENABLED 0x00000001
2179#define SET_REPAIR_VOLUME_BITMAP_SCAN 0x00000002
2180#define SET_REPAIR_DELETE_CROSSLINK 0x00000004
2181#define SET_REPAIR_WARN_ABOUT_DATA_LOSS 0x00000008
2182#define SET_REPAIR_DISABLED_AND_BUGCHECK_ON_CORRUPT 0x00000010
2183#define SET_REPAIR_VALID_MASK 0x0000001F
2184
2185typedef enum _SHRINK_VOLUME_REQUEST_TYPES {
2186 ShrinkPrepare = 1,
2187 ShrinkCommit,
2188 ShrinkAbort
2189} SHRINK_VOLUME_REQUEST_TYPES;
2190
2191typedef struct _SHRINK_VOLUME_INFORMATION {
2192 SHRINK_VOLUME_REQUEST_TYPES ShrinkRequestType;
2193 DWORDLONG Flags;
2194 LONGLONG NewNumberOfSectors;
2195} SHRINK_VOLUME_INFORMATION, *PSHRINK_VOLUME_INFORMATION;
2196
2197#define TXFS_RM_FLAG_LOGGING_MODE 0x00000001
2198#define TXFS_RM_FLAG_RENAME_RM 0x00000002
2199#define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000004
2200#define TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000008
2201#define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000010
2202#define TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000020
2203#define TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000040
2204#define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000080
2205#define TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000100
2206#define TXFS_RM_FLAG_GROW_LOG 0x00000400
2207#define TXFS_RM_FLAG_SHRINK_LOG 0x00000800
2208#define TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE 0x00001000
2209#define TXFS_RM_FLAG_PRESERVE_CHANGES 0x00002000
2210#define TXFS_RM_FLAG_RESET_RM_AT_NEXT_START 0x00004000
2211#define TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START 0x00008000
2212#define TXFS_RM_FLAG_PREFER_CONSISTENCY 0x00010000
2213#define TXFS_RM_FLAG_PREFER_AVAILABILITY 0x00020000
2214
2215#define TXFS_LOGGING_MODE_SIMPLE 1
2216#define TXFS_LOGGING_MODE_FULL 2
2217
2218#define TXFS_TRANSACTION_STATE_NONE 0
2219#define TXFS_TRANSACTION_STATE_ACTIVE 1
2220#define TXFS_TRANSACTION_STATE_PREPARED 2
2221#define TXFS_TRANSACTION_STATE_NOTACTIVE 3
2222
2223#define TXFS_MODIFY_RM_VALID_FLAGS (TXFS_RM_FLAG_LOGGING_MODE | \
2224 TXFS_RM_FLAG_RENAME_RM | \
2225 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \
2226 TXFS_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \
2227 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
2228 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
2229 TXFS_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \
2230 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
2231 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
2232 TXFS_RM_FLAG_SHRINK_LOG | \
2233 TXFS_RM_FLAG_GROW_LOG | \
2234 TXFS_RM_FLAG_ENFORCE_MINIMUM_SIZE | \
2235 TXFS_RM_FLAG_PRESERVE_CHANGES | \
2236 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
2237 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
2238 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
2239 TXFS_RM_FLAG_PREFER_AVAILABILITY)
2240
2241typedef struct _TXFS_MODIFY_RM {
2242 ULONG Flags;
2243 ULONG LogContainerCountMax;
2244 ULONG LogContainerCountMin;
2245 ULONG LogContainerCount;
2246 ULONG LogGrowthIncrement;
2247 ULONG LogAutoShrinkPercentage;
2248 ULONGLONG Reserved;
2249 USHORT LoggingMode;
2250} TXFS_MODIFY_RM, *PTXFS_MODIFY_RM;
2251
2252#define TXFS_RM_STATE_NOT_STARTED 0
2253#define TXFS_RM_STATE_STARTING 1
2254#define TXFS_RM_STATE_ACTIVE 2
2255#define TXFS_RM_STATE_SHUTTING_DOWN 3
2256
2257#define TXFS_QUERY_RM_INFORMATION_VALID_FLAGS \
2258 (TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
2259 TXFS_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
2260 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
2261 TXFS_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN | \
2262 TXFS_RM_FLAG_RESET_RM_AT_NEXT_START | \
2263 TXFS_RM_FLAG_DO_NOT_RESET_RM_AT_NEXT_START | \
2264 TXFS_RM_FLAG_PREFER_CONSISTENCY | \
2265 TXFS_RM_FLAG_PREFER_AVAILABILITY)
2266
2267typedef struct _TXFS_QUERY_RM_INFORMATION {
2268 ULONG BytesRequired;
2269 ULONGLONG TailLsn;
2270 ULONGLONG CurrentLsn;
2271 ULONGLONG ArchiveTailLsn;
2272 ULONGLONG LogContainerSize;
2273 LARGE_INTEGER HighestVirtualClock;
2274 ULONG LogContainerCount;
2275 ULONG LogContainerCountMax;
2276 ULONG LogContainerCountMin;
2277 ULONG LogGrowthIncrement;
2278 ULONG LogAutoShrinkPercentage;
2279 ULONG Flags;
2280 USHORT LoggingMode;
2281 USHORT Reserved;
2282 ULONG RmState;
2283 ULONGLONG LogCapacity;
2284 ULONGLONG LogFree;
2285 ULONGLONG TopsSize;
2286 ULONGLONG TopsUsed;
2287 ULONGLONG TransactionCount;
2288 ULONGLONG OnePCCount;
2289 ULONGLONG TwoPCCount;
2290 ULONGLONG NumberLogFileFull;
2291 ULONGLONG OldestTransactionAge;
2292 GUID RMName;
2293 ULONG TmLogPathOffset;
2294} TXFS_QUERY_RM_INFORMATION, *PTXFS_QUERY_RM_INFORMATION;
2295
2296#define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN 0x01
2297#define TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK 0x02
2298
2299#define TXFS_ROLLFORWARD_REDO_VALID_FLAGS \
2300 (TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_REDO_LSN | \
2301 TXFS_ROLLFORWARD_REDO_FLAG_USE_LAST_VIRTUAL_CLOCK)
2302
2303typedef struct _TXFS_ROLLFORWARD_REDO_INFORMATION {
2304 LARGE_INTEGER LastVirtualClock;
2305 ULONGLONG LastRedoLsn;
2306 ULONGLONG HighestRecoveryLsn;
2307 ULONG Flags;
2308} TXFS_ROLLFORWARD_REDO_INFORMATION, *PTXFS_ROLLFORWARD_REDO_INFORMATION;
2309
2310#define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX 0x00000001
2311#define TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN 0x00000002
2312#define TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE 0x00000004
2313#define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS 0x00000008
2314#define TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT 0x00000010
2315#define TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE 0x00000020
2316#define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX 0x00000040
2317#define TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MIN 0x00000080
2318#define TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT 0x00000200
2319#define TXFS_START_RM_FLAG_LOGGING_MODE 0x00000400
2320#define TXFS_START_RM_FLAG_PRESERVE_CHANGES 0x00000800
2321#define TXFS_START_RM_FLAG_PREFER_CONSISTENCY 0x00001000
2322#define TXFS_START_RM_FLAG_PREFER_AVAILABILITY 0x00002000
2323
2324#define TXFS_START_RM_VALID_FLAGS \
2325 (TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MAX | \
2326 TXFS_START_RM_FLAG_LOG_CONTAINER_COUNT_MIN | \
2327 TXFS_START_RM_FLAG_LOG_CONTAINER_SIZE | \
2328 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_NUM_CONTAINERS | \
2329 TXFS_START_RM_FLAG_LOG_GROWTH_INCREMENT_PERCENT | \
2330 TXFS_START_RM_FLAG_LOG_AUTO_SHRINK_PERCENTAGE | \
2331 TXFS_START_RM_FLAG_RECOVER_BEST_EFFORT | \
2332 TXFS_START_RM_FLAG_LOG_NO_CONTAINER_COUNT_MAX | \
2333 TXFS_START_RM_FLAG_LOGGING_MODE | \
2334 TXFS_START_RM_FLAG_PRESERVE_CHANGES | \
2335 TXFS_START_RM_FLAG_PREFER_CONSISTENCY | \
2336 TXFS_START_RM_FLAG_PREFER_AVAILABILITY)
2337
2338typedef struct _TXFS_START_RM_INFORMATION {
2339 ULONG Flags;
2340 ULONGLONG LogContainerSize;
2341 ULONG LogContainerCountMin;
2342 ULONG LogContainerCountMax;
2343 ULONG LogGrowthIncrement;
2344 ULONG LogAutoShrinkPercentage;
2345 ULONG TmLogPathOffset;
2346 USHORT TmLogPathLength;
2347 USHORT LoggingMode;
2348 USHORT LogPathLength;
2349 USHORT Reserved;
2350 WCHAR LogPath[1];
2351} TXFS_START_RM_INFORMATION, *PTXFS_START_RM_INFORMATION;
2352
2353typedef struct _TXFS_GET_METADATA_INFO_OUT {
2354 struct {
2355 LONGLONG LowPart;
2356 LONGLONG HighPart;
2357 } TxfFileId;
2358 GUID LockingTransaction;
2359 ULONGLONG LastLsn;
2360 ULONG TransactionState;
2361} TXFS_GET_METADATA_INFO_OUT, *PTXFS_GET_METADATA_INFO_OUT;
2362
2363#define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_CREATED 0x00000001
2364#define TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY_FLAG_DELETED 0x00000002
2365
2366typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY {
2367 ULONGLONG Offset;
2368 ULONG NameFlags;
2369 LONGLONG FileId;
2370 ULONG Reserved1;
2371 ULONG Reserved2;
2372 LONGLONG Reserved3;
2373 WCHAR FileName[1];
2374} TXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY, *PTXFS_LIST_TRANSACTION_LOCKED_FILES_ENTRY;
2375
2376typedef struct _TXFS_LIST_TRANSACTION_LOCKED_FILES {
2377 GUID KtmTransaction;
2378 ULONGLONG NumberOfFiles;
2379 ULONGLONG BufferSizeRequired;
2380 ULONGLONG Offset;
2381} TXFS_LIST_TRANSACTION_LOCKED_FILES, *PTXFS_LIST_TRANSACTION_LOCKED_FILES;
2382
2383typedef struct _TXFS_LIST_TRANSACTIONS_ENTRY {
2384 GUID TransactionId;
2385 ULONG TransactionState;
2386 ULONG Reserved1;
2387 ULONG Reserved2;
2388 LONGLONG Reserved3;
2389} TXFS_LIST_TRANSACTIONS_ENTRY, *PTXFS_LIST_TRANSACTIONS_ENTRY;
2390
2391typedef struct _TXFS_LIST_TRANSACTIONS {
2392 ULONGLONG NumberOfTransactions;
2393 ULONGLONG BufferSizeRequired;
2394} TXFS_LIST_TRANSACTIONS, *PTXFS_LIST_TRANSACTIONS;
2395
2396typedef struct _TXFS_READ_BACKUP_INFORMATION_OUT {
2397 __C89_NAMELESS union {
2398 ULONG BufferLength;
2399 UCHAR Buffer;
2400 } DUMMYUNIONNAME;
2401} TXFS_READ_BACKUP_INFORMATION_OUT, *PTXFS_READ_BACKUP_INFORMATION_OUT;
2402
2403typedef struct _TXFS_WRITE_BACKUP_INFORMATION {
2404 UCHAR Buffer;
2405} TXFS_WRITE_BACKUP_INFORMATION, *PTXFS_WRITE_BACKUP_INFORMATION;
2406
2407#define TXFS_TRANSACTED_VERSION_NONTRANSACTED 0xFFFFFFFE
2408#define TXFS_TRANSACTED_VERSION_UNCOMMITTED 0xFFFFFFFF
2409
2410typedef struct _TXFS_GET_TRANSACTED_VERSION {
2411 ULONG ThisBaseVersion;
2412 ULONG LatestVersion;
2413 USHORT ThisMiniVersion;
2414 USHORT FirstMiniVersion;
2415 USHORT LatestMiniVersion;
2416} TXFS_GET_TRANSACTED_VERSION, *PTXFS_GET_TRANSACTED_VERSION;
2417
2418#define TXFS_SAVEPOINT_SET 1
2419#define TXFS_SAVEPOINT_ROLLBACK 2
2420#define TXFS_SAVEPOINT_CLEAR 4
2421#define TXFS_SAVEPOINT_CLEAR_ALL 16
2422
2423typedef struct _TXFS_SAVEPOINT_INFORMATION {
2424 HANDLE KtmTransaction;
2425 ULONG ActionCode;
2426 ULONG SavepointId;
2427} TXFS_SAVEPOINT_INFORMATION, *PTXFS_SAVEPOINT_INFORMATION;
2428
2429typedef struct _TXFS_CREATE_MINIVERSION_INFO {
2430 USHORT StructureVersion;
2431 USHORT StructureLength;
2432 ULONG BaseVersion;
2433 USHORT MiniVersion;
2434} TXFS_CREATE_MINIVERSION_INFO, *PTXFS_CREATE_MINIVERSION_INFO;
2435
2436typedef struct _TXFS_TRANSACTION_ACTIVE_INFO {
2437 BOOLEAN TransactionsActiveAtSnapshot;
2438} TXFS_TRANSACTION_ACTIVE_INFO, *PTXFS_TRANSACTION_ACTIVE_INFO;
2439
2440typedef enum _WRITE_CACHE_TYPE {
2441 WriteCacheTypeUnknown = 0,
2442 WriteCacheTypeNone = 1,
2443 WriteCacheTypeWriteBack = 2,
2444 WriteCacheTypeWriteThrough = 3
2445} WRITE_CACHE_TYPE;
2446
2447typedef enum _WRITE_CACHE_ENABLE {
2448 WriteCacheEnableUnknown = 0,
2449 WriteCacheDisabled = 1,
2450 WriteCacheEnabled = 2
2451} WRITE_CACHE_ENABLE;
2452
2453typedef enum _WRITE_CACHE_CHANGE {
2454 WriteCacheChangeUnknown = 0,
2455 WriteCacheNotChangeable = 1,
2456 WriteCacheChangeable = 2
2457} WRITE_CACHE_CHANGE;
2458
2459typedef enum _WRITE_THROUGH {
2460 WriteThroughUnknown = 0,
2461 WriteThroughNotSupported = 1,
2462 WriteThroughSupported = 2
2463} WRITE_THROUGH;
2464
2465typedef struct _STORAGE_WRITE_CACHE_PROPERTY {
2466 DWORD Version;
2467 DWORD Size;
2468 WRITE_CACHE_TYPE WriteCacheType;
2469 WRITE_CACHE_ENABLE WriteCacheEnabled;
2470 WRITE_CACHE_CHANGE WriteCacheChangeable;
2471 WRITE_THROUGH WriteThroughSupported;
2472 BOOLEAN FlushCacheSupported;
2473 BOOLEAN UserDefinedPowerProtection;
2474 BOOLEAN NVCacheEnabled;
2475} STORAGE_WRITE_CACHE_PROPERTY, *PSTORAGE_WRITE_CACHE_PROPERTY;
2476
2477typedef enum _STORAGE_PORT_CODE_SET {
2478 StoragePortCodeSetReserved = 0,
2479 StoragePortCodeSetStorport = 1,
2480 StoragePortCodeSetSCSIport = 2,
2481 StoragePortCodeSetSpaceport = 3,
2482 StoragePortCodeSetATAport = 4,
2483 StoragePortCodeSetUSBport = 5,
2484 StoragePortCodeSetSBP2port = 6,
2485 StoragePortCodeSetSDport = 7
2486} STORAGE_PORT_CODE_SET, *PSTORAGE_PORT_CODE_SET;
2487
2488typedef struct _STORAGE_MINIPORT_DESCRIPTOR {
2489 DWORD Version;
2490 DWORD Size;
2491 STORAGE_PORT_CODE_SET Portdriver;
2492 BOOLEAN LUNResetSupported;
2493 BOOLEAN TargetResetSupported;
2494} STORAGE_MINIPORT_DESCRIPTOR, *PSTORAGE_MINIPORT_DESCRIPTOR;
2495
2496typedef enum _STORAGE_IDENTIFIER_CODE_SET {
2497 StorageIdCodeSetReserved = 0,
2498 StorageIdCodeSetBinary = 1,
2499 StorageIdCodeSetAscii = 2,
2500 StorageIdCodeSetUtf8 = 3
2501} STORAGE_IDENTIFIER_CODE_SET, *PSTORAGE_IDENTIFIER_CODE_SET;
2502
2503typedef enum _STORAGE_IDENTIFIER_TYPE {
2504 StorageIdTypeVendorSpecific = 0,
2505 StorageIdTypeVendorId = 1,
2506 StorageIdTypeEUI64 = 2,
2507 StorageIdTypeFCPHName = 3,
2508 StorageIdTypePortRelative = 4,
2509 StorageIdTypeTargetPortGroup = 5,
2510 StorageIdTypeLogicalUnitGroup = 6,
2511 StorageIdTypeMD5LogicalUnitIdentifier = 7,
2512 StorageIdTypeScsiNameString = 8
2513} STORAGE_IDENTIFIER_TYPE, *PSTORAGE_IDENTIFIER_TYPE;
2514
2515#define StorageIdTypeNAA StorageIdTypeFCPHName
2516
2517typedef enum _STORAGE_ID_NAA_FORMAT {
2518 StorageIdNAAFormatIEEEExtended = 2,
2519 StorageIdNAAFormatIEEERegistered = 3,
2520 StorageIdNAAFormatIEEEERegisteredExtended = 5
2521} STORAGE_ID_NAA_FORMAT, *PSTORAGE_ID_NAA_FORMAT;
2522
2523typedef enum _STORAGE_ASSOCIATION_TYPE {
2524 StorageIdAssocDevice = 0,
2525 StorageIdAssocPort = 1,
2526 StorageIdAssocTarget = 2
2527} STORAGE_ASSOCIATION_TYPE, *PSTORAGE_ASSOCIATION_TYPE;
2528
2529typedef struct _STORAGE_IDENTIFIER {
2530 STORAGE_IDENTIFIER_CODE_SET CodeSet;
2531 STORAGE_IDENTIFIER_TYPE Type;
2532 USHORT IdentifierSize;
2533 USHORT NextOffset;
2534 STORAGE_ASSOCIATION_TYPE Association;
2535 UCHAR Identifier[1];
2536} STORAGE_IDENTIFIER, *PSTORAGE_IDENTIFIER;
2537
2538typedef struct _STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR {
2539 DWORD Version;
2540 DWORD Size;
2541 DWORD BytesPerCacheLine;
2542 DWORD BytesOffsetForCacheAlignment;
2543 DWORD BytesPerLogicalSector;
2544 DWORD BytesPerPhysicalSector;
2545 DWORD BytesOffsetForSectorAlignment;
2546} STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR, *PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR;
2547
2548typedef struct _STORAGE_MEDIUM_PRODUCT_TYPE_DESCRIPTOR {
2549 DWORD Version;
2550 DWORD Size;
2551 DWORD MediumProductType;
2552} STORAGE_MEDIUM_PRODUCT_TYPE_DESCRIPTOR, *PSTORAGE_MEDIUM_PRODUCT_TYPE_DESCRIPTOR;
2553
2554#endif /*(_WIN32_WINNT >= 0x0600)*/
2555
2556typedef struct _DEVICE_SEEK_PENALTY_DESCRIPTOR {
2557 DWORD Version;
2558 DWORD Size;
2559 BOOLEAN IncursSeekPenalty;
2560} DEVICE_SEEK_PENALTY_DESCRIPTOR, *PDEVICE_SEEK_PENALTY_DESCRIPTOR;
2561
2562typedef struct _DEVICE_WRITE_AGGREGATION_DESCRIPTOR {
2563 ULONG Version;
2564 ULONG Size;
2565 BOOLEAN BenefitsFromWriteAggregation;
2566} DEVICE_WRITE_AGGREGATION_DESCRIPTOR, *PDEVICE_WRITE_AGGREGATION_DESCRIPTOR;
2567
2568typedef struct _DEVICE_TRIM_DESCRIPTOR {
2569 DWORD Version;
2570 DWORD Size;
2571 BOOLEAN TrimEnabled;
2572} DEVICE_TRIM_DESCRIPTOR, *PDEVICE_TRIM_DESCRIPTOR;
2573
2574typedef struct _DEVICE_LB_PROVISIONING_DESCRIPTOR {
2575 DWORD Version;
2576 DWORD Size;
2577 BYTE ThinProvisioningEnabled : 1;
2578 BYTE ThinProvisioningReadZeros : 1;
2579 BYTE AnchorSupported : 3;
2580 BYTE UnmapGranularityAlignmentValid : 1;
2581 BYTE GetFreeSpaceSupported : 1;
2582 BYTE MapSupported : 1;
2583 BYTE Reserved1[7];
2584 DWORDLONG OptimalUnmapGranularity;
2585 DWORDLONG UnmapGranularityAlignment;
2586#if NTDDI_VERSION >= NTDDI_WINBLUE
2587 DWORD MaxUnmapLbaCount;
2588 DWORD MaxUnmapBlockDescriptorCount;
2589#endif
2590} DEVICE_LB_PROVISIONING_DESCRIPTOR, *PDEVICE_LB_PROVISIONING_DESCRIPTOR;
2591
2592#define DEVICE_LB_PROVISIONING_DESCRIPTOR_V1_SIZE RTL_SIZEOF_THROUGH_FIELD(DEVICE_LB_PROVISIONING_DESCRIPTOR, UnmapGranularityAlignment)
2593
2594typedef struct _STORAGE_LB_PROVISIONING_MAP_RESOURCES {
2595 DWORD Size;
2596 DWORD Version;
2597 BYTE AvailableMappingResourcesValid : 1;
2598 BYTE UsedMappingResourcesValid : 1;
2599 BYTE Reserved0 : 6;
2600 BYTE Reserved1[3];
2601 BYTE AvailableMappingResourcesScope : 2;
2602 BYTE UsedMappingResourcesScope : 2;
2603 BYTE Reserved2 : 4;
2604 BYTE Reserved3[3];
2605 DWORDLONG AvailableMappingResources;
2606 DWORDLONG UsedMappingResources;
2607} STORAGE_LB_PROVISIONING_MAP_RESOURCES, *PSTORAGE_LB_PROVISIONING_MAP_RESOURCES;
2608
2609typedef struct _DEVICE_POWER_DESCRIPTOR {
2610 DWORD Version;
2611 DWORD Size;
2612 BOOLEAN DeviceAttentionSupported;
2613 BOOLEAN AsynchronousNotificationSupported;
2614 BOOLEAN IdlePowerManagementEnabled;
2615 BOOLEAN D3ColdEnabled;
2616 BOOLEAN D3ColdSupported;
2617 BOOLEAN NoVerifyDuringIdlePower;
2618 BYTE Reserved[2];
2619 DWORD IdleTimeoutInMS;
2620} DEVICE_POWER_DESCRIPTOR, *PDEVICE_POWER_DESCRIPTOR;
2621
2622typedef struct _DEVICE_COPY_OFFLOAD_DESCRIPTOR {
2623 DWORD Version;
2624 DWORD Size;
2625 DWORD MaximumTokenLifetime;
2626 DWORD DefaultTokenLifetime;
2627 DWORDLONG MaximumTransferSize;
2628 DWORDLONG OptimalTransferCount;
2629 DWORD MaximumDataDescriptors;
2630 DWORD MaximumTransferLengthPerDescriptor;
2631 DWORD OptimalTransferLengthPerDescriptor;
2632 WORD OptimalTransferLengthGranularity;
2633 BYTE Reserved[2];
2634} DEVICE_COPY_OFFLOAD_DESCRIPTOR, *PDEVICE_COPY_OFFLOAD_DESCRIPTOR;
2635
2636typedef struct _STORAGE_DEVICE_RESILIENCY_DESCRIPTOR {
2637 DWORD Version;
2638 DWORD Size;
2639 DWORD NameOffset;
2640 DWORD NumberOfLogicalCopies;
2641 DWORD NumberOfPhysicalCopies;
2642 DWORD PhysicalDiskRedundancy;
2643 DWORD NumberOfColumns;
2644 DWORD Interleave;
2645} STORAGE_DEVICE_RESILIENCY_DESCRIPTOR, *PSTORAGE_DEVICE_RESILIENCY_DESCRIPTOR;
2646
2647typedef enum _STORAGE_RPMB_FRAME_TYPE {
2648 StorageRpmbFrameTypeUnknown = 0,
2649 StorageRpmbFrameTypeStandard,
2650 StorageRpmbFrameTypeMax
2651} STORAGE_RPMB_FRAME_TYPE, *PSTORAGE_RPMB_FRAME_TYPE;
2652
2653#define STORAGE_RPMB_DESCRIPTOR_VERSION_1 1
2654
2655#define STORAGE_RPMB_MINIMUM_RELIABLE_WRITE_SIZE 512
2656
2657typedef struct _STORAGE_RPMB_DESCRIPTOR {
2658 DWORD Version;
2659 DWORD Size;
2660 DWORD SizeInBytes;
2661 DWORD MaxReliableWriteSizeInBytes;
2662 STORAGE_RPMB_FRAME_TYPE FrameFormat;
2663} STORAGE_RPMB_DESCRIPTOR, *PSTORAGE_RPMB_DESCRIPTOR;
2664
2665typedef enum _STORAGE_CRYPTO_ALGORITHM_ID {
2666 StorageCryptoAlgorithmUnknown = 0,
2667 StorageCryptoAlgorithmXTSAES = 1,
2668 StorageCryptoAlgorithmBitlockerAESCBC,
2669 StorageCryptoAlgorithmAESECB,
2670 StorageCryptoAlgorithmESSIVAESCBC,
2671 StorageCryptoAlgorithmMax
2672} STORAGE_CRYPTO_ALGORITHM_ID, *PSTORAGE_CRYPTO_ALGORITHM_ID;
2673
2674typedef enum _STORAGE_CRYPTO_KEY_SIZE {
2675 StorageCryptoKeySizeUnknown = 0,
2676 StorageCryptoKeySize128Bits = 1,
2677 StorageCryptoKeySize192Bits,
2678 StorageCryptoKeySize256Bits,
2679 StorageCryptoKeySize512Bits
2680} STORAGE_CRYPTO_KEY_SIZE, *PSTORAGE_CRYPTO_KEY_SIZE;
2681
2682#define STORAGE_CRYPTO_CAPABILITY_VERSION_1 1
2683
2684typedef struct _STORAGE_CRYPTO_CAPABILITY {
2685 DWORD Version;
2686 DWORD Size;
2687 DWORD CryptoCapabilityIndex;
2688 STORAGE_CRYPTO_ALGORITHM_ID AlgorithmId;
2689 STORAGE_CRYPTO_KEY_SIZE KeySize;
2690 DWORD DataUnitSizeBitmask;
2691} STORAGE_CRYPTO_CAPABILITY, *PSTORAGE_CRYPTO_CAPABILITY;
2692
2693#define STORAGE_CRYPTO_DESCRIPTOR_VERSION_1 1
2694
2695typedef struct _STORAGE_CRYPTO_DESCRIPTOR {
2696 DWORD Version;
2697 DWORD Size;
2698 DWORD NumKeysSupported;
2699 DWORD NumCryptoCapabilities;
2700 STORAGE_CRYPTO_CAPABILITY CryptoCapabilities[ANYSIZE_ARRAY];
2701} STORAGE_CRYPTO_DESCRIPTOR, *PSTORAGE_CRYPTO_DESCRIPTOR;
2702
2703#define STORAGE_TIER_NAME_LENGTH (256)
2704#define STORAGE_TIER_DESCRIPTION_LENGTH (512)
2705
2706#define STORAGE_TIER_FLAG_NO_SEEK_PENALTY (0x00020000)
2707#define STORAGE_TIER_FLAG_WRITE_BACK_CACHE (0x00200000)
2708#define STORAGE_TIER_FLAG_READ_CACHE (0x00400000)
2709#define STORAGE_TIER_FLAG_PARITY (0x00800000)
2710#define STORAGE_TIER_FLAG_SMR (0x01000000)
2711
2712typedef enum _STORAGE_TIER_MEDIA_TYPE {
2713 StorageTierMediaTypeUnspecified = 0,
2714 StorageTierMediaTypeDisk = 1,
2715 StorageTierMediaTypeSsd = 2,
2716 StorageTierMediaTypeScm = 4,
2717 StorageTierMediaTypeMax
2718} STORAGE_TIER_MEDIA_TYPE, *PSTORAGE_TIER_MEDIA_TYPE;
2719
2720typedef enum _STORAGE_TIER_CLASS {
2721 StorageTierClassUnspecified = 0,
2722 StorageTierClassCapacity,
2723 StorageTierClassPerformance,
2724 StorageTierClassMax
2725} STORAGE_TIER_CLASS, *PSTORAGE_TIER_CLASS;
2726
2727typedef struct _STORAGE_TIER {
2728 GUID Id;
2729 WCHAR Name[STORAGE_TIER_NAME_LENGTH];
2730 WCHAR Description[STORAGE_TIER_NAME_LENGTH];
2731 DWORDLONG Flags;
2732 DWORDLONG ProvisionedCapacity;
2733 STORAGE_TIER_MEDIA_TYPE MediaType;
2734 STORAGE_TIER_CLASS Class;
2735} STORAGE_TIER, *PSTORAGE_TIER;
2736
2737typedef struct _STORAGE_DEVICE_TIERING_DESCRIPTOR {
2738 DWORD Version;
2739 DWORD Size;
2740 DWORD Flags;
2741 DWORD TotalNumberOfTiers;
2742 DWORD NumberOfTiersReturned;
2743 STORAGE_TIER Tiers[ANYSIZE_ARRAY];
2744} STORAGE_DEVICE_TIERING_DESCRIPTOR, *PSTORAGE_DEVICE_TIERING_DESCRIPTOR;
2745
2746typedef struct _STORAGE_DEVICE_FAULT_DOMAIN_DESCRIPTOR {
2747 DWORD Version;
2748 DWORD Size;
2749 DWORD NumberOfFaultDomains;
2750 GUID FaultDomainIds[ANYSIZE_ARRAY];
2751} STORAGE_DEVICE_FAULT_DOMAIN_DESCRIPTOR, *PSTORAGE_DEVICE_FAULT_DOMAIN_DESCRIPTOR;
2752
2753typedef enum _STORAGE_PROTOCOL_TYPE {
2754 ProtocolTypeUnknown = 0x00,
2755 ProtocolTypeScsi,
2756 ProtocolTypeAta,
2757 ProtocolTypeNvme,
2758 ProtocolTypeSd,
2759 ProtocolTypeUfs,
2760 ProtocolTypeProprietary = 0x7E,
2761 ProtocolTypeMaxReserved = 0x7F
2762} STORAGE_PROTOCOL_TYPE, *PSTORAGE_PROTOCOL_TYPE;
2763
2764typedef enum _STORAGE_PROTOCOL_NVME_DATA_TYPE {
2765 NVMeDataTypeUnknown = 0,
2766 NVMeDataTypeIdentify,
2767 NVMeDataTypeLogPage,
2768 NVMeDataTypeFeature
2769} STORAGE_PROTOCOL_NVME_DATA_TYPE, *PSTORAGE_PROTOCOL_NVME_DATA_TYPE;
2770
2771typedef enum _STORAGE_PROTOCOL_ATA_DATA_TYPE {
2772 AtaDataTypeUnknown = 0,
2773 AtaDataTypeIdentify,
2774 AtaDataTypeLogPage
2775} STORAGE_PROTOCOL_ATA_DATA_TYPE, *PSTORAGE_PROTOCOL_ATA_DATA_TYPE;
2776
2777typedef enum _STORAGE_PROTOCOL_UFS_DATA_TYPE {
2778 UfsDataTypeUnknown = 0,
2779 UfsDataTypeQueryDescriptor,
2780 UfsDataTypeQueryAttribute,
2781 UfsDataTypeQueryFlag,
2782 UfsDataTypeQueryDmeAttribute,
2783 UfsDataTypeQueryDmePeerAttribute,
2784 UfsDataTypeMax
2785} STORAGE_PROTOCOL_UFS_DATA_TYPE, *PSTORAGE_PROTOCOL_UFS_DATA_TYPE;
2786
2787typedef union _STORAGE_PROTOCOL_DATA_SUBVALUE_GET_LOG_PAGE {
2788 __C89_NAMELESS struct {
2789 DWORD RetainAsynEvent : 1;
2790 DWORD LogSpecificField : 4;
2791 DWORD Reserved : 27;
2792 };
2793 DWORD AsUlong;
2794} STORAGE_PROTOCOL_DATA_SUBVALUE_GET_LOG_PAGE, *PSTORAGE_PROTOCOL_DATA_SUBVALUE_GET_LOG_PAGE;
2795
2796typedef struct _STORAGE_PROTOCOL_SPECIFIC_DATA {
2797 STORAGE_PROTOCOL_TYPE ProtocolType;
2798 DWORD DataType;
2799 DWORD ProtocolDataRequestValue;
2800 DWORD ProtocolDataRequestSubValue;
2801 DWORD ProtocolDataOffset;
2802 DWORD ProtocolDataLength;
2803 DWORD FixedProtocolReturnData;
2804 DWORD ProtocolDataRequestSubValue2;
2805 DWORD ProtocolDataRequestSubValue3;
2806 DWORD ProtocolDataRequestSubValue4;
2807} STORAGE_PROTOCOL_SPECIFIC_DATA, *PSTORAGE_PROTOCOL_SPECIFIC_DATA;
2808
2809typedef struct _STORAGE_PROTOCOL_SPECIFIC_DATA_EXT {
2810 STORAGE_PROTOCOL_TYPE ProtocolType;
2811 DWORD DataType;
2812 DWORD ProtocolDataValue;
2813 DWORD ProtocolDataSubValue;
2814 DWORD ProtocolDataOffset;
2815 DWORD ProtocolDataLength;
2816 DWORD FixedProtocolReturnData;
2817 DWORD ProtocolDataSubValue2;
2818 DWORD ProtocolDataSubValue3;
2819 DWORD ProtocolDataSubValue4;
2820 DWORD ProtocolDataSubValue5;
2821 DWORD Reserved[5];
2822} STORAGE_PROTOCOL_SPECIFIC_DATA_EXT, *PSTORAGE_PROTOCOL_SPECIFIC_DATA_EXT;
2823
2824typedef struct _STORAGE_PROTOCOL_DATA_DESCRIPTOR {
2825 DWORD Version;
2826 DWORD Size;
2827 STORAGE_PROTOCOL_SPECIFIC_DATA ProtocolSpecificData;
2828} STORAGE_PROTOCOL_DATA_DESCRIPTOR, *PSTORAGE_PROTOCOL_DATA_DESCRIPTOR;
2829
2830typedef struct _STORAGE_PROTOCOL_DATA_DESCRIPTOR_EXT {
2831 DWORD Version;
2832 DWORD Size;
2833 STORAGE_PROTOCOL_SPECIFIC_DATA_EXT ProtocolSpecificData;
2834} STORAGE_PROTOCOL_DATA_DESCRIPTOR_EXT, *PSTORAGE_PROTOCOL_DATA_DESCRIPTOR_EXT;
2835
2836#if (_WIN32_WINNT >= 0x0601)
2837typedef struct _REQUEST_OPLOCK_INPUT_BUFFER {
2838 WORD StructureVersion;
2839 WORD StructureLength;
2840 DWORD RequestedOplockLevel;
2841 DWORD Flags;
2842} REQUEST_OPLOCK_INPUT_BUFFER, *PREQUEST_OPLOCK_INPUT_BUFFER;
2843
2844typedef struct _REQUEST_OPLOCK_OUTPUT_BUFFER {
2845 WORD StructureVersion;
2846 WORD StructureLength;
2847 DWORD OriginalOplockLevel;
2848 DWORD NewOplockLevel;
2849 DWORD Flags;
2850 ACCESS_MASK AccessMode;
2851 WORD ShareMode;
2852} REQUEST_OPLOCK_OUTPUT_BUFFER, *PREQUEST_OPLOCK_OUTPUT_BUFFER;
2853
2854#define PERSISTENT_VOLUME_STATE_SHORT_NAME_CREATION_DISABLED (0x00000001)
2855
2856typedef struct _BOOT_AREA_INFO {
2857 ULONG BootSectorCount;
2858 struct {
2859 LARGE_INTEGER Offset;
2860 } BootSectors[2];
2861} BOOT_AREA_INFO, *PBOOT_AREA_INFO;
2862
2863typedef struct _RETRIEVAL_POINTER_BASE {
2864 LARGE_INTEGER FileAreaOffset;
2865} RETRIEVAL_POINTER_BASE, *PRETRIEVAL_POINTER_BASE;
2866
2867typedef struct _FILE_FS_PERSISTENT_VOLUME_INFORMATION {
2868 ULONG VolumeFlags;
2869 ULONG FlagMask;
2870 ULONG Version;
2871 ULONG Reserved;
2872} FILE_FS_PERSISTENT_VOLUME_INFORMATION, *PFILE_FS_PERSISTENT_VOLUME_INFORMATION;
2873
2874typedef struct _FILE_SYSTEM_RECOGNITION_INFORMATION {
2875 CHAR FileSystem[9];
2876} FILE_SYSTEM_RECOGNITION_INFORMATION, *PFILE_SYSTEM_RECOGNITION_INFORMATION;
2877
2878typedef struct _FILE_SYSTEM_RECOGNITION_STRUCTURE {
2879 UCHAR Jmp[3];
2880 UCHAR FsName[8];
2881 UCHAR MustBeZero[5];
2882 ULONG Identifier;
2883 USHORT Length;
2884 USHORT Checksum;
2885} FILE_SYSTEM_RECOGNITION_STRUCTURE;
2886
2887#define OPLOCK_LEVEL_CACHE_READ (0x00000001)
2888#define OPLOCK_LEVEL_CACHE_HANDLE (0x00000002)
2889#define OPLOCK_LEVEL_CACHE_WRITE (0x00000004)
2890
2891#define REQUEST_OPLOCK_INPUT_FLAG_REQUEST (0x00000001)
2892#define REQUEST_OPLOCK_INPUT_FLAG_ACK (0x00000002)
2893#define REQUEST_OPLOCK_INPUT_FLAG_COMPLETE_ACK_ON_CLOSE (0x00000004)
2894
2895#define REQUEST_OPLOCK_CURRENT_VERSION 1
2896
2897#define REQUEST_OPLOCK_OUTPUT_FLAG_ACK_REQUIRED (0x00000001)
2898#define REQUEST_OPLOCK_OUTPUT_FLAG_MODES_PROVIDED (0x00000002)
2899
2900#define SD_GLOBAL_CHANGE_TYPE_MACHINE_SID 1
2901
2902typedef struct _SD_CHANGE_MACHINE_SID_INPUT {
2903 USHORT CurrentMachineSIDOffset;
2904 USHORT CurrentMachineSIDLength;
2905 USHORT NewMachineSIDOffset;
2906 USHORT NewMachineSIDLength;
2907} SD_CHANGE_MACHINE_SID_INPUT, *PSD_CHANGE_MACHINE_SID_INPUT;
2908
2909typedef struct _SD_CHANGE_MACHINE_SID_OUTPUT {
2910 ULONGLONG NumSDChangedSuccess;
2911 ULONGLONG NumSDChangedFail;
2912 ULONGLONG NumSDUnused;
2913 ULONGLONG NumSDTotal;
2914 ULONGLONG NumMftSDChangedSuccess;
2915 ULONGLONG NumMftSDChangedFail;
2916 ULONGLONG NumMftSDTotal;
2917} SD_CHANGE_MACHINE_SID_OUTPUT, *PSD_CHANGE_MACHINE_SID_OUTPUT;
2918
2919#define ENCRYPTED_DATA_INFO_SPARSE_FILE 1
2920
2921typedef struct _EXTENDED_ENCRYPTED_DATA_INFO {
2922 ULONG ExtendedCode;
2923 ULONG Length;
2924 ULONG Flags;
2925 ULONG Reserved;
2926} EXTENDED_ENCRYPTED_DATA_INFO, *PEXTENDED_ENCRYPTED_DATA_INFO;
2927
2928typedef struct _LOOKUP_STREAM_FROM_CLUSTER_INPUT {
2929 DWORD Flags;
2930 DWORD NumberOfClusters;
2931 LARGE_INTEGER Cluster[1];
2932} LOOKUP_STREAM_FROM_CLUSTER_INPUT, *PLOOKUP_STREAM_FROM_CLUSTER_INPUT;
2933
2934typedef struct _LOOKUP_STREAM_FROM_CLUSTER_OUTPUT {
2935 DWORD Offset;
2936 DWORD NumberOfMatches;
2937 DWORD BufferSizeRequired;
2938} LOOKUP_STREAM_FROM_CLUSTER_OUTPUT, *PLOOKUP_STREAM_FROM_CLUSTER_OUTPUT;
2939
2940typedef struct _LOOKUP_STREAM_FROM_CLUSTER_ENTRY {
2941 DWORD OffsetToNext;
2942 DWORD Flags;
2943 LARGE_INTEGER Reserved;
2944 LARGE_INTEGER Cluster;
2945 WCHAR FileName[1];
2946} LOOKUP_STREAM_FROM_CLUSTER_ENTRY, *PLOOKUP_STREAM_FROM_CLUSTER_ENTRY;
2947
2948#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_MASK 0xff000000
2949#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_PAGE_FILE 0x00000001
2950#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_DENY_DEFRAG_SET 0x00000002
2951#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_FS_SYSTEM_FILE 0x00000004
2952#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_FLAG_TXF_SYSTEM_FILE 0x00000008
2953#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_DATA 0x01000000
2954#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_INDEX 0x02000000
2955#define LOOKUP_STREAM_FROM_CLUSTER_ENTRY_ATTRIBUTE_SYSTEM 0x03000000
2956
2957typedef struct _FILE_TYPE_NOTIFICATION_INPUT {
2958 ULONG Flags;
2959 ULONG NumFileTypeIDs;
2960 GUID FileTypeID[1];
2961} FILE_TYPE_NOTIFICATION_INPUT, *PFILE_TYPE_NOTIFICATION_INPUT;
2962
2963#define FILE_TYPE_NOTIFICATION_FLAG_USAGE_BEGIN 0x00000001
2964#define FILE_TYPE_NOTIFICATION_FLAG_USAGE_END 0x00000002
2965
2966#define FSCTL_QUERY_DEPENDENT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,124, METHOD_BUFFERED, FILE_ANY_ACCESS)
2967#define FSCTL_SD_GLOBAL_CHANGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,125, METHOD_BUFFERED, FILE_ANY_ACCESS)
2968#define FSCTL_LOOKUP_STREAM_FROM_CLUSTER CTL_CODE(FILE_DEVICE_FILE_SYSTEM,127, METHOD_BUFFERED, FILE_ANY_ACCESS)
2969#define FSCTL_TXFS_WRITE_BACKUP_INFORMATION2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM,128, METHOD_BUFFERED, FILE_ANY_ACCESS)
2970#define FSCTL_FILE_TYPE_NOTIFICATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,129, METHOD_BUFFERED, FILE_ANY_ACCESS)
2971#define FSCTL_GET_BOOT_AREA_INFO CTL_CODE(FILE_DEVICE_FILE_SYSTEM,140, METHOD_BUFFERED, FILE_ANY_ACCESS)
2972#define FSCTL_GET_RETRIEVAL_POINTER_BASE CTL_CODE(FILE_DEVICE_FILE_SYSTEM,141, METHOD_BUFFERED, FILE_ANY_ACCESS)
2973#define FSCTL_SET_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 142, METHOD_BUFFERED, FILE_ANY_ACCESS)
2974#define FSCTL_QUERY_PERSISTENT_VOLUME_STATE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 143, METHOD_BUFFERED, FILE_ANY_ACCESS)
2975#define FSCTL_REQUEST_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM,144,METHOD_BUFFERED,FILE_ANY_ACCESS)
2976#define FSCTL_CSV_TUNNEL_REQUEST CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 145, METHOD_BUFFERED, FILE_ANY_ACCESS)
2977#define FSCTL_IS_CSV_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 146, METHOD_BUFFERED, FILE_ANY_ACCESS)
2978#define FSCTL_QUERY_FILE_SYSTEM_RECOGNITION CTL_CODE(FILE_DEVICE_FILE_SYSTEM,147, METHOD_BUFFERED, FILE_ANY_ACCESS)
2979#define FSCTL_CSV_GET_VOLUME_PATH_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM,148, METHOD_BUFFERED, FILE_ANY_ACCESS)
2980#define FSCTL_CSV_GET_VOLUME_NAME_FOR_VOLUME_MOUNT_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 149, METHOD_BUFFERED, FILE_ANY_ACCESS)
2981#define FSCTL_CSV_GET_VOLUME_PATH_NAMES_FOR_VOLUME_NAME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 150, METHOD_BUFFERED, FILE_ANY_ACCESS)
2982#define FSCTL_IS_FILE_ON_CSV_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 151, METHOD_BUFFERED, FILE_ANY_ACCESS)
2983
2984typedef struct _CSV_NAMESPACE_INFO {
2985 ULONG Version;
2986 ULONG DeviceNumber;
2987 LARGE_INTEGER StartingOffset;
2988 ULONG SectorSize;
2989} CSV_NAMESPACE_INFO, *PCSV_NAMESPACE_INFO;
2990
2991#define CSV_NAMESPACE_INFO_V1 (sizeof(CSV_NAMESPACE_INFO))
2992#define CSV_INVALID_DEVICE_NUMBER 0xFFFFFFFF
2993
2994#endif /*(_WIN32_WINNT >= 0x0601)*/
2995
2996#endif /* _FILESYSTEMFSCTL_ */
2997
2998
2999#define IOCTL_VOLUME_BASE ((DWORD) 'V')
3000
3001#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS CTL_CODE(IOCTL_VOLUME_BASE,0,METHOD_BUFFERED,FILE_ANY_ACCESS)
3002#define IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE CTL_CODE(IOCTL_VOLUME_BASE,1,METHOD_BUFFERED,FILE_ANY_ACCESS)
3003#define IOCTL_VOLUME_ONLINE CTL_CODE(IOCTL_VOLUME_BASE,2,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
3004#define IOCTL_VOLUME_OFFLINE CTL_CODE(IOCTL_VOLUME_BASE,3,METHOD_BUFFERED,FILE_READ_ACCESS | FILE_WRITE_ACCESS)
3005#define IOCTL_VOLUME_IS_OFFLINE CTL_CODE(IOCTL_VOLUME_BASE,4,METHOD_BUFFERED, FILE_ANY_ACCESS)
3006#define IOCTL_VOLUME_IS_IO_CAPABLE CTL_CODE(IOCTL_VOLUME_BASE,5,METHOD_BUFFERED,FILE_ANY_ACCESS)
3007#define IOCTL_VOLUME_QUERY_FAILOVER_SET CTL_CODE(IOCTL_VOLUME_BASE,6,METHOD_BUFFERED,FILE_ANY_ACCESS)
3008#define IOCTL_VOLUME_QUERY_VOLUME_NUMBER CTL_CODE(IOCTL_VOLUME_BASE,7,METHOD_BUFFERED,FILE_ANY_ACCESS)
3009#define IOCTL_VOLUME_LOGICAL_TO_PHYSICAL CTL_CODE(IOCTL_VOLUME_BASE,8,METHOD_BUFFERED,FILE_ANY_ACCESS)
3010#define IOCTL_VOLUME_PHYSICAL_TO_LOGICAL CTL_CODE(IOCTL_VOLUME_BASE,9,METHOD_BUFFERED,FILE_ANY_ACCESS)
3011#define IOCTL_VOLUME_IS_CLUSTERED CTL_CODE(IOCTL_VOLUME_BASE,12,METHOD_BUFFERED,FILE_ANY_ACCESS)
3012#define IOCTL_VOLUME_GET_GPT_ATTRIBUTES CTL_CODE(IOCTL_VOLUME_BASE,14,METHOD_BUFFERED,FILE_ANY_ACCESS)
3013
3014typedef struct _DISK_EXTENT {
3015 DWORD DiskNumber;
3016 LARGE_INTEGER StartingOffset;
3017 LARGE_INTEGER ExtentLength;
3018} DISK_EXTENT,*PDISK_EXTENT;
3019
3020typedef struct _VOLUME_DISK_EXTENTS {
3021 DWORD NumberOfDiskExtents;
3022 DISK_EXTENT Extents[1];
3023} VOLUME_DISK_EXTENTS,*PVOLUME_DISK_EXTENTS;
3024
3025#if (_WIN32_WINNT >= 0x0603)
3026
3027#define FSCTL_SET_EXTERNAL_BACKING CTL_CODE(FILE_DEVICE_FILE_SYSTEM,195,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
3028#define FSCTL_GET_EXTERNAL_BACKING CTL_CODE(FILE_DEVICE_FILE_SYSTEM,196,METHOD_BUFFERED,FILE_ANY_ACCESS)
3029#define FSCTL_DELETE_EXTERNAL_BACKING CTL_CODE(FILE_DEVICE_FILE_SYSTEM,197,METHOD_BUFFERED,FILE_SPECIAL_ACCESS)
3030
3031#define WOF_CURRENT_VERSION 1
3032
3033typedef struct _WOF_EXTERNAL_INFO {
3034 DWORD Version;
3035 DWORD Provider;
3036} WOF_EXTERNAL_INFO, *PWOF_EXTERNAL_INFO;
3037
3038#endif /*(_WIN32_WINNT >= 0x0603)*/
3039
3040#if (_WIN32_WINNT >= 0x0A00)
3041
3042#define WOF_PROVIDER_FILE 2
3043
3044#define FILE_PROVIDER_CURRENT_VERSION 1
3045
3046#define FILE_PROVIDER_COMPRESSION_XPRESS4K 0
3047#define FILE_PROVIDER_COMPRESSION_LZX 1
3048#define FILE_PROVIDER_COMPRESSION_XPRESS8K 2
3049#define FILE_PROVIDER_COMPRESSION_XPRESS16K 3
3050
3051typedef struct _FILE_PROVIDER_EXTERNAL_INFO_V0 {
3052 DWORD Version;
3053 DWORD Algorithm;
3054} FILE_PROVIDER_EXTERNAL_INFO_V0, *PFILE_PROVIDER_EXTERNAL_INFO_V0;
3055
3056typedef struct _FILE_PROVIDER_EXTERNAL_INFO_V1 {
3057 DWORD Version;
3058 DWORD Algorithm;
3059 DWORD Flags;
3060} FILE_PROVIDER_EXTERNAL_INFO_V1, *PFILE_PROVIDER_EXTERNAL_INFO_V1;
3061
3062#endif /*(_WIN32_WINNT >= 0x0A00)*/
3063
3064#endif /* _WINIOCTL_ */
3065
Note: See TracBrowser for help on using the repository browser.