2 * DDK definitions for storage media access
4 * Copyright (C) 2002 Eric Pouech
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
30 #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
31 #define IOCTL_STORAGE_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
32 #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
33 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
36 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
38 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
39 #define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
40 #define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
41 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
43 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
45 #define IOCTL_STORAGE_SET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
46 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
47 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
48 #define IOCTL_STORAGE_BREAK_RESERVATION CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
49 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
50 #define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
51 #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
53 DEFINE_GUID(DiskClassGuid
,
54 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
55 DEFINE_GUID(CdRomClassGuid
,
56 0x53f56308, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
57 DEFINE_GUID(PartitionClassGuid
,
58 0x53f5630a, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
59 DEFINE_GUID(TapeClassGuid
,
60 0x53f5630b, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
61 DEFINE_GUID(WriteOnceDiskClassGuid
,
62 0x53f5630c, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
63 DEFINE_GUID(VolumeClassGuid
,
64 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
65 DEFINE_GUID(MediumChangerClassGuid
,
66 0x53f56310, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
67 DEFINE_GUID(FloppyClassGuid
,
68 0x53f56311, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
69 DEFINE_GUID(CdChangerClassGuid
,
70 0x53f56312, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
71 DEFINE_GUID(StroagePortClassGuid
,
72 0x2accfe60, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
74 typedef struct _STORAGE_DEVICE_NUMBER
{
75 DEVICE_TYPE DeviceType
;
77 ULONG PartitionNumber
;
78 } STORAGE_DEVICE_NUMBER
, *PSTORAGE_DEVICE_NUMBER
;
80 typedef struct _STORAGE_BUS_RESET_REQUEST
{
82 } STORAGE_BUS_RESET_REQUEST
, *PSTORAGE_BUS_RESET_REQUEST
;
84 typedef struct _PREVENT_MEDIA_REMOVAL
{
85 BOOLEAN PreventMediaRemoval
;
86 } PREVENT_MEDIA_REMOVAL
, *PPREVENT_MEDIA_REMOVAL
;
88 typedef struct _TAPE_STATISTICS
{
91 LARGE_INTEGER RecoveredWrites
;
92 LARGE_INTEGER UnrecoveredWrites
;
93 LARGE_INTEGER RecoveredReads
;
94 LARGE_INTEGER UnrecoveredReads
;
95 UCHAR CompressionRatioReads
;
96 UCHAR CompressionRatioWrites
;
97 } TAPE_STATISTICS
, *PTAPE_STATISTICS
;
99 #define RECOVERED_WRITES_VALID 0x00000001
100 #define UNRECOVERED_WRITES_VALID 0x00000002
101 #define RECOVERED_READS_VALID 0x00000004
102 #define UNRECOVERED_READS_VALID 0x00000008
103 #define WRITE_COMPRESSION_INFO_VALID 0x00000010
104 #define READ_COMPRESSION_INFO_VALID 0x00000020
106 typedef struct _TAPE_GET_STATISTICS
{
108 } TAPE_GET_STATISTICS
, *PTAPE_GET_STATISTICS
;
110 #define TAPE_RETURN_STATISTICS 0L
111 #define TAPE_RETURN_ENV_INFO 1L
112 #define TAPE_RESET_STATISTICS 2L
114 typedef enum _STORAGE_MEDIA_TYPE
{
115 /* see also defines in ntdddisk.h */
165 } STORAGE_MEDIA_TYPE
, *PSTORAGE_MEDIA_TYPE
;
167 #define MEDIA_ERASEABLE 0x00000001
168 #define MEDIA_WRITE_ONCE 0x00000002
169 #define MEDIA_READ_ONLY 0x00000004
170 #define MEDIA_READ_WRITE 0x00000008
171 #define MEDIA_WRITE_PROTECTED 0x00000100
172 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
174 typedef struct _DEVICE_MEDIA_INFO
{
177 LARGE_INTEGER Cylinders
;
178 STORAGE_MEDIA_TYPE MediaType
;
179 ULONG TracksPerCylinder
;
180 ULONG SectorsPerTrack
;
181 ULONG BytesPerSector
;
182 ULONG NumberMediaSides
;
183 ULONG MediaCharacteristics
;
186 LARGE_INTEGER Cylinders
;
187 STORAGE_MEDIA_TYPE MediaType
;
188 ULONG TracksPerCylinder
;
189 ULONG SectorsPerTrack
;
190 ULONG BytesPerSector
;
191 ULONG NumberMediaSides
;
192 ULONG MediaCharacteristics
;
195 STORAGE_MEDIA_TYPE MediaType
;
196 ULONG MediaCharacteristics
;
197 ULONG CurrentBlockSize
;
200 } DEVICE_MEDIA_INFO
, *PDEVICE_MEDIA_INFO
;
202 typedef struct _GET_MEDIA_TYPES
{
204 ULONG MediaInfoCount
;
205 DEVICE_MEDIA_INFO MediaInfo
[1];
206 } GET_MEDIA_TYPES
, *PGET_MEDIA_TYPES
;
208 typedef enum _STORAGE_QUERY_TYPE
{
209 PropertyStandardQuery
= 0,
212 PropertyQueryMaxDefined
213 } STORAGE_QUERY_TYPE
, *PSTORAGE_QUERY_TYPE
;
215 typedef enum _STORAGE_PROPERTY_ID
{
216 StorageDeviceProperty
= 0,
217 StorageAdapterProperty
218 } STORAGE_PROPERTY_ID
, *PSTORAGE_PROPERTY_ID
;
220 typedef struct _STORAGE_PROPERTY_QUERY
{
221 STORAGE_PROPERTY_ID PropertyId
;
222 STORAGE_QUERY_TYPE QueryType
;
223 UCHAR AdditionalParameters
[1];
224 } STORAGE_PROPERTY_QUERY
, *PSTORAGE_PROPERTY_QUERY
;
226 typedef struct _STORAGE_DESCRIPTOR_HEADER
{
229 } STORAGE_DESCRIPTOR_HEADER
, *PSTORAGE_DESCRIPTOR_HEADER
;
231 typedef enum _STORAGE_BUS_TYPE
{
232 BusTypeUnknown
= 0x00,
241 BusTypeMaxReserved
= 0x7F
242 } STORAGE_BUS_TYPE
, *PSTORAGE_BUS_TYPE
;
244 typedef struct _STORAGE_DEVICE_DESCRIPTOR
{
248 UCHAR DeviceTypeModifier
;
249 BOOLEAN RemovableMedia
;
250 BOOLEAN CommandQueueing
;
251 ULONG VendorIdOffset
;
252 ULONG ProductIdOffset
;
253 ULONG ProductRevisionOffset
;
254 ULONG SerialNumberOffset
;
255 STORAGE_BUS_TYPE BusType
;
256 ULONG RawPropertiesLength
;
257 UCHAR RawDeviceProperties
[1];
258 } STORAGE_DEVICE_DESCRIPTOR
, *PSTORAGE_DEVICE_DESCRIPTOR
;
260 typedef struct _STORAGE_ADAPTER_DESCRIPTOR
{
263 ULONG MaximumTransferLength
;
264 ULONG MaximumPhysicalPages
;
266 BOOLEAN AdapterUsesPio
;
267 BOOLEAN AdapterScansDown
;
268 BOOLEAN CommandQueueing
;
269 BOOLEAN AcceleratedTransfer
;
271 USHORT BusMajorVersion
;
272 USHORT BusMinorVersion
;
273 } STORAGE_ADAPTER_DESCRIPTOR
, *PSTORAGE_ADAPTER_DESCRIPTOR
;
279 #endif /* _NTDDSTOR_H_ */