ReactOS  0.4.15-dev-3182-g7b62228
ntddcdvd.h
Go to the documentation of this file.
1 /*
2  * ntddcdvd.h
3  *
4  * DVD 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 _NTDDCDVD_
24 #define _NTDDCDVD_
25 
26 #include "ntddstor.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #define IOCTL_DVD_BASE FILE_DEVICE_DVD
33 
34 #define IOCTL_STORAGE_SET_READ_AHEAD \
35  CTL_CODE(IOCTL_STORAGE_BASE, 0x0100, METHOD_BUFFERED, FILE_READ_ACCESS)
36 
37 #define IOCTL_DVD_START_SESSION \
38  CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
39 
40 #define IOCTL_DVD_READ_KEY \
41  CTL_CODE(IOCTL_DVD_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
42 
43 #define IOCTL_DVD_SEND_KEY \
44  CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
45 
46 #define IOCTL_DVD_END_SESSION \
47  CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
48 
49 #define IOCTL_DVD_SET_READ_AHEAD \
50  CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
51 
52 #define IOCTL_DVD_GET_REGION \
53  CTL_CODE(IOCTL_DVD_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
54 
55 #define IOCTL_DVD_SEND_KEY2 \
56  CTL_CODE(IOCTL_DVD_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
57 
58 #define IOCTL_AACS_READ_MEDIA_KEY_BLOCK_SIZE \
59  CTL_CODE(IOCTL_DVD_BASE, 0x430, METHOD_BUFFERED, FILE_READ_ACCESS)
60 
61 #define IOCTL_AACS_READ_MEDIA_KEY_BLOCK \
62  CTL_CODE(IOCTL_DVD_BASE, 0x431, METHOD_BUFFERED, FILE_READ_ACCESS)
63 
64 #define IOCTL_AACS_START_SESSION \
65  CTL_CODE(IOCTL_DVD_BASE, 0x432, METHOD_BUFFERED, FILE_READ_ACCESS)
66 
67 #define IOCTL_AACS_END_SESSION \
68  CTL_CODE(IOCTL_DVD_BASE, 0x433, METHOD_BUFFERED, FILE_READ_ACCESS)
69 
70 #define IOCTL_AACS_SEND_CERTIFICATE \
71  CTL_CODE(IOCTL_DVD_BASE, 0x434, METHOD_BUFFERED, FILE_READ_ACCESS)
72 
73 #define IOCTL_AACS_GET_CERTIFICATE \
74  CTL_CODE(IOCTL_DVD_BASE, 0x435, METHOD_BUFFERED, FILE_READ_ACCESS)
75 
76 #define IOCTL_AACS_GET_CHALLENGE_KEY \
77  CTL_CODE(IOCTL_DVD_BASE, 0x436, METHOD_BUFFERED, FILE_READ_ACCESS)
78 
79 #define IOCTL_AACS_SEND_CHALLENGE_KEY \
80  CTL_CODE(IOCTL_DVD_BASE, 0x437, METHOD_BUFFERED, FILE_READ_ACCESS)
81 
82 #define IOCTL_AACS_READ_VOLUME_ID \
83  CTL_CODE(IOCTL_DVD_BASE, 0x438, METHOD_BUFFERED, FILE_READ_ACCESS)
84 
85 #define IOCTL_AACS_READ_SERIAL_NUMBER \
86  CTL_CODE(IOCTL_DVD_BASE, 0x439, METHOD_BUFFERED, FILE_READ_ACCESS)
87 
88 #define IOCTL_AACS_READ_MEDIA_ID \
89  CTL_CODE(IOCTL_DVD_BASE, 0x43A, METHOD_BUFFERED, FILE_READ_ACCESS)
90 
91 #define IOCTL_AACS_READ_BINDING_NONCE \
92  CTL_CODE(IOCTL_DVD_BASE, 0x43B, METHOD_BUFFERED, FILE_READ_ACCESS)
93 
94 #define IOCTL_AACS_GENERATE_BINDING_NONCE \
95  CTL_CODE(IOCTL_DVD_BASE, 0x43C, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
96 
97 #define IOCTL_DVD_READ_STRUCTURE \
98  CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
99 
100 
102 
103 typedef struct _STORAGE_SET_READ_AHEAD {
107 
108 typedef enum DVD_STRUCTURE_FORMAT {
116 
117 #include <pshpack1.h>
118 typedef struct DVD_READ_STRUCTURE {
124 #include <poppack.h>
125 
126 typedef struct _DVD_DESCRIPTOR_HEADER {
128  UCHAR Reserved[2];
131 
132 #include <pshpack1.h>
133 typedef struct _DVD_LAYER_DESCRIPTOR {
134  UCHAR BookVersion : 4;
135  UCHAR BookType : 4;
136  UCHAR MinimumRate : 4;
137  UCHAR DiskSize : 4;
138  UCHAR LayerType : 4;
139  UCHAR TrackPath : 1;
140  UCHAR NumberOfLayers : 2;
141  UCHAR Reserved1 : 1;
142  UCHAR TrackDensity : 4;
143  UCHAR LinearDensity : 4;
147  UCHAR Reserved5 : 7;
148  UCHAR BCAFlag : 1;
151 #include <poppack.h>
152 
153 typedef struct _DVD_COPYRIGHT_DESCRIPTOR {
158 
159 typedef struct _DVD_DISK_KEY_DESCRIPTOR {
162 
163 typedef enum _DVD_KEY_TYPE {
171  DvdDiskKey = 0x80,
173 } DVD_KEY_TYPE;
174 
175 typedef struct _DVD_COPY_PROTECT_KEY {
180  union {
183  } Parameters;
186 
187 #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
188 #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
189 #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
190 #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
191 #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
192 #define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
193 #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
194 
195 #define DVD_END_ALL_SESSIONS ((DVD_SESSION_ID) 0xffffffff)
196 
197 
198 #define DVD_CGMS_RESERVED_MASK 0x00000078
199 
200 #define DVD_CGMS_COPY_PROTECT_MASK 0x00000018
201 #define DVD_CGMS_COPY_PERMITTED 0x00000000
202 #define DVD_CGMS_COPY_ONCE 0x00000010
203 #define DVD_CGMS_NO_COPY 0x00000018
204 
205 #define DVD_COPYRIGHT_MASK 0x00000040
206 #define DVD_NOT_COPYRIGHTED 0x00000000
207 #define DVD_COPYRIGHTED 0x00000040
208 
209 #define DVD_SECTOR_PROTECT_MASK 0x00000020
210 #define DVD_SECTOR_NOT_PROTECTED 0x00000000
211 #define DVD_SECTOR_PROTECTED 0x00000020
212 
213 
214 typedef struct _DVD_BCA_DESCRIPTOR {
217 
221 
222 typedef struct _DVD_RPC_KEY {
225  UCHAR TypeCode : 2;
228  UCHAR Reserved2[1];
230 
231 typedef struct _DVD_SET_RPC_KEY {
235 
236 typedef struct _DVD_ASF {
240 } DVD_ASF, *PDVD_ASF;
241 
242 typedef struct _DVD_REGION {
248 
249 #ifdef __cplusplus
250 }
251 #endif
252 
253 // for IOCTLS_AACS_*
254 
255 typedef _Field_range_(0,255) ULONG AACS_LAYER_NUMBER, *PAACS_LAYER_NUMBER;
256 typedef _Field_range_(0,255) const ULONG CAACS_LAYER_NUMBER, *PCAACS_LAYER_NUMBER;
257 
259 {
260  UCHAR Nonce[20];
264 C_ASSERT(sizeof(AACS_CERTIFICATE) == 112);
265 
266 typedef struct _AACS_CHALLENGE_KEY
267 {
272 C_ASSERT(sizeof(AACS_CHALLENGE_KEY) == 80);
273 
274 typedef struct _AACS_VOLUME_ID
275 {
277  UCHAR MAC[16];
280 C_ASSERT(sizeof(AACS_VOLUME_ID) == 32);
281 
282 typedef struct _AACS_SERIAL_NUMBER
283 {
285  UCHAR MAC[16];
288 C_ASSERT(sizeof(AACS_SERIAL_NUMBER) == 32);
289 
290 typedef struct _AACS_MEDIA_ID
291 {
293  UCHAR MAC[16];
296 C_ASSERT(sizeof(AACS_MEDIA_ID) == 32);
297 
299 {
304 
306 {
311 
312 typedef struct _AACS_BINDING_NONCE
313 {
315  UCHAR MAC[16];
318 C_ASSERT(sizeof(AACS_BINDING_NONCE) == 32);
319 
321 {
323  _Field_range_(0,255) ULONG NumberOfSectors;
325  union
326  {
329  };
331 
332 #endif /* _NTDDCDVD_ */
struct _DVD_MANUFACTURER_DESCRIPTOR * PDVD_MANUFACTURER_DESCRIPTOR
UCHAR BCAInformation[0]
Definition: ntddcdvd.h:215
* PAACS_LAYER_NUMBER
Definition: ntddcdvd.h:255
UCHAR EllipticCurvePoint[40]
Definition: ntddcdvd.h:268
ULONGLONG ForceStructureLengthToMatch64bit
Definition: ntddcdvd.h:328
struct _AACS_BINDING_NONCE * PAACS_BINDING_NONCE
_DVD_KEY_TYPE
Definition: ntddcdvd.h:163
struct _DVD_LAYER_DESCRIPTOR DVD_LAYER_DESCRIPTOR
struct _DVD_DESCRIPTOR_HEADER DVD_DESCRIPTOR_HEADER
struct _DVD_DISK_KEY_DESCRIPTOR DVD_DISK_KEY_DESCRIPTOR
struct _STORAGE_SET_READ_AHEAD STORAGE_SET_READ_AHEAD
C_ASSERT(sizeof(AACS_CERTIFICATE)==112)
UCHAR MAC[16]
Definition: ntddcdvd.h:277
struct _AACS_VOLUME_ID * PAACS_VOLUME_ID
static const WCHAR Certificate[]
Definition: register.c:76
LARGE_INTEGER TriggerAddress
Definition: ntddcdvd.h:104
DVD_STRUCTURE_FORMAT
Definition: ntddcdvd.h:108
* PCAACS_LAYER_NUMBER
Definition: ntddcdvd.h:256
struct _AACS_CHALLENGE_KEY AACS_CHALLENGE_KEY
UCHAR PreferredDriveRegionCode
Definition: ntddcdvd.h:232
struct _DVD_ASF * PDVD_ASF
UCHAR NumberOfLayers
Definition: scsi.h:2851
LARGE_INTEGER BlockByteOffset
Definition: ntddcdvd.h:119
struct _AACS_MEDIA_ID * PAACS_MEDIA_ID
UCHAR SystemRegion
Definition: ntddcdvd.h:245
UCHAR RpcScheme
Definition: scsi.h:2927
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:121
struct _DVD_COPYRIGHT_DESCRIPTOR DVD_COPYRIGHT_DESCRIPTOR
AACS_CHALLENGE_KEY ChallengeKey
Definition: ntddcdvd.h:308
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:322
struct _AACS_CERTIFICATE AACS_CERTIFICATE
const AACS_SEND_CERTIFICATE CAACS_SEND_CERTIFICATE
Definition: ntddcdvd.h:303
const AACS_SEND_CHALLENGE_KEY * PCAACS_SEND_CHALLENGE_KEY
Definition: ntddcdvd.h:310
struct _DVD_BCA_DESCRIPTOR * PDVD_BCA_DESCRIPTOR
UCHAR SuccessFlag
Definition: ntddcdvd.h:238
const AACS_CHALLENGE_KEY CAACS_CHALLENGE_KEY
Definition: ntddcdvd.h:271
const AACS_CERTIFICATE CAACS_CERTIFICATE
Definition: ntddcdvd.h:263
struct _AACS_READ_BINDING_NONCE * PAACS_READ_BINDING_NONCE
typedef _Field_range_(0, 255) ULONG AACS_LAYER_NUMBER
struct _DVD_SET_RPC_KEY DVD_SET_RPC_KEY
const AACS_MEDIA_ID * PCAACS_MEDIA_ID
Definition: ntddcdvd.h:295
UCHAR PrerecordedSerialNumber[16]
Definition: ntddcdvd.h:284
UCHAR UserResetsAvailable
Definition: scsi.h:2923
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:307
const AACS_VOLUME_ID * PCAACS_VOLUME_ID
Definition: ntddcdvd.h:279
union _DVD_COPY_PROTECT_KEY::@3076 Parameters
struct _AACS_CERTIFICATE * PAACS_CERTIFICATE
LARGE_INTEGER TitleOffset
Definition: ntddcdvd.h:182
struct _AACS_VOLUME_ID AACS_VOLUME_ID
_Reserved_ PVOID Reserved
Definition: winddi.h:3974
AACS_CERTIFICATE Certificate
Definition: ntddcdvd.h:301
UCHAR Reserved0[3]
Definition: ntddcdvd.h:237
struct _DVD_DISK_KEY_DESCRIPTOR * PDVD_DISK_KEY_DESCRIPTOR
struct _AACS_SERIAL_NUMBER * PAACS_SERIAL_NUMBER
struct _AACS_CHALLENGE_KEY * PAACS_CHALLENGE_KEY
struct _DVD_RPC_KEY DVD_RPC_KEY
struct _DVD_RPC_KEY * PDVD_RPC_KEY
struct _DVD_REGION DVD_REGION
const AACS_SEND_CERTIFICATE * PCAACS_SEND_CERTIFICATE
Definition: ntddcdvd.h:303
struct _AACS_SEND_CERTIFICATE * PAACS_SEND_CERTIFICATE
uint64_t ULONGLONG
Definition: typedefs.h:67
UCHAR ManufacturerResetsAvailable
Definition: scsi.h:2924
enum DVD_STRUCTURE_FORMAT * PDVD_STRUCTURE_FORMAT
struct _DVD_COPY_PROTECT_KEY DVD_COPY_PROTECT_KEY
UCHAR ManufacturingInformation[2048]
Definition: ntddcdvd.h:219
const AACS_SERIAL_NUMBER CAACS_SERIAL_NUMBER
Definition: ntddcdvd.h:287
ULONG * PDVD_SESSION_ID
Definition: ntddcdvd.h:101
UCHAR CopySystem
Definition: ntddcdvd.h:243
struct _DVD_COPYRIGHT_DESCRIPTOR * PDVD_COPYRIGHT_DESCRIPTOR
ULONG DVD_SESSION_ID
Definition: ntddcdvd.h:101
DVD_KEY_TYPE KeyType
Definition: ntddcdvd.h:178
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR VolumeID[16]
Definition: ntddcdvd.h:276
UCHAR BindingNonce[16]
Definition: ntddcdvd.h:314
struct _DVD_ASF DVD_ASF
struct _AACS_SEND_CERTIFICATE AACS_SEND_CERTIFICATE
ULONG DVD_SESSION_ID
Definition: cdrw_usr.h:1544
struct DVD_READ_STRUCTURE DVD_READ_STRUCTURE
UCHAR RegionMask
Definition: scsi.h:2926
UCHAR MAC[16]
Definition: ntddcdvd.h:293
const AACS_CERTIFICATE * PCAACS_CERTIFICATE
Definition: ntddcdvd.h:263
struct _DVD_DESCRIPTOR_HEADER * PDVD_DESCRIPTOR_HEADER
const AACS_VOLUME_ID CAACS_VOLUME_ID
Definition: ntddcdvd.h:279
const AACS_SEND_CHALLENGE_KEY CAACS_SEND_CHALLENGE_KEY
Definition: ntddcdvd.h:310
const AACS_SERIAL_NUMBER * PCAACS_SERIAL_NUMBER
Definition: ntddcdvd.h:287
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:177
struct _DVD_LAYER_DESCRIPTOR * PDVD_LAYER_DESCRIPTOR
unsigned short USHORT
Definition: pedump.c:61
UCHAR MediaID[16]
Definition: ntddcdvd.h:292
const AACS_BINDING_NONCE * PCAACS_BINDING_NONCE
Definition: ntddcdvd.h:317
struct _DVD_COPY_PROTECT_KEY * PDVD_COPY_PROTECT_KEY
struct _DVD_SET_RPC_KEY * PDVD_SET_RPC_KEY
const AACS_CHALLENGE_KEY * PCAACS_CHALLENGE_KEY
Definition: ntddcdvd.h:271
UCHAR Reserved2[1]
Definition: scsi.h:2928
const AACS_BINDING_NONCE CAACS_BINDING_NONCE
Definition: ntddcdvd.h:317
struct _STORAGE_SET_READ_AHEAD * PSTORAGE_SET_READ_AHEAD
struct _AACS_SEND_CHALLENGE_KEY AACS_SEND_CHALLENGE_KEY
UCHAR DiskKeyData[2048]
Definition: ntddcdvd.h:160
UCHAR ResetCount
Definition: ntddcdvd.h:246
DVD_STRUCTURE_FORMAT Format
Definition: ntddcdvd.h:120
UCHAR Signature[40]
Definition: ntddcdvd.h:269
struct _AACS_MEDIA_ID AACS_MEDIA_ID
unsigned int ULONG
Definition: retypes.h:1
const AACS_MEDIA_ID CAACS_MEDIA_ID
Definition: ntddcdvd.h:295
#define const
Definition: zconf.h:230
DVD_KEY_TYPE
Definition: ntddcdvd.h:38
DVD_SESSION_ID SessionId
Definition: ntddcdvd.h:300
UCHAR Reserved1
Definition: ntddcdvd.h:239
struct _AACS_BINDING_NONCE AACS_BINDING_NONCE
struct _DVD_BCA_DESCRIPTOR DVD_BCA_DESCRIPTOR
struct _DVD_MANUFACTURER_DESCRIPTOR DVD_MANUFACTURER_DESCRIPTOR
LARGE_INTEGER TargetAddress
Definition: ntddcdvd.h:105
_Field_range_(0, 255) ULONG NumberOfSectors
UCHAR RegionData
Definition: ntddcdvd.h:244
struct _DVD_REGION * PDVD_REGION
struct _AACS_READ_BINDING_NONCE AACS_READ_BINDING_NONCE
struct _AACS_SEND_CHALLENGE_KEY * PAACS_SEND_CHALLENGE_KEY
struct DVD_READ_STRUCTURE * PDVD_READ_STRUCTURE
struct _AACS_SERIAL_NUMBER AACS_SERIAL_NUMBER
UCHAR TypeCode
Definition: scsi.h:2925