Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

771 lines
26 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddstor.h
  5. Abstract:
  6. This is the include file that defines all common constants and types
  7. accessing the storage class drivers
  8. Author:
  9. Peter Wieland 19-Jun-1996
  10. Revision History:
  11. --*/
  12. //
  13. // Interface GUIDs
  14. //
  15. // need these GUIDs outside conditional includes so that user can
  16. // #include <ntddstor.h> in precompiled header
  17. // #include <initguid.h> in a single source file
  18. // #include <ntddstor.h> in that source file a second time to instantiate the GUIDs
  19. //
  20. #ifdef DEFINE_GUID
  21. //
  22. // Make sure FAR is defined...
  23. //
  24. #ifndef FAR
  25. #ifdef _WIN32
  26. #define FAR
  27. #else
  28. #define FAR _far
  29. #endif
  30. #endif
  31. // begin_wioctlguids
  32. DEFINE_GUID(GUID_DEVINTERFACE_DISK, 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  33. DEFINE_GUID(GUID_DEVINTERFACE_CDROM, 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  34. DEFINE_GUID(GUID_DEVINTERFACE_PARTITION, 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  35. DEFINE_GUID(GUID_DEVINTERFACE_TAPE, 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  36. DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK, 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  37. DEFINE_GUID(GUID_DEVINTERFACE_VOLUME, 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  38. DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER, 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  39. DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY, 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  40. DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER, 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  41. DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT, 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
  42. // end_wioctlguids
  43. // begin_wioctlobsoleteguids
  44. #define DiskClassGuid GUID_DEVINTERFACE_DISK
  45. #define CdRomClassGuid GUID_DEVINTERFACE_CDROM
  46. #define PartitionClassGuid GUID_DEVINTERFACE_PARTITION
  47. #define TapeClassGuid GUID_DEVINTERFACE_TAPE
  48. #define WriteOnceDiskClassGuid GUID_DEVINTERFACE_WRITEONCEDISK
  49. #define VolumeClassGuid GUID_DEVINTERFACE_VOLUME
  50. #define MediumChangerClassGuid GUID_DEVINTERFACE_MEDIUMCHANGER
  51. #define FloppyClassGuid GUID_DEVINTERFACE_FLOPPY
  52. #define CdChangerClassGuid GUID_DEVINTERFACE_CDCHANGER
  53. #define StoragePortClassGuid GUID_DEVINTERFACE_STORAGEPORT
  54. // end_wioctlobsoleteguids
  55. #endif
  56. // begin_winioctl
  57. #ifndef _NTDDSTOR_H_
  58. #define _NTDDSTOR_H_
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62. //
  63. // IoControlCode values for storage devices
  64. //
  65. #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
  66. //
  67. // The following device control codes are common for all class drivers. They
  68. // should be used in place of the older IOCTL_DISK, IOCTL_CDROM and IOCTL_TAPE
  69. // common codes
  70. //
  71. #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  72. #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
  73. #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  74. #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  75. #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  76. #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
  77. #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  78. #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  79. #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
  80. #define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
  81. #define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
  82. #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
  83. #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
  84. #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
  85. #define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
  86. #define IOCTL_STORAGE_SET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  87. #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
  88. #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
  89. #define IOCTL_STORAGE_BREAK_RESERVATION CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
  90. #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
  91. #define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
  92. // end_winioctl
  93. #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
  94. // begin_winioctl
  95. //
  96. // These ioctl codes are obsolete. They are defined here to avoid resuing them
  97. // and to allow class drivers to respond to them more easily.
  98. //
  99. #define OBSOLETE_IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  100. #define OBSOLETE_IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  101. //
  102. // IOCTL_STORAGE_GET_HOTPLUG_INFO
  103. //
  104. typedef struct _STORAGE_HOTPLUG_INFO {
  105. ULONG Size; // version
  106. BOOLEAN MediaRemovable; // ie. zip, jaz, cdrom, mo, etc. vs hdd
  107. BOOLEAN MediaHotplug; // ie. does the device succeed a lock even though its not lockable media?
  108. BOOLEAN DeviceHotplug; // ie. 1394, USB, etc.
  109. BOOLEAN WriteCacheEnableOverride; // This field should not be relied upon because it is no longer used
  110. } STORAGE_HOTPLUG_INFO, *PSTORAGE_HOTPLUG_INFO;
  111. //
  112. // IOCTL_STORAGE_GET_DEVICE_NUMBER
  113. //
  114. // input - none
  115. //
  116. // output - STORAGE_DEVICE_NUMBER structure
  117. // The values in the STORAGE_DEVICE_NUMBER structure are guaranteed
  118. // to remain unchanged until the system is rebooted. They are not
  119. // guaranteed to be persistant across boots.
  120. //
  121. typedef struct _STORAGE_DEVICE_NUMBER {
  122. //
  123. // The FILE_DEVICE_XXX type for this device.
  124. //
  125. DEVICE_TYPE DeviceType;
  126. //
  127. // The number of this device
  128. //
  129. ULONG DeviceNumber;
  130. //
  131. // If the device is partitionable, the partition number of the device.
  132. // Otherwise -1
  133. //
  134. ULONG PartitionNumber;
  135. } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
  136. //
  137. // Define the structures for scsi resets
  138. //
  139. typedef struct _STORAGE_BUS_RESET_REQUEST {
  140. UCHAR PathId;
  141. } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
  142. //
  143. // Break reservation is sent to the Adapter/FDO with the given lun information.
  144. //
  145. typedef struct STORAGE_BREAK_RESERVATION_REQUEST {
  146. ULONG Length;
  147. UCHAR _unused;
  148. UCHAR PathId;
  149. UCHAR TargetId;
  150. UCHAR Lun;
  151. } STORAGE_BREAK_RESERVATION_REQUEST, *PSTORAGE_BREAK_RESERVATION_REQUEST;
  152. //
  153. // IOCTL_STORAGE_MEDIA_REMOVAL disables the mechanism
  154. // on a storage device that ejects media. This function
  155. // may or may not be supported on storage devices that
  156. // support removable media.
  157. //
  158. // TRUE means prevent media from being removed.
  159. // FALSE means allow media removal.
  160. //
  161. typedef struct _PREVENT_MEDIA_REMOVAL {
  162. BOOLEAN PreventMediaRemoval;
  163. } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
  164. //
  165. // This is the format of TARGET_DEVICE_CUSTOM_NOTIFICATION.CustomDataBuffer
  166. // passed to applications by the classpnp autorun code (via IoReportTargetDeviceChangeAsynchronous).
  167. //
  168. typedef struct _CLASS_MEDIA_CHANGE_CONTEXT {
  169. ULONG MediaChangeCount;
  170. ULONG NewState; // see MEDIA_CHANGE_DETECTION_STATE enum in classpnp.h in DDK
  171. } CLASS_MEDIA_CHANGE_CONTEXT, *PCLASS_MEDIA_CHANGE_CONTEXT;
  172. // begin_ntminitape
  173. typedef struct _TAPE_STATISTICS {
  174. ULONG Version;
  175. ULONG Flags;
  176. LARGE_INTEGER RecoveredWrites;
  177. LARGE_INTEGER UnrecoveredWrites;
  178. LARGE_INTEGER RecoveredReads;
  179. LARGE_INTEGER UnrecoveredReads;
  180. UCHAR CompressionRatioReads;
  181. UCHAR CompressionRatioWrites;
  182. } TAPE_STATISTICS, *PTAPE_STATISTICS;
  183. #define RECOVERED_WRITES_VALID 0x00000001
  184. #define UNRECOVERED_WRITES_VALID 0x00000002
  185. #define RECOVERED_READS_VALID 0x00000004
  186. #define UNRECOVERED_READS_VALID 0x00000008
  187. #define WRITE_COMPRESSION_INFO_VALID 0x00000010
  188. #define READ_COMPRESSION_INFO_VALID 0x00000020
  189. typedef struct _TAPE_GET_STATISTICS {
  190. ULONG Operation;
  191. } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
  192. #define TAPE_RETURN_STATISTICS 0L
  193. #define TAPE_RETURN_ENV_INFO 1L
  194. #define TAPE_RESET_STATISTICS 2L
  195. //
  196. // IOCTL_STORAGE_GET_MEDIA_TYPES_EX will return an array of DEVICE_MEDIA_INFO
  197. // structures, one per supported type, embedded in the GET_MEDIA_TYPES struct.
  198. //
  199. typedef enum _STORAGE_MEDIA_TYPE {
  200. //
  201. // Following are defined in ntdddisk.h in the MEDIA_TYPE enum
  202. //
  203. // Unknown, // Format is unknown
  204. // F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
  205. // F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
  206. // F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
  207. // F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
  208. // F3_720_512, // 3.5", 720KB, 512 bytes/sector
  209. // F5_360_512, // 5.25", 360KB, 512 bytes/sector
  210. // F5_320_512, // 5.25", 320KB, 512 bytes/sector
  211. // F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
  212. // F5_180_512, // 5.25", 180KB, 512 bytes/sector
  213. // F5_160_512, // 5.25", 160KB, 512 bytes/sector
  214. // RemovableMedia, // Removable media other than floppy
  215. // FixedMedia, // Fixed hard disk media
  216. // F3_120M_512, // 3.5", 120M Floppy
  217. // F3_640_512, // 3.5" , 640KB, 512 bytes/sector
  218. // F5_640_512, // 5.25", 640KB, 512 bytes/sector
  219. // F5_720_512, // 5.25", 720KB, 512 bytes/sector
  220. // F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
  221. // F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
  222. // F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
  223. // F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
  224. // F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
  225. // F8_256_128, // 8", 256KB, 128 bytes/sector
  226. // F3_200Mb_512, // 3.5", 200M Floppy (HiFD)
  227. //
  228. DDS_4mm = 0x20, // Tape - DAT DDS1,2,... (all vendors)
  229. MiniQic, // Tape - miniQIC Tape
  230. Travan, // Tape - Travan TR-1,2,3,...
  231. QIC, // Tape - QIC
  232. MP_8mm, // Tape - 8mm Exabyte Metal Particle
  233. AME_8mm, // Tape - 8mm Exabyte Advanced Metal Evap
  234. AIT1_8mm, // Tape - 8mm Sony AIT
  235. DLT, // Tape - DLT Compact IIIxt, IV
  236. NCTP, // Tape - Philips NCTP
  237. IBM_3480, // Tape - IBM 3480
  238. IBM_3490E, // Tape - IBM 3490E
  239. IBM_Magstar_3590, // Tape - IBM Magstar 3590
  240. IBM_Magstar_MP, // Tape - IBM Magstar MP
  241. STK_DATA_D3, // Tape - STK Data D3
  242. SONY_DTF, // Tape - Sony DTF
  243. DV_6mm, // Tape - 6mm Digital Video
  244. DMI, // Tape - Exabyte DMI and compatibles
  245. SONY_D2, // Tape - Sony D2S and D2L
  246. CLEANER_CARTRIDGE, // Cleaner - All Drive types that support Drive Cleaners
  247. CD_ROM, // Opt_Disk - CD
  248. CD_R, // Opt_Disk - CD-Recordable (Write Once)
  249. CD_RW, // Opt_Disk - CD-Rewriteable
  250. DVD_ROM, // Opt_Disk - DVD-ROM
  251. DVD_R, // Opt_Disk - DVD-Recordable (Write Once)
  252. DVD_RW, // Opt_Disk - DVD-Rewriteable
  253. MO_3_RW, // Opt_Disk - 3.5" Rewriteable MO Disk
  254. MO_5_WO, // Opt_Disk - MO 5.25" Write Once
  255. MO_5_RW, // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW)
  256. MO_5_LIMDOW, // Opt_Disk - MO 5.25" Rewriteable (LIMDOW)
  257. PC_5_WO, // Opt_Disk - Phase Change 5.25" Write Once Optical
  258. PC_5_RW, // Opt_Disk - Phase Change 5.25" Rewriteable
  259. PD_5_RW, // Opt_Disk - PhaseChange Dual Rewriteable
  260. ABL_5_WO, // Opt_Disk - Ablative 5.25" Write Once Optical
  261. PINNACLE_APEX_5_RW, // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical
  262. SONY_12_WO, // Opt_Disk - Sony 12" Write Once
  263. PHILIPS_12_WO, // Opt_Disk - Philips/LMS 12" Write Once
  264. HITACHI_12_WO, // Opt_Disk - Hitachi 12" Write Once
  265. CYGNET_12_WO, // Opt_Disk - Cygnet/ATG 12" Write Once
  266. KODAK_14_WO, // Opt_Disk - Kodak 14" Write Once
  267. MO_NFR_525, // Opt_Disk - Near Field Recording (Terastor)
  268. NIKON_12_RW, // Opt_Disk - Nikon 12" Rewriteable
  269. IOMEGA_ZIP, // Mag_Disk - Iomega Zip
  270. IOMEGA_JAZ, // Mag_Disk - Iomega Jaz
  271. SYQUEST_EZ135, // Mag_Disk - Syquest EZ135
  272. SYQUEST_EZFLYER, // Mag_Disk - Syquest EzFlyer
  273. SYQUEST_SYJET, // Mag_Disk - Syquest SyJet
  274. AVATAR_F2, // Mag_Disk - 2.5" Floppy
  275. MP2_8mm, // Tape - 8mm Hitachi
  276. DST_S, // Ampex DST Small Tapes
  277. DST_M, // Ampex DST Medium Tapes
  278. DST_L, // Ampex DST Large Tapes
  279. VXATape_1, // Ecrix 8mm Tape
  280. VXATape_2, // Ecrix 8mm Tape
  281. STK_9840, // STK 9840
  282. LTO_Ultrium, // IBM, HP, Seagate LTO Ultrium
  283. LTO_Accelis, // IBM, HP, Seagate LTO Accelis
  284. DVD_RAM, // Opt_Disk - DVD-RAM
  285. AIT_8mm, // AIT2 or higher
  286. ADR_1, // OnStream ADR Mediatypes
  287. ADR_2,
  288. STK_9940 // STK 9940
  289. } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
  290. #define MEDIA_ERASEABLE 0x00000001
  291. #define MEDIA_WRITE_ONCE 0x00000002
  292. #define MEDIA_READ_ONLY 0x00000004
  293. #define MEDIA_READ_WRITE 0x00000008
  294. #define MEDIA_WRITE_PROTECTED 0x00000100
  295. #define MEDIA_CURRENTLY_MOUNTED 0x80000000
  296. //
  297. // Define the different storage bus types
  298. // Bus types below 128 (0x80) are reserved for Microsoft use
  299. //
  300. typedef enum _STORAGE_BUS_TYPE {
  301. BusTypeUnknown = 0x00,
  302. BusTypeScsi,
  303. BusTypeAtapi,
  304. BusTypeAta,
  305. BusType1394,
  306. BusTypeSsa,
  307. BusTypeFibre,
  308. BusTypeUsb,
  309. BusTypeRAID,
  310. BusTypeMaxReserved = 0x7F
  311. } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
  312. typedef struct _DEVICE_MEDIA_INFO {
  313. union {
  314. struct {
  315. LARGE_INTEGER Cylinders;
  316. STORAGE_MEDIA_TYPE MediaType;
  317. ULONG TracksPerCylinder;
  318. ULONG SectorsPerTrack;
  319. ULONG BytesPerSector;
  320. ULONG NumberMediaSides;
  321. ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
  322. } DiskInfo;
  323. struct {
  324. LARGE_INTEGER Cylinders;
  325. STORAGE_MEDIA_TYPE MediaType;
  326. ULONG TracksPerCylinder;
  327. ULONG SectorsPerTrack;
  328. ULONG BytesPerSector;
  329. ULONG NumberMediaSides;
  330. ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
  331. } RemovableDiskInfo;
  332. struct {
  333. STORAGE_MEDIA_TYPE MediaType;
  334. ULONG MediaCharacteristics; // Bitmask of MEDIA_XXX values.
  335. ULONG CurrentBlockSize;
  336. STORAGE_BUS_TYPE BusType;
  337. //
  338. // Bus specific information describing the medium supported.
  339. //
  340. union {
  341. struct {
  342. UCHAR MediumType;
  343. UCHAR DensityCode;
  344. } ScsiInformation;
  345. } BusSpecificData;
  346. } TapeInfo;
  347. } DeviceSpecific;
  348. } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
  349. typedef struct _GET_MEDIA_TYPES {
  350. ULONG DeviceType; // FILE_DEVICE_XXX values
  351. ULONG MediaInfoCount;
  352. DEVICE_MEDIA_INFO MediaInfo[1];
  353. } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
  354. //
  355. // IOCTL_STORAGE_PREDICT_FAILURE
  356. //
  357. // input - none
  358. //
  359. // output - STORAGE_PREDICT_FAILURE structure
  360. // PredictFailure returns zero if no failure predicted and non zero
  361. // if a failure is predicted.
  362. //
  363. // VendorSpecific returns 512 bytes of vendor specific information
  364. // if a failure is predicted
  365. //
  366. typedef struct _STORAGE_PREDICT_FAILURE
  367. {
  368. ULONG PredictFailure;
  369. UCHAR VendorSpecific[512];
  370. } STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
  371. // end_ntminitape
  372. // end_winioctl
  373. //
  374. // Property Query Structures
  375. //
  376. //
  377. // IOCTL_STORAGE_QUERY_PROPERTY
  378. //
  379. // Input Buffer:
  380. // a STORAGE_PROPERTY_QUERY structure which describes what type of query
  381. // is being done, what property is being queried for, and any additional
  382. // parameters which a particular property query requires.
  383. //
  384. // Output Buffer:
  385. // Contains a buffer to place the results of the query into. Since all
  386. // property descriptors can be cast into a STORAGE_DESCRIPTOR_HEADER,
  387. // the IOCTL can be called once with a small buffer then again using
  388. // a buffer as large as the header reports is necessary.
  389. //
  390. //
  391. // Types of queries
  392. //
  393. typedef enum _STORAGE_QUERY_TYPE {
  394. PropertyStandardQuery = 0, // Retrieves the descriptor
  395. PropertyExistsQuery, // Used to test whether the descriptor is supported
  396. PropertyMaskQuery, // Used to retrieve a mask of writeable fields in the descriptor
  397. PropertyQueryMaxDefined // use to validate the value
  398. } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
  399. //
  400. // define some initial property id's
  401. //
  402. typedef enum _STORAGE_PROPERTY_ID {
  403. StorageDeviceProperty = 0,
  404. StorageAdapterProperty,
  405. StorageDeviceIdProperty
  406. } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
  407. //
  408. // Query structure - additional parameters for specific queries can follow
  409. // the header
  410. //
  411. typedef struct _STORAGE_PROPERTY_QUERY {
  412. //
  413. // ID of the property being retrieved
  414. //
  415. STORAGE_PROPERTY_ID PropertyId;
  416. //
  417. // Flags indicating the type of query being performed
  418. //
  419. STORAGE_QUERY_TYPE QueryType;
  420. //
  421. // Space for additional parameters if necessary
  422. //
  423. UCHAR AdditionalParameters[1];
  424. } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
  425. //
  426. // Standard property descriptor header. All property pages should use this
  427. // as their first element or should contain these two elements
  428. //
  429. typedef struct _STORAGE_DESCRIPTOR_HEADER {
  430. ULONG Version;
  431. ULONG Size;
  432. } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
  433. //
  434. // Device property descriptor - this is really just a rehash of the inquiry
  435. // data retrieved from a scsi device
  436. //
  437. // This may only be retrieved from a target device. Sending this to the bus
  438. // will result in an error
  439. //
  440. typedef struct _STORAGE_DEVICE_DESCRIPTOR {
  441. //
  442. // Sizeof(STORAGE_DEVICE_DESCRIPTOR)
  443. //
  444. ULONG Version;
  445. //
  446. // Total size of the descriptor, including the space for additional
  447. // data and id strings
  448. //
  449. ULONG Size;
  450. //
  451. // The SCSI-2 device type
  452. //
  453. UCHAR DeviceType;
  454. //
  455. // The SCSI-2 device type modifier (if any) - this may be zero
  456. //
  457. UCHAR DeviceTypeModifier;
  458. //
  459. // Flag indicating whether the device's media (if any) is removable. This
  460. // field should be ignored for media-less devices
  461. //
  462. BOOLEAN RemovableMedia;
  463. //
  464. // Flag indicating whether the device can support mulitple outstanding
  465. // commands. The actual synchronization in this case is the responsibility
  466. // of the port driver.
  467. //
  468. BOOLEAN CommandQueueing;
  469. //
  470. // Byte offset to the zero-terminated ascii string containing the device's
  471. // vendor id string. For devices with no such ID this will be zero
  472. //
  473. ULONG VendorIdOffset;
  474. //
  475. // Byte offset to the zero-terminated ascii string containing the device's
  476. // product id string. For devices with no such ID this will be zero
  477. //
  478. ULONG ProductIdOffset;
  479. //
  480. // Byte offset to the zero-terminated ascii string containing the device's
  481. // product revision string. For devices with no such string this will be
  482. // zero
  483. //
  484. ULONG ProductRevisionOffset;
  485. //
  486. // Byte offset to the zero-terminated ascii string containing the device's
  487. // serial number. For devices with no serial number this will be zero
  488. //
  489. ULONG SerialNumberOffset;
  490. //
  491. // Contains the bus type (as defined above) of the device. It should be
  492. // used to interpret the raw device properties at the end of this structure
  493. // (if any)
  494. //
  495. STORAGE_BUS_TYPE BusType;
  496. //
  497. // The number of bytes of bus-specific data which have been appended to
  498. // this descriptor
  499. //
  500. ULONG RawPropertiesLength;
  501. //
  502. // Place holder for the first byte of the bus specific property data
  503. //
  504. UCHAR RawDeviceProperties[1];
  505. } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
  506. //
  507. // Adapter properties
  508. //
  509. // This descriptor can be retrieved from a target device object of from the
  510. // device object for the bus. Retrieving from the target device object will
  511. // forward the request to the underlying bus
  512. //
  513. typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
  514. ULONG Version;
  515. ULONG Size;
  516. ULONG MaximumTransferLength;
  517. ULONG MaximumPhysicalPages;
  518. ULONG AlignmentMask;
  519. BOOLEAN AdapterUsesPio;
  520. BOOLEAN AdapterScansDown;
  521. BOOLEAN CommandQueueing;
  522. BOOLEAN AcceleratedTransfer;
  523. UCHAR BusType;
  524. USHORT BusMajorVersion;
  525. USHORT BusMinorVersion;
  526. } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
  527. //
  528. // Storage identification descriptor.
  529. // The definitions here are based on the SCSI/SBP vital product data
  530. // device identifier page.
  531. //
  532. typedef enum _STORAGE_IDENTIFIER_CODE_SET {
  533. StorageIdCodeSetReserved = 0,
  534. StorageIdCodeSetBinary = 1,
  535. StorageIdCodeSetAscii = 2
  536. } STORAGE_IDENTIFIER_CODE_SET, *PSTORAGE_IDENTIFIER_CODE_SET;
  537. typedef enum _STORAGE_IDENTIFIER_TYPE {
  538. StorageIdTypeVendorSpecific = 0,
  539. StorageIdTypeVendorId = 1,
  540. StorageIdTypeEUI64 = 2,
  541. StorageIdTypeFCPHName = 3,
  542. StorageIdTypePortRelative = 4
  543. } STORAGE_IDENTIFIER_TYPE, *PSTORAGE_IDENTIFIER_TYPE;
  544. typedef enum _STORAGE_ASSOCIATION_TYPE {
  545. StorageIdAssocDevice = 0,
  546. StorageIdAssocPort = 1
  547. } STORAGE_ASSOCIATION_TYPE, *PSTORAGE_ASSOCIATION_TYPE;
  548. typedef struct _STORAGE_IDENTIFIER {
  549. STORAGE_IDENTIFIER_CODE_SET CodeSet;
  550. STORAGE_IDENTIFIER_TYPE Type;
  551. USHORT IdentifierSize;
  552. USHORT NextOffset;
  553. //
  554. // Add new fields here since existing code depends on
  555. // the above layout not changing.
  556. //
  557. STORAGE_ASSOCIATION_TYPE Association;
  558. //
  559. // The identifier is a variable length array of bytes.
  560. //
  561. UCHAR Identifier[1];
  562. } STORAGE_IDENTIFIER, *PSTORAGE_IDENTIFIER;
  563. typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
  564. ULONG Version;
  565. ULONG Size;
  566. //
  567. // The number of identifiers reported by the device.
  568. //
  569. ULONG NumberOfIdentifiers;
  570. //
  571. // The following field is actually a variable length array of identification
  572. // descriptors. Unfortunately there's no C notation for an array of
  573. // variable length structures so we're forced to just pretend.
  574. //
  575. UCHAR Identifiers[1];
  576. } STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
  577. #pragma warning(push)
  578. #pragma warning(disable:4200)
  579. typedef struct _STORAGE_MEDIA_SERIAL_NUMBER_DATA {
  580. USHORT Reserved;
  581. //
  582. // the SerialNumberLength will be set to zero
  583. // if the command is supported and the media
  584. // does not have a valid serial number.
  585. //
  586. USHORT SerialNumberLength;
  587. //
  588. // the following data is binary, and is not guaranteed
  589. // to be NULL terminated. this is an excercise for the
  590. // caller.
  591. //
  592. UCHAR SerialNumber[0];
  593. } STORAGE_MEDIA_SERIAL_NUMBER_DATA, *PSTORAGE_MEDIA_SERIAL_NUMBER_DATA;
  594. #pragma warning(push)
  595. // begin_winioctl
  596. #ifdef __cplusplus
  597. }
  598. #endif
  599. #endif // _NTDDSTOR_H_
  600. // end_winioctl