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