Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

556 lines
15 KiB

  1. /*++ BUILD Version: 0001 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddcdrm.h
  5. Abstract:
  6. This module contains structures and definitions
  7. associated with CDROM IOCTls.
  8. Author:
  9. Mike Glass
  10. Revision History:
  11. --*/
  12. // begin_winioctl
  13. #ifndef _NTDDCDRM_
  14. #define _NTDDCDRM_
  15. #if _MSC_VER >= 1200
  16. #pragma warning(push)
  17. #endif
  18. #if _MSC_VER > 1000
  19. #pragma once
  20. #endif
  21. //
  22. // remove some level 4 warnings for this header file:
  23. #pragma warning(disable:4200) // array[0]
  24. #pragma warning(disable:4201) // nameless struct/unions
  25. #pragma warning(disable:4214) // bit fields other than int
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. //
  30. // NtDeviceIoControlFile IoControlCode values for this device.
  31. //
  32. // Warning: Remember that the low two bits of the code specify how the
  33. // buffers are passed to the driver!
  34. //
  35. #define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
  36. #define IOCTL_CDROM_UNLOAD_DRIVER CTL_CODE(IOCTL_CDROM_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
  37. //
  38. // CDROM Audio Device Control Functions
  39. //
  40. #define IOCTL_CDROM_READ_TOC CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
  41. #define IOCTL_CDROM_SEEK_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
  42. #define IOCTL_CDROM_STOP_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
  43. #define IOCTL_CDROM_PAUSE_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
  44. #define IOCTL_CDROM_RESUME_AUDIO CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
  45. #define IOCTL_CDROM_GET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
  46. #define IOCTL_CDROM_PLAY_AUDIO_MSF CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
  47. #define IOCTL_CDROM_SET_VOLUME CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
  48. #define IOCTL_CDROM_READ_Q_CHANNEL CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
  49. #define OBSOLETE_IOCTL_CDROM_GET_CONTROL CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
  50. #define IOCTL_CDROM_GET_LAST_SESSION CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
  51. #define IOCTL_CDROM_RAW_READ CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
  52. #define IOCTL_CDROM_DISK_TYPE CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
  53. #define IOCTL_CDROM_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
  54. #define IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0014, METHOD_BUFFERED, FILE_READ_ACCESS)
  55. #define IOCTL_CDROM_READ_TOC_EX CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
  56. #define IOCTL_CDROM_GET_CONFIGURATION CTL_CODE(IOCTL_CDROM_BASE, 0x0016, METHOD_BUFFERED, FILE_READ_ACCESS)
  57. // end_winioctl
  58. //
  59. // The following device control codes are common for all class drivers. The
  60. // functions codes defined here must match all of the other class drivers.
  61. //
  62. // Warning: these codes will be replaced in the future with the IOCTL_STORAGE
  63. // codes included below
  64. //
  65. #define IOCTL_CDROM_CHECK_VERIFY CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
  66. #define IOCTL_CDROM_MEDIA_REMOVAL CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
  67. #define IOCTL_CDROM_EJECT_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
  68. #define IOCTL_CDROM_LOAD_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
  69. #define IOCTL_CDROM_RESERVE CTL_CODE(IOCTL_CDROM_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
  70. #define IOCTL_CDROM_RELEASE CTL_CODE(IOCTL_CDROM_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
  71. #define IOCTL_CDROM_FIND_NEW_DEVICES CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
  72. //
  73. // The following file contains the IOCTL_STORAGE class ioctl definitions
  74. //
  75. #include <ntddstor.h>
  76. // begin_winioctl
  77. //
  78. // The following device control code is for the SIMBAD simulated bad
  79. // sector facility. See SIMBAD.H in this directory for related structures.
  80. //
  81. #define IOCTL_CDROM_SIMBAD CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
  82. //
  83. // Maximum CD Rom size
  84. //
  85. #define MAXIMUM_NUMBER_TRACKS 100
  86. #define MAXIMUM_CDROM_SIZE 804
  87. #define MINIMUM_CDROM_READ_TOC_EX_SIZE 2 // two bytes min transferred
  88. //
  89. // READ_TOC_EX structure
  90. //
  91. typedef struct _CDROM_READ_TOC_EX {
  92. UCHAR Format : 4;
  93. UCHAR Reserved1 : 3; // future expansion
  94. UCHAR Msf : 1;
  95. UCHAR SessionTrack;
  96. UCHAR Reserved2; // future expansion
  97. UCHAR Reserved3; // future expansion
  98. } CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
  99. #define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
  100. #define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
  101. #define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
  102. #define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
  103. #define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
  104. #define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
  105. //
  106. // CD ROM Table OF Contents (TOC)
  107. // Format 0 - Get table of contents
  108. //
  109. typedef struct _TRACK_DATA {
  110. UCHAR Reserved;
  111. UCHAR Control : 4;
  112. UCHAR Adr : 4;
  113. UCHAR TrackNumber;
  114. UCHAR Reserved1;
  115. UCHAR Address[4];
  116. } TRACK_DATA, *PTRACK_DATA;
  117. typedef struct _CDROM_TOC {
  118. //
  119. // Header
  120. //
  121. UCHAR Length[2]; // add two bytes for this field
  122. UCHAR FirstTrack;
  123. UCHAR LastTrack;
  124. //
  125. // Track data
  126. //
  127. TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
  128. } CDROM_TOC, *PCDROM_TOC;
  129. #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
  130. //
  131. // CD ROM Table OF Contents
  132. // Format 1 - Session Information
  133. //
  134. typedef struct _CDROM_TOC_SESSION_DATA {
  135. //
  136. // Header
  137. //
  138. UCHAR Length[2]; // add two bytes for this field
  139. UCHAR FirstCompleteSession;
  140. UCHAR LastCompleteSession;
  141. //
  142. // One track, representing the first track
  143. // of the last finished session
  144. //
  145. TRACK_DATA TrackData[1];
  146. } CDROM_TOC_SESSION_DATA, *PCDROM_TOC_SESSION_DATA;
  147. //
  148. // CD ROM Table OF Contents
  149. // Format 2 - Full TOC
  150. //
  151. typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
  152. UCHAR SessionNumber;
  153. UCHAR Control : 4;
  154. UCHAR Adr : 4;
  155. UCHAR Reserved1;
  156. UCHAR Point;
  157. UCHAR MsfExtra[3];
  158. UCHAR Zero;
  159. UCHAR Msf[3];
  160. } CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
  161. typedef struct _CDROM_TOC_FULL_TOC_DATA {
  162. //
  163. // Header
  164. //
  165. UCHAR Length[2]; // add two bytes for this field
  166. UCHAR FirstCompleteSession;
  167. UCHAR LastCompleteSession;
  168. //
  169. // one to N descriptors included
  170. //
  171. CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
  172. } CDROM_TOC_FULL_TOC_DATA, *PCDROM_TOC_FULL_TOC_DATA;
  173. //
  174. // CD ROM Table OF Contents
  175. // Format 3 - Program Memory Area
  176. //
  177. typedef struct _CDROM_TOC_PMA_DATA {
  178. //
  179. // Header
  180. //
  181. UCHAR Length[2]; // add two bytes for this field
  182. UCHAR Reserved1;
  183. UCHAR Reserved2;
  184. //
  185. // one to N descriptors included
  186. //
  187. CDROM_TOC_FULL_TOC_DATA_BLOCK Descriptors[0];
  188. } CDROM_TOC_PMA_DATA, *PCDROM_TOC_PMA_DATA;
  189. //
  190. // CD ROM Table OF Contents
  191. // Format 4 - Absolute Time In Pregroove
  192. //
  193. typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
  194. UCHAR CdrwReferenceSpeed : 3;
  195. UCHAR Reserved3 : 1;
  196. UCHAR WritePower : 3;
  197. UCHAR True1 : 1;
  198. UCHAR Reserved4 : 6;
  199. UCHAR UnrestrictedUse : 1;
  200. UCHAR Reserved5 : 1;
  201. UCHAR A3Valid : 1;
  202. UCHAR A2Valid : 1;
  203. UCHAR A1Valid : 1;
  204. UCHAR DiscSubType : 3;
  205. UCHAR IsCdrw : 1;
  206. UCHAR True2 : 1;
  207. UCHAR Reserved7;
  208. UCHAR LeadInMsf[3];
  209. UCHAR Reserved8;
  210. UCHAR LeadOutMsf[3];
  211. UCHAR Reserved9;
  212. UCHAR A1Values[3];
  213. UCHAR Reserved10;
  214. UCHAR A2Values[3];
  215. UCHAR Reserved11;
  216. UCHAR A3Values[3];
  217. UCHAR Reserved12;
  218. } CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
  219. typedef struct _CDROM_TOC_ATIP_DATA {
  220. //
  221. // Header
  222. //
  223. UCHAR Length[2]; // add two bytes for this field
  224. UCHAR Reserved1;
  225. UCHAR Reserved2;
  226. //
  227. // zero? to N descriptors included.
  228. //
  229. CDROM_TOC_ATIP_DATA_BLOCK Descriptors[0];
  230. } CDROM_TOC_ATIP_DATA, *PCDROM_TOC_ATIP_DATA;
  231. //
  232. // CD ROM Table OF Contents
  233. // Format 5 - CD Text Info
  234. //
  235. typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
  236. UCHAR PackType;
  237. UCHAR TrackNumber : 7;
  238. UCHAR ExtensionFlag : 1; // should be zero!
  239. UCHAR SequenceNumber;
  240. UCHAR CharacterPosition : 4;
  241. UCHAR BlockNumber : 3;
  242. UCHAR Unicode : 1;
  243. union {
  244. UCHAR Text[12];
  245. WCHAR WText[6];
  246. };
  247. UCHAR CRC[2];
  248. } CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
  249. typedef struct _CDROM_TOC_CD_TEXT_DATA {
  250. //
  251. // Header
  252. //
  253. UCHAR Length[2]; // add two bytes for this field
  254. UCHAR Reserved1;
  255. UCHAR Reserved2;
  256. //
  257. // the text info comes in discrete blocks of
  258. // a heavily-overloaded structure
  259. //
  260. CDROM_TOC_CD_TEXT_DATA_BLOCK Descriptors[0];
  261. } CDROM_TOC_CD_TEXT_DATA, *PCDROM_TOC_CD_TEXT_DATA;
  262. //
  263. // These are the types used for PackType field in CDROM_TOC_CD_TEXT_DATA_BLOCK
  264. // and also for requesting specific info from IOCTL_CDROM_READ_CD_TEXT
  265. //
  266. #define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
  267. #define CDROM_CD_TEXT_PACK_PERFORMER 0x81
  268. #define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
  269. #define CDROM_CD_TEXT_PACK_COMPOSER 0x83
  270. #define CDROM_CD_TEXT_PACK_ARRANGER 0x84
  271. #define CDROM_CD_TEXT_PACK_MESSAGES 0x85
  272. #define CDROM_CD_TEXT_PACK_DISC_ID 0x86
  273. #define CDROM_CD_TEXT_PACK_GENRE 0x87
  274. #define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
  275. #define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
  276. // 0x8a - 0x8d are reserved....
  277. #define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
  278. #define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
  279. //
  280. // Play audio starting at MSF and ending at MSF
  281. //
  282. typedef struct _CDROM_PLAY_AUDIO_MSF {
  283. UCHAR StartingM;
  284. UCHAR StartingS;
  285. UCHAR StartingF;
  286. UCHAR EndingM;
  287. UCHAR EndingS;
  288. UCHAR EndingF;
  289. } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
  290. //
  291. // Seek to MSF
  292. //
  293. typedef struct _CDROM_SEEK_AUDIO_MSF {
  294. UCHAR M;
  295. UCHAR S;
  296. UCHAR F;
  297. } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
  298. //
  299. // Flags for the disk type
  300. //
  301. typedef struct _CDROM_DISK_DATA {
  302. ULONG DiskData;
  303. } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
  304. #define CDROM_DISK_AUDIO_TRACK (0x00000001)
  305. #define CDROM_DISK_DATA_TRACK (0x00000002)
  306. //
  307. // CD ROM Data Mode Codes, used with IOCTL_CDROM_READ_Q_CHANNEL
  308. //
  309. #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
  310. #define IOCTL_CDROM_CURRENT_POSITION 0x01
  311. #define IOCTL_CDROM_MEDIA_CATALOG 0x02
  312. #define IOCTL_CDROM_TRACK_ISRC 0x03
  313. typedef struct _CDROM_SUB_Q_DATA_FORMAT {
  314. UCHAR Format;
  315. UCHAR Track;
  316. } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
  317. //
  318. // CD ROM Sub-Q Channel Data Format
  319. //
  320. typedef struct _SUB_Q_HEADER {
  321. UCHAR Reserved;
  322. UCHAR AudioStatus;
  323. UCHAR DataLength[2];
  324. } SUB_Q_HEADER, *PSUB_Q_HEADER;
  325. typedef struct _SUB_Q_CURRENT_POSITION {
  326. SUB_Q_HEADER Header;
  327. UCHAR FormatCode;
  328. UCHAR Control : 4;
  329. UCHAR ADR : 4;
  330. UCHAR TrackNumber;
  331. UCHAR IndexNumber;
  332. UCHAR AbsoluteAddress[4];
  333. UCHAR TrackRelativeAddress[4];
  334. } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
  335. typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
  336. SUB_Q_HEADER Header;
  337. UCHAR FormatCode;
  338. UCHAR Reserved[3];
  339. UCHAR Reserved1 : 7;
  340. UCHAR Mcval : 1;
  341. UCHAR MediaCatalog[15];
  342. } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
  343. typedef struct _SUB_Q_TRACK_ISRC {
  344. SUB_Q_HEADER Header;
  345. UCHAR FormatCode;
  346. UCHAR Reserved0;
  347. UCHAR Track;
  348. UCHAR Reserved1;
  349. UCHAR Reserved2 : 7;
  350. UCHAR Tcval : 1;
  351. UCHAR TrackIsrc[15];
  352. } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
  353. typedef union _SUB_Q_CHANNEL_DATA {
  354. SUB_Q_CURRENT_POSITION CurrentPosition;
  355. SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
  356. SUB_Q_TRACK_ISRC TrackIsrc;
  357. } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
  358. //
  359. // Audio Status Codes
  360. //
  361. #define AUDIO_STATUS_NOT_SUPPORTED 0x00
  362. #define AUDIO_STATUS_IN_PROGRESS 0x11
  363. #define AUDIO_STATUS_PAUSED 0x12
  364. #define AUDIO_STATUS_PLAY_COMPLETE 0x13
  365. #define AUDIO_STATUS_PLAY_ERROR 0x14
  366. #define AUDIO_STATUS_NO_STATUS 0x15
  367. //
  368. // ADR Sub-channel Q Field
  369. //
  370. #define ADR_NO_MODE_INFORMATION 0x0
  371. #define ADR_ENCODES_CURRENT_POSITION 0x1
  372. #define ADR_ENCODES_MEDIA_CATALOG 0x2
  373. #define ADR_ENCODES_ISRC 0x3
  374. //
  375. // Sub-channel Q Control Bits
  376. //
  377. #define AUDIO_WITH_PREEMPHASIS 0x1
  378. #define DIGITAL_COPY_PERMITTED 0x2
  379. #define AUDIO_DATA_TRACK 0x4
  380. #define TWO_FOUR_CHANNEL_AUDIO 0x8
  381. #if PRAGMA_DEPRECATED_DDK
  382. #define _CDROM_AUDIO_CONTROL _this_is_obsoleted__CDROM_AUDIO_CONTROL
  383. #define CDROM_AUDIO_CONTROL _this_is_obsoleted_CDROM_AUDIO_CONTROL
  384. #define PCDROM_AUDIO_CONTROL _this_is_obsoleted_PCDROM_AUDIO_CONTROL
  385. #endif // PRAGMA_DEPRECATED_DDK
  386. //
  387. // Volume control - Volume takes a value between 1 and 0xFF.
  388. // SCSI-II CDROM audio suppports up to 4 audio ports with
  389. // Independent volume control.
  390. //
  391. typedef struct _VOLUME_CONTROL {
  392. UCHAR PortVolume[4];
  393. } VOLUME_CONTROL, *PVOLUME_CONTROL;
  394. typedef enum _TRACK_MODE_TYPE {
  395. YellowMode2,
  396. XAForm2,
  397. CDDA
  398. } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
  399. //
  400. // Passed to cdrom to describe the raw read, ie. Mode 2, Form 2, CDDA...
  401. //
  402. typedef struct __RAW_READ_INFO {
  403. LARGE_INTEGER DiskOffset;
  404. ULONG SectorCount;
  405. TRACK_MODE_TYPE TrackMode;
  406. } RAW_READ_INFO, *PRAW_READ_INFO;
  407. typedef enum _MEDIA_BLANK_TYPE {
  408. MediaBlankTypeFull = 0, // mandatory support
  409. MediaBlankTypeMinimal = 1, // mandatory support
  410. MediaBlankTypeIncompleteTrack = 2, // optional support
  411. MediaBlankTypeUnreserveLastTrack = 3, // optional support, hairy
  412. MediaBlankTypeTrackTail = 4, // mandatory support
  413. MediaBlankTypeUncloseLastSession = 5, // optional support
  414. MediaBlankTypeEraseLastSession = 6, // optional support
  415. // MediaBlankType7 is reserved
  416. } MEDIA_BLANK_TYPE, *PMEDIA_BLANK_TYPE;
  417. #ifdef __cplusplus
  418. }
  419. #endif
  420. #if _MSC_VER >= 1200
  421. #pragma warning(pop) // un-sets any local warning changes
  422. #else
  423. #pragma warning(default:4200) // array[0] is not a warning for this file
  424. #pragma warning(default:4201) // nameless struct/unions
  425. #pragma warning(default:4214) // bit fields other than int
  426. #endif
  427. #endif // _NTDDCDRM_
  428. // end_winioctl