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