xref: /reactos/sdk/include/psdk/ntddstor.h (revision c2c66aff)
1 /*
2  * ntddstor.h
3  *
4  * Storage class IOCTL interface.
5  *
6  * This file is part of the w32api package.
7  *
8  * Contributors:
9  *   Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10  *
11  * THIS SOFTWARE IS NOT COPYRIGHTED
12  *
13  * This source code is offered for use in the public domain. You may
14  * use, modify or distribute it freely.
15  *
16  * This code is distributed in the hope that it will be useful but
17  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18  * DISCLAIMED. This includes but is not limited to warranties of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  */
22 
23 #ifndef _NTDDSTOR_H_
24 #define _NTDDSTOR_H_
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #if defined(DEFINE_GUID)
31 
32 DEFINE_GUID(GUID_DEVINTERFACE_DISK,
33   0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
34 
35 DEFINE_GUID(GUID_DEVINTERFACE_CDROM,
36   0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
37 
38 DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,
39   0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
40 
41 DEFINE_GUID(GUID_DEVINTERFACE_TAPE,
42   0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
43 
44 DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,
45   0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
46 
47 DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,
48   0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
49 
50 DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,
51   0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
52 
53 DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,
54   0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
55 
56 DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,
57   0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
58 
59 DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,
60   0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
61 
62 DEFINE_GUID(GUID_DEVINTERFACE_HIDDEN_VOLUME,
63   0x7f108a28L, 0x9833, 0x4b3b, 0xb7, 0x80, 0x2c, 0x6b, 0x5f, 0xa5, 0xc0, 0x62);
64 
65 #define WDI_STORAGE_PREDICT_FAILURE_DPS_GUID \
66   {0xe9f2d03aL, 0x747c, 0x41c2, {0xbb, 0x9a, 0x02, 0xc6, 0x2b, 0x6d, 0x5f, 0xcb}};
67 
68 /* Aliases for storage guids */
69 #define DiskClassGuid               GUID_DEVINTERFACE_DISK
70 #define CdRomClassGuid              GUID_DEVINTERFACE_CDROM
71 #define PartitionClassGuid          GUID_DEVINTERFACE_PARTITION
72 #define TapeClassGuid               GUID_DEVINTERFACE_TAPE
73 #define WriteOnceDiskClassGuid      GUID_DEVINTERFACE_WRITEONCEDISK
74 #define VolumeClassGuid             GUID_DEVINTERFACE_VOLUME
75 #define MediumChangerClassGuid      GUID_DEVINTERFACE_MEDIUMCHANGER
76 #define FloppyClassGuid             GUID_DEVINTERFACE_FLOPPY
77 #define CdChangerClassGuid          GUID_DEVINTERFACE_CDCHANGER
78 #define StoragePortClassGuid        GUID_DEVINTERFACE_STORAGEPORT
79 #define HiddenVolumeClassGuid       GUID_DEVINTERFACE_HIDDEN_VOLUME
80 
81 #endif /* defined(DEFINE_GUID) */
82 
83 #ifndef _WINIOCTL_
84 
85 #define IOCTL_STORAGE_BASE                FILE_DEVICE_MASS_STORAGE
86 
87 #define IOCTL_STORAGE_CHECK_VERIFY \
88   CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
89 
90 #define IOCTL_STORAGE_CHECK_VERIFY2 \
91   CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
92 
93 #define IOCTL_STORAGE_MEDIA_REMOVAL \
94   CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
95 
96 #define IOCTL_STORAGE_EJECT_MEDIA \
97   CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
98 
99 #define IOCTL_STORAGE_LOAD_MEDIA \
100   CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
101 
102 #define IOCTL_STORAGE_LOAD_MEDIA2 \
103   CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
104 
105 #define IOCTL_STORAGE_RESERVE \
106   CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
107 
108 #define IOCTL_STORAGE_RELEASE \
109   CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
110 
111 #define IOCTL_STORAGE_FIND_NEW_DEVICES \
112   CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
113 
114 #define IOCTL_STORAGE_EJECTION_CONTROL \
115   CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
116 
117 #define IOCTL_STORAGE_MCN_CONTROL \
118   CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
119 
120 #define IOCTL_STORAGE_GET_MEDIA_TYPES \
121   CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
122 
123 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
124   CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
125 
126 #define IOCTL_STORAGE_RESET_BUS \
127   CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
128 
129 #define IOCTL_STORAGE_RESET_DEVICE \
130   CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
131 
132 #define IOCTL_STORAGE_GET_DEVICE_NUMBER \
133   CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
134 
135 #define IOCTL_STORAGE_PREDICT_FAILURE \
136   CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
137 
138 #endif /* _WINIOCTL_ */
139 
140 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER \
141   CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
142 
143 #define IOCTL_STORAGE_GET_HOTPLUG_INFO \
144   CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
145 
146 #define IOCTL_STORAGE_SET_HOTPLUG_INFO \
147   CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
148 
149 #define OBSOLETE_IOCTL_STORAGE_RESET_BUS \
150   CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
151 
152 #define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE \
153   CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
154 
155 #define IOCTL_STORAGE_BREAK_RESERVATION \
156   CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
157 
158 #define IOCTL_STORAGE_PERSISTENT_RESERVE_IN \
159   CTL_CODE(IOCTL_STORAGE_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS)
160 
161 #define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT \
162   CTL_CODE(IOCTL_STORAGE_BASE, 0x0407, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
163 
164 #define IOCTL_STORAGE_READ_CAPACITY \
165   CTL_CODE(IOCTL_STORAGE_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
166 
167 #define IOCTL_STORAGE_QUERY_PROPERTY \
168   CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
169 
170 #define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES \
171   CTL_CODE(IOCTL_STORAGE_BASE, 0x0501, METHOD_BUFFERED, FILE_WRITE_ACCESS)
172 
173 #define IOCTL_STORAGE_GET_BC_PROPERTIES \
174   CTL_CODE(IOCTL_STORAGE_BASE, 0x0600, METHOD_BUFFERED, FILE_READ_ACCESS)
175 
176 #define IOCTL_STORAGE_ALLOCATE_BC_STREAM \
177   CTL_CODE(IOCTL_STORAGE_BASE, 0x0601, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
178 
179 #define IOCTL_STORAGE_FREE_BC_STREAM \
180   CTL_CODE(IOCTL_STORAGE_BASE, 0x0602, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
181 
182 #define IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT \
183   CTL_CODE(IOCTL_STORAGE_BASE, 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS)
184 
185 #define RECOVERED_WRITES_VALID         0x00000001
186 #define UNRECOVERED_WRITES_VALID       0x00000002
187 #define RECOVERED_READS_VALID          0x00000004
188 #define UNRECOVERED_READS_VALID        0x00000008
189 #define WRITE_COMPRESSION_INFO_VALID   0x00000010
190 #define READ_COMPRESSION_INFO_VALID    0x00000020
191 
192 #define TAPE_RETURN_STATISTICS         0L
193 #define TAPE_RETURN_ENV_INFO           1L
194 #define TAPE_RESET_STATISTICS          2L
195 
196 /* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants */
197 #define MEDIA_ERASEABLE                   0x00000001
198 #define MEDIA_WRITE_ONCE                  0x00000002
199 #define MEDIA_READ_ONLY                   0x00000004
200 #define MEDIA_READ_WRITE                  0x00000008
201 #define MEDIA_WRITE_PROTECTED             0x00000100
202 #define MEDIA_CURRENTLY_MOUNTED           0x80000000
203 
204 #define StorageIdTypeNAA StorageIdTypeFCPHName
205 
206 #define DeviceDsmActionFlag_NonDestructive  0x80000000
207 
208 #define IsDsmActionNonDestructive(_Action) ((BOOLEAN)((_Action & DeviceDsmActionFlag_NonDestructive) != 0))
209 
210 #define DeviceDsmAction_None            0
211 #define DeviceDsmAction_Trim            1
212 #define DeviceDsmAction_Notification   (2 | DeviceDsmActionFlag_NonDestructive)
213 
214 #define DEVICE_DSM_FLAG_ENTIRE_DATA_SET_RANGE    0x00000001
215 
216 #define DEVICE_DSM_NOTIFY_FLAG_BEGIN             0x00000001
217 #define DEVICE_DSM_NOTIFY_FLAG_END               0x00000002
218 
219 #define IOCTL_STORAGE_BC_VERSION                 1
220 
221 #define STORAGE_PRIORITY_HINT_SUPPORTED          0x0001
222 
223 typedef struct _STORAGE_HOTPLUG_INFO {
224   ULONG Size;
225   BOOLEAN MediaRemovable;
226   BOOLEAN MediaHotplug;
227   BOOLEAN DeviceHotplug;
228   BOOLEAN WriteCacheEnableOverride;
229 } STORAGE_HOTPLUG_INFO, *PSTORAGE_HOTPLUG_INFO;
230 
231 typedef struct _STORAGE_DEVICE_NUMBER {
232   DEVICE_TYPE DeviceType;
233   ULONG DeviceNumber;
234   ULONG PartitionNumber;
235 } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
236 
237 typedef struct _STORAGE_BUS_RESET_REQUEST {
238   UCHAR PathId;
239 } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
240 
241 typedef struct _STORAGE_BREAK_RESERVATION_REQUEST {
242   ULONG Length;
243   UCHAR _unused;
244   UCHAR PathId;
245   UCHAR TargetId;
246   UCHAR Lun;
247 } STORAGE_BREAK_RESERVATION_REQUEST, *PSTORAGE_BREAK_RESERVATION_REQUEST;
248 
249 #ifndef _WINIOCTL_
250 typedef struct _PREVENT_MEDIA_REMOVAL {
251   BOOLEAN PreventMediaRemoval;
252 } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
253 #endif
254 
255 typedef struct _CLASS_MEDIA_CHANGE_CONTEXT {
256   ULONG MediaChangeCount;
257   ULONG NewState;
258 } CLASS_MEDIA_CHANGE_CONTEXT, *PCLASS_MEDIA_CHANGE_CONTEXT;
259 
260 typedef struct _TAPE_STATISTICS {
261   ULONG Version;
262   ULONG Flags;
263   LARGE_INTEGER RecoveredWrites;
264   LARGE_INTEGER UnrecoveredWrites;
265   LARGE_INTEGER RecoveredReads;
266   LARGE_INTEGER UnrecoveredReads;
267   UCHAR CompressionRatioReads;
268   UCHAR CompressionRatioWrites;
269 } TAPE_STATISTICS, *PTAPE_STATISTICS;
270 
271 typedef struct _TAPE_GET_STATISTICS {
272   ULONG Operation;
273 } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
274 
275 typedef enum _STORAGE_MEDIA_TYPE {
276   DDS_4mm = 0x20,
277   MiniQic,
278   Travan,
279   QIC,
280   MP_8mm,
281   AME_8mm,
282   AIT1_8mm,
283   DLT,
284   NCTP,
285   IBM_3480,
286   IBM_3490E,
287   IBM_Magstar_3590,
288   IBM_Magstar_MP,
289   STK_DATA_D3,
290   SONY_DTF,
291   DV_6mm,
292   DMI,
293   SONY_D2,
294   CLEANER_CARTRIDGE,
295   CD_ROM,
296   CD_R,
297   CD_RW,
298   DVD_ROM,
299   DVD_R,
300   DVD_RW,
301   MO_3_RW,
302   MO_5_WO,
303   MO_5_RW,
304   MO_5_LIMDOW,
305   PC_5_WO,
306   PC_5_RW,
307   PD_5_RW,
308   ABL_5_WO,
309   PINNACLE_APEX_5_RW,
310   SONY_12_WO,
311   PHILIPS_12_WO,
312   HITACHI_12_WO,
313   CYGNET_12_WO,
314   KODAK_14_WO,
315   MO_NFR_525,
316   NIKON_12_RW,
317   IOMEGA_ZIP,
318   IOMEGA_JAZ,
319   SYQUEST_EZ135,
320   SYQUEST_EZFLYER,
321   SYQUEST_SYJET,
322   AVATAR_F2,
323   MP2_8mm,
324   DST_S,
325   DST_M,
326   DST_L,
327   VXATape_1,
328   VXATape_2,
329 #if (NTDDI_VERSION < NTDDI_WINXP)
330   STK_EAGLE,
331 #else
332   STK_9840,
333 #endif
334   LTO_Ultrium,
335   LTO_Accelis,
336   DVD_RAM,
337   AIT_8mm,
338   ADR_1,
339   ADR_2,
340   STK_9940,
341   SAIT,
342   VXATape
343 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
344 
345 typedef enum _STORAGE_BUS_TYPE {
346   BusTypeUnknown = 0x00,
347   BusTypeScsi,
348   BusTypeAtapi,
349   BusTypeAta,
350   BusType1394,
351   BusTypeSsa,
352   BusTypeFibre,
353   BusTypeUsb,
354   BusTypeRAID,
355   BusTypeiScsi,
356   BusTypeSas,
357   BusTypeSata,
358   BusTypeSd,
359   BusTypeMmc,
360   BusTypeVirtual,
361   BusTypeFileBackedVirtual,
362   BusTypeMax,
363   BusTypeMaxReserved = 0x7F
364 } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
365 
366 typedef struct _DEVICE_MEDIA_INFO {
367   union {
368     struct {
369       LARGE_INTEGER Cylinders;
370       STORAGE_MEDIA_TYPE MediaType;
371       ULONG TracksPerCylinder;
372       ULONG SectorsPerTrack;
373       ULONG BytesPerSector;
374       ULONG NumberMediaSides;
375       ULONG MediaCharacteristics;
376     } DiskInfo;
377     struct {
378       LARGE_INTEGER Cylinders;
379       STORAGE_MEDIA_TYPE MediaType;
380       ULONG TracksPerCylinder;
381       ULONG SectorsPerTrack;
382       ULONG BytesPerSector;
383       ULONG NumberMediaSides;
384       ULONG MediaCharacteristics;
385     } RemovableDiskInfo;
386     struct {
387       STORAGE_MEDIA_TYPE MediaType;
388       ULONG MediaCharacteristics;
389       ULONG CurrentBlockSize;
390       STORAGE_BUS_TYPE BusType;
391       union {
392         struct {
393           UCHAR MediumType;
394           UCHAR DensityCode;
395         } ScsiInformation;
396       } BusSpecificData;
397     } TapeInfo;
398   } DeviceSpecific;
399 } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
400 
401 typedef struct _GET_MEDIA_TYPES {
402   ULONG DeviceType;
403   ULONG MediaInfoCount;
404   DEVICE_MEDIA_INFO MediaInfo[1];
405 } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
406 
407 typedef struct _STORAGE_PREDICT_FAILURE {
408   ULONG PredictFailure;
409   UCHAR VendorSpecific[512];
410 } STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
411 
412 typedef enum _STORAGE_QUERY_TYPE {
413   PropertyStandardQuery = 0,
414   PropertyExistsQuery,
415   PropertyMaskQuery,
416   PropertyQueryMaxDefined
417 } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
418 
419 typedef enum _STORAGE_PROPERTY_ID {
420   StorageDeviceProperty = 0,
421   StorageAdapterProperty,
422   StorageDeviceIdProperty,
423   StorageDeviceUniqueIdProperty,
424   StorageDeviceWriteCacheProperty,
425   StorageMiniportProperty,
426   StorageAccessAlignmentProperty,
427   StorageDeviceSeekPenaltyProperty,
428   StorageDeviceTrimProperty,
429   StorageDeviceWriteAggregationProperty
430 } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
431 
432 typedef struct _STORAGE_PROPERTY_QUERY {
433   STORAGE_PROPERTY_ID PropertyId;
434   STORAGE_QUERY_TYPE QueryType;
435   UCHAR AdditionalParameters[1];
436 } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
437 
438 typedef _Struct_size_bytes_(Size) struct _STORAGE_DESCRIPTOR_HEADER {
439   ULONG Version;
440   ULONG Size;
441 } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
442 
443 typedef _Struct_size_bytes_(Size) struct _STORAGE_DEVICE_DESCRIPTOR {
444   ULONG Version;
445   ULONG Size;
446   UCHAR DeviceType;
447   UCHAR DeviceTypeModifier;
448   BOOLEAN RemovableMedia;
449   BOOLEAN CommandQueueing;
450   ULONG VendorIdOffset;
451   ULONG ProductIdOffset;
452   ULONG ProductRevisionOffset;
453   ULONG SerialNumberOffset;
454   STORAGE_BUS_TYPE BusType;
455   ULONG RawPropertiesLength;
456   UCHAR RawDeviceProperties[1];
457 } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
458 
459 typedef _Struct_size_bytes_(Size) struct _STORAGE_ADAPTER_DESCRIPTOR {
460   ULONG Version;
461   ULONG Size;
462   ULONG MaximumTransferLength;
463   ULONG MaximumPhysicalPages;
464   ULONG AlignmentMask;
465   BOOLEAN AdapterUsesPio;
466   BOOLEAN AdapterScansDown;
467   BOOLEAN CommandQueueing;
468   BOOLEAN AcceleratedTransfer;
469 #if (NTDDI_VERSION < NTDDI_WINXP)
470   BOOLEAN BusType;
471 #else
472   UCHAR BusType;
473 #endif
474   USHORT BusMajorVersion;
475   USHORT BusMinorVersion;
476 } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
477 
478 typedef _Struct_size_bytes_(Size) struct _STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR {
479   ULONG Version;
480   ULONG Size;
481   ULONG BytesPerCacheLine;
482   ULONG BytesOffsetForCacheAlignment;
483   ULONG BytesPerLogicalSector;
484   ULONG BytesPerPhysicalSector;
485   ULONG BytesOffsetForSectorAlignment;
486 } STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR, *PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR;
487 
488 typedef enum _STORAGE_PORT_CODE_SET {
489   StoragePortCodeSetReserved = 0,
490   StoragePortCodeSetStorport = 1,
491   StoragePortCodeSetSCSIport = 2
492 } STORAGE_PORT_CODE_SET, *PSTORAGE_PORT_CODE_SET;
493 
494 typedef struct _STORAGE_MINIPORT_DESCRIPTOR {
495   ULONG Version;
496   ULONG Size;
497   STORAGE_PORT_CODE_SET Portdriver;
498   BOOLEAN LUNResetSupported;
499   BOOLEAN TargetResetSupported;
500 } STORAGE_MINIPORT_DESCRIPTOR, *PSTORAGE_MINIPORT_DESCRIPTOR;
501 
502 typedef enum _STORAGE_IDENTIFIER_CODE_SET {
503   StorageIdCodeSetReserved = 0,
504   StorageIdCodeSetBinary = 1,
505   StorageIdCodeSetAscii = 2,
506   StorageIdCodeSetUtf8 = 3
507 } STORAGE_IDENTIFIER_CODE_SET, *PSTORAGE_IDENTIFIER_CODE_SET;
508 
509 typedef enum _STORAGE_IDENTIFIER_TYPE {
510   StorageIdTypeVendorSpecific = 0,
511   StorageIdTypeVendorId = 1,
512   StorageIdTypeEUI64 = 2,
513   StorageIdTypeFCPHName = 3,
514   StorageIdTypePortRelative = 4,
515   StorageIdTypeTargetPortGroup = 5,
516   StorageIdTypeLogicalUnitGroup = 6,
517   StorageIdTypeMD5LogicalUnitIdentifier = 7,
518   StorageIdTypeScsiNameString = 8
519 } STORAGE_IDENTIFIER_TYPE, *PSTORAGE_IDENTIFIER_TYPE;
520 
521 typedef enum _STORAGE_ID_NAA_FORMAT {
522   StorageIdNAAFormatIEEEExtended = 2,
523   StorageIdNAAFormatIEEERegistered = 3,
524   StorageIdNAAFormatIEEEERegisteredExtended = 5
525 } STORAGE_ID_NAA_FORMAT, *PSTORAGE_ID_NAA_FORMAT;
526 
527 typedef enum _STORAGE_ASSOCIATION_TYPE {
528   StorageIdAssocDevice = 0,
529   StorageIdAssocPort = 1,
530   StorageIdAssocTarget = 2
531 } STORAGE_ASSOCIATION_TYPE, *PSTORAGE_ASSOCIATION_TYPE;
532 
533 typedef struct _STORAGE_IDENTIFIER {
534   STORAGE_IDENTIFIER_CODE_SET CodeSet;
535   STORAGE_IDENTIFIER_TYPE Type;
536   USHORT IdentifierSize;
537   USHORT NextOffset;
538   STORAGE_ASSOCIATION_TYPE Association;
539   UCHAR Identifier[1];
540 } STORAGE_IDENTIFIER, *PSTORAGE_IDENTIFIER;
541 
542 typedef _Struct_size_bytes_(Size) struct _STORAGE_DEVICE_ID_DESCRIPTOR {
543   ULONG Version;
544   ULONG Size;
545   ULONG NumberOfIdentifiers;
546   UCHAR Identifiers[1];
547 } STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
548 
549 typedef struct _DEVICE_SEEK_PENALTY_DESCRIPTOR {
550   ULONG Version;
551   ULONG Size;
552   BOOLEAN IncursSeekPenalty;
553 } DEVICE_SEEK_PENALTY_DESCRIPTOR, *PDEVICE_SEEK_PENALTY_DESCRIPTOR;
554 
555 typedef struct _DEVICE_WRITE_AGGREGATION_DESCRIPTOR {
556   ULONG Version;
557   ULONG Size;
558   BOOLEAN BenefitsFromWriteAggregation;
559 } DEVICE_WRITE_AGGREGATION_DESCRIPTOR, *PDEVICE_WRITE_AGGREGATION_DESCRIPTOR;
560 
561 typedef struct _DEVICE_TRIM_DESCRIPTOR {
562   ULONG Version;
563   ULONG Size;
564   BOOLEAN TrimEnabled;
565 } DEVICE_TRIM_DESCRIPTOR, *PDEVICE_TRIM_DESCRIPTOR;
566 
567 typedef ULONG DEVICE_DATA_MANAGEMENT_SET_ACTION;
568 
569 #define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000
570 
571 typedef struct _DEVICE_DATA_SET_RANGE {
572   LONGLONG StartingOffset;
573   ULONGLONG LengthInBytes;
574 } DEVICE_DATA_SET_RANGE, *PDEVICE_DATA_SET_RANGE;
575 
576 typedef struct _DEVICE_MANAGE_DATA_SET_ATTRIBUTES {
577   ULONG Size;
578   DEVICE_DATA_MANAGEMENT_SET_ACTION Action;
579   ULONG Flags;
580   ULONG ParameterBlockOffset;
581   ULONG ParameterBlockLength;
582   ULONG DataSetRangesOffset;
583   ULONG DataSetRangesLength;
584 } DEVICE_MANAGE_DATA_SET_ATTRIBUTES, *PDEVICE_MANAGE_DATA_SET_ATTRIBUTES;
585 
586 typedef struct _DEVICE_DSM_NOTIFICATION_PARAMETERS {
587   ULONG Size;
588   ULONG Flags;
589   ULONG NumFileTypeIDs;
590   GUID FileTypeID[1];
591 } DEVICE_DSM_NOTIFICATION_PARAMETERS, *PDEVICE_DSM_NOTIFICATION_PARAMETERS;
592 
593 typedef struct _STORAGE_GET_BC_PROPERTIES_OUTPUT {
594   ULONG MaximumRequestsPerPeriod;
595   ULONG MinimumPeriod;
596   ULONGLONG MaximumRequestSize;
597   ULONG EstimatedTimePerRequest;
598   ULONG NumOutStandingRequests;
599   ULONGLONG RequestSize;
600 } STORAGE_GET_BC_PROPERTIES_OUTPUT, *PSTORAGE_GET_BC_PROPERTIES_OUTPUT;
601 
602 typedef struct _STORAGE_ALLOCATE_BC_STREAM_INPUT {
603   ULONG Version;
604   ULONG RequestsPerPeriod;
605   ULONG Period;
606   BOOLEAN RetryFailures;
607   BOOLEAN Discardable;
608   BOOLEAN Reserved1[2];
609   ULONG AccessType;
610   ULONG AccessMode;
611 } STORAGE_ALLOCATE_BC_STREAM_INPUT, *PSTORAGE_ALLOCATE_BC_STREAM_INPUT;
612 
613 typedef struct _STORAGE_ALLOCATE_BC_STREAM_OUTPUT {
614   ULONGLONG RequestSize;
615   ULONG NumOutStandingRequests;
616 } STORAGE_ALLOCATE_BC_STREAM_OUTPUT, *PSTORAGE_ALLOCATE_BC_STREAM_OUTPUT;
617 
618 typedef struct _STORAGE_PRIORITY_HINT_SUPPORT {
619   ULONG SupportFlags;
620 } STORAGE_PRIORITY_HINT_SUPPORT, *PSTORAGE_PRIORITY_HINT_SUPPORT;
621 
622 #ifdef _MSC_VER
623 #pragma warning(push)
624 #pragma warning(disable:4200)
625 #endif
626 
627 #if defined(_MSC_EXTENSIONS)
628 
629 typedef struct _STORAGE_MEDIA_SERIAL_NUMBER_DATA {
630   USHORT Reserved;
631   USHORT SerialNumberLength;
632   UCHAR SerialNumber[0];
633 } STORAGE_MEDIA_SERIAL_NUMBER_DATA, *PSTORAGE_MEDIA_SERIAL_NUMBER_DATA;
634 
635 typedef struct _PERSISTENT_RESERVE_COMMAND {
636   ULONG Version;
637   ULONG Size;
638   __MINGW_EXTENSION union {
639     struct {
640       UCHAR ServiceAction:5;
641       UCHAR Reserved1:3;
642       USHORT AllocationLength;
643     } PR_IN;
644     struct {
645       UCHAR ServiceAction:5;
646       UCHAR Reserved1:3;
647       UCHAR Type:4;
648       UCHAR Scope:4;
649       UCHAR ParameterList[0];
650     } PR_OUT;
651   } DUMMYUNIONNAME;
652 } PERSISTENT_RESERVE_COMMAND, *PPERSISTENT_RESERVE_COMMAND;
653 
654 #endif /* defined(_MSC_EXTENSIONS) */
655 
656 #ifdef _MSC_VER
657 #pragma warning(pop) /* disable:4200 */
658 #endif
659 
660 typedef _Struct_size_bytes_(Size) struct _STORAGE_READ_CAPACITY {
661   ULONG Version;
662   ULONG Size;
663   ULONG BlockLength;
664   LARGE_INTEGER NumberOfBlocks;
665   LARGE_INTEGER DiskLength;
666 } STORAGE_READ_CAPACITY, *PSTORAGE_READ_CAPACITY;
667 
668 typedef enum _WRITE_CACHE_TYPE {
669   WriteCacheTypeUnknown,
670   WriteCacheTypeNone,
671   WriteCacheTypeWriteBack,
672   WriteCacheTypeWriteThrough
673 } WRITE_CACHE_TYPE;
674 
675 typedef enum _WRITE_CACHE_ENABLE {
676   WriteCacheEnableUnknown,
677   WriteCacheDisabled,
678   WriteCacheEnabled
679 } WRITE_CACHE_ENABLE;
680 
681 typedef enum _WRITE_CACHE_CHANGE {
682   WriteCacheChangeUnknown,
683   WriteCacheNotChangeable,
684   WriteCacheChangeable
685 } WRITE_CACHE_CHANGE;
686 
687 typedef enum _WRITE_THROUGH {
688   WriteThroughUnknown,
689   WriteThroughNotSupported,
690   WriteThroughSupported
691 } WRITE_THROUGH;
692 
693 typedef _Struct_size_bytes_(Size) struct _STORAGE_WRITE_CACHE_PROPERTY {
694   ULONG Version;
695   ULONG Size;
696   WRITE_CACHE_TYPE WriteCacheType;
697   WRITE_CACHE_ENABLE WriteCacheEnabled;
698   WRITE_CACHE_CHANGE WriteCacheChangeable;
699   WRITE_THROUGH WriteThroughSupported;
700   BOOLEAN FlushCacheSupported;
701   BOOLEAN UserDefinedPowerProtection;
702   BOOLEAN NVCacheEnabled;
703 } STORAGE_WRITE_CACHE_PROPERTY, *PSTORAGE_WRITE_CACHE_PROPERTY;
704 
705 #ifdef __cplusplus
706 }
707 #endif
708 
709 #endif /* _NTDDSTOR_H_ */
710