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