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