4 * CDROM IOCTL interface.
6 * This file is part of the w32api package.
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.
27 #pragma GCC system_header
37 #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
39 #define IOCTL_CDROM_CHECK_VERIFY \
40 CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
42 #define IOCTL_CDROM_FIND_NEW_DEVICES \
43 CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
45 #define IOCTL_CDROM_GET_CONTROL \
46 CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
48 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY \
49 CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
51 #define IOCTL_CDROM_GET_LAST_SESSION \
52 CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
54 #define IOCTL_CDROM_GET_VOLUME \
55 CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
57 #define IOCTL_CDROM_PAUSE_AUDIO \
58 CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
60 #define IOCTL_CDROM_PLAY_AUDIO_MSF \
61 CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
63 #define IOCTL_CDROM_RAW_READ \
64 CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
66 #define IOCTL_CDROM_READ_Q_CHANNEL \
67 CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
69 #define IOCTL_CDROM_READ_TOC \
70 CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
72 #define IOCTL_CDROM_READ_TOC_EX \
73 CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
75 #define IOCTL_CDROM_RESUME_AUDIO \
76 CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
78 #define IOCTL_CDROM_SEEK_AUDIO_MSF \
79 CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
81 #define IOCTL_CDROM_SET_VOLUME \
82 CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
84 #define IOCTL_CDROM_SIMBAD \
85 CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
87 #define IOCTL_CDROM_STOP_AUDIO \
88 CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
91 #define MAXIMUM_NUMBER_TRACKS 100
92 #define MAXIMUM_CDROM_SIZE 804
93 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
95 typedef struct _TRACK_DATA
{
102 } TRACK_DATA
, *PTRACK_DATA
;
104 /* CDROM_DISK_DATA.DiskData flags */
105 #define CDROM_DISK_AUDIO_TRACK 0x00000001
106 #define CDROM_DISK_DATA_TRACK 0x00000002
108 typedef struct _CDROM_DISK_DATA
{
110 } CDROM_DISK_DATA
, *PCDROM_DISK_DATA
;
112 typedef struct _CDROM_PLAY_AUDIO_MSF
{
119 } CDROM_PLAY_AUDIO_MSF
, *PCDROM_PLAY_AUDIO_MSF
;
121 /* CDROM_READ_TOC_EX.Format constants */
122 #define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
123 #define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
124 #define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
125 #define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
126 #define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
127 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
129 typedef struct _CDROM_READ_TOC_EX
{
136 } CDROM_READ_TOC_EX
, *PCDROM_READ_TOC_EX
;
138 typedef struct _CDROM_SEEK_AUDIO_MSF
{
142 } CDROM_SEEK_AUDIO_MSF
, *PCDROM_SEEK_AUDIO_MSF
;
144 /* CDROM_SUB_Q_DATA_FORMAT.Format constants */
145 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
146 #define IOCTL_CDROM_CURRENT_POSITION 0x01
147 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
148 #define IOCTL_CDROM_TRACK_ISRC 0x03
150 typedef struct _CDROM_SUB_Q_DATA_FORMAT
{
153 } CDROM_SUB_Q_DATA_FORMAT
, *PCDROM_SUB_Q_DATA_FORMAT
;
155 typedef struct _CDROM_TOC
{
159 TRACK_DATA TrackData
[MAXIMUM_NUMBER_TRACKS
];
160 } CDROM_TOC
, *PCDROM_TOC
;
162 #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
164 typedef struct _CDROM_TOC_ATIP_DATA_BLOCK
{
165 UCHAR CdrwReferenceSpeed
: 3;
167 UCHAR WritePower
: 3;
170 UCHAR UnrestrictedUse
: 1;
189 } CDROM_TOC_ATIP_DATA_BLOCK
, *PCDROM_TOC_ATIP_DATA_BLOCK
;
191 typedef struct _CDROM_TOC_ATIP_DATA
{
195 CDROM_TOC_ATIP_DATA_BLOCK Descriptors
[0];
196 } CDROM_TOC_ATIP_DATA
, *PCDROM_TOC_ATIP_DATA
;
198 /* CDROM_TOC_CD_TEXT_DATA_BLOCK.PackType constants */
199 #define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
200 #define CDROM_CD_TEXT_PACK_PERFORMER 0x81
201 #define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
202 #define CDROM_CD_TEXT_PACK_COMPOSER 0x83
203 #define CDROM_CD_TEXT_PACK_ARRANGER 0x84
204 #define CDROM_CD_TEXT_PACK_MESSAGES 0x85
205 #define CDROM_CD_TEXT_PACK_DISC_ID 0x86
206 #define CDROM_CD_TEXT_PACK_GENRE 0x87
207 #define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
208 #define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
209 #define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
210 #define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
212 typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK
{
214 UCHAR TrackNumber
: 7;
215 UCHAR ExtensionFlag
: 1;
216 UCHAR SequenceNumber
;
217 UCHAR CharacterPosition
: 4;
218 UCHAR BlockNumber
: 3;
220 _ANONYMOUS_UNION
union {
225 } CDROM_TOC_CD_TEXT_DATA_BLOCK
, *PCDROM_TOC_CD_TEXT_DATA_BLOCK
;
227 typedef struct _CDROM_TOC_CD_TEXT_DATA
{
231 CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors
[0];
232 } CDROM_TOC_CD_TEXT_DATA
, *PCDROM_TOC_CD_TEXT_DATA
;
234 /* CDROM_TOC_FULL_TOC_DATA_BLOCK.Adr constants */
235 #define ADR_NO_MODE_INFORMATION 0x0
236 #define ADR_ENCODES_CURRENT_POSITION 0x1
237 #define ADR_ENCODES_MEDIA_CATALOG 0x2
238 #define ADR_ENCODES_ISRC 0x3
240 typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK
{
249 } CDROM_TOC_FULL_TOC_DATA_BLOCK
, *PCDROM_TOC_FULL_TOC_DATA_BLOCK
;
251 typedef struct _CDROM_TOC_FULL_TOC_DATA
{
253 UCHAR FirstCompleteSession
;
254 UCHAR LastCompleteSession
;
255 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors
[0];
256 } CDROM_TOC_FULL_TOC_DATA
, *PCDROM_TOC_FULL_TOC_DATA
;
258 typedef struct _CDROM_TOC_PMA_DATA
{
262 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors
[0];
263 } CDROM_TOC_PMA_DATA
, *PCDROM_TOC_PMA_DATA
;
265 /* SUB_Q_HEADER.AudioStatus constants */
266 #define AUDIO_STATUS_NOT_SUPPORTED 0x00
267 #define AUDIO_STATUS_IN_PROGRESS 0x11
268 #define AUDIO_STATUS_PAUSED 0x12
269 #define AUDIO_STATUS_PLAY_COMPLETE 0x13
270 #define AUDIO_STATUS_PLAY_ERROR 0x14
271 #define AUDIO_STATUS_NO_STATUS 0x15
273 typedef struct _SUB_Q_HEADER
{
277 } SUB_Q_HEADER
, *PSUB_Q_HEADER
;
279 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER
{
285 UCHAR MediaCatalog
[15];
286 } SUB_Q_MEDIA_CATALOG_NUMBER
, *PSUB_Q_MEDIA_CATALOG_NUMBER
;
288 typedef struct _SUB_Q_TRACK_ISRC
{
297 } SUB_Q_TRACK_ISRC
, *PSUB_Q_TRACK_ISRC
;
299 typedef struct _SUB_Q_CURRENT_POSITION
{
306 UCHAR AbsoluteAddress
[4];
307 UCHAR TrackRelativeAddress
[4];
308 } SUB_Q_CURRENT_POSITION
, *PSUB_Q_CURRENT_POSITION
;
310 typedef union _SUB_Q_CHANNEL_DATA
{
311 SUB_Q_CURRENT_POSITION CurrentPosition
;
312 SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog
;
313 SUB_Q_TRACK_ISRC TrackIsrc
;
314 } SUB_Q_CHANNEL_DATA
, *PSUB_Q_CHANNEL_DATA
;
316 /* CDROM_AUDIO_CONTROL.LbaFormat constants */
317 #define AUDIO_WITH_PREEMPHASIS 0x1
318 #define DIGITAL_COPY_PERMITTED 0x2
319 #define AUDIO_DATA_TRACK 0x4
320 #define TWO_FOUR_CHANNEL_AUDIO 0x8
322 typedef struct _CDROM_AUDIO_CONTROL
{
324 USHORT LogicalBlocksPerSecond
;
325 } CDROM_AUDIO_CONTROL
, *PCDROM_AUDIO_CONTROL
;
327 typedef struct _VOLUME_CONTROL
{
329 } VOLUME_CONTROL
, *PVOLUME_CONTROL
;
331 typedef enum _TRACK_MODE_TYPE
{
335 } TRACK_MODE_TYPE
, *PTRACK_MODE_TYPE
;
337 typedef struct __RAW_READ_INFO
{
338 LARGE_INTEGER DiskOffset
;
340 TRACK_MODE_TYPE TrackMode
;
341 } RAW_READ_INFO
, *PRAW_READ_INFO
;
347 #endif /* __NTDDCDRM_H */