1 /*++ BUILD Version: 0001 // Increment this if a change has global effects
3 Copyright (c) Microsoft Corporation. All rights reserved.
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
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
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)
79 //#include <ntddstor.h>
90 DvdChallengeKey
= 0x01,
98 DvdInvalidateAGID
= 0x3f
101 typedef ULONG DVD_SESSION_ID
, *PDVD_SESSION_ID
;
103 typedef struct _DVD_COPY_PROTECT_KEY
{
105 DVD_SESSION_ID SessionId
;
106 DVD_KEY_TYPE KeyType
;
110 LARGE_INTEGER TitleOffset
;
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
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.
163 a STORAGE_SET_READ_AHEAD structure which contains:
164 * the trigger address
173 typedef struct _STORAGE_SET_READ_AHEAD
{
174 LARGE_INTEGER TriggerAddress
;
175 LARGE_INTEGER TargetAddress
;
176 } STORAGE_SET_READ_AHEAD
, *PSTORAGE_SET_READ_AHEAD
;
180 IOCTL_DVD_READ_STRUCTURE
182 Issues a READ_DVD_STRUCTURE command to the drive.
186 a DVD_READ_STRUCTURE describing what information is requested
190 a DVD Layer Descriptor as defined below
194 typedef enum DVD_STRUCTURE_FORMAT
{
195 DvdPhysicalDescriptor
,
196 DvdCopyrightDescriptor
,
197 DvdDiskKeyDescriptor
,
199 DvdManufacturerDescriptor
,
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
;
208 } DVD_READ_STRUCTURE
, *PDVD_READ_STRUCTURE
;
210 typedef struct _DVD_DESCRIPTOR_HEADER
{
214 } DVD_DESCRIPTOR_HEADER
, *PDVD_DESCRIPTOR_HEADER
;
216 typedef struct _DVD_LAYER_DESCRIPTOR
{
217 UCHAR BookVersion
: 4;
219 UCHAR MinimumRate
: 4;
223 UCHAR NumberOfLayers
: 2;
225 UCHAR TrackDensity
: 4;
226 UCHAR LinearDensity
: 4;
227 ULONG StartingDataSector
;
229 ULONG EndLayerZeroSector
;
233 } DVD_LAYER_DESCRIPTOR
, *PDVD_LAYER_DESCRIPTOR
;
235 typedef struct _DVD_COPYRIGHT_DESCRIPTOR
{
236 UCHAR CopyrightProtectionType
;
237 UCHAR RegionManagementInformation
;
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;
260 } DVD_RPC_KEY
, * PDVD_RPC_KEY
;
262 typedef struct _DVD_SET_RPC_KEY
{
263 UCHAR PreferredDriveRegionCode
;
265 } DVD_SET_RPC_KEY
, * PDVD_SET_RPC_KEY
;
267 typedef struct _DVD_ASF
{
271 } DVD_ASF
, * PDVD_ASF
;
274 typedef struct _DVD_REGION
{
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
;