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 | * Oracle 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, Oracle 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_CHECK_VERIFY2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
41 | #define IOCTL_STORAGE_MEDIA_REMOVAL CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
42 | #define IOCTL_STORAGE_EJECT_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
43 | #define IOCTL_STORAGE_LOAD_MEDIA CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
44 | #define IOCTL_STORAGE_LOAD_MEDIA2 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
45 | #define IOCTL_STORAGE_RESERVE CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
46 | #define IOCTL_STORAGE_RELEASE CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
47 | #define IOCTL_STORAGE_FIND_NEW_DEVICES CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
48 | #define IOCTL_STORAGE_EJECTION_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
49 | #define IOCTL_STORAGE_MCN_CONTROL CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
50 | #define IOCTL_STORAGE_GET_MEDIA_TYPES CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
51 | #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
52 | #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
53 | #define IOCTL_STORAGE_GET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
54 | #define IOCTL_STORAGE_SET_HOTPLUG_INFO CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
---|
55 | #define IOCTL_STORAGE_RESET_BUS CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
56 | #define IOCTL_STORAGE_RESET_DEVICE CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
57 | #define IOCTL_STORAGE_BREAK_RESERVATION CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
|
---|
58 | #define IOCTL_STORAGE_GET_DEVICE_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
59 | #define IOCTL_STORAGE_PREDICT_FAILURE CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
60 | #define IOCTL_STORAGE_QUERY_PROPERTY CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
61 |
|
---|
62 | DEFINE_GUID(DiskClassGuid,
|
---|
63 | 0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
64 | DEFINE_GUID(CdRomClassGuid,
|
---|
65 | 0x53f56308, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
66 | DEFINE_GUID(PartitionClassGuid,
|
---|
67 | 0x53f5630a, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
68 | DEFINE_GUID(TapeClassGuid,
|
---|
69 | 0x53f5630b, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
70 | DEFINE_GUID(WriteOnceDiskClassGuid,
|
---|
71 | 0x53f5630c, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
72 | DEFINE_GUID(VolumeClassGuid,
|
---|
73 | 0x53f5630d, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
74 | DEFINE_GUID(MediumChangerClassGuid,
|
---|
75 | 0x53f56310, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
76 | DEFINE_GUID(FloppyClassGuid,
|
---|
77 | 0x53f56311, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
78 | DEFINE_GUID(CdChangerClassGuid,
|
---|
79 | 0x53f56312, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
80 | DEFINE_GUID(StroagePortClassGuid,
|
---|
81 | 0x2accfe60, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
|
---|
82 |
|
---|
83 | typedef struct _STORAGE_DEVICE_NUMBER {
|
---|
84 | DEVICE_TYPE DeviceType;
|
---|
85 | ULONG DeviceNumber;
|
---|
86 | ULONG PartitionNumber;
|
---|
87 | } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
|
---|
88 |
|
---|
89 | typedef struct _STORAGE_BUS_RESET_REQUEST {
|
---|
90 | UCHAR PathId;
|
---|
91 | } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
|
---|
92 |
|
---|
93 | typedef struct _PREVENT_MEDIA_REMOVAL {
|
---|
94 | BOOLEAN PreventMediaRemoval;
|
---|
95 | } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
|
---|
96 |
|
---|
97 | typedef struct _TAPE_STATISTICS {
|
---|
98 | ULONG Version;
|
---|
99 | ULONG Flags;
|
---|
100 | LARGE_INTEGER RecoveredWrites;
|
---|
101 | LARGE_INTEGER UnrecoveredWrites;
|
---|
102 | LARGE_INTEGER RecoveredReads;
|
---|
103 | LARGE_INTEGER UnrecoveredReads;
|
---|
104 | UCHAR CompressionRatioReads;
|
---|
105 | UCHAR CompressionRatioWrites;
|
---|
106 | } TAPE_STATISTICS, *PTAPE_STATISTICS;
|
---|
107 |
|
---|
108 | #define RECOVERED_WRITES_VALID 0x00000001
|
---|
109 | #define UNRECOVERED_WRITES_VALID 0x00000002
|
---|
110 | #define RECOVERED_READS_VALID 0x00000004
|
---|
111 | #define UNRECOVERED_READS_VALID 0x00000008
|
---|
112 | #define WRITE_COMPRESSION_INFO_VALID 0x00000010
|
---|
113 | #define READ_COMPRESSION_INFO_VALID 0x00000020
|
---|
114 |
|
---|
115 | typedef struct _TAPE_GET_STATISTICS {
|
---|
116 | ULONG Operation;
|
---|
117 | } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
|
---|
118 |
|
---|
119 | #define TAPE_RETURN_STATISTICS __MSABI_LONG(0)
|
---|
120 | #define TAPE_RETURN_ENV_INFO __MSABI_LONG(1)
|
---|
121 | #define TAPE_RESET_STATISTICS __MSABI_LONG(2)
|
---|
122 |
|
---|
123 | typedef enum _STORAGE_MEDIA_TYPE {
|
---|
124 | /* see also defines in ntdddisk.h */
|
---|
125 |
|
---|
126 | DDS_4mm = 0x20,
|
---|
127 | MiniQic,
|
---|
128 | Travan,
|
---|
129 | QIC,
|
---|
130 | MP_8mm,
|
---|
131 | AME_8mm,
|
---|
132 | AIT1_8mm,
|
---|
133 | DLT,
|
---|
134 | NCTP,
|
---|
135 | IBM_3480,
|
---|
136 | IBM_3490E,
|
---|
137 | IBM_Magstar_3590,
|
---|
138 | IBM_Magstar_MP,
|
---|
139 | STK_DATA_D3,
|
---|
140 | SONY_DTF,
|
---|
141 | DV_6mm,
|
---|
142 | DMI,
|
---|
143 | SONY_D2,
|
---|
144 | CLEANER_CARTRIDGE,
|
---|
145 | CD_ROM,
|
---|
146 | CD_R,
|
---|
147 | CD_RW,
|
---|
148 | DVD_ROM,
|
---|
149 | DVD_R,
|
---|
150 | DVD_RW,
|
---|
151 | MO_3_RW,
|
---|
152 | MO_5_WO,
|
---|
153 | MO_5_RW,
|
---|
154 | MO_5_LIMDOW,
|
---|
155 | PC_5_WO,
|
---|
156 | PC_5_RW,
|
---|
157 | PD_5_RW,
|
---|
158 | ABL_5_WO,
|
---|
159 | PINNACLE_APEX_5_RW,
|
---|
160 | SONY_12_WO,
|
---|
161 | PHILIPS_12_WO,
|
---|
162 | HITACHI_12_WO,
|
---|
163 | CYGNET_12_WO,
|
---|
164 | KODAK_14_WO,
|
---|
165 | MO_NFR_525,
|
---|
166 | NIKON_12_RW,
|
---|
167 | IOMEGA_ZIP,
|
---|
168 | IOMEGA_JAZ,
|
---|
169 | SYQUEST_EZ135,
|
---|
170 | SYQUEST_EZFLYER,
|
---|
171 | SYQUEST_SYJET,
|
---|
172 | AVATAR_F2,
|
---|
173 | MP2_8mm
|
---|
174 | } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
|
---|
175 |
|
---|
176 | #define MEDIA_ERASEABLE 0x00000001
|
---|
177 | #define MEDIA_WRITE_ONCE 0x00000002
|
---|
178 | #define MEDIA_READ_ONLY 0x00000004
|
---|
179 | #define MEDIA_READ_WRITE 0x00000008
|
---|
180 | #define MEDIA_WRITE_PROTECTED 0x00000100
|
---|
181 | #define MEDIA_CURRENTLY_MOUNTED 0x80000000
|
---|
182 |
|
---|
183 | typedef struct _DEVICE_MEDIA_INFO {
|
---|
184 | union {
|
---|
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 | } DiskInfo;
|
---|
194 | struct {
|
---|
195 | LARGE_INTEGER Cylinders;
|
---|
196 | STORAGE_MEDIA_TYPE MediaType;
|
---|
197 | ULONG TracksPerCylinder;
|
---|
198 | ULONG SectorsPerTrack;
|
---|
199 | ULONG BytesPerSector;
|
---|
200 | ULONG NumberMediaSides;
|
---|
201 | ULONG MediaCharacteristics;
|
---|
202 | } RemovableDiskInfo;
|
---|
203 | struct {
|
---|
204 | STORAGE_MEDIA_TYPE MediaType;
|
---|
205 | ULONG MediaCharacteristics;
|
---|
206 | ULONG CurrentBlockSize;
|
---|
207 | } TapeInfo;
|
---|
208 | } DeviceSpecific;
|
---|
209 | } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
|
---|
210 |
|
---|
211 | typedef struct _GET_MEDIA_TYPES {
|
---|
212 | ULONG DeviceType;
|
---|
213 | ULONG MediaInfoCount;
|
---|
214 | DEVICE_MEDIA_INFO MediaInfo[1];
|
---|
215 | } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
|
---|
216 |
|
---|
217 | typedef enum _STORAGE_QUERY_TYPE {
|
---|
218 | PropertyStandardQuery = 0,
|
---|
219 | PropertyExistsQuery,
|
---|
220 | PropertyMaskQuery,
|
---|
221 | PropertyQueryMaxDefined
|
---|
222 | } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
|
---|
223 |
|
---|
224 | typedef enum _STORAGE_PROPERTY_ID {
|
---|
225 | StorageDeviceProperty = 0,
|
---|
226 | StorageAdapterProperty
|
---|
227 | } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
|
---|
228 |
|
---|
229 | typedef struct _STORAGE_PROPERTY_QUERY {
|
---|
230 | STORAGE_PROPERTY_ID PropertyId;
|
---|
231 | STORAGE_QUERY_TYPE QueryType;
|
---|
232 | UCHAR AdditionalParameters[1];
|
---|
233 | } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
|
---|
234 |
|
---|
235 | typedef struct _STORAGE_DESCRIPTOR_HEADER {
|
---|
236 | ULONG Version;
|
---|
237 | ULONG Size;
|
---|
238 | } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
|
---|
239 |
|
---|
240 | typedef enum _STORAGE_BUS_TYPE {
|
---|
241 | BusTypeUnknown = 0x00,
|
---|
242 | BusTypeScsi,
|
---|
243 | BusTypeAtapi,
|
---|
244 | BusTypeAta,
|
---|
245 | BusType1394,
|
---|
246 | BusTypeSsa,
|
---|
247 | BusTypeFibre,
|
---|
248 | BusTypeUsb,
|
---|
249 | BusTypeRAID,
|
---|
250 | BusTypeMaxReserved = 0x7F
|
---|
251 | } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
|
---|
252 |
|
---|
253 | typedef struct _STORAGE_DEVICE_DESCRIPTOR {
|
---|
254 | ULONG Version;
|
---|
255 | ULONG Size;
|
---|
256 | UCHAR DeviceType;
|
---|
257 | UCHAR DeviceTypeModifier;
|
---|
258 | BOOLEAN RemovableMedia;
|
---|
259 | BOOLEAN CommandQueueing;
|
---|
260 | ULONG VendorIdOffset;
|
---|
261 | ULONG ProductIdOffset;
|
---|
262 | ULONG ProductRevisionOffset;
|
---|
263 | ULONG SerialNumberOffset;
|
---|
264 | STORAGE_BUS_TYPE BusType;
|
---|
265 | ULONG RawPropertiesLength;
|
---|
266 | UCHAR RawDeviceProperties[1];
|
---|
267 | } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
|
---|
268 |
|
---|
269 | typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
|
---|
270 | ULONG Version;
|
---|
271 | ULONG Size;
|
---|
272 | ULONG MaximumTransferLength;
|
---|
273 | ULONG MaximumPhysicalPages;
|
---|
274 | ULONG AlignmentMask;
|
---|
275 | BOOLEAN AdapterUsesPio;
|
---|
276 | BOOLEAN AdapterScansDown;
|
---|
277 | BOOLEAN CommandQueueing;
|
---|
278 | BOOLEAN AcceleratedTransfer;
|
---|
279 | BOOLEAN BusType;
|
---|
280 | USHORT BusMajorVersion;
|
---|
281 | USHORT BusMinorVersion;
|
---|
282 | } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
|
---|
283 |
|
---|
284 | #ifdef __cplusplus
|
---|
285 | }
|
---|
286 | #endif
|
---|
287 |
|
---|
288 | #endif /* _NTDDSTOR_H_ */
|
---|