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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
32 #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
33 #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
36 #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
38 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
39 #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
40 #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
41 #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 DEFINE_GUID(DiskClassGuid
,
45 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
46 DEFINE_GUID(CdRomClassGuid
,
47 0x53f56308, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
48 DEFINE_GUID(PartitionClassGuid
,
49 0x53f5630a, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
50 DEFINE_GUID(TapeClassGuid
,
51 0x53f5630b, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
52 DEFINE_GUID(WriteOnceDiskClassGuid
,
53 0x53f5630c, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
54 DEFINE_GUID(VolumeClassGuid
,
55 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
56 DEFINE_GUID(MediumChangerClassGuid
,
57 0x53f56310, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
58 DEFINE_GUID(FloppyClassGuid
,
59 0x53f56311, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
60 DEFINE_GUID(CdChangerClassGuid
,
61 0x53f56312, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
62 DEFINE_GUID(StroagePortClassGuid
,
63 0x2accfe60, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
65 typedef struct _STORAGE_DEVICE_NUMBER
{
66 DEVICE_TYPE DeviceType
;
68 ULONG PartitionNumber
;
69 } STORAGE_DEVICE_NUMBER
, *PSTORAGE_DEVICE_NUMBER
;
71 typedef struct _STORAGE_BUS_RESET_REQUEST
{
73 } STORAGE_BUS_RESET_REQUEST
, *PSTORAGE_BUS_RESET_REQUEST
;
75 typedef struct _PREVENT_MEDIA_REMOVAL
{
76 BOOLEAN PreventMediaRemoval
;
77 } PREVENT_MEDIA_REMOVAL
, *PPREVENT_MEDIA_REMOVAL
;
79 typedef struct _TAPE_STATISTICS
{
82 LARGE_INTEGER RecoveredWrites
;
83 LARGE_INTEGER UnrecoveredWrites
;
84 LARGE_INTEGER RecoveredReads
;
85 LARGE_INTEGER UnrecoveredReads
;
86 UCHAR CompressionRatioReads
;
87 UCHAR CompressionRatioWrites
;
88 } TAPE_STATISTICS
, *PTAPE_STATISTICS
;
90 #define RECOVERED_WRITES_VALID 0x00000001
91 #define UNRECOVERED_WRITES_VALID 0x00000002
92 #define RECOVERED_READS_VALID 0x00000004
93 #define UNRECOVERED_READS_VALID 0x00000008
94 #define WRITE_COMPRESSION_INFO_VALID 0x00000010
95 #define READ_COMPRESSION_INFO_VALID 0x00000020
97 typedef struct _TAPE_GET_STATISTICS
{
99 } TAPE_GET_STATISTICS
, *PTAPE_GET_STATISTICS
;
101 #define TAPE_RETURN_STATISTICS 0L
102 #define TAPE_RETURN_ENV_INFO 1L
103 #define TAPE_RESET_STATISTICS 2L
105 typedef enum _STORAGE_MEDIA_TYPE
{
106 /* see also defines in ntdddisk.h */
156 } STORAGE_MEDIA_TYPE
, *PSTORAGE_MEDIA_TYPE
;
158 #define MEDIA_ERASEABLE 0x00000001
159 #define MEDIA_WRITE_ONCE 0x00000002
160 #define MEDIA_READ_ONLY 0x00000004
161 #define MEDIA_READ_WRITE 0x00000008
162 #define MEDIA_WRITE_PROTECTED 0x00000100
163 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
165 typedef struct _DEVICE_MEDIA_INFO
{
168 LARGE_INTEGER Cylinders
;
169 STORAGE_MEDIA_TYPE MediaType
;
170 ULONG TracksPerCylinder
;
171 ULONG SectorsPerTrack
;
172 ULONG BytesPerSector
;
173 ULONG NumberMediaSides
;
174 ULONG MediaCharacteristics
;
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 STORAGE_MEDIA_TYPE MediaType
;
187 ULONG MediaCharacteristics
;
188 ULONG CurrentBlockSize
;
191 } DEVICE_MEDIA_INFO
, *PDEVICE_MEDIA_INFO
;
193 typedef struct _GET_MEDIA_TYPES
{
195 ULONG MediaInfoCount
;
196 DEVICE_MEDIA_INFO MediaInfo
[1];
197 } GET_MEDIA_TYPES
, *PGET_MEDIA_TYPES
;
199 typedef enum _STORAGE_QUERY_TYPE
{
200 PropertyStandardQuery
= 0,
203 PropertyQueryMaxDefined
204 } STORAGE_QUERY_TYPE
, *PSTORAGE_QUERY_TYPE
;
206 typedef enum _STORAGE_PROPERTY_ID
{
207 StorageDeviceProperty
= 0,
208 StorageAdapterProperty
209 } STORAGE_PROPERTY_ID
, *PSTORAGE_PROPERTY_ID
;
211 typedef struct _STORAGE_PROPERTY_QUERY
{
212 STORAGE_PROPERTY_ID PropertyId
;
213 STORAGE_QUERY_TYPE QueryType
;
214 UCHAR AdditionalParameters
[1];
215 } STORAGE_PROPERTY_QUERY
, *PSTORAGE_PROPERTY_QUERY
;
217 typedef struct _STORAGE_DESCRIPTOR_HEADER
{
220 } STORAGE_DESCRIPTOR_HEADER
, *PSTORAGE_DESCRIPTOR_HEADER
;
222 typedef enum _STORAGE_BUS_TYPE
{
223 BusTypeUnknown
= 0x00,
232 BusTypeMaxReserved
= 0x7F
233 } STORAGE_BUS_TYPE
, *PSTORAGE_BUS_TYPE
;
235 typedef struct _STORAGE_DEVICE_DESCRIPTOR
{
239 UCHAR DeviceTypeModifier
;
240 BOOLEAN RemovableMedia
;
241 BOOLEAN CommandQueueing
;
242 ULONG VendorIdOffset
;
243 ULONG ProductIdOffset
;
244 ULONG ProductRevisionOffset
;
245 ULONG SerialNumberOffset
;
246 STORAGE_BUS_TYPE BusType
;
247 ULONG RawPropertiesLength
;
248 UCHAR RawDeviceProperties
[1];
249 } STORAGE_DEVICE_DESCRIPTOR
, *PSTORAGE_DEVICE_DESCRIPTOR
;
251 typedef struct _STORAGE_ADAPTER_DESCRIPTOR
{
254 ULONG MaximumTransferLength
;
255 ULONG MaximumPhysicalPages
;
257 BOOLEAN AdapterUsesPio
;
258 BOOLEAN AdapterScansDown
;
259 BOOLEAN CommandQueueing
;
260 BOOLEAN AcceleratedTransfer
;
262 USHORT BusMajorVersion
;
263 USHORT BusMinorVersion
;
264 } STORAGE_ADAPTER_DESCRIPTOR
, *PSTORAGE_ADAPTER_DESCRIPTOR
;
270 #endif /* _NTDDSTOR_H_ */