Minor fix on MemSubpic.[PART 3]
[xy_vsfilter.git] / include / winddk / ntddcdrm.h
blob6b77f707ab97dc3385b261c9761ec4cf4647303b
1 /*++ BUILD Version: 0001 // Increment this if a change has global effects
3 Copyright (c) Microsoft Corporation. All rights reserved.
5 Module Name:
7 ntddcdrm.h
9 Abstract:
11 This module contains structures and definitions
12 associated with CDROM IOCTls.
14 Author:
16 Mike Glass
18 Revision History:
20 --*/
22 // begin_winioctl
24 #ifndef _NTDDCDRM_
25 #define _NTDDCDRM_
27 #if _MSC_VER >= 1200
28 #pragma warning(push)
29 #endif
31 #if _MSC_VER > 1000
32 #pragma once
33 #endif
36 // remove some level 4 warnings for this header file:
37 #pragma warning(disable:4200) // array[0]
38 #pragma warning(disable:4201) // nameless struct/unions
39 #pragma warning(disable:4214) // bit fields other than int
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
46 // NtDeviceIoControlFile IoControlCode values for this device.
48 // Warning: Remember that the low two bits of the code specify how the
49 // buffers are passed to the driver!
52 #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
54 #define IOCTL_CDROM_UNLOAD_DRIVER CTL_CODE(IOCTL_CDROM_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
57 // CDROM Audio Device Control Functions
60 #define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
61 #define IOCTL_CDROM_SEEK_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
62 #define IOCTL_CDROM_STOP_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
63 #define IOCTL_CDROM_PAUSE_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
64 #define IOCTL_CDROM_RESUME_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
65 #define IOCTL_CDROM_GET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
66 #define IOCTL_CDROM_PLAY_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
67 #define IOCTL_CDROM_SET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
68 #define IOCTL_CDROM_READ_Q_CHANNEL CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
69 #define IOCTL_CDROM_GET_CONTROL CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
70 #define IOCTL_CDROM_GET_LAST_SESSION CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
71 #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
72 #define IOCTL_CDROM_DISK_TYPE CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
74 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
75 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0014, METHOD_BUFFERED, FILE_READ_ACCESS)
77 #define IOCTL_CDROM_READ_TOC_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
78 #define IOCTL_CDROM_GET_CONFIGURATION CTL_CODE(IOCTL_CDROM_BASE, 0x0016, METHOD_BUFFERED, FILE_READ_ACCESS)
80 // end_winioctl
83 // The following device control codes are common for all class drivers. The
84 // functions codes defined here must match all of the other class drivers.
86 // Warning: these codes will be replaced in the future with the IOCTL_STORAGE
87 // codes included below
90 #define IOCTL_CDROM_CHECK_VERIFY CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
91 #define IOCTL_CDROM_MEDIA_REMOVAL CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
92 #define IOCTL_CDROM_EJECT_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
93 #define IOCTL_CDROM_LOAD_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
94 #define IOCTL_CDROM_RESERVE CTL_CODE(IOCTL_CDROM_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
95 #define IOCTL_CDROM_RELEASE CTL_CODE(IOCTL_CDROM_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
96 #define IOCTL_CDROM_FIND_NEW_DEVICES CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
99 // The following file contains the IOCTL_STORAGE class ioctl definitions
102 #include "ntddstor.h"
104 // begin_winioctl
107 // The following device control code is for the SIMBAD simulated bad
108 // sector facility. See SIMBAD.H in this directory for related structures.
111 #define IOCTL_CDROM_SIMBAD CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
114 // Maximum CD Rom size
117 #define MAXIMUM_NUMBER_TRACKS 100
118 #define MAXIMUM_CDROM_SIZE 804
119 #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2 // two bytes min transferred
122 // READ_TOC_EX structure
124 typedef struct _CDROM_READ_TOC_EX {
125 UCHAR Format : 4;
126 UCHAR Reserved1 : 3; // future expansion
127 UCHAR Msf : 1;
128 UCHAR SessionTrack;
129 UCHAR Reserved2; // future expansion
130 UCHAR Reserved3; // future expansion
131 } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
133 #define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
134 #define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
135 #define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
136 #define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
137 #define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
138 #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
141 // CD ROM Table OF Contents (TOC)
142 // Format 0 - Get table of contents
145 typedef struct _TRACK_DATA {
146 UCHAR Reserved;
147 UCHAR Control : 4;
148 UCHAR Adr : 4;
149 UCHAR TrackNumber;
150 UCHAR Reserved1;
151 UCHAR Address[4];
152 } TRACK_DATA, *PTRACK_DATA;
154 typedef struct _CDROM_TOC {
157 // Header
160 UCHAR Length[2]; // add two bytes for this field
161 UCHAR FirstTrack;
162 UCHAR LastTrack;
165 // Track data
168 TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
169 } CDROM_TOC, *PCDROM_TOC;
171 #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
174 // CD ROM Table OF Contents
175 // Format 1 - Session Information
178 typedef struct _CDROM_TOC_SESSION_DATA {
181 // Header
184 UCHAR Length[2]; // add two bytes for this field
185 UCHAR FirstCompleteSession;
186 UCHAR LastCompleteSession;
189 // One track, representing the first track
190 // of the last finished session
193 TRACK_DATA TrackData[1];
195 } CDROM_TOC_SESSION_DATA, *PCDROM_TOC_SESSION_DATA;
199 // CD ROM Table OF Contents
200 // Format 2 - Full TOC
203 typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
204 UCHAR SessionNumber;
205 UCHAR Control : 4;
206 UCHAR Adr : 4;
207 UCHAR Reserved1;
208 UCHAR Point;
209 UCHAR MsfExtra[3];
210 UCHAR Zero;
211 UCHAR Msf[3];
212 } CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
214 typedef struct _CDROM_TOC_FULL_TOC_DATA {
217 // Header
220 UCHAR Length[2]; // add two bytes for this field
221 UCHAR FirstCompleteSession;
222 UCHAR LastCompleteSession;
225 // one to N descriptors included
228 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
230 } CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
233 // CD ROM Table OF Contents
234 // Format 3 - Program Memory Area
236 typedef struct _CDROM_TOC_PMA_DATA {
239 // Header
242 UCHAR Length[2]; // add two bytes for this field
243 UCHAR Reserved1;
244 UCHAR Reserved2;
247 // one to N descriptors included
250 CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
252 } CDROM_TOC_PMA_DATA, *PCDROM_TOC_PMA_DATA;
255 // CD ROM Table OF Contents
256 // Format 4 - Absolute Time In Pregroove
259 typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
261 UCHAR CdrwReferenceSpeed : 3;
262 UCHAR Reserved3 : 1;
263 UCHAR WritePower : 3;
264 UCHAR True1 : 1;
265 UCHAR Reserved4 : 6;
266 UCHAR UnrestrictedUse : 1;
267 UCHAR Reserved5 : 1;
268 UCHAR A3Valid : 1;
269 UCHAR A2Valid : 1;
270 UCHAR A1Valid : 1;
271 UCHAR DiscSubType : 3;
272 UCHAR IsCdrw : 1;
273 UCHAR True2 : 1;
274 UCHAR Reserved7;
276 UCHAR LeadInMsf[3];
277 UCHAR Reserved8;
279 UCHAR LeadOutMsf[3];
280 UCHAR Reserved9;
282 UCHAR A1Values[3];
283 UCHAR Reserved10;
285 UCHAR A2Values[3];
286 UCHAR Reserved11;
288 UCHAR A3Values[3];
289 UCHAR Reserved12;
291 } CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
293 typedef struct _CDROM_TOC_ATIP_DATA {
296 // Header
299 UCHAR Length[2]; // add two bytes for this field
300 UCHAR Reserved1;
301 UCHAR Reserved2;
304 // zero? to N descriptors included.
307 CDROM_TOC_ATIP_DATA_BLOCK Descriptors[0];
309 } CDROM_TOC_ATIP_DATA, *PCDROM_TOC_ATIP_DATA;
312 // CD ROM Table OF Contents
313 // Format 5 - CD Text Info
315 typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
316 UCHAR PackType;
317 UCHAR TrackNumber : 7;
318 UCHAR ExtensionFlag : 1; // should be zero!
319 UCHAR SequenceNumber;
320 UCHAR CharacterPosition : 4;
321 UCHAR BlockNumber : 3;
322 UCHAR Unicode : 1;
323 union {
324 UCHAR Text[12];
325 WCHAR WText[6];
327 UCHAR CRC[2];
328 } CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
330 typedef struct _CDROM_TOC_CD_TEXT_DATA {
333 // Header
336 UCHAR Length[2]; // add two bytes for this field
337 UCHAR Reserved1;
338 UCHAR Reserved2;
341 // the text info comes in discrete blocks of
342 // a heavily-overloaded structure
345 CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors[0];
347 } CDROM_TOC_CD_TEXT_DATA, *PCDROM_TOC_CD_TEXT_DATA;
350 // These are the types used for PackType field in CDROM_TOC_CD_TEXT_DATA_BLOCK
351 // and also for requesting specific info from IOCTL_CDROM_READ_CD_TEXT
353 #define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
354 #define CDROM_CD_TEXT_PACK_PERFORMER 0x81
355 #define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
356 #define CDROM_CD_TEXT_PACK_COMPOSER 0x83
357 #define CDROM_CD_TEXT_PACK_ARRANGER 0x84
358 #define CDROM_CD_TEXT_PACK_MESSAGES 0x85
359 #define CDROM_CD_TEXT_PACK_DISC_ID 0x86
360 #define CDROM_CD_TEXT_PACK_GENRE 0x87
361 #define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
362 #define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
363 // 0x8a - 0x8d are reserved....
364 #define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
365 #define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
368 // Play audio starting at MSF and ending at MSF
371 typedef struct _CDROM_PLAY_AUDIO_MSF {
372 UCHAR StartingM;
373 UCHAR StartingS;
374 UCHAR StartingF;
375 UCHAR EndingM;
376 UCHAR EndingS;
377 UCHAR EndingF;
378 } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
381 // Seek to MSF
384 typedef struct _CDROM_SEEK_AUDIO_MSF {
385 UCHAR M;
386 UCHAR S;
387 UCHAR F;
388 } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
392 // Flags for the disk type
395 typedef struct _CDROM_DISK_DATA {
397 ULONG DiskData;
399 } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
401 #define CDROM_DISK_AUDIO_TRACK (0x00000001)
402 #define CDROM_DISK_DATA_TRACK (0x00000002)
405 // CD ROM Data Mode Codes, used with IOCTL_CDROM_READ_Q_CHANNEL
408 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
409 #define IOCTL_CDROM_CURRENT_POSITION 0x01
410 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
411 #define IOCTL_CDROM_TRACK_ISRC 0x03
413 typedef struct _CDROM_SUB_Q_DATA_FORMAT {
414 UCHAR Format;
415 UCHAR Track;
416 } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
420 // CD ROM Sub-Q Channel Data Format
423 typedef struct _SUB_Q_HEADER {
424 UCHAR Reserved;
425 UCHAR AudioStatus;
426 UCHAR DataLength[2];
427 } SUB_Q_HEADER, *PSUB_Q_HEADER;
429 typedef struct _SUB_Q_CURRENT_POSITION {
430 SUB_Q_HEADER Header;
431 UCHAR FormatCode;
432 UCHAR Control : 4;
433 UCHAR ADR : 4;
434 UCHAR TrackNumber;
435 UCHAR IndexNumber;
436 UCHAR AbsoluteAddress[4];
437 UCHAR TrackRelativeAddress[4];
438 } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
440 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
441 SUB_Q_HEADER Header;
442 UCHAR FormatCode;
443 UCHAR Reserved[3];
444 UCHAR Reserved1 : 7;
445 UCHAR Mcval : 1;
446 UCHAR MediaCatalog[15];
447 } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
449 typedef struct _SUB_Q_TRACK_ISRC {
450 SUB_Q_HEADER Header;
451 UCHAR FormatCode;
452 UCHAR Reserved0;
453 UCHAR Track;
454 UCHAR Reserved1;
455 UCHAR Reserved2 : 7;
456 UCHAR Tcval : 1;
457 UCHAR TrackIsrc[15];
458 } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
460 typedef union _SUB_Q_CHANNEL_DATA {
461 SUB_Q_CURRENT_POSITION CurrentPosition;
462 SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
463 SUB_Q_TRACK_ISRC TrackIsrc;
464 } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
467 // Audio Status Codes
470 #define AUDIO_STATUS_NOT_SUPPORTED 0x00
471 #define AUDIO_STATUS_IN_PROGRESS 0x11
472 #define AUDIO_STATUS_PAUSED 0x12
473 #define AUDIO_STATUS_PLAY_COMPLETE 0x13
474 #define AUDIO_STATUS_PLAY_ERROR 0x14
475 #define AUDIO_STATUS_NO_STATUS 0x15
478 // ADR Sub-channel Q Field
481 #define ADR_NO_MODE_INFORMATION 0x0
482 #define ADR_ENCODES_CURRENT_POSITION 0x1
483 #define ADR_ENCODES_MEDIA_CATALOG 0x2
484 #define ADR_ENCODES_ISRC 0x3
487 // Sub-channel Q Control Bits
490 #define AUDIO_WITH_PREEMPHASIS 0x1
491 #define DIGITAL_COPY_PERMITTED 0x2
492 #define AUDIO_DATA_TRACK 0x4
493 #define TWO_FOUR_CHANNEL_AUDIO 0x8
496 // Get Audio control parameters
499 typedef struct _CDROM_AUDIO_CONTROL {
500 UCHAR LbaFormat;
501 USHORT LogicalBlocksPerSecond;
502 } CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
505 // Volume control - Volume takes a value between 1 and 0xFF.
506 // SCSI-II CDROM audio suppports up to 4 audio ports with
507 // Independent volume control.
510 typedef struct _VOLUME_CONTROL {
511 UCHAR PortVolume[4];
512 } VOLUME_CONTROL, *PVOLUME_CONTROL;
514 typedef enum _TRACK_MODE_TYPE {
515 YellowMode2,
516 XAForm2,
517 CDDA
518 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
521 // Passed to cdrom to describe the raw read, ie. Mode 2, Form 2, CDDA...
524 typedef struct __RAW_READ_INFO {
525 LARGE_INTEGER DiskOffset;
526 ULONG SectorCount;
527 TRACK_MODE_TYPE TrackMode;
528 } RAW_READ_INFO, *PRAW_READ_INFO;
530 #ifdef __cplusplus
532 #endif
535 #if _MSC_VER >= 1200
536 #pragma warning(pop) // un-sets any local warning changes
537 #else
538 #pragma warning(default:4200) // array[0] is not a warning for this file
539 #pragma warning(default:4201) // nameless struct/unions
540 #pragma warning(default:4214) // bit fields other than int
541 #endif
544 #endif // _NTDDCDRM_
546 // end_winioctl