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.

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