1 | /*
|
---|
2 | * DDK definitions for storage media access
|
---|
3 | *
|
---|
4 | * Copyright (C) 2002 Eric Pouech
|
---|
5 | *
|
---|
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.
|
---|
10 | *
|
---|
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.
|
---|
15 | *
|
---|
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
|
---|
19 | */
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
24 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
25 | * a choice of LGPL license versions is made available with the language indicating
|
---|
26 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the LGPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef _NTDDSTOR_H_
|
---|
31 | #define _NTDDSTOR_H_
|
---|
32 |
|
---|
33 | #ifdef __cplusplus
|
---|
34 | extern "C" {
|
---|
35 | #endif
|
---|
36 |
|
---|
37 | #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
|
---|
38 |
|
---|
39 | #define IOCTL_STORAGE_CHECK_VERIFY CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
40 | #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
41 | #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
42 | #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
43 | #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
44 | #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
45 | #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
46 | #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
47 | #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
48 | #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
49 | #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
50 | #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
51 | #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
52 |
|
---|
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);
|
---|
73 |
|
---|
74 | typedef struct _STORAGE_DEVICE_NUMBER {
|
---|
75 | DEVICE_TYPE DeviceType;
|
---|
76 | ULONG DeviceNumber;
|
---|
77 | ULONG PartitionNumber;
|
---|
78 | } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
|
---|
79 |
|
---|
80 | typedef struct _STORAGE_BUS_RESET_REQUEST {
|
---|
81 | UCHAR PathId;
|
---|
82 | } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
|
---|
83 |
|
---|
84 | typedef struct _PREVENT_MEDIA_REMOVAL {
|
---|
85 | BOOLEAN PreventMediaRemoval;
|
---|
86 | } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
|
---|
87 |
|
---|
88 | typedef struct _TAPE_STATISTICS {
|
---|
89 | ULONG Version;
|
---|
90 | ULONG Flags;
|
---|
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;
|
---|
98 |
|
---|
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
|
---|
105 |
|
---|
106 | typedef struct _TAPE_GET_STATISTICS {
|
---|
107 | ULONG Operation;
|
---|
108 | } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
|
---|
109 |
|
---|
110 | #define TAPE_RETURN_STATISTICS 0L
|
---|
111 | #define TAPE_RETURN_ENV_INFO 1L
|
---|
112 | #define TAPE_RESET_STATISTICS 2L
|
---|
113 |
|
---|
114 | typedef enum _STORAGE_MEDIA_TYPE {
|
---|
115 | /* see also defines in ntdddisk.h */
|
---|
116 |
|
---|
117 | DDS_4mm = 0x20,
|
---|
118 | MiniQic,
|
---|
119 | Travan,
|
---|
120 | QIC,
|
---|
121 | MP_8mm,
|
---|
122 | AME_8mm,
|
---|
123 | AIT1_8mm,
|
---|
124 | DLT,
|
---|
125 | NCTP,
|
---|
126 | IBM_3480,
|
---|
127 | IBM_3490E,
|
---|
128 | IBM_Magstar_3590,
|
---|
129 | IBM_Magstar_MP,
|
---|
130 | STK_DATA_D3,
|
---|
131 | SONY_DTF,
|
---|
132 | DV_6mm,
|
---|
133 | DMI,
|
---|
134 | SONY_D2,
|
---|
135 | CLEANER_CARTRIDGE,
|
---|
136 | CD_ROM,
|
---|
137 | CD_R,
|
---|
138 | CD_RW,
|
---|
139 | DVD_ROM,
|
---|
140 | DVD_R,
|
---|
141 | DVD_RW,
|
---|
142 | MO_3_RW,
|
---|
143 | MO_5_WO,
|
---|
144 | MO_5_RW,
|
---|
145 | MO_5_LIMDOW,
|
---|
146 | PC_5_WO,
|
---|
147 | PC_5_RW,
|
---|
148 | PD_5_RW,
|
---|
149 | ABL_5_WO,
|
---|
150 | PINNACLE_APEX_5_RW,
|
---|
151 | SONY_12_WO,
|
---|
152 | PHILIPS_12_WO,
|
---|
153 | HITACHI_12_WO,
|
---|
154 | CYGNET_12_WO,
|
---|
155 | KODAK_14_WO,
|
---|
156 | MO_NFR_525,
|
---|
157 | NIKON_12_RW,
|
---|
158 | IOMEGA_ZIP,
|
---|
159 | IOMEGA_JAZ,
|
---|
160 | SYQUEST_EZ135,
|
---|
161 | SYQUEST_EZFLYER,
|
---|
162 | SYQUEST_SYJET,
|
---|
163 | AVATAR_F2,
|
---|
164 | MP2_8mm
|
---|
165 | } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
|
---|
166 |
|
---|
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
|
---|
173 |
|
---|
174 | typedef struct _DEVICE_MEDIA_INFO {
|
---|
175 | union {
|
---|
176 | struct {
|
---|
177 | LARGE_INTEGER Cylinders;
|
---|
178 | STORAGE_MEDIA_TYPE MediaType;
|
---|
179 | ULONG TracksPerCylinder;
|
---|
180 | ULONG SectorsPerTrack;
|
---|
181 | ULONG BytesPerSector;
|
---|
182 | ULONG NumberMediaSides;
|
---|
183 | ULONG MediaCharacteristics;
|
---|
184 | } DiskInfo;
|
---|
185 | struct {
|
---|
186 | LARGE_INTEGER Cylinders;
|
---|
187 | STORAGE_MEDIA_TYPE MediaType;
|
---|
188 | ULONG TracksPerCylinder;
|
---|
189 | ULONG SectorsPerTrack;
|
---|
190 | ULONG BytesPerSector;
|
---|
191 | ULONG NumberMediaSides;
|
---|
192 | ULONG MediaCharacteristics;
|
---|
193 | } RemovableDiskInfo;
|
---|
194 | struct {
|
---|
195 | STORAGE_MEDIA_TYPE MediaType;
|
---|
196 | ULONG MediaCharacteristics;
|
---|
197 | ULONG CurrentBlockSize;
|
---|
198 | } TapeInfo;
|
---|
199 | } DeviceSpecific;
|
---|
200 | } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
|
---|
201 |
|
---|
202 | typedef struct _GET_MEDIA_TYPES {
|
---|
203 | ULONG DeviceType;
|
---|
204 | ULONG MediaInfoCount;
|
---|
205 | DEVICE_MEDIA_INFO MediaInfo[1];
|
---|
206 | } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
|
---|
207 |
|
---|
208 | typedef enum _STORAGE_QUERY_TYPE {
|
---|
209 | PropertyStandardQuery = 0,
|
---|
210 | PropertyExistsQuery,
|
---|
211 | PropertyMaskQuery,
|
---|
212 | PropertyQueryMaxDefined
|
---|
213 | } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
|
---|
214 |
|
---|
215 | typedef enum _STORAGE_PROPERTY_ID {
|
---|
216 | StorageDeviceProperty = 0,
|
---|
217 | StorageAdapterProperty
|
---|
218 | } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
|
---|
219 |
|
---|
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;
|
---|
225 |
|
---|
226 | typedef struct _STORAGE_DESCRIPTOR_HEADER {
|
---|
227 | ULONG Version;
|
---|
228 | ULONG Size;
|
---|
229 | } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
|
---|
230 |
|
---|
231 | typedef enum _STORAGE_BUS_TYPE {
|
---|
232 | BusTypeUnknown = 0x00,
|
---|
233 | BusTypeScsi,
|
---|
234 | BusTypeAtapi,
|
---|
235 | BusTypeAta,
|
---|
236 | BusType1394,
|
---|
237 | BusTypeSsa,
|
---|
238 | BusTypeFibre,
|
---|
239 | BusTypeUsb,
|
---|
240 | BusTypeRAID,
|
---|
241 | BusTypeMaxReserved = 0x7F
|
---|
242 | } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
|
---|
243 |
|
---|
244 | typedef struct _STORAGE_DEVICE_DESCRIPTOR {
|
---|
245 | ULONG Version;
|
---|
246 | ULONG Size;
|
---|
247 | UCHAR DeviceType;
|
---|
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;
|
---|
259 |
|
---|
260 | typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
|
---|
261 | ULONG Version;
|
---|
262 | ULONG Size;
|
---|
263 | ULONG MaximumTransferLength;
|
---|
264 | ULONG MaximumPhysicalPages;
|
---|
265 | ULONG AlignmentMask;
|
---|
266 | BOOLEAN AdapterUsesPio;
|
---|
267 | BOOLEAN AdapterScansDown;
|
---|
268 | BOOLEAN CommandQueueing;
|
---|
269 | BOOLEAN AcceleratedTransfer;
|
---|
270 | BOOLEAN BusType;
|
---|
271 | USHORT BusMajorVersion;
|
---|
272 | USHORT BusMinorVersion;
|
---|
273 | } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
|
---|
274 |
|
---|
275 | #ifdef __cplusplus
|
---|
276 | }
|
---|
277 | #endif
|
---|
278 |
|
---|
279 | #endif /* _NTDDSTOR_H_ */
|
---|