source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ntddstor.h@ 1194

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

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

File size: 35.4 KB
RevLine 
[1166]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
27extern "C" {
28#endif
29
30#if defined(DEFINE_GUID)
31
32DEFINE_GUID(GUID_DEVINTERFACE_DISK,
33 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
34
35DEFINE_GUID(GUID_DEVINTERFACE_CDROM,
36 0x53f56308, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
37
38DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,
39 0x53f5630a, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
40
41DEFINE_GUID(GUID_DEVINTERFACE_TAPE,
42 0x53f5630b, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
43
44DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,
45 0x53f5630c, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
46
47DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,
48 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
49
50DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,
51 0x53f56310, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
52
53DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,
54 0x53f56311, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
55
56DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,
57 0x53f56312, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
58
59DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,
60 0x2accfe60, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
61
62DEFINE_GUID(GUID_DEVINTERFACE_VMLUN,
63 0x6f416619, 0x9f29, 0x42a5, 0xb2, 0x0b, 0x37, 0xe2, 0x19, 0xca, 0x02, 0xb0);
64
65DEFINE_GUID(GUID_DEVINTERFACE_SES,
66 0x1790c9ec, 0x47d5, 0x4df3, 0xb5, 0xaf, 0x9a, 0xdf, 0x3c, 0xf2, 0x3e, 0x48);
67
68DEFINE_GUID(GUID_DEVINTERFACE_HIDDEN_VOLUME,
69 0x7f108a28, 0x9833, 0x4b3b, 0xb7, 0x80, 0x2c, 0x6b, 0x5f, 0xa5, 0xc0, 0x62);
70
71DEFINE_GUID(GUID_DEVICEDUMP_STORAGE_DEVICE,
72 0xd8e2592f, 0x1aab, 0x4d56, 0xa7, 0x46, 0x1f, 0x75, 0x85, 0xdf, 0x40, 0xf4);
73
74DEFINE_GUID(GUID_DEVICEDUMP_DRIVER_STORAGE_PORT,
75 0xda82441d, 0x7142, 0x4bc1, 0xb8, 0x44, 0x08, 0x07, 0xc5, 0xa4, 0xb6, 0x7f);
76
77#define WDI_STORAGE_PREDICT_FAILURE_DPS_GUID \
78 {0xe9f2d03a, 0x747c, 0x41c2, {0xbb, 0x9a, 0x02, 0xc6, 0x2b, 0x6d, 0x5f, 0xcb}};
79
80/* Aliases for storage guids */
81#define DiskClassGuid GUID_DEVINTERFACE_DISK
82#define CdRomClassGuid GUID_DEVINTERFACE_CDROM
83#define PartitionClassGuid GUID_DEVINTERFACE_PARTITION
84#define TapeClassGuid GUID_DEVINTERFACE_TAPE
85#define WriteOnceDiskClassGuid GUID_DEVINTERFACE_WRITEONCEDISK
86#define VolumeClassGuid GUID_DEVINTERFACE_VOLUME
87#define MediumChangerClassGuid GUID_DEVINTERFACE_MEDIUMCHANGER
88#define FloppyClassGuid GUID_DEVINTERFACE_FLOPPY
89#define CdChangerClassGuid GUID_DEVINTERFACE_CDCHANGER
90#define StoragePortClassGuid GUID_DEVINTERFACE_STORAGEPORT
91#define HiddenVolumeClassGuid GUID_DEVINTERFACE_HIDDEN_VOLUME
92
93#endif /* defined(DEFINE_GUID) */
94
95#ifdef DEFINE_DEVPROPKEY
96
97DEFINE_DEVPROPKEY(DEVPKEY_Storage_Portable,
98 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 2);
99
100DEFINE_DEVPROPKEY(DEVPKEY_Storage_Removable_Media,
101 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 3);
102
103DEFINE_DEVPROPKEY(DEVPKEY_Storage_System_Critical,
104 0x4d1ebee8, 0x803, 0x4774, 0x98, 0x42, 0xb7, 0x7d, 0xb5, 0x2, 0x65, 0xe9, 4);
105
106#endif /* #ifdef DEFINE_DEVPROPKEY */
107
108#ifndef _WINIOCTL_
109
110#define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
111
112#define IOCTL_STORAGE_CHECK_VERIFY \
113 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
114
115#define IOCTL_STORAGE_CHECK_VERIFY2 \
116 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
117
118#define IOCTL_STORAGE_MEDIA_REMOVAL \
119 CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
120
121#define IOCTL_STORAGE_EJECT_MEDIA \
122 CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
123
124#define IOCTL_STORAGE_LOAD_MEDIA \
125 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
126
127#define IOCTL_STORAGE_LOAD_MEDIA2 \
128 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
129
130#define IOCTL_STORAGE_RESERVE \
131 CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
132
133#define IOCTL_STORAGE_RELEASE \
134 CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
135
136#define IOCTL_STORAGE_FIND_NEW_DEVICES \
137 CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
138
139#define IOCTL_STORAGE_EJECTION_CONTROL \
140 CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
141
142#define IOCTL_STORAGE_MCN_CONTROL \
143 CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
144
145#define IOCTL_STORAGE_GET_MEDIA_TYPES \
146 CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
147
148#define IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
149 CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
150
151#define IOCTL_STORAGE_RESET_BUS \
152 CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
153
154#define IOCTL_STORAGE_RESET_DEVICE \
155 CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
156
157#define IOCTL_STORAGE_GET_DEVICE_NUMBER \
158 CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
159
160#define IOCTL_STORAGE_PREDICT_FAILURE \
161 CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
162
163#endif /* _WINIOCTL_ */
164
165#define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER \
166 CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
167
168#define IOCTL_STORAGE_GET_HOTPLUG_INFO \
169 CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
170
171#define IOCTL_STORAGE_SET_HOTPLUG_INFO \
172 CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
173
174#define OBSOLETE_IOCTL_STORAGE_RESET_BUS \
175 CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
176
177#define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE \
178 CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
179
180#define IOCTL_STORAGE_BREAK_RESERVATION \
181 CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
182
183#define IOCTL_STORAGE_PERSISTENT_RESERVE_IN \
184 CTL_CODE(IOCTL_STORAGE_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS)
185
186#define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT \
187 CTL_CODE(IOCTL_STORAGE_BASE, 0x0407, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
188
189#define IOCTL_STORAGE_READ_CAPACITY \
190 CTL_CODE(IOCTL_STORAGE_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
191
192#define IOCTL_STORAGE_GET_DEVICE_TELEMETRY \
193 CTL_CODE(IOCTL_STORAGE_BASE, 0x0470, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
194
195#define IOCTL_STORAGE_DEVICE_TELEMETRY_NOTIFY \
196 CTL_CODE(IOCTL_STORAGE_BASE, 0x0471, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
197
198#define IOCTL_STORAGE_DEVICE_TELEMETRY_QUERY_CAPS \
199 CTL_CODE(IOCTL_STORAGE_BASE, 0x0472, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
200
201#define IOCTL_STORAGE_GET_DEVICE_TELEMETRY_RAW \
202 CTL_CODE(IOCTL_STORAGE_BASE, 0x0473, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
203
204#define IOCTL_STORAGE_QUERY_PROPERTY \
205 CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
206
207#define IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES \
208 CTL_CODE(IOCTL_STORAGE_BASE, 0x0501, METHOD_BUFFERED, FILE_WRITE_ACCESS)
209
210#define IOCTL_STORAGE_GET_LB_PROVISIONING_MAP_RESOURCES \
211 CTL_CODE(IOCTL_STORAGE_BASE, 0x0502, METHOD_BUFFERED, FILE_READ_ACCESS)
212
213#define IOCTL_STORAGE_GET_BC_PROPERTIES \
214 CTL_CODE(IOCTL_STORAGE_BASE, 0x0600, METHOD_BUFFERED, FILE_READ_ACCESS)
215
216#define IOCTL_STORAGE_ALLOCATE_BC_STREAM \
217 CTL_CODE(IOCTL_STORAGE_BASE, 0x0601, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
218
219#define IOCTL_STORAGE_FREE_BC_STREAM \
220 CTL_CODE(IOCTL_STORAGE_BASE, 0x0602, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
221
222#define IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT \
223 CTL_CODE(IOCTL_STORAGE_BASE, 0x0620, METHOD_BUFFERED, FILE_ANY_ACCESS)
224
225#define IOCTL_STORAGE_START_DATA_INTEGRITY_CHECK \
226 CTL_CODE(IOCTL_STORAGE_BASE, 0x0621, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
227
228#define IOCTL_STORAGE_STOP_DATA_INTEGRITY_CHECK \
229 CTL_CODE(IOCTL_STORAGE_BASE, 0x0622, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
230
231#define IOCTL_STORAGE_ENABLE_IDLE_POWER \
232 CTL_CODE(IOCTL_STORAGE_BASE, 0x0720, METHOD_BUFFERED, FILE_ANY_ACCESS)
233
234#define IOCTL_STORAGE_GET_IDLE_POWERUP_REASON \
235 CTL_CODE(IOCTL_STORAGE_BASE, 0x0721, METHOD_BUFFERED, FILE_ANY_ACCESS)
236
237#define IOCTL_STORAGE_POWER_ACTIVE \
238 CTL_CODE(IOCTL_STORAGE_BASE, 0x0722, METHOD_BUFFERED, FILE_ANY_ACCESS)
239
240#define IOCTL_STORAGE_POWER_IDLE \
241 CTL_CODE(IOCTL_STORAGE_BASE, 0x0723, METHOD_BUFFERED, FILE_ANY_ACCESS)
242
243#define IOCTL_STORAGE_EVENT_NOTIFICATION \
244 CTL_CODE(IOCTL_STORAGE_BASE, 0x0724, METHOD_BUFFERED, FILE_ANY_ACCESS)
245
246#define RECOVERED_WRITES_VALID 0x00000001
247#define UNRECOVERED_WRITES_VALID 0x00000002
248#define RECOVERED_READS_VALID 0x00000004
249#define UNRECOVERED_READS_VALID 0x00000008
250#define WRITE_COMPRESSION_INFO_VALID 0x00000010
251#define READ_COMPRESSION_INFO_VALID 0x00000020
252
253#define TAPE_RETURN_STATISTICS __MSABI_LONG(0)
254#define TAPE_RETURN_ENV_INFO __MSABI_LONG(1)
255#define TAPE_RESET_STATISTICS __MSABI_LONG(2)
256
257/* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants */
258#define MEDIA_ERASEABLE 0x00000001
259#define MEDIA_WRITE_ONCE 0x00000002
260#define MEDIA_READ_ONLY 0x00000004
261#define MEDIA_READ_WRITE 0x00000008
262#define MEDIA_WRITE_PROTECTED 0x00000100
263#define MEDIA_CURRENTLY_MOUNTED 0x80000000
264
265#define StorageIdTypeNAA StorageIdTypeFCPHName
266
267#define DeviceDsmActionFlag_NonDestructive 0x80000000
268
269#define IsDsmActionNonDestructive(_Action) ((BOOLEAN)((_Action & DeviceDsmActionFlag_NonDestructive) != 0))
270
271#define DeviceDsmAction_None 0
272#define DeviceDsmAction_Trim 1
273#define DeviceDsmAction_Notification (2 | DeviceDsmActionFlag_NonDestructive)
274
275#define DeviceDsmAction_OffloadRead (3 | DeviceDsmActionFlag_NonDestructive)
276#define DeviceDsmAction_OffloadWrite 4
277#define DeviceDsmAction_Allocation (5 | DeviceDsmActionFlag_NonDestructive)
278#define DeviceDsmAction_Repair (6 | DeviceDsmActionFlag_NonDestructive)
279#define DeviceDsmAction_Scrub (7 | DeviceDsmActionFlag_NonDestructive)
280#define DeviceDsmAction_DrtQuery (8 | DeviceDsmActionFlag_NonDestructive)
281#define DeviceDsmAction_DrtClear (9 | DeviceDsmActionFlag_NonDestructive)
282#define DeviceDsmAction_DrtDisable (10 | DeviceDsmActionFlag_NonDestructive)
283
284#define DEVICE_DSM_FLAG_ENTIRE_DATA_SET_RANGE 0x00000001
285#define DEVICE_DSM_FLAG_SCRUB_SKIP_IN_SYNC 0x10000000
286#define DEVICE_DSM_FLAG_ALLOCATION_CONSOLIDATEABLE_ONLY 0x40000000
287#define DEVICE_DSM_FLAG_TRIM_NOT_FS_ALLOCATED 0x80000000
288
289#define DEVICE_DSM_NOTIFY_FLAG_BEGIN 0x00000001
290#define DEVICE_DSM_NOTIFY_FLAG_END 0x00000002
291
292#define IOCTL_STORAGE_BC_VERSION 1
293
294#define STORAGE_PRIORITY_HINT_SUPPORTED 0x0001
295
296typedef struct _STORAGE_HOTPLUG_INFO {
297 ULONG Size;
298 BOOLEAN MediaRemovable;
299 BOOLEAN MediaHotplug;
300 BOOLEAN DeviceHotplug;
301 BOOLEAN WriteCacheEnableOverride;
302} STORAGE_HOTPLUG_INFO, *PSTORAGE_HOTPLUG_INFO;
303
304typedef struct _STORAGE_DEVICE_NUMBER {
305 DEVICE_TYPE DeviceType;
306 ULONG DeviceNumber;
307 ULONG PartitionNumber;
308} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
309
310typedef struct _STORAGE_BUS_RESET_REQUEST {
311 UCHAR PathId;
312} STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
313
314typedef struct _STORAGE_BREAK_RESERVATION_REQUEST {
315 ULONG Length;
316 UCHAR _unused;
317 UCHAR PathId;
318 UCHAR TargetId;
319 UCHAR Lun;
320} STORAGE_BREAK_RESERVATION_REQUEST, *PSTORAGE_BREAK_RESERVATION_REQUEST;
321
322#ifndef _WINIOCTL_
323typedef struct _PREVENT_MEDIA_REMOVAL {
324 BOOLEAN PreventMediaRemoval;
325} PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
326#endif
327
328typedef struct _CLASS_MEDIA_CHANGE_CONTEXT {
329 ULONG MediaChangeCount;
330 ULONG NewState;
331} CLASS_MEDIA_CHANGE_CONTEXT, *PCLASS_MEDIA_CHANGE_CONTEXT;
332
333typedef struct _TAPE_STATISTICS {
334 ULONG Version;
335 ULONG Flags;
336 LARGE_INTEGER RecoveredWrites;
337 LARGE_INTEGER UnrecoveredWrites;
338 LARGE_INTEGER RecoveredReads;
339 LARGE_INTEGER UnrecoveredReads;
340 UCHAR CompressionRatioReads;
341 UCHAR CompressionRatioWrites;
342} TAPE_STATISTICS, *PTAPE_STATISTICS;
343
344typedef struct _TAPE_GET_STATISTICS {
345 ULONG Operation;
346} TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
347
348typedef enum _STORAGE_MEDIA_TYPE {
349 DDS_4mm = 0x20,
350 MiniQic,
351 Travan,
352 QIC,
353 MP_8mm,
354 AME_8mm,
355 AIT1_8mm,
356 DLT,
357 NCTP,
358 IBM_3480,
359 IBM_3490E,
360 IBM_Magstar_3590,
361 IBM_Magstar_MP,
362 STK_DATA_D3,
363 SONY_DTF,
364 DV_6mm,
365 DMI,
366 SONY_D2,
367 CLEANER_CARTRIDGE,
368 CD_ROM,
369 CD_R,
370 CD_RW,
371 DVD_ROM,
372 DVD_R,
373 DVD_RW,
374 MO_3_RW,
375 MO_5_WO,
376 MO_5_RW,
377 MO_5_LIMDOW,
378 PC_5_WO,
379 PC_5_RW,
380 PD_5_RW,
381 ABL_5_WO,
382 PINNACLE_APEX_5_RW,
383 SONY_12_WO,
384 PHILIPS_12_WO,
385 HITACHI_12_WO,
386 CYGNET_12_WO,
387 KODAK_14_WO,
388 MO_NFR_525,
389 NIKON_12_RW,
390 IOMEGA_ZIP,
391 IOMEGA_JAZ,
392 SYQUEST_EZ135,
393 SYQUEST_EZFLYER,
394 SYQUEST_SYJET,
395 AVATAR_F2,
396 MP2_8mm,
397 DST_S,
398 DST_M,
399 DST_L,
400 VXATape_1,
401 VXATape_2,
402#if (NTDDI_VERSION < NTDDI_WINXP)
403 STK_EAGLE,
404#else
405 STK_9840,
406#endif
407 LTO_Ultrium,
408 LTO_Accelis,
409 DVD_RAM,
410 AIT_8mm,
411 ADR_1,
412 ADR_2,
413 STK_9940,
414 SAIT,
415 VXATape
416} STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
417
418typedef enum _STORAGE_BUS_TYPE {
419 BusTypeUnknown = 0x00,
420 BusTypeScsi,
421 BusTypeAtapi,
422 BusTypeAta,
423 BusType1394,
424 BusTypeSsa,
425 BusTypeFibre,
426 BusTypeUsb,
427 BusTypeRAID,
428 BusTypeiScsi,
429 BusTypeSas,
430 BusTypeSata,
431 BusTypeSd,
432 BusTypeMmc,
433 BusTypeVirtual,
434 BusTypeFileBackedVirtual,
435 BusTypeSpaces,
436 BusTypeMax,
437 BusTypeMaxReserved = 0x7F
438} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
439
440#define SupportsDeviceSharing(type) (type == BusTypeScsi || type == BusTypeFibre ||type == BusTypeiScsi || \
441 type == BusTypeSas || type == BusTypeSpaces)
442
443typedef struct _DEVICE_MEDIA_INFO {
444 union {
445 struct {
446 LARGE_INTEGER Cylinders;
447 STORAGE_MEDIA_TYPE MediaType;
448 ULONG TracksPerCylinder;
449 ULONG SectorsPerTrack;
450 ULONG BytesPerSector;
451 ULONG NumberMediaSides;
452 ULONG MediaCharacteristics;
453 } DiskInfo;
454 struct {
455 LARGE_INTEGER Cylinders;
456 STORAGE_MEDIA_TYPE MediaType;
457 ULONG TracksPerCylinder;
458 ULONG SectorsPerTrack;
459 ULONG BytesPerSector;
460 ULONG NumberMediaSides;
461 ULONG MediaCharacteristics;
462 } RemovableDiskInfo;
463 struct {
464 STORAGE_MEDIA_TYPE MediaType;
465 ULONG MediaCharacteristics;
466 ULONG CurrentBlockSize;
467 STORAGE_BUS_TYPE BusType;
468 union {
469 struct {
470 UCHAR MediumType;
471 UCHAR DensityCode;
472 } ScsiInformation;
473 } BusSpecificData;
474 } TapeInfo;
475 } DeviceSpecific;
476} DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
477
478typedef struct _GET_MEDIA_TYPES {
479 ULONG DeviceType;
480 ULONG MediaInfoCount;
481 DEVICE_MEDIA_INFO MediaInfo[1];
482} GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
483
484typedef struct _STORAGE_PREDICT_FAILURE {
485 ULONG PredictFailure;
486 UCHAR VendorSpecific[512];
487} STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
488
489typedef enum _STORAGE_QUERY_TYPE {
490 PropertyStandardQuery = 0,
491 PropertyExistsQuery,
492 PropertyMaskQuery,
493 PropertyQueryMaxDefined
494} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
495
496typedef enum _STORAGE_PROPERTY_ID {
497 StorageDeviceProperty = 0,
498 StorageAdapterProperty,
499 StorageDeviceIdProperty,
500 StorageDeviceUniqueIdProperty,
501 StorageDeviceWriteCacheProperty,
502 StorageMiniportProperty,
503 StorageAccessAlignmentProperty,
504 StorageDeviceSeekPenaltyProperty,
505 StorageDeviceTrimProperty,
506 StorageDeviceWriteAggregationProperty,
507 StorageDeviceDeviceTelemetryProperty,
508 StorageDeviceLBProvisioningProperty,
509 StorageDevicePowerProperty,
510 StorageDeviceCopyOffloadProperty,
511 StorageDeviceResiliencyProperty
512} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
513
514typedef struct _STORAGE_PROPERTY_QUERY {
515 STORAGE_PROPERTY_ID PropertyId;
516 STORAGE_QUERY_TYPE QueryType;
517 UCHAR AdditionalParameters[1];
518} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
519
520typedef struct _STORAGE_DESCRIPTOR_HEADER {
521 ULONG Version;
522 ULONG Size;
523} STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
524
525typedef struct _STORAGE_DEVICE_DESCRIPTOR {
526 ULONG Version;
527 ULONG Size;
528 UCHAR DeviceType;
529 UCHAR DeviceTypeModifier;
530 BOOLEAN RemovableMedia;
531 BOOLEAN CommandQueueing;
532 ULONG VendorIdOffset;
533 ULONG ProductIdOffset;
534 ULONG ProductRevisionOffset;
535 ULONG SerialNumberOffset;
536 STORAGE_BUS_TYPE BusType;
537 ULONG RawPropertiesLength;
538 UCHAR RawDeviceProperties[1];
539} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
540
541typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
542 ULONG Version;
543 ULONG Size;
544 ULONG MaximumTransferLength;
545 ULONG MaximumPhysicalPages;
546 ULONG AlignmentMask;
547 BOOLEAN AdapterUsesPio;
548 BOOLEAN AdapterScansDown;
549 BOOLEAN CommandQueueing;
550 BOOLEAN AcceleratedTransfer;
551#if (NTDDI_VERSION < NTDDI_WINXP)
552 BOOLEAN BusType;
553#else
554 UCHAR BusType;
555#endif
556 USHORT BusMajorVersion;
557 USHORT BusMinorVersion;
558#if (NTDDI_VERSION >= NTDDI_WIN8)
559 UCHAR SrbType;
560 UCHAR AddressType;
561#endif
562} STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
563
564typedef struct _STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR {
565 ULONG Version;
566 ULONG Size;
567 ULONG BytesPerCacheLine;
568 ULONG BytesOffsetForCacheAlignment;
569 ULONG BytesPerLogicalSector;
570 ULONG BytesPerPhysicalSector;
571 ULONG BytesOffsetForSectorAlignment;
572} STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR, *PSTORAGE_ACCESS_ALIGNMENT_DESCRIPTOR;
573
574typedef enum _STORAGE_PORT_CODE_SET {
575 StoragePortCodeSetReserved = 0,
576 StoragePortCodeSetStorport = 1,
577 StoragePortCodeSetSCSIport = 2,
578 StoragePortCodeSetSpaceport = 3,
579 StoragePortCodeSetATAport = 4,
580 StoragePortCodeSetUSBport = 5,
581 StoragePortCodeSetSBP2port = 6,
582 StoragePortCodeSetSDport = 7
583} STORAGE_PORT_CODE_SET, *PSTORAGE_PORT_CODE_SET;
584
585typedef struct _STORAGE_MINIPORT_DESCRIPTOR {
586 ULONG Version;
587 ULONG Size;
588 STORAGE_PORT_CODE_SET Portdriver;
589 BOOLEAN LUNResetSupported;
590 BOOLEAN TargetResetSupported;
591#if (NTDDI_VERSION >= NTDDI_WIN8)
592 USHORT IoTimeoutValue;
593#endif
594} STORAGE_MINIPORT_DESCRIPTOR, *PSTORAGE_MINIPORT_DESCRIPTOR;
595
596typedef enum _STORAGE_IDENTIFIER_CODE_SET {
597 StorageIdCodeSetReserved = 0,
598 StorageIdCodeSetBinary = 1,
599 StorageIdCodeSetAscii = 2,
600 StorageIdCodeSetUtf8 = 3
601} STORAGE_IDENTIFIER_CODE_SET, *PSTORAGE_IDENTIFIER_CODE_SET;
602
603typedef enum _STORAGE_IDENTIFIER_TYPE {
604 StorageIdTypeVendorSpecific = 0,
605 StorageIdTypeVendorId = 1,
606 StorageIdTypeEUI64 = 2,
607 StorageIdTypeFCPHName = 3,
608 StorageIdTypePortRelative = 4,
609 StorageIdTypeTargetPortGroup = 5,
610 StorageIdTypeLogicalUnitGroup = 6,
611 StorageIdTypeMD5LogicalUnitIdentifier = 7,
612 StorageIdTypeScsiNameString = 8
613} STORAGE_IDENTIFIER_TYPE, *PSTORAGE_IDENTIFIER_TYPE;
614
615typedef enum _STORAGE_ID_NAA_FORMAT {
616 StorageIdNAAFormatIEEEExtended = 2,
617 StorageIdNAAFormatIEEERegistered = 3,
618 StorageIdNAAFormatIEEEERegisteredExtended = 5
619} STORAGE_ID_NAA_FORMAT, *PSTORAGE_ID_NAA_FORMAT;
620
621typedef enum _STORAGE_ASSOCIATION_TYPE {
622 StorageIdAssocDevice = 0,
623 StorageIdAssocPort = 1,
624 StorageIdAssocTarget = 2
625} STORAGE_ASSOCIATION_TYPE, *PSTORAGE_ASSOCIATION_TYPE;
626
627typedef struct _STORAGE_IDENTIFIER {
628 STORAGE_IDENTIFIER_CODE_SET CodeSet;
629 STORAGE_IDENTIFIER_TYPE Type;
630 USHORT IdentifierSize;
631 USHORT NextOffset;
632 STORAGE_ASSOCIATION_TYPE Association;
633 UCHAR Identifier[1];
634} STORAGE_IDENTIFIER, *PSTORAGE_IDENTIFIER;
635
636typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
637 ULONG Version;
638 ULONG Size;
639 ULONG NumberOfIdentifiers;
640 UCHAR Identifiers[1];
641} STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
642
643typedef struct _DEVICE_SEEK_PENALTY_DESCRIPTOR {
644 ULONG Version;
645 ULONG Size;
646 BOOLEAN IncursSeekPenalty;
647} DEVICE_SEEK_PENALTY_DESCRIPTOR, *PDEVICE_SEEK_PENALTY_DESCRIPTOR;
648
649typedef struct _DEVICE_WRITE_AGGREGATION_DESCRIPTOR {
650 ULONG Version;
651 ULONG Size;
652 BOOLEAN BenefitsFromWriteAggregation;
653} DEVICE_WRITE_AGGREGATION_DESCRIPTOR, *PDEVICE_WRITE_AGGREGATION_DESCRIPTOR;
654
655typedef struct _DEVICE_TRIM_DESCRIPTOR {
656 ULONG Version;
657 ULONG Size;
658 BOOLEAN TrimEnabled;
659} DEVICE_TRIM_DESCRIPTOR, *PDEVICE_TRIM_DESCRIPTOR;
660
661typedef ULONG DEVICE_DATA_MANAGEMENT_SET_ACTION;
662
663typedef struct _DEVICE_DATA_SET_RANGE {
664 LONGLONG StartingOffset;
665 ULONGLONG LengthInBytes;
666} DEVICE_DATA_SET_RANGE, *PDEVICE_DATA_SET_RANGE;
667
668typedef struct _DEVICE_MANAGE_DATA_SET_ATTRIBUTES {
669 ULONG Size;
670 DEVICE_DATA_MANAGEMENT_SET_ACTION Action;
671 ULONG Flags;
672 ULONG ParameterBlockOffset;
673 ULONG ParameterBlockLength;
674 ULONG DataSetRangesOffset;
675 ULONG DataSetRangesLength;
676} DEVICE_MANAGE_DATA_SET_ATTRIBUTES, *PDEVICE_MANAGE_DATA_SET_ATTRIBUTES;
677
678typedef struct _DEVICE_DSM_NOTIFICATION_PARAMETERS {
679 ULONG Size;
680 ULONG Flags;
681 ULONG NumFileTypeIDs;
682 GUID FileTypeID[1];
683} DEVICE_DSM_NOTIFICATION_PARAMETERS, *PDEVICE_DSM_NOTIFICATION_PARAMETERS;
684
685typedef struct _STORAGE_GET_BC_PROPERTIES_OUTPUT {
686 ULONG MaximumRequestsPerPeriod;
687 ULONG MinimumPeriod;
688 ULONGLONG MaximumRequestSize;
689 ULONG EstimatedTimePerRequest;
690 ULONG NumOutStandingRequests;
691 ULONGLONG RequestSize;
692} STORAGE_GET_BC_PROPERTIES_OUTPUT, *PSTORAGE_GET_BC_PROPERTIES_OUTPUT;
693
694typedef struct _STORAGE_ALLOCATE_BC_STREAM_INPUT {
695 ULONG Version;
696 ULONG RequestsPerPeriod;
697 ULONG Period;
698 BOOLEAN RetryFailures;
699 BOOLEAN Discardable;
700 BOOLEAN Reserved1[2];
701 ULONG AccessType;
702 ULONG AccessMode;
703} STORAGE_ALLOCATE_BC_STREAM_INPUT, *PSTORAGE_ALLOCATE_BC_STREAM_INPUT;
704
705typedef struct _STORAGE_ALLOCATE_BC_STREAM_OUTPUT {
706 ULONGLONG RequestSize;
707 ULONG NumOutStandingRequests;
708} STORAGE_ALLOCATE_BC_STREAM_OUTPUT, *PSTORAGE_ALLOCATE_BC_STREAM_OUTPUT;
709
710typedef struct _STORAGE_PRIORITY_HINT_SUPPORT {
711 ULONG SupportFlags;
712} STORAGE_PRIORITY_HINT_SUPPORT, *PSTORAGE_PRIORITY_HINT_SUPPORT;
713
714#if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
715
716typedef struct _STORAGE_MEDIA_SERIAL_NUMBER_DATA {
717 USHORT Reserved;
718 USHORT SerialNumberLength;
719 UCHAR SerialNumber[0];
720} STORAGE_MEDIA_SERIAL_NUMBER_DATA, *PSTORAGE_MEDIA_SERIAL_NUMBER_DATA;
721
722typedef struct _PERSISTENT_RESERVE_COMMAND {
723 ULONG Version;
724 ULONG Size;
725 __C89_NAMELESS union {
726 struct {
727 UCHAR ServiceAction:5;
728 UCHAR Reserved1:3;
729 USHORT AllocationLength;
730 } PR_IN;
731 struct {
732 UCHAR ServiceAction:5;
733 UCHAR Reserved1:3;
734 UCHAR Type:4;
735 UCHAR Scope:4;
736 UCHAR ParameterList[0];
737 } PR_OUT;
738 } DUMMYUNIONNAME;
739} PERSISTENT_RESERVE_COMMAND, *PPERSISTENT_RESERVE_COMMAND;
740
741#endif /* defined(_MSC_EXTENSIONS) */
742
743typedef struct _STORAGE_READ_CAPACITY {
744 ULONG Version;
745 ULONG Size;
746 ULONG BlockLength;
747 LARGE_INTEGER NumberOfBlocks;
748 LARGE_INTEGER DiskLength;
749} STORAGE_READ_CAPACITY, *PSTORAGE_READ_CAPACITY;
750
751typedef enum _WRITE_CACHE_TYPE {
752 WriteCacheTypeUnknown,
753 WriteCacheTypeNone,
754 WriteCacheTypeWriteBack,
755 WriteCacheTypeWriteThrough
756} WRITE_CACHE_TYPE;
757
758typedef enum _WRITE_CACHE_ENABLE {
759 WriteCacheEnableUnknown,
760 WriteCacheDisabled,
761 WriteCacheEnabled
762} WRITE_CACHE_ENABLE;
763
764typedef enum _WRITE_CACHE_CHANGE {
765 WriteCacheChangeUnknown,
766 WriteCacheNotChangeable,
767 WriteCacheChangeable
768} WRITE_CACHE_CHANGE;
769
770typedef enum _WRITE_THROUGH {
771 WriteThroughUnknown,
772 WriteThroughNotSupported,
773 WriteThroughSupported
774} WRITE_THROUGH;
775
776typedef struct _STORAGE_WRITE_CACHE_PROPERTY {
777 ULONG Version;
778 ULONG Size;
779 WRITE_CACHE_TYPE WriteCacheType;
780 WRITE_CACHE_ENABLE WriteCacheEnabled;
781 WRITE_CACHE_CHANGE WriteCacheChangeable;
782 WRITE_THROUGH WriteThroughSupported;
783 BOOLEAN FlushCacheSupported;
784 BOOLEAN UserDefinedPowerProtection;
785 BOOLEAN NVCacheEnabled;
786} STORAGE_WRITE_CACHE_PROPERTY, *PSTORAGE_WRITE_CACHE_PROPERTY;
787
788#define STORAGE_OFFLOAD_MAX_TOKEN_LENGTH 0x200
789#define STORAGE_OFFLOAD_TOKEN_ID_LENGTH 0x1f8
790#define STORAGE_OFFLOAD_TOKEN_TYPE_ZERO_DATA 0xffff0001
791
792#if defined(_MSC_EXTENSIONS) || defined(__GNUC__)
793
794typedef struct _STORAGE_OFFLOAD_TOKEN {
795 UCHAR TokenType[4];
796 UCHAR Reserved[2];
797 UCHAR TokenIdLength[2];
798 __C89_NAMELESS union {
799 struct {
800 UCHAR Reserved2[STORAGE_OFFLOAD_TOKEN_ID_LENGTH];
801 } StorageOffloadZeroDataToken;
802 UCHAR Token[STORAGE_OFFLOAD_TOKEN_ID_LENGTH];
803 };
804} STORAGE_OFFLOAD_TOKEN, *PSTORAGE_OFFLOAD_TOKEN;
805
806#endif /* defined(_MSC_EXTENSIONS) */
807
808#define MAKE_ZERO_TOKEN(T) (((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[0] = 0xff, \
809 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[1] = 0xff, \
810 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[2] = 0x00, \
811 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[3] = 0x01, \
812 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenIdLength[0] = 0x01, \
813 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenIdLength[1] = 0xf8)
814
815#define IS_ZERO_TOKEN(T) (((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[0] == 0xff && \
816 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[1] == 0xff && \
817 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[2] == 0x00 && \
818 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenType[3] == 0x01 && \
819 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenIdLength[0] == 0x01 && \
820 ((PSTORAGE_OFFLOAD_TOKEN)T)->TokenIdLength[1] == 0xf8)
821
822typedef struct _STORAGE_OFFLOAD_READ_OUTPUT {
823 ULONG OffloadReadFlags;
824 ULONG Reserved;
825 ULONGLONG LengthProtected;
826 ULONG TokenLength;
827 STORAGE_OFFLOAD_TOKEN Token;
828} STORAGE_OFFLOAD_READ_OUTPUT, *PSTORAGE_OFFLOAD_READ_OUTPUT;
829
830#define STORAGE_OFFLOAD_READ_RANGE_TRUNCATED 0x0001
831
832typedef struct _STORAGE_OFFLOAD_WRITE_OUTPUT {
833 ULONG OffloadWriteFlags;
834 ULONG Reserved;
835 ULONGLONG LengthCopied;
836} STORAGE_OFFLOAD_WRITE_OUTPUT, *PSTORAGE_OFFLOAD_WRITE_OUTPUT;
837
838#define STORAGE_OFFLOAD_WRITE_RANGE_TRUNCATED 0x0001
839#define STORAGE_OFFLOAD_TOKEN_INVALID 0x0002
840
841#define STORAGE_CRASH_TELEMETRY_REGKEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\CrashControl\\StorageTelemetry"
842#define STORAGE_DEVICE_TELEMETRY_REGKEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Storage\\StorageTelemetry"
843#define DDUMP_FLAG_DATA_READ_FROM_DEVICE 0x0001
844#define FW_ISSUEID_NO_ISSUE 0x00000000
845#define FW_ISSUEID_UNKNOWN 0xffffffff
846#define TC_PUBLIC_DEVICEDUMP_CONTENT_SMART 1
847#define TC_PUBLIC_DEVICEDUMP_CONTENT_GPLOG 2
848#define TC_PUBLIC_DATA_TYPE_ATAGP "ATAGPLogPages"
849#define TC_PUBLIC_DATA_TYPE_ATASMART "ATASMARTPages"
850#define DEVICEDUMP_CAP_PRIVATE_SECTION 0x00000001
851#define DEVICEDUMP_CAP_RESTRICTED_SECTION 0x00000002
852
853#define TCRecordStorportSrbFunction Command[0]
854
855typedef enum _DEVICEDUMP_COLLECTION_TYPE {
856 TCCollectionBugCheck = 1,
857 TCCollectionApplicationRequested,
858 TCCollectionDeviceRequested
859} DEVICEDUMP_COLLECTION_TYPEIDE_NOTIFICATION_TYPE, *PDEVICEDUMP_COLLECTION_TYPE;
860
861typedef struct _DEVICEDUMP_SUBSECTION_POINTER {
862 ULONG dwSize;
863 ULONG dwFlags;
864 ULONG dwOffset;
865} DEVICEDUMP_SUBSECTION_POINTER, *PDEVICEDUMP_SUBSECTION_POINTER;
866
867#define DEVICEDUMP_STRUCTURE_VERSION_V1 1
868
869typedef struct _DEVICEDUMP_STRUCTURE_VERSION {
870 ULONG dwSignature;
871 ULONG dwVersion;
872 ULONG dwSize;
873} DEVICEDUMP_STRUCTURE_VERSION, *PDEVICEDUMP_STRUCTURE_VERSION;
874
875#define DEVICEDUMP_MAX_IDSTRING 32
876#define MAX_FW_BUCKET_ID_LENGTH 132
877
878typedef struct _DEVICEDUMP_SECTION_HEADER {
879 GUID guidDeviceDataId;
880 UCHAR sOrganizationID[16];
881 ULONG dwFirmwareRevision;
882 UCHAR sModelNumber[DEVICEDUMP_MAX_IDSTRING];
883 UCHAR szDeviceManufacturingID[DEVICEDUMP_MAX_IDSTRING];
884 ULONG dwFlags;
885 ULONG bRestrictedPrivateDataVersion;
886 ULONG dwFirmwareIssueId;
887 UCHAR szIssueDescriptionString[MAX_FW_BUCKET_ID_LENGTH];
888} DEVICEDUMP_SECTION_HEADER, *PDEVICEDUMP_SECTION_HEADER;
889
890#define TC_PUBLIC_DEVICEDUMP_CONTENT_GPLOG_MAX 16
891#define TC_DEVICEDUMP_SUBSECTION_DESC_LENGTH 16
892
893typedef struct _GP_LOG_PAGE_DESCRIPTOR {
894 USHORT LogAddress;
895 USHORT LogSectors;
896} GP_LOG_PAGE_DESCRIPTOR, *PGP_LOG_PAGE_DESCRIPTOR;
897
898typedef struct _DEVICEDUMP_PUBLIC_SUBSECTION {
899 ULONG dwFlags;
900 GP_LOG_PAGE_DESCRIPTOR GPLogTable[TC_PUBLIC_DEVICEDUMP_CONTENT_GPLOG_MAX];
901 CHAR szDescription[TC_DEVICEDUMP_SUBSECTION_DESC_LENGTH];
902 UCHAR bData[1];
903} DEVICEDUMP_PUBLIC_SUBSECTION, *PDEVICEDUMP_PUBLIC_SUBSECTION;
904
905typedef struct _DEVICEDUMP_PRIVATE_SUBSECTION {
906 ULONG dwFlags;
907 GP_LOG_PAGE_DESCRIPTOR GPLogId;
908 UCHAR bData[1];
909} DEVICEDUMP_PRIVATE_SUBSECTION, *PDEVICEDUMP_PRIVATE_SUBSECTION;
910
911#define CDB_SIZE 16
912#define TELEMETRY_COMMAND_SIZE 16
913
914typedef struct _DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD {
915 UCHAR Cdb[CDB_SIZE];
916 UCHAR Command[TELEMETRY_COMMAND_SIZE];
917 ULONGLONG StartTime;
918 ULONGLONG EndTime;
919 ULONG OperationStatus;
920 ULONG OperationError;
921
922 union {
923 struct {
924 ULONG dwReserved;
925 } ExternalStack;
926
927 struct {
928 ULONG dwAtaPortSpecific;
929 } AtaPort;
930
931 struct {
932 ULONG SrbTag;
933 } StorPort;
934 } StackSpecific;
935} DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD, *PDEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD;
936
937typedef struct _DEVICEDUMP_RESTRICTED_SUBSECTION {
938 UCHAR bData[1];
939} DEVICEDUMP_RESTRICTED_SUBSECTION, *PDEVICEDUMP_RESTRICTED_SUBSECTION;
940
941typedef struct _DEVICEDUMP_STORAGEDEVICE_DATA {
942 DEVICEDUMP_STRUCTURE_VERSION Descriptor;
943 DEVICEDUMP_SECTION_HEADER SectionHeader;
944 ULONG dwBufferSize;
945 ULONG dwReasonForCollection;
946 DEVICEDUMP_SUBSECTION_POINTER PublicData;
947 DEVICEDUMP_SUBSECTION_POINTER RestrictedData;
948 DEVICEDUMP_SUBSECTION_POINTER PrivateData;
949} DEVICEDUMP_STORAGEDEVICE_DATA, *PDEVICEDUMP_STORAGEDEVICE_DATA;
950
951typedef struct _DEVICEDUMP_STORAGESTACK_PUBLIC_DUMP {
952 DEVICEDUMP_STRUCTURE_VERSION Descriptor;
953 ULONG dwReasonForCollection;
954 UCHAR cDriverName[16];
955 ULONG uiNumRecords;
956 DEVICEDUMP_STORAGESTACK_PUBLIC_STATE_RECORD RecordArray[1];
957} DEVICEDUMP_STORAGESTACK_PUBLIC_DUMP, *PDEVICEDUMP_STORAGESTACK_PUBLIC_DUMP;
958
959typedef struct _DEVICE_LB_PROVISIONING_DESCRIPTOR {
960 ULONG Version;
961 ULONG Size;
962 UCHAR ThinProvisioningEnabled : 1;
963 UCHAR ThinProvisioningReadZeros : 1;
964 UCHAR AnchorSupported : 3;
965 UCHAR UnmapGranularityAlignmentValid : 1;
966 UCHAR Reserved0 : 2;
967 UCHAR Reserved1[7];
968 ULONGLONG OptimalUnmapGranularity;
969 ULONGLONG UnmapGranularityAlignment;
970} DEVICE_LB_PROVISIONING_DESCRIPTOR, *PDEVICE_LB_PROVISIONING_DESCRIPTOR;
971
972typedef struct _STORAGE_LB_PROVISIONING_MAP_RESOURCES {
973 ULONG Size;
974 ULONG Version;
975 UCHAR AvailableMappingResourcesValid : 1;
976 UCHAR UsedMappingResourcesValid : 1;
977 UCHAR Reserved0 : 6;
978 UCHAR Reserved1[3];
979 UCHAR MappingResourcesScope : 2;
980 UCHAR UsedMappingResourcesScope : 2;
981 UCHAR Reserved2 : 4;
982 UCHAR Reserved3[3];
983 ULONGLONG AvailableMappingResources;
984 ULONGLONG UsedMappingResources;
985} STORAGE_LB_PROVISIONING_MAP_RESOURCES, *PSTORAGE_LB_PROVISIONING_MAP_RESOURCES;
986
987typedef struct _DEVICE_POWER_DESCRIPTOR {
988 ULONG Version;
989 ULONG Size;
990 BOOLEAN DeviceAttentionSupported;
991 BOOLEAN AsynchronousNotificationSupported;
992 BOOLEAN IdlePowerManagementEnabled;
993 BOOLEAN D3ColdEnabled;
994 BOOLEAN D3ColdSupported;
995 BOOLEAN NoVerifyDuringIdlePower;
996 UCHAR Reserved[2];
997 ULONG IdleTimeoutInMS;
998} DEVICE_POWER_DESCRIPTOR, *PDEVICE_POWER_DESCRIPTOR;
999
1000typedef struct _DEVICE_COPY_OFFLOAD_DESCRIPTOR {
1001 ULONG Version;
1002 ULONG Size;
1003 ULONG MaximumTokenLifetime;
1004 ULONG DefaultTokenLifetime;
1005 ULONGLONG MaximumTransferSize;
1006 ULONGLONG OptimalTransferCount;
1007 ULONG MaximumDataDescriptors;
1008 ULONG MaximumTransferLengthPerDescriptor;
1009 ULONG OptimalTransferLengthPerDescriptor;
1010 USHORT OptimalTransferLengthGranularity;
1011 UCHAR Reserved[2];
1012} DEVICE_COPY_OFFLOAD_DESCRIPTOR, *PDEVICE_COPY_OFFLOAD_DESCRIPTOR;
1013
1014typedef struct _STORAGE_DEVICE_RESILIENCY_DESCRIPTOR {
1015 ULONG Version;
1016 ULONG Size;
1017 ULONG NameOffset;
1018 ULONG NumberOfLogicalCopies;
1019 ULONG NumberOfPhysicalCopies;
1020 ULONG PhysicalDiskRedundancy;
1021 ULONG NumberOfColumns;
1022 ULONG Interleave;
1023} STORAGE_DEVICE_RESILIENCY_DESCRIPTOR, *PSTORAGE_DEVICE_RESILIENCY_DESCRIPTOR;
1024
1025typedef struct _STORAGE_IDLE_POWER {
1026 ULONG Version;
1027 ULONG Size;
1028 ULONG WakeCapableHint : 1;
1029 ULONG D3ColdSupported : 1;
1030 ULONG Reserved : 30;
1031 ULONG D3IdleTimeout;
1032} STORAGE_IDLE_POWER, *PSTORAGE_IDLE_POWER;
1033
1034typedef enum _STORAGE_POWERUP_REASON_TYPE {
1035 StoragePowerupUnknown,
1036 StoragePowerupIO,
1037 StoragePowerupDeviceAttention
1038} STORAGE_POWERUP_REASON_TYPE, *PSTORAGE_POWERUP_REASON_TYPE;
1039
1040typedef struct _STORAGE_IDLE_POWERUP_REASON {
1041 ULONG Version;
1042 ULONG Size;
1043 STORAGE_POWERUP_REASON_TYPE PowerupReason;
1044} STORAGE_IDLE_POWERUP_REASON, *PSTORAGE_IDLE_POWERUP_REASON;
1045
1046#define STORAGE_IDLE_POWERUP_REASON_VERSION_V1 1
1047
1048typedef struct _STORAGE_EVENT_NOTIFICATION {
1049 ULONG Version;
1050 ULONG Size;
1051 ULONGLONG Events;
1052} STORAGE_EVENT_NOTIFICATION, *PSTORAGE_EVENT_NOTIFICATION;
1053
1054#define STORAGE_EVENT_NOTIFICATION_VERSION_V1 1
1055
1056#define STORAGE_EVENT_MEDIA_STATUS 1
1057#define STORAGE_EVENT_DEVICE_STATUS 2
1058#define STORAGE_EVENT_DEVICE_OPERATION 4
1059
1060#define STORAGE_EVENT_ALL \
1061 (STORAGE_EVENT_MEDIA_STATUS | STORAGE_EVENT_DEVICE_STATUS | STORAGE_EVENT_DEVICE_OPERATION)
1062
1063#define READ_COPY_NUMBER_KEY 0x52434e00
1064
1065#define IsKeyReadCopyNumber(k) (((k) & 0xffffff00) == READ_COPY_NUMBER_KEY)
1066#define ReadCopyNumberToKey(c) (READ_COPY_NUMBER_KEY | (UCHAR)(c))
1067#define ReadCopyNumberFromKey(k) (UCHAR)((k) & 0x000000ff)
1068
1069typedef struct _DEVICE_DSM_OFFLOAD_READ_PARAMETERS {
1070 ULONG Flags;
1071 ULONG TimeToLive;
1072 ULONG Reserved[2];
1073} DEVICE_DSM_OFFLOAD_READ_PARAMETERS, *PDEVICE_DSM_OFFLOAD_READ_PARAMETERS;
1074
1075typedef struct _DEVICE_DSM_OFFLOAD_WRITE_PARAMETERS {
1076 ULONG Flags;
1077 ULONG Reserved;
1078 ULONGLONG TokenOffset;
1079 STORAGE_OFFLOAD_TOKEN Token;
1080} DEVICE_DSM_OFFLOAD_WRITE_PARAMETERS, *PDEVICE_DSM_OFFLOAD_WRITE_PARAMETERS;
1081
1082typedef struct _DEVICE_DATA_SET_REPAIR_PARAMETERS {
1083 ULONG NumberOfRepairCopies;
1084 ULONG SourceCopy;
1085 ULONG RepairCopies[1];
1086} DEVICE_DATA_SET_REPAIR_PARAMETERS, *PDEVICE_DATA_SET_REPAIR_PARAMETERS;
1087
1088typedef struct _DEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT {
1089 ULONG Size;
1090 DEVICE_DATA_MANAGEMENT_SET_ACTION Action;
1091 ULONG Flags;
1092 ULONG OperationStatus;
1093 ULONG ExtendedError;
1094 ULONG TargetDetailedError;
1095 ULONG ReservedStatus;
1096 ULONG OutputBlockOffset;
1097 ULONG OutputBlockLength;
1098} DEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT, *PDEVICE_MANAGE_DATA_SET_ATTRIBUTES_OUTPUT;
1099
1100typedef struct _DEVICE_DATA_SET_LB_PROVISIONING_STATE {
1101 ULONG Size;
1102 ULONG Version;
1103 ULONGLONG SlabSizeInBytes;
1104 ULONG SlabOffsetDeltaInBytes;
1105 ULONG SlabAllocationBitMapBitCount;
1106 ULONG SlabAllocationBitMapLength;
1107 ULONG SlabAllocationBitMap[1];
1108} DEVICE_DATA_SET_LB_PROVISIONING_STATE, *PDEVICE_DATA_SET_LB_PROVISIONING_STATE;
1109
1110typedef struct _DEVICE_DATA_SET_SCRUB_OUTPUT {
1111 ULONGLONG BytesProcessed;
1112 ULONGLONG BytesRepaired;
1113 ULONGLONG BytesFailed;
1114} DEVICE_DATA_SET_SCRUB_OUTPUT, *PDEVICE_DATA_SET_SCRUB_OUTPUT;
1115
1116#if NTDDI_VERSION >= NTDDI_WIN8
1117
1118#define NO_SRBTYPE_ADAPTER_DESCRIPTOR_SIZE FIELD_OFFSET(STORAGE_ADAPTER_DESCRIPTOR, SrbType)
1119
1120#ifndef SRB_TYPE_SCSI_REQUEST_BLOCK
1121#define SRB_TYPE_SCSI_REQUEST_BLOCK 0
1122#endif
1123
1124#ifndef SRB_TYPE_STORAGE_REQUEST_BLOCK
1125#define SRB_TYPE_STORAGE_REQUEST_BLOCK 1
1126#endif
1127
1128#ifndef STORAGE_ADDRESS_TYPE_BTL8
1129#define STORAGE_ADDRESS_TYPE_BTL8 0
1130#endif
1131
1132#endif
1133
1134#ifdef __cplusplus
1135}
1136#endif
1137
1138#endif /* _NTDDSTOR_H_ */
Note: See TracBrowser for help on using the repository browser.