Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / ddk / ntddstor.h
blob232834aab09efdbe0639c8ae1c8b032a23d11f1f
1 /*
2 * ntddstor.h
4 * Storage class IOCTL interface.
6 * This file is part of the w32api package.
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __NTDDSTOR_H
24 #define __NTDDSTOR_H
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include "ntddk.h"
36 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
38 #define IOCTL_STORAGE_CHECK_VERIFY \
39 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
41 #define IOCTL_STORAGE_CHECK_VERIFY2 \
42 CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_STORAGE_EJECT_MEDIA \
45 CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
47 #define IOCTL_STORAGE_EJECTION_CONTROL \
48 CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
50 #define IOCTL_STORAGE_FIND_NEW_DEVICES \
51 CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
53 #define IOCTL_STORAGE_GET_DEVICE_NUMBER \
54 CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
56 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER \
57 CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
59 #define IOCTL_STORAGE_GET_MEDIA_TYPES \
60 CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
62 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
63 CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
65 #define IOCTL_STORAGE_LOAD_MEDIA \
66 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
68 #define IOCTL_STORAGE_LOAD_MEDIA2 \
69 CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
71 #define IOCTL_STORAGE_MCN_CONTROL \
72 CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
74 #define IOCTL_STORAGE_MEDIA_REMOVAL \
75 CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
77 #define IOCTL_STORAGE_PREDICT_FAILURE \
78 CTL_CODE(IOCTL_STORAGE_BASE, 0x0440, METHOD_BUFFERED, FILE_ANY_ACCESS)
80 #define IOCTL_STORAGE_QUERY_PROPERTY \
81 CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
83 #define IOCTL_STORAGE_RELEASE \
84 CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
86 #define IOCTL_STORAGE_RESERVE \
87 CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
89 #define IOCTL_STORAGE_RESET_BUS \
90 CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
92 #define IOCTL_STORAGE_RESET_DEVICE \
93 CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
96 DEFINE_GUID(GUID_DEVINTERFACE_DISK,
97 0x53f56307L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
99 DEFINE_GUID(GUID_DEVINTERFACE_CDROM,
100 0x53f56308L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
102 DEFINE_GUID(GUID_DEVINTERFACE_PARTITION,
103 0x53f5630aL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
105 DEFINE_GUID(GUID_DEVINTERFACE_TAPE,
106 0x53f5630bL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
108 DEFINE_GUID(GUID_DEVINTERFACE_WRITEONCEDISK,
109 0x53f5630cL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
111 DEFINE_GUID(GUID_DEVINTERFACE_VOLUME,
112 0x53f5630dL, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
114 DEFINE_GUID(GUID_DEVINTERFACE_MEDIUMCHANGER,
115 0x53f56310L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
117 DEFINE_GUID(GUID_DEVINTERFACE_FLOPPY,
118 0x53f56311L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
120 DEFINE_GUID(GUID_DEVINTERFACE_CDCHANGER,
121 0x53f56312L, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
123 DEFINE_GUID(GUID_DEVINTERFACE_STORAGEPORT,
124 0x2accfe60L, 0xc130, 0x11d2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b);
127 typedef enum _STORAGE_MEDIA_TYPE {
128 DDS_4mm = 0x20,
129 MiniQic,
130 Travan,
131 QIC,
132 MP_8mm,
133 AME_8mm,
134 AIT1_8mm,
135 DLT,
136 NCTP,
137 IBM_3480,
138 IBM_3490E,
139 IBM_Magstar_3590,
140 IBM_Magstar_MP,
141 STK_DATA_D3,
142 SONY_DTF,
143 DV_6mm,
144 DMI,
145 SONY_D2,
146 CLEANER_CARTRIDGE,
147 CD_ROM,
148 CD_R,
149 CD_RW,
150 DVD_ROM,
151 DVD_R,
152 DVD_RW,
153 MO_3_RW,
154 MO_5_WO,
155 MO_5_RW,
156 MO_5_LIMDOW,
157 PC_5_WO,
158 PC_5_RW,
159 PD_5_RW,
160 ABL_5_WO,
161 PINNACLE_APEX_5_RW,
162 SONY_12_WO,
163 PHILIPS_12_WO,
164 HITACHI_12_WO,
165 CYGNET_12_WO,
166 KODAK_14_WO,
167 MO_NFR_525,
168 NIKON_12_RW,
169 IOMEGA_ZIP,
170 IOMEGA_JAZ,
171 SYQUEST_EZ135,
172 SYQUEST_EZFLYER,
173 SYQUEST_SYJET,
174 AVATAR_F2,
175 MP2_8mm,
176 DST_S,
177 DST_M,
178 DST_L,
179 VXATape_1,
180 VXATape_2,
181 STK_9840,
182 LTO_Ultrium,
183 LTO_Accelis,
184 DVD_RAM,
185 AIT_8mm,
186 ADR_1,
187 ADR_2
188 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
190 typedef enum _STORAGE_BUS_TYPE {
191 BusTypeUnknown = 0x00,
192 BusTypeScsi,
193 BusTypeAtapi,
194 BusTypeAta,
195 BusType1394,
196 BusTypeSsa,
197 BusTypeFibre,
198 BusTypeUsb,
199 BusTypeRAID,
200 BusTypeMaxReserved = 0x7F
201 } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
203 /* DEVICE_MEDIA_INFO.DeviceSpecific.DiskInfo.MediaCharacteristics constants */
204 #define MEDIA_ERASEABLE 0x00000001
205 #define MEDIA_WRITE_ONCE 0x00000002
206 #define MEDIA_READ_ONLY 0x00000004
207 #define MEDIA_READ_WRITE 0x00000008
208 #define MEDIA_WRITE_PROTECTED 0x00000100
209 #define MEDIA_CURRENTLY_MOUNTED 0x80000000
211 typedef struct _DEVICE_MEDIA_INFO {
212 union {
213 struct {
214 LARGE_INTEGER Cylinders;
215 STORAGE_MEDIA_TYPE MediaType;
216 ULONG TracksPerCylinder;
217 ULONG SectorsPerTrack;
218 ULONG BytesPerSector;
219 ULONG NumberMediaSides;
220 ULONG MediaCharacteristics;
221 } DiskInfo;
222 struct {
223 LARGE_INTEGER Cylinders;
224 STORAGE_MEDIA_TYPE MediaType;
225 ULONG TracksPerCylinder;
226 ULONG SectorsPerTrack;
227 ULONG BytesPerSector;
228 ULONG NumberMediaSides;
229 ULONG MediaCharacteristics;
230 } RemovableDiskInfo;
231 struct {
232 STORAGE_MEDIA_TYPE MediaType;
233 ULONG MediaCharacteristics;
234 ULONG CurrentBlockSize;
235 STORAGE_BUS_TYPE BusType;
236 union {
237 struct {
238 UCHAR MediumType;
239 UCHAR DensityCode;
240 } ScsiInformation;
241 } BusSpecificData;
242 } TapeInfo;
243 } DeviceSpecific;
244 } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
246 typedef struct _GET_MEDIA_TYPES {
247 ULONG DeviceType;
248 ULONG MediaInfoCount;
249 DEVICE_MEDIA_INFO MediaInfo[1];
250 } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
252 typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
253 ULONG Version;
254 ULONG Size;
255 ULONG MaximumTransferLength;
256 ULONG MaximumPhysicalPages;
257 ULONG AlignmentMask;
258 BOOLEAN AdapterUsesPio;
259 BOOLEAN AdapterScansDown;
260 BOOLEAN CommandQueueing;
261 BOOLEAN AcceleratedTransfer;
262 STORAGE_BUS_TYPE BusType;
263 USHORT BusMajorVersion;
264 USHORT BusMinorVersion;
265 } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
267 typedef struct _STORAGE_BUS_RESET_REQUEST {
268 UCHAR PathId;
269 } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
271 typedef struct _STORAGE_DESCRIPTOR_HEADER {
272 ULONG Version;
273 ULONG Size;
274 } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
276 typedef struct _STORAGE_DEVICE_DESCRIPTOR {
277 ULONG Version;
278 ULONG Size;
279 UCHAR DeviceType;
280 UCHAR DeviceTypeModifier;
281 BOOLEAN RemovableMedia;
282 BOOLEAN CommandQueueing;
283 ULONG VendorIdOffset;
284 ULONG ProductIdOffset;
285 ULONG ProductRevisionOffset;
286 ULONG SerialNumberOffset;
287 STORAGE_BUS_TYPE BusType;
288 ULONG RawPropertiesLength;
289 UCHAR RawDeviceProperties[1];
290 } STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
292 typedef struct _STORAGE_DEVICE_ID_DESCRIPTOR {
293 ULONG Version;
294 ULONG Size;
295 ULONG NumberOfIdentifiers;
296 UCHAR Identifiers[1];
297 } STORAGE_DEVICE_ID_DESCRIPTOR, *PSTORAGE_DEVICE_ID_DESCRIPTOR;
299 typedef struct _STORAGE_DEVICE_NUMBER {
300 DEVICE_TYPE DeviceType;
301 ULONG DeviceNumber;
302 ULONG PartitionNumber;
303 } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
305 typedef struct _STORAGE_PREDICT_FAILURE {
306 ULONG PredictFailure;
307 UCHAR VendorSpecific[512];
308 } STORAGE_PREDICT_FAILURE, *PSTORAGE_PREDICT_FAILURE;
310 typedef enum _STORAGE_PROPERTY_ID {
311 StorageDeviceProperty = 0,
312 StorageAdapterProperty,
313 StorageDeviceIdProperty
314 } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
316 typedef enum _STORAGE_QUERY_TYPE {
317 PropertyStandardQuery = 0,
318 PropertyExistsQuery,
319 PropertyMaskQuery,
320 PropertyQueryMaxDefined
321 } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
323 typedef struct _STORAGE_PROPERTY_QUERY {
324 STORAGE_PROPERTY_ID PropertyId;
325 STORAGE_QUERY_TYPE QueryType;
326 UCHAR AdditionalParameters[1];
327 } STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
329 #ifdef __cplusplus
331 #endif
333 #endif /* __NTDDSTOR_H */