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