Support unrar64.dll
[xy_vsfilter.git] / include / winddk / ntddcdvd.h
blobe6d22d1ad6f82d1a25e659c9e22f8783c9c7ba44
1 /*++ BUILD Version: 0001 // Increment this if a change has global effects
3 Copyright (c) Microsoft Corporation. All rights reserved.
5 Module Name:
7 ntddcdvd.h
9 Abstract:
11 This module contains structures and definitions
12 associated with DVD ioctls.
14 This module is used in conjunction with ntddcdrm.h which contains the
15 cdrom specific ioctls which will work on CDVD drives
17 Author:
19 Peter Wieland
21 Revision History:
23 --*/
25 // begin_winioctl
27 #ifndef _NTDDCDVD_
28 #define _NTDDCDVD_
30 #if _MSC_VER > 1000
31 #pragma once
32 #endif
34 #include <pshpack1.h>
38 // NtDeviceIoControlFile IoControlCode values for this device.
40 // Warning: Remember that the low two bits of the code specify how the
41 // buffers are passed to the driver!
44 #define IOCTL_DVD_BASE FILE_DEVICE_DVD
47 // CDVD Device Control Functions
49 // Warning: Ioctls from 200 through 300 are used for the old common class
50 // driver ioctls and should not be used for device specific functionality
54 // Copyright ioctls
57 #define IOCTL_DVD_START_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
58 #define IOCTL_DVD_READ_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
59 #define IOCTL_DVD_SEND_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
60 #define IOCTL_DVD_END_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
61 #define IOCTL_DVD_SET_READ_AHEAD CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
62 #define IOCTL_DVD_GET_REGION CTL_CODE(IOCTL_DVD_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
63 #define IOCTL_DVD_SEND_KEY2 CTL_CODE(IOCTL_DVD_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
66 // DVD Structure queries
69 #define IOCTL_DVD_READ_STRUCTURE CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
72 // The following file contains the IOCTL_STORAGE class ioctl definitions
75 #define IOCTL_STORAGE_SET_READ_AHEAD CTL_CODE(IOCTL_STORAGE_BASE, 0x0100, METHOD_BUFFERED, FILE_READ_ACCESS)
77 // end_winioctl
79 //#include <ntddstor.h>
80 #include "ntddstor.h"
82 // begin_winioctl
85 #ifdef __cplusplus
86 extern "C" {
87 #endif
89 typedef enum {
90 DvdChallengeKey = 0x01,
91 DvdBusKey1,
92 DvdBusKey2,
93 DvdTitleKey,
94 DvdAsf,
95 DvdSetRpcKey = 0x6,
96 DvdGetRpcKey = 0x8,
97 DvdDiskKey = 0x80,
98 DvdInvalidateAGID = 0x3f
99 } DVD_KEY_TYPE;
101 typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
103 typedef struct _DVD_COPY_PROTECT_KEY {
104 ULONG KeyLength;
105 DVD_SESSION_ID SessionId;
106 DVD_KEY_TYPE KeyType;
107 ULONG KeyFlags;
108 union {
109 HANDLE FileHandle;
110 LARGE_INTEGER TitleOffset;
111 } Parameters;
112 UCHAR KeyData[0];
113 } DVD_COPY_PROTECT_KEY, *PDVD_COPY_PROTECT_KEY;
116 // Predefined (Mt. Fuji) key sizes
117 // Add sizeof(DVD_COPY_PROTECT_KEY) to get allocation size for
118 // the full key structure
121 #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
122 #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
123 #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
124 #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
125 #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
126 #define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
127 #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
130 // Used with IOCTL_DVD_END_SESSION to end all DVD sessions at once
133 #define DVD_END_ALL_SESSIONS ((DVD_SESSION_ID) 0xffffffff)
136 // CGMS Copy Protection Flags
139 #define DVD_CGMS_RESERVED_MASK 0x00000078
141 #define DVD_CGMS_COPY_PROTECT_MASK 0x00000018
142 #define DVD_CGMS_COPY_PERMITTED 0x00000000
143 #define DVD_CGMS_COPY_ONCE 0x00000010
144 #define DVD_CGMS_NO_COPY 0x00000018
146 #define DVD_COPYRIGHT_MASK 0x00000040
147 #define DVD_NOT_COPYRIGHTED 0x00000000
148 #define DVD_COPYRIGHTED 0x00000040
150 #define DVD_SECTOR_PROTECT_MASK 0x00000020
151 #define DVD_SECTOR_NOT_PROTECTED 0x00000000
152 #define DVD_SECTOR_PROTECTED 0x00000020
154 /*++
156 IOCTL_STORAGE_SET_READ_AHEAD
158 Requests that the storage device skip to TargetAddress once it has run across
159 TriggerAddress during the course of it's read-ahead caching operations.
161 Input:
163 a STORAGE_SET_READ_AHEAD structure which contains:
164 * the trigger address
165 * the target address
167 Output:
169 none
171 --*/
173 typedef struct _STORAGE_SET_READ_AHEAD {
174 LARGE_INTEGER TriggerAddress;
175 LARGE_INTEGER TargetAddress;
176 } STORAGE_SET_READ_AHEAD, *PSTORAGE_SET_READ_AHEAD;
178 /*++
180 IOCTL_DVD_READ_STRUCTURE
182 Issues a READ_DVD_STRUCTURE command to the drive.
184 Input:
186 a DVD_READ_STRUCTURE describing what information is requested
188 Output:
190 a DVD Layer Descriptor as defined below
192 --*/
194 typedef enum DVD_STRUCTURE_FORMAT {
195 DvdPhysicalDescriptor,
196 DvdCopyrightDescriptor,
197 DvdDiskKeyDescriptor,
198 DvdBCADescriptor,
199 DvdManufacturerDescriptor,
200 DvdMaxDescriptor
201 } DVD_STRUCTURE_FORMAT, *PDVD_STRUCTURE_FORMAT;
203 typedef struct DVD_READ_STRUCTURE {
204 LARGE_INTEGER BlockByteOffset;
205 DVD_STRUCTURE_FORMAT Format;
206 DVD_SESSION_ID SessionId;
207 UCHAR LayerNumber;
208 } DVD_READ_STRUCTURE, *PDVD_READ_STRUCTURE;
210 typedef struct _DVD_DESCRIPTOR_HEADER {
211 USHORT Length;
212 UCHAR Reserved[2];
213 UCHAR Data[0];
214 } DVD_DESCRIPTOR_HEADER, *PDVD_DESCRIPTOR_HEADER;
216 typedef struct _DVD_LAYER_DESCRIPTOR {
217 UCHAR BookVersion : 4;
218 UCHAR BookType : 4;
219 UCHAR MinimumRate : 4;
220 UCHAR DiskSize : 4;
221 UCHAR LayerType : 4;
222 UCHAR TrackPath : 1;
223 UCHAR NumberOfLayers : 2;
224 UCHAR Reserved1 : 1;
225 UCHAR TrackDensity : 4;
226 UCHAR LinearDensity : 4;
227 ULONG StartingDataSector;
228 ULONG EndDataSector;
229 ULONG EndLayerZeroSector;
230 UCHAR Reserved5 : 7;
231 UCHAR BCAFlag : 1;
232 UCHAR Reserved6;
233 } DVD_LAYER_DESCRIPTOR, *PDVD_LAYER_DESCRIPTOR;
235 typedef struct _DVD_COPYRIGHT_DESCRIPTOR {
236 UCHAR CopyrightProtectionType;
237 UCHAR RegionManagementInformation;
238 USHORT Reserved;
239 } DVD_COPYRIGHT_DESCRIPTOR, *PDVD_COPYRIGHT_DESCRIPTOR;
241 typedef struct _DVD_DISK_KEY_DESCRIPTOR {
242 UCHAR DiskKeyData[2048];
243 } DVD_DISK_KEY_DESCRIPTOR, *PDVD_DISK_KEY_DESCRIPTOR;
245 typedef struct _DVD_BCA_DESCRIPTOR {
246 UCHAR BCAInformation[0];
247 } DVD_BCA_DESCRIPTOR, *PDVD_BCA_DESCRIPTOR;
249 typedef struct _DVD_MANUFACTURER_DESCRIPTOR {
250 UCHAR ManufacturingInformation[2048];
251 } DVD_MANUFACTURER_DESCRIPTOR, *PDVD_MANUFACTURER_DESCRIPTOR;
253 typedef struct _DVD_RPC_KEY {
254 UCHAR UserResetsAvailable:3;
255 UCHAR ManufacturerResetsAvailable:3;
256 UCHAR TypeCode:2;
257 UCHAR RegionMask;
258 UCHAR RpcScheme;
259 UCHAR Reserved2[1];
260 } DVD_RPC_KEY, * PDVD_RPC_KEY;
262 typedef struct _DVD_SET_RPC_KEY {
263 UCHAR PreferredDriveRegionCode;
264 UCHAR Reserved[3];
265 } DVD_SET_RPC_KEY, * PDVD_SET_RPC_KEY;
267 typedef struct _DVD_ASF {
268 UCHAR Reserved0[3];
269 UCHAR SuccessFlag:1;
270 UCHAR Reserved1:7;
271 } DVD_ASF, * PDVD_ASF;
273 #if 0
274 typedef struct _DVD_REGION {
275 UCHAR CopySystem;
276 UCHAR RegionData; // current media region (not playable when set)
277 UCHAR SystemRegion; // current drive region (playable when set)
278 UCHAR ResetCount; // number of resets available
279 } DVD_REGION, *PDVD_REGION;
280 #endif
282 #ifdef __cplusplus
284 #endif
287 #include <poppack.h>
290 #endif // _NTDDCDVD_
292 // end_winioctl