Refactoring in order to cache more operation.
[xy_vsfilter.git] / include / winddk / ntddstor.h
blob83f7fe0191fe645d68af8b80aa67ff5545b882b6
1 /*++ BUILD Version: 0001 // Increment this if a change has global effects
3 Copyright (c) Microsoft Corporation. All rights reserved.
5 Module Name:
7 ntddstor.h
9 Abstract:
11 This is the include file that defines all common constants and types
12 accessing the storage class drivers
14 Author:
16 Peter Wieland 19-Jun-1996
18 Revision History:
20 --*/
22 #pragma once
24 #include "devioctl.h"
27 // Interface GUIDs
29 // need these GUIDs outside conditional includes so that user can
30 // #include <ntddstor.h> in precompiled header
31 // #include <initguid.h> in a single source file
32 // #include <ntddstor.h> in that source file a second time to instantiate the GUIDs
34 #ifdef DEFINE_GUID
36 // Make sure FAR is defined...
38 #ifndef FAR
39 #ifdef _WIN32
40 #define FAR
41 #else
42 #define FAR _far
43 #endif
44 #endif
46 // begin_wioctlguids
47 DEFINE_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
48 DEFINE_GUID(GUID_DEVINTERFACE_CDROM, 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
49 DEFINE_GUID(GUID_DEVINTERFACE_PARTITION, 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
50 DEFINE_GUID(GUID_DEVINTERFACE_TAPE, 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
51 DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK, 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
52 DEFINE_GUID(GUID_DEVINTERFACE_VOLUME, 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
53 DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER, 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
54 DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY, 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
55 DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER, 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
56 DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT, 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
57 // end_wioctlguids
59 // begin_wioctlobsoleteguids
60 #define DiskClassGuid GUID_DEVINTERFACE_DISK
61 #define CdRomClassGuid GUID_DEVINTERFACE_CDROM
62 #define PartitionClassGuid GUID_DEVINTERFACE_PARTITION
63 #define TapeClassGuid GUID_DEVINTERFACE_TAPE
64 #define WriteOnceDiskClassGuid GUID_DEVINTERFACE_WRITEONCEDISK
65 #define VolumeClassGuid GUID_DEVINTERFACE_VOLUME
66 #define MediumChangerClassGuid GUID_DEVINTERFACE_MEDIUMCHANGER
67 #define FloppyClassGuid GUID_DEVINTERFACE_FLOPPY
68 #define CdChangerClassGuid GUID_DEVINTERFACE_CDCHANGER
69 #define StoragePortClassGuid GUID_DEVINTERFACE_STORAGEPORT
70 // end_wioctlobsoleteguids
71 #endif
73 // begin_winioctl
75 #ifndef _NTDDSTOR_H_
76 #define _NTDDSTOR_H_
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
83 // IoControlCode values for storage devices
86 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
89 // The following device control codes are common for all class drivers. They
90 // should be used in place of the older IOCTL_DISK, IOCTL_CDROM and IOCTL_TAPE
91 // common codes
94 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
95 #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
96 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
97 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
98 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
99 #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
100 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
101 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
102 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
104 #define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
105 #define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
107 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
108 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
109 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
110 #define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
111 #define IOCTL_STORAGE_SET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
113 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
114 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
115 #define IOCTL_STORAGE_BREAK_RESERVATION CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
117 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
118 #define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
120 // end_winioctl
123 #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
126 // begin_winioctl
129 // These ioctl codes are obsolete. They are defined here to avoid resuing them
130 // and to allow class drivers to respond to them more easily.
133 #define OBSOLETE_IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
134 #define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
138 // IOCTL_STORAGE_GET_HOTPLUG_INFO
141 typedef struct _STORAGE_HOTPLUG_INFO {
142 ULONG Size; // version
143 BOOLEAN MediaRemovable; // ie. zip, jaz, cdrom, mo, etc. vs hdd
144 BOOLEAN MediaHotplug; // ie. does the device succeed a lock even though its not lockable media?
145 BOOLEAN DeviceHotplug; // ie. 1394, USB, etc.
146 BOOLEAN WriteCacheEnableOverride; // This field should not be relied upon because it is no longer used
147 } STORAGE_HOTPLUG_INFO, *PSTORAGE_HOTPLUG_INFO;
150 // IOCTL_STORAGE_GET_DEVICE_NUMBER
152 // input - none
154 // output - STORAGE_DEVICE_NUMBER structure
155 // The values in the STORAGE_DEVICE_NUMBER structure are guaranteed
156 // to remain unchanged until the system is rebooted. They are not
157 // guaranteed to be persistant across boots.
160 typedef struct _STORAGE_DEVICE_NUMBER {
163 // The FILE_DEVICE_XXX type for this device.
166 DEVICE_TYPE DeviceType;
169 // The number of this device
172 ULONG DeviceNumber;
175 // If the device is partitionable, the partition number of the device.
176 // Otherwise -1
179 ULONG PartitionNumber;
180 } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
183 // Define the structures for scsi resets
186 typedef struct _STORAGE_BUS_RESET_REQUEST {
187 UCHAR PathId;
188 } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
191 // IOCTL_STORAGE_MEDIA_REMOVAL disables the mechanism
192 // on a storage device that ejects media. This function
193 // may or may not be supported on storage devices that
194 // support removable media.
196 // TRUE means prevent media from being removed.
197 // FALSE means allow media removal.
200 typedef struct _PREVENT_MEDIA_REMOVAL {
201 BOOLEAN PreventMediaRemoval;
202 } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
204 // begin_ntminitape
207 typedef struct _TAPE_STATISTICS {
208 ULONG Version;
209 ULONG Flags;
210 LARGE_INTEGER RecoveredWrites;
211 LARGE_INTEGER UnrecoveredWrites;
212 LARGE_INTEGER RecoveredReads;
213 LARGE_INTEGER UnrecoveredReads;
214 UCHAR CompressionRatioReads;
215 UCHAR CompressionRatioWrites;
216 } TAPE_STATISTICS, *PTAPE_STATISTICS;
218 #define RECOVERED_WRITES_VALID 0x00000001
219 #define UNRECOVERED_WRITES_VALID 0x00000002
220 #define RECOVERED_READS_VALID 0x00000004
221 #define UNRECOVERED_READS_VALID 0x00000008
222 #define WRITE_COMPRESSION_INFO_VALID 0x00000010
223 #define READ_COMPRESSION_INFO_VALID 0x00000020
225 typedef struct _TAPE_GET_STATISTICS {
226 ULONG Operation;
227 } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
229 #define TAPE_RETURN_STATISTICS 0L
230 #define TAPE_RETURN_ENV_INFO 1L
231 #define TAPE_RESET_STATISTICS 2L
234 // IOCTL_STORAGE_GET_MEDIA_TYPES_EX will return an array of DEVICE_MEDIA_INFO
235 // structures, one per supported type, embedded in the GET_MEDIA_TYPES struct.
238 typedef enum _STORAGE_MEDIA_TYPE {
240 // Following are defined in ntdddisk.h in the MEDIA_TYPE enum
242 // Unknown, // Format is unknown
243 // F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
244 // F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
245 // F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
246 // F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
247 // F3_720_512, // 3.5", 720KB, 512 bytes/sector
248 // F5_360_512, // 5.25", 360KB, 512 bytes/sector
249 // F5_320_512, // 5.25", 320KB, 512 bytes/sector
250 // F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
251 // F5_180_512, // 5.25", 180KB, 512 bytes/sector
252 // F5_160_512, // 5.25", 160KB, 512 bytes/sector
253 // RemovableMedia, // Removable media other than floppy
254 // FixedMedia, // Fixed hard disk media
255 // F3_120M_512, // 3.5", 120M Floppy
256 // F3_640_512, // 3.5" , 640KB, 512 bytes/sector
257 // F5_640_512, // 5.25", 640KB, 512 bytes/sector
258 // F5_720_512, // 5.25", 720KB, 512 bytes/sector
259 // F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
260 // F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
261 // F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
262 // F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
263 // F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
264 // F8_256_128, // 8", 256KB, 128 bytes/sector
265 // F3_200Mb_512, // 3.5", 200M Floppy (HiFD)
268 DDS_4mm = 0x20, // Tape - DAT DDS1,2,... (all vendors)
269 MiniQic, // Tape - miniQIC Tape
270 Travan, // Tape - Travan TR-1,2,3,...
271 QIC, // Tape - QIC
272 MP_8mm, // Tape - 8mm Exabyte Metal Particle
273 AME_8mm, // Tape - 8mm Exabyte Advanced Metal Evap
274 AIT1_8mm, // Tape - 8mm Sony AIT
275 DLT, // Tape - DLT Compact IIIxt, IV
276 NCTP, // Tape - Philips NCTP
277 IBM_3480, // Tape - IBM 3480
278 IBM_3490E, // Tape - IBM 3490E
279 IBM_Magstar_3590, // Tape - IBM Magstar 3590
280 IBM_Magstar_MP, // Tape - IBM Magstar MP
281 STK_DATA_D3, // Tape - STK Data D3
282 SONY_DTF, // Tape - Sony DTF
283 DV_6mm, // Tape - 6mm Digital Video
284 DMI, // Tape - Exabyte DMI and compatibles
285 SONY_D2, // Tape - Sony D2S and D2L
286 CLEANER_CARTRIDGE, // Cleaner - All Drive types that support Drive Cleaners
287 CD_ROM, // Opt_Disk - CD
288 CD_R, // Opt_Disk - CD-Recordable (Write Once)
289 CD_RW, // Opt_Disk - CD-Rewriteable
290 DVD_ROM, // Opt_Disk - DVD-ROM
291 DVD_R, // Opt_Disk - DVD-Recordable (Write Once)
292 DVD_RW, // Opt_Disk - DVD-Rewriteable
293 MO_3_RW, // Opt_Disk - 3.5" Rewriteable MO Disk
294 MO_5_WO, // Opt_Disk - MO 5.25" Write Once
295 MO_5_RW, // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW)
296 MO_5_LIMDOW, // Opt_Disk - MO 5.25" Rewriteable (LIMDOW)
297 PC_5_WO, // Opt_Disk - Phase Change 5.25" Write Once Optical
298 PC_5_RW, // Opt_Disk - Phase Change 5.25" Rewriteable
299 PD_5_RW, // Opt_Disk - PhaseChange Dual Rewriteable
300 ABL_5_WO, // Opt_Disk - Ablative 5.25" Write Once Optical
301 PINNACLE_APEX_5_RW, // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical
302 SONY_12_WO, // Opt_Disk - Sony 12" Write Once
303 PHILIPS_12_WO, // Opt_Disk - Philips/LMS 12" Write Once
304 HITACHI_12_WO, // Opt_Disk - Hitachi 12" Write Once
305 CYGNET_12_WO, // Opt_Disk - Cygnet/ATG 12" Write Once
306 KODAK_14_WO, // Opt_Disk - Kodak 14" Write Once
307 MO_NFR_525, // Opt_Disk - Near Field Recording (Terastor)
308 NIKON_12_RW, // Opt_Disk - Nikon 12" Rewriteable
309 IOMEGA_ZIP, // Mag_Disk - Iomega Zip
310 IOMEGA_JAZ, // Mag_Disk - Iomega Jaz
311 SYQUEST_EZ135, // Mag_Disk - Syquest EZ135
312 SYQUEST_EZFLYER, // Mag_Disk - Syquest EzFlyer
313 SYQUEST_SYJET, // Mag_Disk - Syquest SyJet
314 AVATAR_F2, // Mag_Disk - 2.5" Floppy
315 MP2_8mm, // Tape - 8mm Hitachi
316 DST_S, // Ampex DST Small Tapes
317 DST_M, // Ampex DST Medium Tapes
318 DST_L, // Ampex DST Large Tapes
319 VXATape_1, // Ecrix 8mm Tape
320 VXATape_2, // Ecrix 8mm Tape
321 STK_9840, // STK 9840
322 LTO_Ultrium, // IBM, HP, Seagate LTO Ultrium
323 LTO_Accelis, // IBM, HP, Seagate LTO Accelis
324 DVD_RAM, // Opt_Disk - DVD-RAM
325 AIT_8mm, // AIT2 or higher
326 ADR_1, // OnStream ADR Mediatypes
327 ADR_2
328 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
330 #define MEDIA_ERASEABLE 0x00000001
331 #define MEDIA_WRITE_ONCE 0x00000002
332 #define MEDIA_READ_ONLY 0x00000004
333 #define MEDIA_READ_WRITE 0x00000008
335 #define MEDIA_WRITE_PROTECTED 0x00000100
336 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
339 // Define the different storage bus types
340 // Bus types below 128 (0x80) are reserved for Microsoft use
343 typedef enum _STORAGE_BUS_TYPE {
344 BusTypeUnknown = 0x00,
345 BusTypeScsi,
346 BusTypeAtapi,
347 BusTypeAta,
348 BusType1394,
349 BusTypeSsa,
350 BusTypeFibre,
351 BusTypeUsb,
352 BusTypeRAID,
353 BusTypeMaxReserved = 0x7F
354 } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
356 typedef struct _DEVICE_MEDIA_INFO {
357 union {
358 struct {
359 LARGE_INTEGER Cylinders;
360 STORAGE_MEDIA_TYPE MediaType;
361 ULONG TracksPerCylinder;
362 ULONG SectorsPerTrack;
363 ULONG BytesPerSector;
364 ULONG NumberMediaSides;
365 ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
366 } DiskInfo;
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; // Bitmask of MEDIA_XXX values.
376 } RemovableDiskInfo;
378 struct {
379 STORAGE_MEDIA_TYPE MediaType;
380 ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
381 ULONG CurrentBlockSize;
382 STORAGE_BUS_TYPE BusType;
385 // Bus specific information describing the medium supported.
388 union {
389 struct {
390 UCHAR MediumType;
391 UCHAR DensityCode;
392 } ScsiInformation;
393 } BusSpecificData;
395 } TapeInfo;
396 } DeviceSpecific;
397 } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
399 typedef struct _GET_MEDIA_TYPES {
400 ULONG DeviceType; // FILE_DEVICE_XXX values
401 ULONG MediaInfoCount;
402 DEVICE_MEDIA_INFO MediaInfo[1];
403 } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
407 // IOCTL_STORAGE_PREDICT_FAILURE
409 // input - none
411 // output - STORAGE_PREDICT_FAILURE structure
412 // PredictFailure returns zero if no failure predicted and non zero
413 // if a failure is predicted.
415 // VendorSpecific returns 512 bytes of vendor specific information
416 // if a failure is predicted
418 typedef struct _STORAGE_PREDICT_FAILURE
420 ULONG PredictFailure;
421 UCHAR VendorSpecific[512];
422 } STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
424 // end_ntminitape
425 // end_winioctl
428 // Property Query Structures
432 // IOCTL_STORAGE_QUERY_PROPERTY
434 // Input Buffer:
435 // a STORAGE_PROPERTY_QUERY structure which describes what type of query
436 // is being done, what property is being queried for, and any additional
437 // parameters which a particular property query requires.
439 // Output Buffer:
440 // Contains a buffer to place the results of the query into. Since all
441 // property descriptors can be cast into a STORAGE_DESCRIPTOR_HEADER,
442 // the IOCTL can be called once with a small buffer then again using
443 // a buffer as large as the header reports is necessary.
448 // Types of queries
451 typedef enum _STORAGE_QUERY_TYPE {
452 PropertyStandardQuery = 0, // Retrieves the descriptor
453 PropertyExistsQuery, // Used to test whether the descriptor is supported
454 PropertyMaskQuery, // Used to retrieve a mask of writeable fields in the descriptor
455 PropertyQueryMaxDefined // use to validate the value
456 } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
459 // define some initial property id's
462 typedef enum _STORAGE_PROPERTY_ID {
463 StorageDeviceProperty = 0,
464 StorageAdapterProperty,
465 StorageDeviceIdProperty
466 } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
469 // Query structure - additional parameters for specific queries can follow
470 // the header
473 typedef struct _STORAGE_PROPERTY_QUERY {
476 // ID of the property being retrieved
479 STORAGE_PROPERTY_ID PropertyId;
482 // Flags indicating the type of query being performed
485 STORAGE_QUERY_TYPE QueryType;
488 // Space for additional parameters if necessary
491 UCHAR AdditionalParameters[1];
493 } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
496 // Standard property descriptor header. All property pages should use this
497 // as their first element or should contain these two elements
500 typedef struct _STORAGE_DESCRIPTOR_HEADER {
502 ULONG Version;
504 ULONG Size;
506 } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
509 // Device property descriptor - this is really just a rehash of the inquiry
510 // data retrieved from a scsi device
512 // This may only be retrieved from a target device. Sending this to the bus
513 // will result in an error
516 typedef struct _STORAGE_DEVICE_DESCRIPTOR {
519 // Sizeof(STORAGE_DEVICE_DESCRIPTOR)
522 ULONG Version;
525 // Total size of the descriptor, including the space for additional
526 // data and id strings
529 ULONG Size;
532 // The SCSI-2 device type
535 UCHAR DeviceType;
538 // The SCSI-2 device type modifier (if any) - this may be zero
541 UCHAR DeviceTypeModifier;
544 // Flag indicating whether the device's media (if any) is removable. This
545 // field should be ignored for media-less devices
548 BOOLEAN RemovableMedia;
551 // Flag indicating whether the device can support mulitple outstanding
552 // commands. The actual synchronization in this case is the responsibility
553 // of the port driver.
556 BOOLEAN CommandQueueing;
559 // Byte offset to the zero-terminated ascii string containing the device's
560 // vendor id string. For devices with no such ID this will be zero
563 ULONG VendorIdOffset;
566 // Byte offset to the zero-terminated ascii string containing the device's
567 // product id string. For devices with no such ID this will be zero
570 ULONG ProductIdOffset;
573 // Byte offset to the zero-terminated ascii string containing the device's
574 // product revision string. For devices with no such string this will be
575 // zero
578 ULONG ProductRevisionOffset;
581 // Byte offset to the zero-terminated ascii string containing the device's
582 // serial number. For devices with no serial number this will be zero
585 ULONG SerialNumberOffset;
588 // Contains the bus type (as defined above) of the device. It should be
589 // used to interpret the raw device properties at the end of this structure
590 // (if any)
593 STORAGE_BUS_TYPE BusType;
596 // The number of bytes of bus-specific data which have been appended to
597 // this descriptor
600 ULONG RawPropertiesLength;
603 // Place holder for the first byte of the bus specific property data
606 UCHAR RawDeviceProperties[1];
608 } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
612 // Adapter properties
614 // This descriptor can be retrieved from a target device object of from the
615 // device object for the bus. Retrieving from the target device object will
616 // forward the request to the underlying bus
619 typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
621 ULONG Version;
623 ULONG Size;
625 ULONG MaximumTransferLength;
627 ULONG MaximumPhysicalPages;
629 ULONG AlignmentMask;
631 BOOLEAN AdapterUsesPio;
633 BOOLEAN AdapterScansDown;
635 BOOLEAN CommandQueueing;
637 BOOLEAN AcceleratedTransfer;
639 UCHAR BusType;
641 USHORT BusMajorVersion;
643 USHORT BusMinorVersion;
645 } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
648 // Storage identification descriptor.
649 // The definitions here are based on the SCSI/SBP vital product data
650 // device identifier page.
653 typedef enum _STORAGE_IDENTIFIER_CODE_SET {
654 StorageIdCodeSetReserved = 0,
655 StorageIdCodeSetBinary = 1,
656 StorageIdCodeSetAscii = 2
657 } STORAGE_IDENTIFIER_CODE_SET, *PSTORAGE_IDENTIFIER_CODE_SET;
659 typedef enum _STORAGE_IDENTIFIER_TYPE {
660 StorageIdTypeVendorSpecific = 0,
661 StorageIdTypeVendorId = 1,
662 StorageIdTypeEUI64 = 2,
663 StorageIdTypeFCPHName = 3,
664 StorageIdTypePortRelative = 4
665 } STORAGE_IDENTIFIER_TYPE, *PSTORAGE_IDENTIFIER_TYPE;
667 typedef enum _STORAGE_ASSOCIATION_TYPE {
668 StorageIdAssocDevice = 0,
669 StorageIdAssocPort = 1
670 } STORAGE_ASSOCIATION_TYPE, *PSTORAGE_ASSOCIATION_TYPE;
672 typedef struct _STORAGE_IDENTIFIER {
673 STORAGE_IDENTIFIER_CODE_SET CodeSet;
674 STORAGE_IDENTIFIER_TYPE Type;
675 USHORT IdentifierSize;
676 USHORT NextOffset;
679 // Add new fields here since existing code depends on
680 // the above layout not changing.
683 STORAGE_ASSOCIATION_TYPE Association;
686 // The identifier is a variable length array of bytes.
689 UCHAR Identifier[1];
690 } STORAGE_IDENTIFIER, *PSTORAGE_IDENTIFIER;
692 typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
694 ULONG Version;
696 ULONG Size;
699 // The number of identifiers reported by the device.
702 ULONG NumberOfIdentifiers;
705 // The following field is actually a variable length array of identification
706 // descriptors. Unfortunately there's no C notation for an array of
707 // variable length structures so we're forced to just pretend.
710 UCHAR Identifiers[1];
711 } STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
714 #pragma warning(push)
715 #pragma warning(disable:4200)
716 typedef struct _STORAGE_MEDIA_SERIAL_NUMBER_DATA {
718 USHORT Reserved;
721 // the SerialNumberLength will be set to zero
722 // if the command is supported and the media
723 // does not have a valid serial number.
726 USHORT SerialNumberLength;
729 // the following data is binary, and is not guaranteed
730 // to be NULL terminated. this is an excercise for the
731 // caller.
734 UCHAR SerialNumber[0];
736 } STORAGE_MEDIA_SERIAL_NUMBER_DATA, *PSTORAGE_MEDIA_SERIAL_NUMBER_DATA;
737 #pragma warning(push)
740 // begin_winioctl
742 #ifdef __cplusplus
744 #endif
746 #endif // _NTDDSTOR_H_
747 // end_winioctl