[HEADERS]
[reactos.git] / reactos / include / ddk / ntddcdvd.h
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_H
24 #define __NTDDCDVD_H
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_DVD_END_SESSION \
35 CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
36
37 #define IOCTL_DVD_GET_REGION \
38 CTL_CODE(IOCTL_DVD_BASE, 0x0405, 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_READ_STRUCTURE \
44 CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
45
46 #define IOCTL_DVD_SEND_KEY \
47 CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
48
49 #define IOCTL_DVD_START_SESSION \
50 CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
51
52 #define IOCTL_DVD_SET_READ_AHEAD \
53 CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
54
55
56 typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
57
58 typedef struct _STORAGE_SET_READ_AHEAD {
59 LARGE_INTEGER TriggerAddress;
60 LARGE_INTEGER TargetAddress;
61 } STORAGE_SET_READ_AHEAD, *PSTORAGE_SET_READ_AHEAD;
62
63 typedef enum DVD_STRUCTURE_FORMAT {
64 DvdPhysicalDescriptor,
65 DvdCopyrightDescriptor,
66 DvdDiskKeyDescriptor,
67 DvdBCADescriptor,
68 DvdManufacturerDescriptor,
69 DvdMaxDescriptor
70 } DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT;
71
72 #include <pshpack1.h>
73 typedef struct DVD_READ_STRUCTURE {
74 LARGE_INTEGER BlockByteOffset;
75 DVD_STRUCTURE_FORMAT Format;
76 DVD_SESSION_ID SessionId;
77 UCHAR LayerNumber;
78 } DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE;
79 #include <poppack.h>
80
81 typedef struct _DVD_DESCRIPTOR_HEADER {
82 USHORT Length;
83 UCHAR Reserved[2];
84 UCHAR Data[0];
85 } DVD_DESCRIPTOR_HEADER, *PDVD_DESCRIPTOR_HEADER;
86
87 #include <pshpack1.h>
88 typedef struct _DVD_LAYER_DESCRIPTOR {
89 UCHAR BookVersion : 4;
90 UCHAR BookType : 4;
91 UCHAR MinimumRate : 4;
92 UCHAR DiskSize : 4;
93 UCHAR LayerType : 4;
94 UCHAR TrackPath : 1;
95 UCHAR NumberOfLayers : 2;
96 UCHAR Reserved1 : 1;
97 UCHAR TrackDensity : 4;
98 UCHAR LinearDensity : 4;
99 ULONG StartingDataSector;
100 ULONG EndDataSector;
101 ULONG EndLayerZeroSector;
102 UCHAR Reserved5 : 7;
103 UCHAR BCAFlag : 1;
104 UCHAR Reserved6;
105 } DVD_LAYER_DESCRIPTOR, *PDVD_LAYER_DESCRIPTOR;
106 #include <poppack.h>
107
108 typedef struct _DVD_COPYRIGHT_DESCRIPTOR {
109 UCHAR CopyrightProtectionType;
110 UCHAR RegionManagementInformation;
111 USHORT Reserved;
112 } DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR;
113
114 typedef struct _DVD_DISK_KEY_DESCRIPTOR {
115 UCHAR DiskKeyData[2048];
116 } DVD_DISK_KEY_DESCRIPTOR, *PDVD_DISK_KEY_DESCRIPTOR;
117
118 typedef enum _DVD_KEY_TYPE {
119 DvdChallengeKey = 0x01,
120 DvdBusKey1,
121 DvdBusKey2,
122 DvdTitleKey,
123 DvdAsf,
124 DvdSetRpcKey = 0x6,
125 DvdGetRpcKey = 0x8,
126 DvdDiskKey = 0x80,
127 DvdInvalidateAGID = 0x3f
128 } DVD_KEY_TYPE;
129
130 typedef struct _DVD_COPY_PROTECT_KEY {
131 ULONG KeyLength;
132 DVD_SESSION_ID SessionId;
133 DVD_KEY_TYPE KeyType;
134 ULONG KeyFlags;
135 union {
136 HANDLE FileHandle;
137 LARGE_INTEGER TitleOffset;
138 } Parameters;
139 UCHAR KeyData[0];
140 } DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
141
142 #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
143 #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
144 #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
145 #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
146 #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
147 #define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
148 #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
149
150 #define DVD_END_ALL_SESSIONS ((DVD_SESSION_ID) 0xffffffff)
151
152
153 #define DVD_CGMS_RESERVED_MASK 0x00000078
154
155 #define DVD_CGMS_COPY_PROTECT_MASK 0x00000018
156 #define DVD_CGMS_COPY_PERMITTED 0x00000000
157 #define DVD_CGMS_COPY_ONCE 0x00000010
158 #define DVD_CGMS_NO_COPY 0x00000018
159
160 #define DVD_COPYRIGHT_MASK 0x00000040
161 #define DVD_NOT_COPYRIGHTED 0x00000000
162 #define DVD_COPYRIGHTED 0x00000040
163
164 #define DVD_SECTOR_PROTECT_MASK 0x00000020
165 #define DVD_SECTOR_NOT_PROTECTED 0x00000000
166 #define DVD_SECTOR_PROTECTED 0x00000020
167
168
169 typedef struct _DVD_BCA_DESCRIPTOR {
170 UCHAR BCAInformation[0];
171 } DVD_BCA_DESCRIPTOR, *PDVD_BCA_DESCRIPTOR;
172
173 typedef struct _DVD_MANUFACTURER_DESCRIPTOR {
174 UCHAR ManufacturingInformation[2048];
175 } DVD_MANUFACTURER_DESCRIPTOR, *PDVD_MANUFACTURER_DESCRIPTOR;
176
177 typedef struct _DVD_RPC_KEY {
178 UCHAR UserResetsAvailable : 3;
179 UCHAR ManufacturerResetsAvailable : 3;
180 UCHAR TypeCode : 2;
181 UCHAR RegionMask;
182 UCHAR RpcScheme;
183 UCHAR Reserved2[1];
184 } DVD_RPC_KEY, *PDVD_RPC_KEY;
185
186 typedef struct _DVD_SET_RPC_KEY {
187 UCHAR PreferredDriveRegionCode;
188 UCHAR Reserved[3];
189 } DVD_SET_RPC_KEY, *PDVD_SET_RPC_KEY;
190
191 typedef struct _DVD_ASF {
192 UCHAR Reserved0[3];
193 UCHAR SuccessFlag : 1;
194 UCHAR Reserved1 : 7;
195 } DVD_ASF, *PDVD_ASF;
196
197 typedef struct _DVD_REGION {
198 UCHAR CopySystem;
199 UCHAR RegionData;
200 UCHAR SystemRegion;
201 UCHAR ResetCount;
202 } DVD_REGION, *PDVD_REGION;
203
204 #ifdef __cplusplus
205 }
206 #endif
207
208 #endif /* __NTDDCDVD_H */