- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / include / ddk / ntddcdrm.h
1 /*
2 * ntddcdrm.h
3 *
4 * CDROM IOCTL interface.
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
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.
20 *
21 */
22
23 #ifndef __NTDDCDRM_H
24 #define __NTDDCDRM_H
25
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
29
30 #include "ntddstor.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
37
38 #define IOCTL_CDROM_CHECK_VERIFY \
39 CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
40
41 #define IOCTL_CDROM_FIND_NEW_DEVICES \
42 CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
43
44 #define IOCTL_CDROM_GET_CONTROL \
45 CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
46
47 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY \
48 CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
49
50 #define IOCTL_CDROM_GET_LAST_SESSION \
51 CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
52
53 #define IOCTL_CDROM_GET_VOLUME \
54 CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
55
56 #define IOCTL_CDROM_PAUSE_AUDIO \
57 CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
58
59 #define IOCTL_CDROM_PLAY_AUDIO_MSF \
60 CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
61
62 #define IOCTL_CDROM_RAW_READ \
63 CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
64
65 #define IOCTL_CDROM_DISK_TYPE \
66 CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
67
68 #define IOCTL_CDROM_READ_Q_CHANNEL \
69 CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
70
71 #define IOCTL_CDROM_READ_TOC \
72 CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
73
74 #define IOCTL_CDROM_READ_TOC_EX \
75 CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
76
77 #define IOCTL_CDROM_RESUME_AUDIO \
78 CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
79
80 #define IOCTL_CDROM_SEEK_AUDIO_MSF \
81 CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
82
83 #define IOCTL_CDROM_SET_VOLUME \
84 CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
85
86 #define IOCTL_CDROM_SIMBAD \
87 CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
88
89 #define IOCTL_CDROM_STOP_AUDIO \
90 CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
91
92
93 #define MAXIMUM_NUMBER_TRACKS 100
94 #define MAXIMUM_CDROM_SIZE 804
95 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
96
97 typedef struct _TRACK_DATA {
98 UCHAR Reserved;
99 UCHAR Control : 4;
100 UCHAR Adr : 4;
101 UCHAR TrackNumber;
102 UCHAR Reserved1;
103 UCHAR Address[4];
104 } TRACK_DATA, *PTRACK_DATA;
105
106 /* CDROM_DISK_DATA.DiskData flags */
107 #define CDROM_DISK_AUDIO_TRACK 0x00000001
108 #define CDROM_DISK_DATA_TRACK 0x00000002
109
110 typedef struct _CDROM_DISK_DATA {
111 ULONG DiskData;
112 } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
113
114 typedef struct _CDROM_PLAY_AUDIO_MSF {
115 UCHAR StartingM;
116 UCHAR StartingS;
117 UCHAR StartingF;
118 UCHAR EndingM;
119 UCHAR EndingS;
120 UCHAR EndingF;
121 } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
122
123 /* CDROM_READ_TOC_EX.Format constants */
124 #define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
125 #define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
126 #define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
127 #define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
128 #define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
129 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
130
131 typedef struct _CDROM_READ_TOC_EX {
132 UCHAR Format : 4;
133 UCHAR Reserved1 : 3;
134 UCHAR Msf : 1;
135 UCHAR SessionTrack;
136 UCHAR Reserved2;
137 UCHAR Reserved3;
138 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
139
140 typedef struct _CDROM_SEEK_AUDIO_MSF {
141 UCHAR M;
142 UCHAR S;
143 UCHAR F;
144 } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
145
146 /* CDROM_SUB_Q_DATA_FORMAT.Format constants */
147 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
148 #define IOCTL_CDROM_CURRENT_POSITION 0x01
149 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
150 #define IOCTL_CDROM_TRACK_ISRC 0x03
151
152 typedef struct _CDROM_SUB_Q_DATA_FORMAT {
153 UCHAR Format;
154 UCHAR Track;
155 } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
156
157 typedef struct _CDROM_TOC {
158 UCHAR Length[2];
159 UCHAR FirstTrack;
160 UCHAR LastTrack;
161 TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
162 } CDROM_TOC, *PCDROM_TOC;
163
164 #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
165
166 typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
167 UCHAR CdrwReferenceSpeed : 3;
168 UCHAR Reserved3 : 1;
169 UCHAR WritePower : 3;
170 UCHAR True1 : 1;
171 UCHAR Reserved4 : 6;
172 UCHAR UnrestrictedUse : 1;
173 UCHAR Reserved5 : 1;
174 UCHAR A3Valid : 1;
175 UCHAR A2Valid : 1;
176 UCHAR A1Valid : 1;
177 UCHAR Reserved6 : 3;
178 UCHAR IsCdrw : 1;
179 UCHAR True2 : 1;
180 UCHAR Reserved7;
181 UCHAR LeadInMsf[3];
182 UCHAR Reserved8;
183 UCHAR LeadOutMsf[3];
184 UCHAR Reserved9;
185 UCHAR A1Values[3];
186 UCHAR Reserved10;
187 UCHAR A2Values[3];
188 UCHAR Reserved11;
189 UCHAR A3Values[3];
190 UCHAR Reserved12;
191 } CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
192
193 typedef struct _CDROM_TOC_ATIP_DATA {
194 UCHAR Length[2];
195 UCHAR Reserved1;
196 UCHAR Reserved2;
197 CDROM_TOC_ATIP_DATA_BLOCK Descriptors[0];
198 } CDROM_TOC_ATIP_DATA, *PCDROM_TOC_ATIP_DATA;
199
200 /* CDROM_TOC_CD_TEXT_DATA_BLOCK.PackType constants */
201 #define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
202 #define CDROM_CD_TEXT_PACK_PERFORMER 0x81
203 #define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
204 #define CDROM_CD_TEXT_PACK_COMPOSER 0x83
205 #define CDROM_CD_TEXT_PACK_ARRANGER 0x84
206 #define CDROM_CD_TEXT_PACK_MESSAGES 0x85
207 #define CDROM_CD_TEXT_PACK_DISC_ID 0x86
208 #define CDROM_CD_TEXT_PACK_GENRE 0x87
209 #define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
210 #define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
211 #define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
212 #define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
213
214 typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
215 UCHAR PackType;
216 UCHAR TrackNumber : 7;
217 UCHAR ExtensionFlag : 1;
218 UCHAR SequenceNumber;
219 UCHAR CharacterPosition : 4;
220 UCHAR BlockNumber : 3;
221 UCHAR Unicode : 1;
222 _ANONYMOUS_UNION union {
223 UCHAR Text[12];
224 WCHAR WText[6];
225 } DUMMYUNIONNAME;
226 UCHAR CRC[2];
227 } CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
228
229 typedef struct _CDROM_TOC_CD_TEXT_DATA {
230 UCHAR Length[2];
231 UCHAR Reserved1;
232 UCHAR Reserved2;
233 CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors[0];
234 } CDROM_TOC_CD_TEXT_DATA, *PCDROM_TOC_CD_TEXT_DATA;
235
236 /* CDROM_TOC_FULL_TOC_DATA_BLOCK.Adr constants */
237 #define ADR_NO_MODE_INFORMATION 0x0
238 #define ADR_ENCODES_CURRENT_POSITION 0x1
239 #define ADR_ENCODES_MEDIA_CATALOG 0x2
240 #define ADR_ENCODES_ISRC 0x3
241
242 typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
243 UCHAR SessionNumber;
244 UCHAR Control : 4;
245 UCHAR Adr : 4;
246 UCHAR Reserved1;
247 UCHAR Point;
248 UCHAR MsfExtra[3];
249 UCHAR Zero;
250 UCHAR Msf[3];
251 } CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
252
253 typedef struct _CDROM_TOC_FULL_TOC_DATA {
254 UCHAR Length[2];
255 UCHAR FirstCompleteSession;
256 UCHAR LastCompleteSession;
257 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
258 } CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
259
260 typedef struct _CDROM_TOC_PMA_DATA {
261 UCHAR Length[2];
262 UCHAR Reserved1;
263 UCHAR Reserved2;
264 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
265 } CDROM_TOC_PMA_DATA, *PCDROM_TOC_PMA_DATA;
266
267 /* SUB_Q_HEADER.AudioStatus constants */
268 #define AUDIO_STATUS_NOT_SUPPORTED 0x00
269 #define AUDIO_STATUS_IN_PROGRESS 0x11
270 #define AUDIO_STATUS_PAUSED 0x12
271 #define AUDIO_STATUS_PLAY_COMPLETE 0x13
272 #define AUDIO_STATUS_PLAY_ERROR 0x14
273 #define AUDIO_STATUS_NO_STATUS 0x15
274
275 typedef struct _SUB_Q_HEADER {
276 UCHAR Reserved;
277 UCHAR AudioStatus;
278 UCHAR DataLength[2];
279 } SUB_Q_HEADER, *PSUB_Q_HEADER;
280
281 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
282 SUB_Q_HEADER Header;
283 UCHAR FormatCode;
284 UCHAR Reserved[3];
285 UCHAR Reserved1 : 7;
286 UCHAR Mcval :1;
287 UCHAR MediaCatalog[15];
288 } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
289
290 typedef struct _SUB_Q_TRACK_ISRC {
291 SUB_Q_HEADER Header;
292 UCHAR FormatCode;
293 UCHAR Reserved0;
294 UCHAR Track;
295 UCHAR Reserved1;
296 UCHAR Reserved2 : 7;
297 UCHAR Tcval : 1;
298 UCHAR TrackIsrc[15];
299 } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
300
301 typedef struct _SUB_Q_CURRENT_POSITION {
302 SUB_Q_HEADER Header;
303 UCHAR FormatCode;
304 UCHAR Control : 4;
305 UCHAR ADR : 4;
306 UCHAR TrackNumber;
307 UCHAR IndexNumber;
308 UCHAR AbsoluteAddress[4];
309 UCHAR TrackRelativeAddress[4];
310 } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
311
312 typedef union _SUB_Q_CHANNEL_DATA {
313 SUB_Q_CURRENT_POSITION CurrentPosition;
314 SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
315 SUB_Q_TRACK_ISRC TrackIsrc;
316 } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
317
318 /* CDROM_AUDIO_CONTROL.LbaFormat constants */
319 #define AUDIO_WITH_PREEMPHASIS 0x1
320 #define DIGITAL_COPY_PERMITTED 0x2
321 #define AUDIO_DATA_TRACK 0x4
322 #define TWO_FOUR_CHANNEL_AUDIO 0x8
323
324 typedef struct _CDROM_AUDIO_CONTROL {
325 UCHAR LbaFormat;
326 USHORT LogicalBlocksPerSecond;
327 } CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
328
329 typedef struct _VOLUME_CONTROL {
330 UCHAR PortVolume[4];
331 } VOLUME_CONTROL, *PVOLUME_CONTROL;
332
333 typedef enum _TRACK_MODE_TYPE {
334 YellowMode2,
335 XAForm2,
336 CDDA
337 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
338
339 typedef struct __RAW_READ_INFO {
340 LARGE_INTEGER DiskOffset;
341 ULONG SectorCount;
342 TRACK_MODE_TYPE TrackMode;
343 } RAW_READ_INFO, *PRAW_READ_INFO;
344
345 #ifdef __cplusplus
346 }
347 #endif
348
349 #endif /* __NTDDCDRM_H */