1 | /*
|
---|
2 | * ddk/ntddstor.h
|
---|
3 | *
|
---|
4 | * Windows Device Driver Kit -- storage class IOCTL interface.
|
---|
5 | *
|
---|
6 | * $Id: ntddstor.h,v 6d2220f53104 2016/07/21 21:20:34 keithmarshall $
|
---|
7 | *
|
---|
8 | * Written by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
9 | * Copyright (C) 2002, 2004, 2015, 2016, MinGW.org Project.
|
---|
10 | *
|
---|
11 | *
|
---|
12 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
13 | * copy of this software and associated documentation files (the "Software"),
|
---|
14 | * to deal in the Software without restriction, including without limitation
|
---|
15 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
16 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
17 | * Software is furnished to do so, subject to the following conditions:
|
---|
18 | *
|
---|
19 | * The above copyright notice, this permission notice, and the following
|
---|
20 | * disclaimer shall be included in all copies or substantial portions of
|
---|
21 | * the Software.
|
---|
22 | *
|
---|
23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
24 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
26 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
28 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
|
---|
29 | * DEALINGS IN THE SOFTWARE.
|
---|
30 | *
|
---|
31 | */
|
---|
32 | #ifndef _DDK_NTDDSTOR_H
|
---|
33 | #pragma GCC system_header
|
---|
34 |
|
---|
35 | /* This file supports partial inclusion by <winioctl.h>; defer definition
|
---|
36 | * of its normal repeat inclusion guard macro...
|
---|
37 | */
|
---|
38 | #ifndef __WINIOCTL_H_SOURCED__
|
---|
39 | /* ...until we've ascertained that this is NOT such partial inclusion.
|
---|
40 | */
|
---|
41 | #define _DDK_NTDDSTOR_H
|
---|
42 |
|
---|
43 | /* In case of full inclusion, we must also include the full content of:
|
---|
44 | */
|
---|
45 | #include "ntddk.h"
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | #if ! (defined _DDK_NTDDSTOR_H && defined _WINIOCTL_H)
|
---|
49 | /* The majority of the IOCTL_STORAGE control code generator macros,
|
---|
50 | * structural type STORAGE_BUS_TYPE, and its associated pointer type,
|
---|
51 | * are required to be defined by both <ddk/ntddstor.h> and <winioctl.h>,
|
---|
52 | * but if both repeat inclusion guards are already defined, then we've
|
---|
53 | * already seen this; there is no need to process it again.
|
---|
54 | */
|
---|
55 | #define __IOCTL_STORAGE_(FN,M,A) CTL_CODE(IOCTL_STORAGE_BASE,(FN),(M),(A))
|
---|
56 |
|
---|
57 | #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
|
---|
58 | #define IOCTL_STORAGE_CHECK_VERIFY __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0200)
|
---|
59 | #define IOCTL_STORAGE_CHECK_VERIFY2 __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0200)
|
---|
60 | #define IOCTL_STORAGE_MEDIA_REMOVAL __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0201)
|
---|
61 | #define IOCTL_STORAGE_EJECT_MEDIA __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0202)
|
---|
62 | #define IOCTL_STORAGE_LOAD_MEDIA __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0203)
|
---|
63 | #define IOCTL_STORAGE_LOAD_MEDIA2 __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0203)
|
---|
64 | #define IOCTL_STORAGE_RESERVE __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0204)
|
---|
65 | #define IOCTL_STORAGE_RELEASE __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0205)
|
---|
66 | #define IOCTL_STORAGE_FIND_NEW_DEVICES __FILE_RD_BUFFERED(__IOCTL_STORAGE_,0x0206)
|
---|
67 | #define IOCTL_STORAGE_EJECTION_CONTROL __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0250)
|
---|
68 | #define IOCTL_STORAGE_MCN_CONTROL __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0251)
|
---|
69 | #define IOCTL_STORAGE_GET_MEDIA_TYPES __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0300)
|
---|
70 | #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0301)
|
---|
71 | #define IOCTL_STORAGE_RESET_BUS __FILE_RW_BUFFERED(__IOCTL_STORAGE_,0x0400)
|
---|
72 | #define IOCTL_STORAGE_RESET_DEVICE __FILE_RW_BUFFERED(__IOCTL_STORAGE_,0x0401)
|
---|
73 | #define IOCTL_STORAGE_GET_DEVICE_NUMBER __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0420)
|
---|
74 | #define IOCTL_STORAGE_PREDICT_FAILURE __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0440)
|
---|
75 |
|
---|
76 | typedef
|
---|
77 | enum _STORAGE_BUS_TYPE
|
---|
78 | /* https://msdn.microsoft.com/en-us/library/windows/hardware/ff566356(v=vs.85).aspx */
|
---|
79 | { BusTypeUnknown = 0x00,
|
---|
80 | BusTypeScsi = 0x01,
|
---|
81 | BusTypeAtapi = 0x02,
|
---|
82 | BusTypeAta = 0x03,
|
---|
83 | BusType1394 = 0x04,
|
---|
84 | BusTypeSsa = 0x05,
|
---|
85 | BusTypeFibre = 0x06,
|
---|
86 | BusTypeUsb = 0x07,
|
---|
87 | BusTypeRAID = 0x08,
|
---|
88 | BusTypeiScsi = 0x09,
|
---|
89 | BusTypeSas = 0x0A,
|
---|
90 | BusTypeSata = 0x0B,
|
---|
91 | BusTypeSd = 0x0C,
|
---|
92 | BusTypeMmc = 0x0D,
|
---|
93 | BusTypeVirtual = 0x0E,
|
---|
94 | BusTypeFileBackedVirtual = 0x0F,
|
---|
95 | BusTypeSpaces = 0x10,
|
---|
96 | BusTypeMax /* variant; number of bus types */,
|
---|
97 | BusTypeMaxReserved = 0x7F
|
---|
98 | } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
|
---|
99 |
|
---|
100 | /* End of _DDK_NTDDSTOR_H and _WINIOCTL_H common declarations.
|
---|
101 | */
|
---|
102 | #endif
|
---|
103 | #ifdef _DDK_NTDDSTOR_H
|
---|
104 | /* Declarations specific to _DDK_NTDDSTOR_H alone.
|
---|
105 | */
|
---|
106 | _BEGIN_C_DECLS
|
---|
107 |
|
---|
108 | #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0304)
|
---|
109 | #define IOCTL_STORAGE_QUERY_PROPERTY __FILE_AM_BUFFERED(__IOCTL_STORAGE_,0x0500)
|
---|
110 |
|
---|
111 | DEFINE_GUID( GUID_DEVINTERFACE_DISK,
|
---|
112 | 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
113 | );
|
---|
114 | DEFINE_GUID( GUID_DEVINTERFACE_CDROM,
|
---|
115 | 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
116 | );
|
---|
117 | DEFINE_GUID( GUID_DEVINTERFACE_PARTITION,
|
---|
118 | 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
119 | );
|
---|
120 | DEFINE_GUID( GUID_DEVINTERFACE_TAPE,
|
---|
121 | 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
122 | );
|
---|
123 | DEFINE_GUID( GUID_DEVINTERFACE_WRITEONCEDISK,
|
---|
124 | 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
125 | );
|
---|
126 | DEFINE_GUID( GUID_DEVINTERFACE_VOLUME,
|
---|
127 | 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
128 | );
|
---|
129 | DEFINE_GUID( GUID_DEVINTERFACE_MEDIUMCHANGER,
|
---|
130 | 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
131 | );
|
---|
132 | DEFINE_GUID( GUID_DEVINTERFACE_FLOPPY,
|
---|
133 | 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
134 | );
|
---|
135 | DEFINE_GUID( GUID_DEVINTERFACE_CDCHANGER,
|
---|
136 | 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
137 | );
|
---|
138 | DEFINE_GUID( GUID_DEVINTERFACE_STORAGEPORT,
|
---|
139 | 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b
|
---|
140 | );
|
---|
141 |
|
---|
142 | typedef
|
---|
143 | enum _STORAGE_MEDIA_TYPE
|
---|
144 | { DDS_4mm = 0x20,
|
---|
145 | MiniQic = 0x21,
|
---|
146 | Travan = 0x22,
|
---|
147 | QIC = 0x23,
|
---|
148 | MP_8mm = 0x24,
|
---|
149 | AME_8mm = 0x25,
|
---|
150 | AIT1_8mm = 0x26,
|
---|
151 | DLT = 0x27,
|
---|
152 | NCTP = 0x28,
|
---|
153 | IBM_3480 = 0x29,
|
---|
154 | IBM_3490E = 0x2A,
|
---|
155 | IBM_Magstar_3590 = 0x2B,
|
---|
156 | IBM_Magstar_MP = 0x2C,
|
---|
157 | STK_DATA_D3 = 0x2D,
|
---|
158 | SONY_DTF = 0x2E,
|
---|
159 | DV_6mm = 0x2F,
|
---|
160 | DMI = 0x30,
|
---|
161 | SONY_D2 = 0x31,
|
---|
162 | CLEANER_CARTRIDGE = 0x32,
|
---|
163 | CD_ROM = 0x33,
|
---|
164 | CD_R = 0x34,
|
---|
165 | CD_RW = 0x35,
|
---|
166 | DVD_ROM = 0x36,
|
---|
167 | DVD_R = 0x37,
|
---|
168 | DVD_RW = 0x38,
|
---|
169 | MO_3_RW = 0x39,
|
---|
170 | MO_5_WO = 0x3A,
|
---|
171 | MO_5_RW = 0x3B,
|
---|
172 | MO_5_LIMDOW = 0x3C,
|
---|
173 | PC_5_WO = 0x3D,
|
---|
174 | PC_5_RW = 0x3E,
|
---|
175 | PD_5_RW = 0x3F,
|
---|
176 | ABL_5_WO = 0x40,
|
---|
177 | PINNACLE_APEX_5_RW = 0x41,
|
---|
178 | SONY_12_WO = 0x42,
|
---|
179 | PHILIPS_12_WO = 0x43,
|
---|
180 | HITACHI_12_WO = 0x44,
|
---|
181 | CYGNET_12_WO = 0x45,
|
---|
182 | KODAK_14_WO = 0x46,
|
---|
183 | MO_NFR_525 = 0x47,
|
---|
184 | NIKON_12_RW = 0x48,
|
---|
185 | IOMEGA_ZIP = 0x49,
|
---|
186 | IOMEGA_JAZ = 0x4A,
|
---|
187 | SYQUEST_EZ135 = 0x4B,
|
---|
188 | SYQUEST_EZFLYER = 0x4C,
|
---|
189 | SYQUEST_SYJET = 0x4D,
|
---|
190 | AVATAR_F2 = 0x4E,
|
---|
191 | MP2_8mm = 0x4F,
|
---|
192 | DST_S = 0x50,
|
---|
193 | DST_M = 0x51,
|
---|
194 | DST_L = 0x52,
|
---|
195 | VXATape_1 = 0x53,
|
---|
196 | VXATape_2 = 0x54,
|
---|
197 | STK_9840 = 0x55,
|
---|
198 | LTO_Ultrium = 0x56,
|
---|
199 | LTO_Accelis = 0x57,
|
---|
200 | DVD_RAM = 0x58,
|
---|
201 | AIT_8mm = 0x59,
|
---|
202 | ADR_1 = 0x5A,
|
---|
203 | ADR_2 = 0x5B
|
---|
204 | } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
|
---|
205 |
|
---|
206 |
|
---|
207 | /* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants
|
---|
208 | */
|
---|
209 | #define MEDIA_ERASEABLE 0x00000001
|
---|
210 | #define MEDIA_WRITE_ONCE 0x00000002
|
---|
211 | #define MEDIA_READ_ONLY 0x00000004
|
---|
212 | #define MEDIA_READ_WRITE 0x00000008
|
---|
213 | #define MEDIA_WRITE_PROTECTED 0x00000100
|
---|
214 | #define MEDIA_CURRENTLY_MOUNTED 0x80000000
|
---|
215 |
|
---|
216 | typedef struct _DEVICE_MEDIA_INFO
|
---|
217 | { union
|
---|
218 | { struct
|
---|
219 | { LARGE_INTEGER Cylinders;
|
---|
220 | STORAGE_MEDIA_TYPE MediaType;
|
---|
221 | ULONG TracksPerCylinder;
|
---|
222 | ULONG SectorsPerTrack;
|
---|
223 | ULONG BytesPerSector;
|
---|
224 | ULONG NumberMediaSides;
|
---|
225 | ULONG MediaCharacteristics;
|
---|
226 | } DiskInfo;
|
---|
227 | struct
|
---|
228 | { LARGE_INTEGER Cylinders;
|
---|
229 | STORAGE_MEDIA_TYPE MediaType;
|
---|
230 | ULONG TracksPerCylinder;
|
---|
231 | ULONG SectorsPerTrack;
|
---|
232 | ULONG BytesPerSector;
|
---|
233 | ULONG NumberMediaSides;
|
---|
234 | ULONG MediaCharacteristics;
|
---|
235 | } RemovableDiskInfo;
|
---|
236 | struct
|
---|
237 | { STORAGE_MEDIA_TYPE MediaType;
|
---|
238 | ULONG MediaCharacteristics;
|
---|
239 | ULONG CurrentBlockSize;
|
---|
240 | STORAGE_BUS_TYPE BusType;
|
---|
241 | union
|
---|
242 | { struct
|
---|
243 | { UCHAR MediumType;
|
---|
244 | UCHAR DensityCode;
|
---|
245 | } ScsiInformation;
|
---|
246 | } BusSpecificData;
|
---|
247 | } TapeInfo;
|
---|
248 | } DeviceSpecific;
|
---|
249 | } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
|
---|
250 |
|
---|
251 | typedef
|
---|
252 | struct _GET_MEDIA_TYPES
|
---|
253 | { ULONG DeviceType;
|
---|
254 | ULONG MediaInfoCount;
|
---|
255 | DEVICE_MEDIA_INFO MediaInfo[1];
|
---|
256 | } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
|
---|
257 |
|
---|
258 | typedef
|
---|
259 | struct _STORAGE_ADAPTER_DESCRIPTOR
|
---|
260 | { ULONG Version;
|
---|
261 | ULONG Size;
|
---|
262 | ULONG MaximumTransferLength;
|
---|
263 | ULONG MaximumPhysicalPages;
|
---|
264 | ULONG AlignmentMask;
|
---|
265 | BOOLEAN AdapterUsesPio;
|
---|
266 | BOOLEAN AdapterScansDown;
|
---|
267 | BOOLEAN CommandQueueing;
|
---|
268 | BOOLEAN AcceleratedTransfer;
|
---|
269 | STORAGE_BUS_TYPE BusType;
|
---|
270 | USHORT BusMajorVersion;
|
---|
271 | USHORT BusMinorVersion;
|
---|
272 | } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
|
---|
273 |
|
---|
274 | typedef
|
---|
275 | struct _STORAGE_BUS_RESET_REQUEST
|
---|
276 | { UCHAR PathId;
|
---|
277 | } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
|
---|
278 |
|
---|
279 | typedef
|
---|
280 | struct _STORAGE_DESCRIPTOR_HEADER
|
---|
281 | { ULONG Version;
|
---|
282 | ULONG Size;
|
---|
283 | } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
|
---|
284 |
|
---|
285 | typedef
|
---|
286 | struct _STORAGE_DEVICE_DESCRIPTOR
|
---|
287 | { ULONG Version;
|
---|
288 | ULONG Size;
|
---|
289 | UCHAR DeviceType;
|
---|
290 | UCHAR DeviceTypeModifier;
|
---|
291 | BOOLEAN RemovableMedia;
|
---|
292 | BOOLEAN CommandQueueing;
|
---|
293 | ULONG VendorIdOffset;
|
---|
294 | ULONG ProductIdOffset;
|
---|
295 | ULONG ProductRevisionOffset;
|
---|
296 | ULONG SerialNumberOffset;
|
---|
297 | STORAGE_BUS_TYPE BusType;
|
---|
298 | ULONG RawPropertiesLength;
|
---|
299 | UCHAR RawDeviceProperties[1];
|
---|
300 | } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
|
---|
301 |
|
---|
302 | typedef
|
---|
303 | struct _STORAGE_DEVICE_ID_DESCRIPTOR
|
---|
304 | { ULONG Version;
|
---|
305 | ULONG Size;
|
---|
306 | ULONG NumberOfIdentifiers;
|
---|
307 | UCHAR Identifiers[1];
|
---|
308 | } STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
|
---|
309 |
|
---|
310 | typedef
|
---|
311 | struct _STORAGE_DEVICE_NUMBER
|
---|
312 | { DEVICE_TYPE DeviceType;
|
---|
313 | ULONG DeviceNumber;
|
---|
314 | ULONG PartitionNumber;
|
---|
315 | } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
|
---|
316 |
|
---|
317 | typedef
|
---|
318 | struct _STORAGE_PREDICT_FAILURE
|
---|
319 | { ULONG PredictFailure;
|
---|
320 | UCHAR VendorSpecific[512];
|
---|
321 | } STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
|
---|
322 |
|
---|
323 | typedef
|
---|
324 | enum _STORAGE_PROPERTY_ID
|
---|
325 | { StorageDeviceProperty = 0,
|
---|
326 | StorageAdapterProperty = 1,
|
---|
327 | StorageDeviceIdProperty = 2
|
---|
328 | } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
|
---|
329 |
|
---|
330 | typedef
|
---|
331 | enum _STORAGE_QUERY_TYPE
|
---|
332 | { PropertyStandardQuery = 0,
|
---|
333 | PropertyExistsQuery = 1,
|
---|
334 | PropertyMaskQuery = 2,
|
---|
335 | PropertyQueryMaxDefined = 3
|
---|
336 | } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
|
---|
337 |
|
---|
338 | typedef
|
---|
339 | struct _STORAGE_PROPERTY_QUERY
|
---|
340 | { STORAGE_PROPERTY_ID PropertyId;
|
---|
341 | STORAGE_QUERY_TYPE QueryType;
|
---|
342 | UCHAR AdditionalParameters[1];
|
---|
343 | } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
|
---|
344 |
|
---|
345 | _END_C_DECLS
|
---|
346 |
|
---|
347 | #endif /* _DDK_NTDDSTOR_H */
|
---|
348 | #endif /* !_DDK_NTDDSTOR_H: $RCSfile: ntddstor.h,v $: end of file */
|
---|