1 /* DDK definitions for storage media access */
10 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
12 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
13 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
14 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
15 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
16 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
17 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
18 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
19 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
20 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
21 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
22 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
23 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
24 #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
26 typedef struct _STORAGE_DEVICE_NUMBER
{
27 DEVICE_TYPE DeviceType
;
29 ULONG PartitionNumber
;
30 } STORAGE_DEVICE_NUMBER
, *PSTORAGE_DEVICE_NUMBER
;
32 typedef struct _STORAGE_BUS_RESET_REQUEST
{
34 } STORAGE_BUS_RESET_REQUEST
, *PSTORAGE_BUS_RESET_REQUEST
;
36 typedef struct _PREVENT_MEDIA_REMOVAL
{
37 BOOLEAN PreventMediaRemoval
;
38 } PREVENT_MEDIA_REMOVAL
, *PPREVENT_MEDIA_REMOVAL
;
40 typedef struct _TAPE_STATISTICS
{
43 LARGE_INTEGER RecoveredWrites
;
44 LARGE_INTEGER UnrecoveredWrites
;
45 LARGE_INTEGER RecoveredReads
;
46 LARGE_INTEGER UnrecoveredReads
;
47 UCHAR CompressionRatioReads
;
48 UCHAR CompressionRatioWrites
;
49 } TAPE_STATISTICS
, *PTAPE_STATISTICS
;
51 #define RECOVERED_WRITES_VALID 0x00000001
52 #define UNRECOVERED_WRITES_VALID 0x00000002
53 #define RECOVERED_READS_VALID 0x00000004
54 #define UNRECOVERED_READS_VALID 0x00000008
55 #define WRITE_COMPRESSION_INFO_VALID 0x00000010
56 #define READ_COMPRESSION_INFO_VALID 0x00000020
58 typedef struct _TAPE_GET_STATISTICS
{
60 } TAPE_GET_STATISTICS
, *PTAPE_GET_STATISTICS
;
62 #define TAPE_RETURN_STATISTICS 0L
63 #define TAPE_RETURN_ENV_INFO 1L
64 #define TAPE_RESET_STATISTICS 2L
66 typedef enum _STORAGE_MEDIA_TYPE
{
67 /* see also defines in ntdddisk.h */
117 } STORAGE_MEDIA_TYPE
, *PSTORAGE_MEDIA_TYPE
;
119 #define MEDIA_ERASEABLE 0x00000001
120 #define MEDIA_WRITE_ONCE 0x00000002
121 #define MEDIA_READ_ONLY 0x00000004
122 #define MEDIA_READ_WRITE 0x00000008
123 #define MEDIA_WRITE_PROTECTED 0x00000100
124 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
126 typedef struct _DEVICE_MEDIA_INFO
{
129 LARGE_INTEGER Cylinders
;
130 STORAGE_MEDIA_TYPE MediaType
;
131 ULONG TracksPerCylinder
;
132 ULONG SectorsPerTrack
;
133 ULONG BytesPerSector
;
134 ULONG NumberMediaSides
;
135 ULONG MediaCharacteristics
;
138 LARGE_INTEGER Cylinders
;
139 STORAGE_MEDIA_TYPE MediaType
;
140 ULONG TracksPerCylinder
;
141 ULONG SectorsPerTrack
;
142 ULONG BytesPerSector
;
143 ULONG NumberMediaSides
;
144 ULONG MediaCharacteristics
;
147 STORAGE_MEDIA_TYPE MediaType
;
148 ULONG MediaCharacteristics
;
149 ULONG CurrentBlockSize
;
152 } DEVICE_MEDIA_INFO
, *PDEVICE_MEDIA_INFO
;
154 typedef struct _GET_MEDIA_TYPES
{
156 ULONG MediaInfoCount
;
157 DEVICE_MEDIA_INFO MediaInfo
[1];
158 } GET_MEDIA_TYPES
, *PGET_MEDIA_TYPES
;
160 typedef enum _STORAGE_QUERY_TYPE
{
161 PropertyStandardQuery
= 0,
164 PropertyQueryMaxDefined
165 } STORAGE_QUERY_TYPE
, *PSTORAGE_QUERY_TYPE
;
167 typedef enum _STORAGE_PROPERTY_ID
{
168 StorageDeviceProperty
= 0,
169 StorageAdapterProperty
170 } STORAGE_PROPERTY_ID
, *PSTORAGE_PROPERTY_ID
;
172 typedef struct _STORAGE_PROPERTY_QUERY
{
173 STORAGE_PROPERTY_ID PropertyId
;
174 STORAGE_QUERY_TYPE QueryType
;
175 UCHAR AdditionalParameters
[1];
176 } STORAGE_PROPERTY_QUERY
, *PSTORAGE_PROPERTY_QUERY
;
178 typedef struct _STORAGE_DESCRIPTOR_HEADER
{
181 } STORAGE_DESCRIPTOR_HEADER
, *PSTORAGE_DESCRIPTOR_HEADER
;
183 typedef enum _STORAGE_BUS_TYPE
{
184 BusTypeUnknown
= 0x00,
191 BusTypeMaxReserved
= 0x7F
192 } STORAGE_BUS_TYPE
, *PSTORAGE_BUS_TYPE
;
194 typedef struct _STORAGE_DEVICE_DESCRIPTOR
{
198 UCHAR DeviceTypeModifier
;
199 BOOLEAN RemovableMedia
;
200 BOOLEAN CommandQueueing
;
201 ULONG VendorIdOffset
;
202 ULONG ProductIdOffset
;
203 ULONG ProductRevisionOffset
;
204 ULONG SerialNumberOffset
;
205 STORAGE_BUS_TYPE BusType
;
206 ULONG RawPropertiesLength
;
207 UCHAR RawDeviceProperties
[1];
208 } STORAGE_DEVICE_DESCRIPTOR
, *PSTORAGE_DEVICE_DESCRIPTOR
;
210 typedef struct _STORAGE_ADAPTER_DESCRIPTOR
{
213 ULONG MaximumTransferLength
;
214 ULONG MaximumPhysicalPages
;
216 BOOLEAN AdapterUsesPio
;
217 BOOLEAN AdapterScansDown
;
218 BOOLEAN CommandQueueing
;
219 BOOLEAN AcceleratedTransfer
;
221 USHORT BusMajorVersion
;
222 USHORT BusMinorVersion
;
223 } STORAGE_ADAPTER_DESCRIPTOR
, *PSTORAGE_ADAPTER_DESCRIPTOR
;
229 #endif /* _NTDDSTOR_H_ */