ntdll: Fix compilation on systems that don't support nameless unions.
[wine] / include / ntddstor.h
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 #ifndef _NTDDSTOR_H_
22 #define _NTDDSTOR_H_
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
29
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)
43
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);
64
65 typedef struct _STORAGE_DEVICE_NUMBER {
66     DEVICE_TYPE         DeviceType;
67     ULONG               DeviceNumber;
68     ULONG               PartitionNumber;
69 } STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
70
71 typedef struct _STORAGE_BUS_RESET_REQUEST {
72     UCHAR               PathId;
73 } STORAGE_BUS_RESET_REQUEST, *PSTORAGE_BUS_RESET_REQUEST;
74
75 typedef struct _PREVENT_MEDIA_REMOVAL {
76     BOOLEAN             PreventMediaRemoval;
77 } PREVENT_MEDIA_REMOVAL, *PPREVENT_MEDIA_REMOVAL;
78
79 typedef struct _TAPE_STATISTICS {
80     ULONG               Version;
81     ULONG               Flags;
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;
89
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
96
97 typedef struct _TAPE_GET_STATISTICS {
98     ULONG               Operation;
99 } TAPE_GET_STATISTICS, *PTAPE_GET_STATISTICS;
100
101 #define TAPE_RETURN_STATISTICS          0L
102 #define TAPE_RETURN_ENV_INFO            1L
103 #define TAPE_RESET_STATISTICS           2L
104
105 typedef enum _STORAGE_MEDIA_TYPE {
106     /* see also defines in ntdddisk.h */
107
108     DDS_4mm = 0x20,
109     MiniQic,
110     Travan,
111     QIC,
112     MP_8mm,
113     AME_8mm,
114     AIT1_8mm,
115     DLT,
116     NCTP,
117     IBM_3480,
118     IBM_3490E,
119     IBM_Magstar_3590,
120     IBM_Magstar_MP,
121     STK_DATA_D3,
122     SONY_DTF,
123     DV_6mm,
124     DMI,
125     SONY_D2,
126     CLEANER_CARTRIDGE,
127     CD_ROM,
128     CD_R,
129     CD_RW,
130     DVD_ROM,
131     DVD_R,
132     DVD_RW,
133     MO_3_RW,
134     MO_5_WO,
135     MO_5_RW,
136     MO_5_LIMDOW,
137     PC_5_WO,
138     PC_5_RW,
139     PD_5_RW,
140     ABL_5_WO,
141     PINNACLE_APEX_5_RW,
142     SONY_12_WO,
143     PHILIPS_12_WO,
144     HITACHI_12_WO,
145     CYGNET_12_WO,
146     KODAK_14_WO,
147     MO_NFR_525,
148     NIKON_12_RW,
149     IOMEGA_ZIP,
150     IOMEGA_JAZ,
151     SYQUEST_EZ135,
152     SYQUEST_EZFLYER,
153     SYQUEST_SYJET,
154     AVATAR_F2,
155     MP2_8mm
156 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
157
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
164
165 typedef struct _DEVICE_MEDIA_INFO {
166     union {
167         struct {
168             LARGE_INTEGER       Cylinders;
169             STORAGE_MEDIA_TYPE  MediaType;
170             ULONG               TracksPerCylinder;
171             ULONG               SectorsPerTrack;
172             ULONG               BytesPerSector;
173             ULONG               NumberMediaSides;
174             ULONG               MediaCharacteristics;
175         } DiskInfo;
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         } RemovableDiskInfo;
185         struct {
186             STORAGE_MEDIA_TYPE  MediaType;
187             ULONG               MediaCharacteristics;
188             ULONG               CurrentBlockSize;
189         } TapeInfo;
190     } DeviceSpecific;
191 } DEVICE_MEDIA_INFO, *PDEVICE_MEDIA_INFO;
192
193 typedef struct _GET_MEDIA_TYPES {
194     ULONG               DeviceType;
195     ULONG               MediaInfoCount;
196     DEVICE_MEDIA_INFO   MediaInfo[1];
197 } GET_MEDIA_TYPES, *PGET_MEDIA_TYPES;
198
199 typedef enum _STORAGE_QUERY_TYPE {
200     PropertyStandardQuery = 0,
201     PropertyExistsQuery,
202     PropertyMaskQuery,
203     PropertyQueryMaxDefined
204 } STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
205
206 typedef enum _STORAGE_PROPERTY_ID {
207     StorageDeviceProperty = 0,
208     StorageAdapterProperty
209 } STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
210
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;
216
217 typedef struct _STORAGE_DESCRIPTOR_HEADER {
218     ULONG                       Version;
219     ULONG                       Size;
220 } STORAGE_DESCRIPTOR_HEADER, *PSTORAGE_DESCRIPTOR_HEADER;
221
222 typedef enum _STORAGE_BUS_TYPE {
223     BusTypeUnknown = 0x00,
224     BusTypeScsi,
225     BusTypeAtapi,
226     BusTypeAta,
227     BusType1394,
228     BusTypeSsa,
229     BusTypeFibre,
230     BusTypeUsb,
231     BusTypeRAID,
232     BusTypeMaxReserved = 0x7F
233 } STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
234
235 typedef struct _STORAGE_DEVICE_DESCRIPTOR {
236     ULONG                       Version;
237     ULONG                       Size;
238     UCHAR                       DeviceType;
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;
250
251 typedef struct _STORAGE_ADAPTER_DESCRIPTOR {
252     ULONG                       Version;
253     ULONG                       Size;
254     ULONG                       MaximumTransferLength;
255     ULONG                       MaximumPhysicalPages;
256     ULONG                       AlignmentMask;
257     BOOLEAN                     AdapterUsesPio;
258     BOOLEAN                     AdapterScansDown;
259     BOOLEAN                     CommandQueueing;
260     BOOLEAN                     AcceleratedTransfer;
261     BOOLEAN                     BusType;
262     USHORT                      BusMajorVersion;
263     USHORT                      BusMinorVersion;
264 } STORAGE_ADAPTER_DESCRIPTOR, *PSTORAGE_ADAPTER_DESCRIPTOR;
265
266 #ifdef __cplusplus
267 }
268 #endif
269
270 #endif /* _NTDDSTOR_H_ */