Source code of Windows XP (NT5)
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.

290 lines
7.3 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. ntddcdvd.h
  5. Abstract:
  6. This module contains structures and definitions
  7. associated with DVD ioctls.
  8. This module is used in conjunction with ntddcdrm.h which contains the
  9. cdrom specific ioctls which will work on CDVD drives
  10. Author:
  11. Peter Wieland
  12. Revision History:
  13. --*/
  14. // begin_winioctl
  15. #ifndef _NTDDCDVD_
  16. #define _NTDDCDVD_
  17. #if _MSC_VER > 1000
  18. #pragma once
  19. #endif
  20. #include <pshpack1.h>
  21. //
  22. // NtDeviceIoControlFile IoControlCode values for this device.
  23. //
  24. // Warning: Remember that the low two bits of the code specify how the
  25. // buffers are passed to the driver!
  26. //
  27. #define IOCTL_DVD_BASE FILE_DEVICE_DVD
  28. //
  29. // CDVD Device Control Functions
  30. //
  31. // Warning: Ioctls from 200 through 300 are used for the old common class
  32. // driver ioctls and should not be used for device specific functionality
  33. //
  34. //
  35. // Copyright ioctls
  36. //
  37. #define IOCTL_DVD_START_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
  38. #define IOCTL_DVD_READ_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
  39. #define IOCTL_DVD_SEND_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
  40. #define IOCTL_DVD_END_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
  41. #define IOCTL_DVD_SET_READ_AHEAD CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
  42. #define IOCTL_DVD_GET_REGION CTL_CODE(IOCTL_DVD_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
  43. #define IOCTL_DVD_SEND_KEY2 CTL_CODE(IOCTL_DVD_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
  44. //
  45. // DVD Structure queries
  46. //
  47. #define IOCTL_DVD_READ_STRUCTURE CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
  48. //
  49. // The following file contains the IOCTL_STORAGE class ioctl definitions
  50. //
  51. #define IOCTL_STORAGE_SET_READ_AHEAD CTL_CODE(IOCTL_STORAGE_BASE, 0x0100, METHOD_BUFFERED, FILE_READ_ACCESS)
  52. // end_winioctl
  53. #include <ntddstor.h>
  54. // begin_winioctl
  55. #ifdef __cplusplus
  56. extern "C" {
  57. #endif
  58. typedef enum {
  59. DvdChallengeKey = 0x01,
  60. DvdBusKey1,
  61. DvdBusKey2,
  62. DvdTitleKey,
  63. DvdAsf,
  64. DvdSetRpcKey = 0x6,
  65. DvdGetRpcKey = 0x8,
  66. DvdDiskKey = 0x80,
  67. DvdInvalidateAGID = 0x3f
  68. } DVD_KEY_TYPE;
  69. typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
  70. typedef struct _DVD_COPY_PROTECT_KEY {
  71. ULONG KeyLength;
  72. DVD_SESSION_ID SessionId;
  73. DVD_KEY_TYPE KeyType;
  74. ULONG KeyFlags;
  75. union {
  76. HANDLE FileHandle;
  77. LARGE_INTEGER TitleOffset;
  78. } Parameters;
  79. UCHAR KeyData[0];
  80. } DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
  81. //
  82. // Predefined (Mt. Fuji) key sizes
  83. // Add sizeof(DVD_COPY_PROTECT_KEY) to get allocation size for
  84. // the full key structure
  85. //
  86. #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
  87. #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
  88. #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
  89. #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
  90. #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
  91. #define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
  92. #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
  93. //
  94. // Used with IOCTL_DVD_END_SESSION to end all DVD sessions at once
  95. //
  96. #define DVD_END_ALL_SESSIONS ((DVD_SESSION_ID) 0xffffffff)
  97. //
  98. // CGMS Copy Protection Flags
  99. //
  100. #define DVD_CGMS_RESERVED_MASK 0x00000078
  101. #define DVD_CGMS_COPY_PROTECT_MASK 0x00000018
  102. #define DVD_CGMS_COPY_PERMITTED 0x00000000
  103. #define DVD_CGMS_COPY_ONCE 0x00000010
  104. #define DVD_CGMS_NO_COPY 0x00000018
  105. #define DVD_COPYRIGHT_MASK 0x00000040
  106. #define DVD_NOT_COPYRIGHTED 0x00000000
  107. #define DVD_COPYRIGHTED 0x00000040
  108. #define DVD_SECTOR_PROTECT_MASK 0x00000020
  109. #define DVD_SECTOR_NOT_PROTECTED 0x00000000
  110. #define DVD_SECTOR_PROTECTED 0x00000020
  111. /*++
  112. IOCTL_STORAGE_SET_READ_AHEAD
  113. Requests that the storage device skip to TargetAddress once it has run across
  114. TriggerAddress during the course of it's read-ahead caching operations.
  115. Input:
  116. a STORAGE_SET_READ_AHEAD structure which contains:
  117. * the trigger address
  118. * the target address
  119. Output:
  120. none
  121. --*/
  122. typedef struct _STORAGE_SET_READ_AHEAD {
  123. LARGE_INTEGER TriggerAddress;
  124. LARGE_INTEGER TargetAddress;
  125. } STORAGE_SET_READ_AHEAD, *PSTORAGE_SET_READ_AHEAD;
  126. /*++
  127. IOCTL_DVD_READ_STRUCTURE
  128. Issues a READ_DVD_STRUCTURE command to the drive.
  129. Input:
  130. a DVD_READ_STRUCTURE describing what information is requested
  131. Output:
  132. a DVD Layer Descriptor as defined below
  133. --*/
  134. typedef enum DVD_STRUCTURE_FORMAT {
  135. DvdPhysicalDescriptor,
  136. DvdCopyrightDescriptor,
  137. DvdDiskKeyDescriptor,
  138. DvdBCADescriptor,
  139. DvdManufacturerDescriptor,
  140. DvdMaxDescriptor
  141. } DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT;
  142. typedef struct DVD_READ_STRUCTURE {
  143. LARGE_INTEGER BlockByteOffset;
  144. DVD_STRUCTURE_FORMAT Format;
  145. DVD_SESSION_ID SessionId;
  146. UCHAR LayerNumber;
  147. } DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE;
  148. typedef struct _DVD_DESCRIPTOR_HEADER {
  149. USHORT Length;
  150. UCHAR Reserved[2];
  151. UCHAR Data[0];
  152. } DVD_DESCRIPTOR_HEADER, *PDVD_DESCRIPTOR_HEADER;
  153. typedef struct _DVD_LAYER_DESCRIPTOR {
  154. UCHAR BookVersion : 4;
  155. UCHAR BookType : 4;
  156. UCHAR MinimumRate : 4;
  157. UCHAR DiskSize : 4;
  158. UCHAR LayerType : 4;
  159. UCHAR TrackPath : 1;
  160. UCHAR NumberOfLayers : 2;
  161. UCHAR Reserved1 : 1;
  162. UCHAR TrackDensity : 4;
  163. UCHAR LinearDensity : 4;
  164. ULONG StartingDataSector;
  165. ULONG EndDataSector;
  166. ULONG EndLayerZeroSector;
  167. UCHAR Reserved5 : 7;
  168. UCHAR BCAFlag : 1;
  169. UCHAR Reserved6;
  170. } DVD_LAYER_DESCRIPTOR, *PDVD_LAYER_DESCRIPTOR;
  171. typedef struct _DVD_COPYRIGHT_DESCRIPTOR {
  172. UCHAR CopyrightProtectionType;
  173. UCHAR RegionManagementInformation;
  174. USHORT Reserved;
  175. } DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR;
  176. typedef struct _DVD_DISK_KEY_DESCRIPTOR {
  177. UCHAR DiskKeyData[2048];
  178. } DVD_DISK_KEY_DESCRIPTOR, *PDVD_DISK_KEY_DESCRIPTOR;
  179. typedef struct _DVD_BCA_DESCRIPTOR {
  180. UCHAR BCAInformation[0];
  181. } DVD_BCA_DESCRIPTOR, *PDVD_BCA_DESCRIPTOR;
  182. typedef struct _DVD_MANUFACTURER_DESCRIPTOR {
  183. UCHAR ManufacturingInformation[2048];
  184. } DVD_MANUFACTURER_DESCRIPTOR, *PDVD_MANUFACTURER_DESCRIPTOR;
  185. typedef struct _DVD_RPC_KEY {
  186. UCHAR UserResetsAvailable:3;
  187. UCHAR ManufacturerResetsAvailable:3;
  188. UCHAR TypeCode:2;
  189. UCHAR RegionMask;
  190. UCHAR RpcScheme;
  191. UCHAR Reserved2[1];
  192. } DVD_RPC_KEY, * PDVD_RPC_KEY;
  193. typedef struct _DVD_SET_RPC_KEY {
  194. UCHAR PreferredDriveRegionCode;
  195. UCHAR Reserved[3];
  196. } DVD_SET_RPC_KEY, * PDVD_SET_RPC_KEY;
  197. typedef struct _DVD_ASF {
  198. UCHAR Reserved0[3];
  199. UCHAR SuccessFlag:1;
  200. UCHAR Reserved1:7;
  201. } DVD_ASF, * PDVD_ASF;
  202. typedef struct _DVD_REGION {
  203. UCHAR CopySystem;
  204. UCHAR RegionData; // current media region (not playable when set)
  205. UCHAR SystemRegion; // current drive region (playable when set)
  206. UCHAR ResetCount; // number of resets available
  207. } DVD_REGION, *PDVD_REGION;
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #include <poppack.h>
  212. #endif // _NTDDCDVD_
  213. // end_winioctl