4 * Storage class IOCTL interface.
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
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.
27 #pragma GCC system_header
36 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
38 #define IOCTL_STORAGE_CHECK_VERIFY \
39 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
41 #define IOCTL_STORAGE_CHECK_VERIFY2 \
42 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_STORAGE_EJECT_MEDIA \
45 CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
47 #define IOCTL_STORAGE_EJECTION_CONTROL \
48 CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
50 #define IOCTL_STORAGE_FIND_NEW_DEVICES \
51 CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
53 #define IOCTL_STORAGE_GET_DEVICE_NUMBER \
54 CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
56 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER \
57 CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
59 #define IOCTL_STORAGE_GET_MEDIA_TYPES \
60 CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
62 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
63 CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
65 #define IOCTL_STORAGE_LOAD_MEDIA \
66 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
68 #define IOCTL_STORAGE_LOAD_MEDIA2 \
69 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
71 #define IOCTL_STORAGE_MCN_CONTROL \
72 CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
74 #define IOCTL_STORAGE_MEDIA_REMOVAL \
75 CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
77 #define IOCTL_STORAGE_PREDICT_FAILURE \
78 CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
80 #define IOCTL_STORAGE_QUERY_PROPERTY \
81 CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
83 #define IOCTL_STORAGE_RELEASE \
84 CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
86 #define IOCTL_STORAGE_RESERVE \
87 CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
89 #define IOCTL_STORAGE_RESET_BUS \
90 CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
92 #define IOCTL_STORAGE_RESET_DEVICE \
93 CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
96 DEFINE_GUID(GUID_DEVINTERFACE_DISK
,
97 0x53f56307L
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
99 DEFINE_GUID(GUID_DEVINTERFACE_CDROM
,
100 0x53f56308L
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
102 DEFINE_GUID(GUID_DEVINTERFACE_PARTITION
,
103 0x53f5630aL
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
105 DEFINE_GUID(GUID_DEVINTERFACE_TAPE
,
106 0x53f5630bL
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
108 DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK
,
109 0x53f5630cL
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
111 DEFINE_GUID(GUID_DEVINTERFACE_VOLUME
,
112 0x53f5630dL
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
114 DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER
,
115 0x53f56310L
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
117 DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY
,
118 0x53f56311L
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
120 DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER
,
121 0x53f56312L
, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
123 DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT
,
124 0x2accfe60L
, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
127 typedef enum _STORAGE_MEDIA_TYPE
{
188 } STORAGE_MEDIA_TYPE
, *PSTORAGE_MEDIA_TYPE
;
190 typedef enum _STORAGE_BUS_TYPE
{
191 BusTypeUnknown
= 0x00,
200 BusTypeMaxReserved
= 0x7F
201 } STORAGE_BUS_TYPE
, *PSTORAGE_BUS_TYPE
;
203 /* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants */
204 #define MEDIA_ERASEABLE 0x00000001
205 #define MEDIA_WRITE_ONCE 0x00000002
206 #define MEDIA_READ_ONLY 0x00000004
207 #define MEDIA_READ_WRITE 0x00000008
208 #define MEDIA_WRITE_PROTECTED 0x00000100
209 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
211 typedef struct _DEVICE_MEDIA_INFO
{
214 LARGE_INTEGER Cylinders
;
215 STORAGE_MEDIA_TYPE MediaType
;
216 ULONG TracksPerCylinder
;
217 ULONG SectorsPerTrack
;
218 ULONG BytesPerSector
;
219 ULONG NumberMediaSides
;
220 ULONG MediaCharacteristics
;
223 LARGE_INTEGER Cylinders
;
224 STORAGE_MEDIA_TYPE MediaType
;
225 ULONG TracksPerCylinder
;
226 ULONG SectorsPerTrack
;
227 ULONG BytesPerSector
;
228 ULONG NumberMediaSides
;
229 ULONG MediaCharacteristics
;
232 STORAGE_MEDIA_TYPE MediaType
;
233 ULONG MediaCharacteristics
;
234 ULONG CurrentBlockSize
;
235 STORAGE_BUS_TYPE BusType
;
244 } DEVICE_MEDIA_INFO
, *PDEVICE_MEDIA_INFO
;
246 typedef struct _GET_MEDIA_TYPES
{
248 ULONG MediaInfoCount
;
249 DEVICE_MEDIA_INFO MediaInfo
[1];
250 } GET_MEDIA_TYPES
, *PGET_MEDIA_TYPES
;
252 typedef struct _STORAGE_ADAPTER_DESCRIPTOR
{
255 ULONG MaximumTransferLength
;
256 ULONG MaximumPhysicalPages
;
258 BOOLEAN AdapterUsesPio
;
259 BOOLEAN AdapterScansDown
;
260 BOOLEAN CommandQueueing
;
261 BOOLEAN AcceleratedTransfer
;
262 STORAGE_BUS_TYPE BusType
;
263 USHORT BusMajorVersion
;
264 USHORT BusMinorVersion
;
265 } STORAGE_ADAPTER_DESCRIPTOR
, *PSTORAGE_ADAPTER_DESCRIPTOR
;
267 typedef struct _STORAGE_BUS_RESET_REQUEST
{
269 } STORAGE_BUS_RESET_REQUEST
, *PSTORAGE_BUS_RESET_REQUEST
;
271 typedef struct _STORAGE_DESCRIPTOR_HEADER
{
274 } STORAGE_DESCRIPTOR_HEADER
, *PSTORAGE_DESCRIPTOR_HEADER
;
276 typedef struct _STORAGE_DEVICE_DESCRIPTOR
{
280 UCHAR DeviceTypeModifier
;
281 BOOLEAN RemovableMedia
;
282 BOOLEAN CommandQueueing
;
283 ULONG VendorIdOffset
;
284 ULONG ProductIdOffset
;
285 ULONG ProductRevisionOffset
;
286 ULONG SerialNumberOffset
;
287 STORAGE_BUS_TYPE BusType
;
288 ULONG RawPropertiesLength
;
289 UCHAR RawDeviceProperties
[1];
290 } STORAGE_DEVICE_DESCRIPTOR
, *PSTORAGE_DEVICE_DESCRIPTOR
;
292 typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR
{
295 ULONG NumberOfIdentifiers
;
296 UCHAR Identifiers
[1];
297 } STORAGE_DEVICE_ID_DESCRIPTOR
, *PSTORAGE_DEVICE_ID_DESCRIPTOR
;
299 typedef struct _STORAGE_DEVICE_NUMBER
{
300 DEVICE_TYPE DeviceType
;
302 ULONG PartitionNumber
;
303 } STORAGE_DEVICE_NUMBER
, *PSTORAGE_DEVICE_NUMBER
;
305 typedef struct _STORAGE_PREDICT_FAILURE
{
306 ULONG PredictFailure
;
307 UCHAR VendorSpecific
[512];
308 } STORAGE_PREDICT_FAILURE
, *PSTORAGE_PREDICT_FAILURE
;
310 typedef enum _STORAGE_PROPERTY_ID
{
311 StorageDeviceProperty
= 0,
312 StorageAdapterProperty
,
313 StorageDeviceIdProperty
314 } STORAGE_PROPERTY_ID
, *PSTORAGE_PROPERTY_ID
;
316 typedef enum _STORAGE_QUERY_TYPE
{
317 PropertyStandardQuery
= 0,
320 PropertyQueryMaxDefined
321 } STORAGE_QUERY_TYPE
, *PSTORAGE_QUERY_TYPE
;
323 typedef struct _STORAGE_PROPERTY_QUERY
{
324 STORAGE_PROPERTY_ID PropertyId
;
325 STORAGE_QUERY_TYPE QueryType
;
326 UCHAR AdditionalParameters
[1];
327 } STORAGE_PROPERTY_QUERY
, *PSTORAGE_PROPERTY_QUERY
;
333 #endif /* __NTDDSTOR_H */