[UDFS] Remove definitions that exist in platform headers and use those instead.
[reactos.git] / reactos / drivers / filesystems / udfs / CDRW / cdrw_usr.h
1 ////////////////////////////////////////////////////////////////////
2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3 // All rights reserved
4 // This file was released under the GPLv2 on June 2015.
5 ////////////////////////////////////////////////////////////////////
6 /*
7
8 Module Name:
9
10 cdrw_usr.h
11
12 Abstract:
13
14 This file defines the interface between CD-Writer's driver & user
15 applications.
16
17 Environment:
18
19 NT kernel mode or Win32 app
20 */
21
22 #ifndef __CDRW_PUBLIC_H__
23 #define __CDRW_PUBLIC_H__
24
25 #define CDRW_SIGNATURE_v1 "ALWA CD-R/W v1"
26
27 //#define CDRW_RESTRICT_ACCESS // require W-acces rights for some IOCTLs
28
29 #include "cdrw_hw.h"
30 //#include "ntdddisk.h"
31
32 #include <ntddcdrm.h>
33 #include <ntddcdvd.h>
34
35 #ifndef CTL_CODE
36 #pragma pack(push, 8)
37 #include "winioctl.h"
38 #pragma pack(pop)
39 #endif
40
41 #if defined(CDRW_EXPORTS) || defined(FileSys_EXPORTS)
42 #include "mountmgr.h"
43 #endif
44
45 #ifndef FILE_DEVICE_SECURE_OPEN
46 #define FILE_DEVICE_SECURE_OPEN 0x00000100
47 #endif //FILE_DEVICE_SECURE_OPEN
48
49 #pragma pack(push, 1)
50
51 #ifndef IRP_MJ_PNP
52 #define IRP_MJ_PNP IRP_MJ_PNP_POWER // Obsolete....
53 #endif //IRP_MJ_PNP
54
55 #ifndef FILE_DEVICE_CDRW
56 #define FILE_DEVICE_CDRW 0x00000999
57 #endif
58
59 #define IOCTL_CDROM_MEDIA_REMOVAL CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
60 #define IOCTL_CDROM_EJECT_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
61 #define IOCTL_CDROM_LOAD_MEDIA CTL_CODE(IOCTL_CDROM_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
62
63 #ifdef CDRW_RESTRICT_ACCESS
64
65 #define CDRW_CTL_CODE_R(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA)
66 #define CDRW_CTL_CODE_W(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA)
67 #define CDRW_CTL_CODE_W(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_WRITE_DATA )
68 #define CDRW_CTL_CODE_A(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA | FILE_WRITE_DATA )
69
70 #else //CDRW_RESTRICT_ACCESS
71
72 #define CDRW_CTL_CODE_R(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA)
73 #define CDRW_CTL_CODE_W(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA)
74 #define CDRW_CTL_CODE_A(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_READ_DATA)
75 #define CDRW_CTL_CODE_X(a,b) CTL_CODE(FILE_DEVICE_CDRW, a,b, FILE_ANY_ACCESS )
76
77 #endif //CDRW_RESTRICT_ACCESS
78
79 #define IOCTL_CDRW_LOCK_DOOR CDRW_CTL_CODE_R(0x801, METHOD_BUFFERED)
80 #define IOCTL_CDRW_SET_SPEED CDRW_CTL_CODE_R(0x802, METHOD_BUFFERED)
81 #define IOCTL_CDRW_SYNC_CACHE CDRW_CTL_CODE_W(0x803, METHOD_BUFFERED)
82 #define IOCTL_CDRW_GET_CAPABILITIES CDRW_CTL_CODE_X(0x804, METHOD_BUFFERED)
83 #define IOCTL_CDRW_GET_SPEED IOCTL_CDRW_GET_CAPABILITIES
84 #define IOCTL_CDRW_GET_MEDIA_TYPE CDRW_CTL_CODE_X(0x805, METHOD_BUFFERED)
85 #define IOCTL_CDRW_GET_WRITE_MODE CDRW_CTL_CODE_R(0x806, METHOD_BUFFERED)
86 #define IOCTL_CDRW_SET_WRITE_MODE CDRW_CTL_CODE_W(0x807, METHOD_BUFFERED)
87 #define IOCTL_CDRW_RESERVE_TRACK CDRW_CTL_CODE_W(0x808, METHOD_BUFFERED)
88 #define IOCTL_CDRW_BLANK CDRW_CTL_CODE_R(0x809, METHOD_BUFFERED)
89 #define IOCTL_CDRW_CLOSE_TRK_SES CDRW_CTL_CODE_W(0x80a, METHOD_BUFFERED)
90 //#define IOCTL_CDRW_LL_WRITE CDRW_CTL_CODE_R(0x80b, METHOD_OUT_DIRECT)
91 #define IOCTL_CDRW_LL_WRITE CDRW_CTL_CODE_R(0x80b, METHOD_BUFFERED)
92 #define IOCTL_CDRW_READ_TRACK_INFO CDRW_CTL_CODE_R(0x80c, METHOD_IN_DIRECT)
93 #define IOCTL_CDRW_READ_DISC_INFO CDRW_CTL_CODE_R(0x80d, METHOD_IN_DIRECT)
94 #define IOCTL_CDRW_BUFFER_CAPACITY CDRW_CTL_CODE_A(0x80e, METHOD_IN_DIRECT)
95 #define IOCTL_CDRW_GET_SIGNATURE CDRW_CTL_CODE_X(0x80f, METHOD_BUFFERED)
96 #define IOCTL_CDRW_RESET_DRIVER CDRW_CTL_CODE_A(0x810, METHOD_BUFFERED)
97 //#ifndef WITHOUT_FORMATTER
98 #define IOCTL_CDRW_FORMAT_UNIT CDRW_CTL_CODE_W(0x811, METHOD_BUFFERED)
99 #define IOCTL_CDRW_SET_RANDOM_ACCESS CDRW_CTL_CODE_W(0x812, METHOD_BUFFERED)
100 //#endif //WITHOUT_FORMATTER
101 #define IOCTL_CDRW_TEST_UNIT_READY CDRW_CTL_CODE_X(0x813, METHOD_BUFFERED)
102 #define IOCTL_CDRW_RESET_WRITE_STATUS CDRW_CTL_CODE_X(0x814, METHOD_BUFFERED)
103 #define IOCTL_CDRW_GET_LAST_ERROR CDRW_CTL_CODE_R(0x815, METHOD_BUFFERED)
104 #define IOCTL_CDRW_MODE_SENSE CDRW_CTL_CODE_X(0x816, METHOD_BUFFERED)
105 #define IOCTL_CDRW_MODE_SELECT CDRW_CTL_CODE_R(0x817, METHOD_BUFFERED)
106 #define IOCTL_CDRW_SET_READ_AHEAD CDRW_CTL_CODE_R(0x818, METHOD_BUFFERED)
107 #define IOCTL_CDRW_SET_DEFAULT_SESSION CDRW_CTL_CODE_R(0x819, METHOD_BUFFERED) // RESERVED !!!
108 #define IOCTL_CDRW_NOTIFY_MEDIA_CHANGE CDRW_CTL_CODE_X(0x81a, METHOD_BUFFERED)
109 #define IOCTL_CDRW_SEND_OPC_INFO CDRW_CTL_CODE_W(0x81b, METHOD_BUFFERED)
110 #define IOCTL_CDRW_LL_READ CDRW_CTL_CODE_R(0x81c, METHOD_BUFFERED)
111 #define IOCTL_CDRW_SEND_CUE_SHEET CDRW_CTL_CODE_W(0x81d, METHOD_OUT_DIRECT)
112 #define IOCTL_CDRW_INIT_DEINIT CDRW_CTL_CODE_A(0x81e, METHOD_BUFFERED)
113 #define IOCTL_CDRW_READ_FULL_TOC CDRW_CTL_CODE_R(0x81f, METHOD_BUFFERED)
114 #define IOCTL_CDRW_READ_PMA CDRW_CTL_CODE_R(0x820, METHOD_BUFFERED)
115 #define IOCTL_CDRW_READ_SESSION_INFO CDRW_CTL_CODE_R(0x821, METHOD_BUFFERED)
116 #define IOCTL_CDRW_READ_ATIP CDRW_CTL_CODE_R(0x822, METHOD_BUFFERED)
117 #define IOCTL_CDRW_READ_CD_TEXT CDRW_CTL_CODE_R(0x823, METHOD_BUFFERED)
118 #define IOCTL_CDRW_READ_TOC_EX CDRW_CTL_CODE_R(0x824, METHOD_BUFFERED)
119 #define IOCTL_CDRW_GET_DEVICE_INFO CDRW_CTL_CODE_R(0x825, METHOD_BUFFERED)
120 #define IOCTL_CDRW_GET_EVENT CDRW_CTL_CODE_R(0x826, METHOD_IN_DIRECT)
121 #define IOCTL_CDRW_GET_DEVICE_NAME CDRW_CTL_CODE_R(0x827, METHOD_BUFFERED)
122 #define IOCTL_CDRW_RESET_DRIVER_EX CDRW_CTL_CODE_A(0x828, METHOD_BUFFERED)
123 #define IOCTL_CDRW_GET_MEDIA_TYPE_EX CDRW_CTL_CODE_X(0x829, METHOD_BUFFERED)
124 #ifndef WITHOUT_FORMATTER
125 #define IOCTL_CDRW_GET_MRW_MODE CDRW_CTL_CODE_X(0x82a, METHOD_BUFFERED)
126 #define IOCTL_CDRW_SET_MRW_MODE CDRW_CTL_CODE_X(0x82b, METHOD_BUFFERED)
127 #endif //WITHOUT_FORMATTER
128 #define IOCTL_CDRW_READ_CAPACITY CDRW_CTL_CODE_R(0x82c, METHOD_IN_DIRECT)
129 #define IOCTL_CDRW_GET_DISC_LAYOUT CDRW_CTL_CODE_R(0x82d, METHOD_IN_DIRECT)
130 #define IOCTL_CDRW_SET_STREAMING CDRW_CTL_CODE_W(0x82e, METHOD_BUFFERED)
131
132 #define IOCTL_CDRW_UNLOAD_DRIVER IOCTL_CDROM_UNLOAD_DRIVER
133
134 #define IOCTL_CDRW_READ_TOC IOCTL_CDROM_READ_TOC
135 #define IOCTL_CDRW_GET_CONTROL IOCTL_CDROM_GET_CONTROL
136 #define IOCTL_CDRW_PLAY_AUDIO_MSF IOCTL_CDROM_PLAY_AUDIO_MSF
137 #define IOCTL_CDRW_SEEK_AUDIO_MSF IOCTL_CDROM_SEEK_AUDIO_MSF
138 #define IOCTL_CDRW_STOP_AUDIO IOCTL_CDROM_STOP_AUDIO
139 #define IOCTL_CDRW_PAUSE_AUDIO IOCTL_CDROM_PAUSE_AUDIO
140 #define IOCTL_CDRW_RESUME_AUDIO IOCTL_CDROM_RESUME_AUDIO
141 #define IOCTL_CDRW_GET_VOLUME IOCTL_CDROM_GET_VOLUME
142 #define IOCTL_CDRW_SET_VOLUME IOCTL_CDROM_SET_VOLUME
143 #define IOCTL_CDRW_READ_Q_CHANNEL IOCTL_CDROM_READ_Q_CHANNEL
144 #define IOCTL_CDRW_GET_LAST_SESSION IOCTL_CDROM_GET_LAST_SESSION
145 #define IOCTL_CDRW_RAW_READ IOCTL_CDROM_RAW_READ
146 #define IOCTL_CDRW_DISK_TYPE IOCTL_CDROM_DISK_TYPE
147
148 #define IOCTL_CDRW_CHECK_VERIFY IOCTL_CDROM_CHECK_VERIFY
149 #define IOCTL_CDRW_MEDIA_REMOVAL IOCTL_CDROM_MEDIA_REMOVAL
150 #define IOCTL_CDRW_EJECT_MEDIA IOCTL_CDROM_EJECT_MEDIA
151 #define IOCTL_CDRW_LOAD_MEDIA IOCTL_CDROM_LOAD_MEDIA
152 #define IOCTL_CDRW_RESERVE IOCTL_CDROM_RESERVE
153 #define IOCTL_CDRW_RELEASE IOCTL_CDROM_RELEASE
154 #define IOCTL_CDRW_FIND_NEW_DEVICES IOCTL_CDROM_FIND_NEW_DEVICES
155
156 #ifndef IOCTL_DVD_READ_STRUCTURE
157 #define IOCTL_DVD_READ_STRUCTURE CTL_CODE(IOCTL_DVD_BASE, 0x0450, METHOD_BUFFERED, FILE_READ_ACCESS)
158
159 #define IOCTL_DVD_START_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
160 #define IOCTL_DVD_READ_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
161 #define IOCTL_DVD_SEND_KEY CTL_CODE(IOCTL_DVD_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
162 #define IOCTL_DVD_END_SESSION CTL_CODE(IOCTL_DVD_BASE, 0x0403, METHOD_BUFFERED, FILE_READ_ACCESS)
163 #define IOCTL_DVD_SET_READ_AHEAD CTL_CODE(IOCTL_DVD_BASE, 0x0404, METHOD_BUFFERED, FILE_READ_ACCESS)
164 #define IOCTL_DVD_GET_REGION CTL_CODE(IOCTL_DVD_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS)
165 #define IOCTL_DVD_SEND_KEY2 CTL_CODE(IOCTL_DVD_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
166 #endif //IOCTL_DVD_READ_STRUCTURE
167
168 #ifndef IOCTL_DISK_GET_DRIVE_GEOMETRY
169 #define IOCTL_DISK_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
170 #define IOCTL_DISK_VERIFY CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
171 #define IOCTL_DISK_FORMAT_TRACKS CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
172 #define IOCTL_DISK_IS_WRITABLE CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
173 #define IOCTL_DISK_FORMAT_TRACKS_EX CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
174
175 #define IOCTL_DISK_CHECK_VERIFY CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
176 #define IOCTL_DISK_MEDIA_REMOVAL CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
177 #define IOCTL_DISK_EJECT_MEDIA CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
178 #define IOCTL_DISK_LOAD_MEDIA CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
179 #define IOCTL_DISK_RESERVE CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
180 #define IOCTL_DISK_RELEASE CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
181 #define IOCTL_DISK_FIND_NEW_DEVICES CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
182 #define IOCTL_DISK_GET_MEDIA_TYPES CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
183 #endif //IOCTL_DISK_GET_DRIVE_GEOMETRY
184
185 #ifndef IOCTL_STORAGE_SET_READ_AHEAD
186 #define IOCTL_STORAGE_SET_READ_AHEAD CTL_CODE(IOCTL_STORAGE_BASE, 0x0100, METHOD_BUFFERED, FILE_READ_ACCESS)
187 #endif //IOCTL_STORAGE_SET_READ_AHEAD
188
189 #ifndef IOCTL_STORAGE_GET_MEDIA_TYPES_EX
190 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
191
192 typedef enum _STORAGE_MEDIA_TYPE {
193 //
194 // Following are defined in ntdddisk.h in the MEDIA_TYPE enum
195 //
196 // Unknown, // Format is unknown
197 // F5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
198 // F3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
199 // F3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
200 // F3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
201 // F3_720_512, // 3.5", 720KB, 512 bytes/sector
202 // F5_360_512, // 5.25", 360KB, 512 bytes/sector
203 // F5_320_512, // 5.25", 320KB, 512 bytes/sector
204 // F5_320_1024, // 5.25", 320KB, 1024 bytes/sector
205 // F5_180_512, // 5.25", 180KB, 512 bytes/sector
206 // F5_160_512, // 5.25", 160KB, 512 bytes/sector
207 // RemovableMedia, // Removable media other than floppy
208 // FixedMedia, // Fixed hard disk media
209 // F3_120M_512, // 3.5", 120M Floppy
210 // F3_640_512, // 3.5" , 640KB, 512 bytes/sector
211 // F5_640_512, // 5.25", 640KB, 512 bytes/sector
212 // F5_720_512, // 5.25", 720KB, 512 bytes/sector
213 // F3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
214 // F3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
215 // F5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
216 // F3_128Mb_512, // 3.5" MO 128Mb 512 bytes/sector
217 // F3_230Mb_512, // 3.5" MO 230Mb 512 bytes/sector
218 // F8_256_128, // 8", 256KB, 128 bytes/sector
219 //
220
221 DDS_4mm = 0x20, // Tape - DAT DDS1,2,... (all vendors)
222 MiniQic, // Tape - miniQIC Tape
223 Travan, // Tape - Travan TR-1,2,3,...
224 QIC, // Tape - QIC
225 MP_8mm, // Tape - 8mm Exabyte Metal Particle
226 AME_8mm, // Tape - 8mm Exabyte Advanced Metal Evap
227 AIT1_8mm, // Tape - 8mm Sony AIT1
228 DLT, // Tape - DLT Compact IIIxt, IV
229 NCTP, // Tape - Philips NCTP
230 IBM_3480, // Tape - IBM 3480
231 IBM_3490E, // Tape - IBM 3490E
232 IBM_Magstar_3590, // Tape - IBM Magstar 3590
233 IBM_Magstar_MP, // Tape - IBM Magstar MP
234 STK_DATA_D3, // Tape - STK Data D3
235 SONY_DTF, // Tape - Sony DTF
236 DV_6mm, // Tape - 6mm Digital Video
237 DMI, // Tape - Exabyte DMI and compatibles
238 SONY_D2, // Tape - Sony D2S and D2L
239 CLEANER_CARTRIDGE, // Cleaner - All Drive types that support Drive Cleaners
240 CD_ROM, // Opt_Disk - CD
241 CD_R, // Opt_Disk - CD-Recordable (Write Once)
242 CD_RW, // Opt_Disk - CD-Rewriteable
243 DVD_ROM, // Opt_Disk - DVD-ROM
244 DVD_R, // Opt_Disk - DVD-Recordable (Write Once)
245 DVD_RW, // Opt_Disk - DVD-Rewriteable
246 MO_3_RW, // Opt_Disk - 3.5" Rewriteable MO Disk
247 MO_5_WO, // Opt_Disk - MO 5.25" Write Once
248 MO_5_RW, // Opt_Disk - MO 5.25" Rewriteable (not LIMDOW)
249 MO_5_LIMDOW, // Opt_Disk - MO 5.25" Rewriteable (LIMDOW)
250 PC_5_WO, // Opt_Disk - Phase Change 5.25" Write Once Optical
251 PC_5_RW, // Opt_Disk - Phase Change 5.25" Rewriteable
252 PD_5_RW, // Opt_Disk - PhaseChange Dual Rewriteable
253 ABL_5_WO, // Opt_Disk - Ablative 5.25" Write Once Optical
254 PINNACLE_APEX_5_RW, // Opt_Disk - Pinnacle Apex 4.6GB Rewriteable Optical
255 SONY_12_WO, // Opt_Disk - Sony 12" Write Once
256 PHILIPS_12_WO, // Opt_Disk - Philips/LMS 12" Write Once
257 HITACHI_12_WO, // Opt_Disk - Hitachi 12" Write Once
258 CYGNET_12_WO, // Opt_Disk - Cygnet/ATG 12" Write Once
259 KODAK_14_WO, // Opt_Disk - Kodak 14" Write Once
260 MO_NFR_525, // Opt_Disk - Near Field Recording (Terastor)
261 NIKON_12_RW, // Opt_Disk - Nikon 12" Rewriteable
262 IOMEGA_ZIP, // Mag_Disk - Iomega Zip
263 IOMEGA_JAZ, // Mag_Disk - Iomega Jaz
264 SYQUEST_EZ135, // Mag_Disk - Syquest EZ135
265 SYQUEST_EZFLYER, // Mag_Disk - Syquest EzFlyer
266 SYQUEST_SYJET, // Mag_Disk - Syquest SyJet
267 AVATAR_F2, // Mag_Disk - 2.5" Floppy
268 MP2_8mm, // Tape - 8mm Hitachi
269 DST_S, // Ampex DST Small Tapes
270 DST_M, // Ampex DST Medium Tapes
271 DST_L, // Ampex DST Large Tapes
272 VXATape_1, // Ecrix 8mm Tape
273 VXATape_2, // Ecrix 8mm Tape
274 STK_EAGLE, // STK Eagle
275 LTO_Ultrium, // IBM, HP, Seagate LTO Ultrium
276 LTO_Accelis // IBM, HP, Seagate LTO Accelis
277 } STORAGE_MEDIA_TYPE, *PSTORAGE_MEDIA_TYPE;
278
279 #endif //IOCTL_STORAGE_GET_MEDIA_TYPES_EX
280
281
282 //**********************************************************************************************
283
284 typedef struct _SET_CD_SPEED_USER_IN {
285 ULONG ReadSpeed; // Kbyte/sec 176 = 1X
286 ULONG WriteSpeed; // Kbyte/sec
287 } SET_CD_SPEED_USER_IN, *PSET_CD_SPEED_USER_IN;
288
289 typedef struct _SET_CD_SPEED_EX_USER_IN {
290 ULONG ReadSpeed; // Kbyte/sec 176 = 1X
291 ULONG WriteSpeed; // Kbyte/sec
292 UCHAR RotCtrl;
293 UCHAR Reserved[3];
294 } SET_CD_SPEED_EX_USER_IN, *PSET_CD_SPEED_EX_USER_IN;
295
296 //**********************************************************************************************
297
298 typedef struct _SET_STREAMING_USER_IN {
299 union {
300 UCHAR Flags;
301 struct {
302 UCHAR RA : 1; // Random Access
303 UCHAR Exact : 1;
304 UCHAR RDD : 1; // Restore Defaults
305 UCHAR WRC : 2;
306 UCHAR Reserved0 : 3;
307 } Fields;
308 } Options;
309
310 UCHAR Reserved1[3];
311
312 ULONG StartLBA;
313 ULONG EndLBA;
314
315 ULONG ReadSize; // KBytes
316 ULONG ReadTime; // ms
317
318 ULONG WriteSize; // KBytes
319 ULONG WriteTime; // ms
320 } SET_STREAMING_USER_IN, *PSET_STREAMING_USER_IN;
321
322 //**********************************************************************************************
323
324 /*
325 #ifndef SyncCache_RELADR
326 #define SyncCache_RELADR 0x01
327 #define SyncCache_Immed 0x02
328 #endif //SyncCache_RELADR
329 */
330
331 typedef struct _SYNC_CACHE_USER_IN {
332 union {
333 UCHAR Flags;
334 struct {
335 UCHAR RELADR : 1;
336 UCHAR Immed : 1;
337 UCHAR Reserved0 : 6;
338 } Fields;
339 } Byte1;
340 ULONG LBA;
341 USHORT NumOfBlocks;
342 } SYNC_CACHE_USER_IN, *PSYNC_CACHE_USER_IN;
343
344 //**********************************************************************************************
345
346 typedef struct _BUFFER_CAPACITY_BLOCK_USER_OUT {
347 UCHAR Reserved0[4];
348 ULONG BufferLength;
349 ULONG BlankBufferLength;
350 ULONG WriteStatus;
351 BOOLEAN LostStreaming;
352 ULONG MaximumPhysicalPages;
353 ULONG MaximumTransferLength;
354 ULONG ActualMaximumTransferLength;
355 } BUFFER_CAPACITY_BLOCK_USER_OUT, *PBUFFER_CAPACITY_BLOCK_USER_OUT;
356
357 //**********************************************************************************************
358
359 typedef struct _TRACK_INFO_BLOCK_USER_OUT {
360 USHORT DataLength;
361 UCHAR _TrackNum;
362 UCHAR _SesNum;
363 UCHAR Reserved0;
364
365 union {
366 UCHAR Flags;
367 struct {
368 UCHAR TrackMode : 4;
369 UCHAR Copy : 1;
370 UCHAR Damage : 1;
371 UCHAR Reserved1 : 2;
372 } Fields;
373 } TrackParam;
374
375 union {
376 UCHAR Flags;
377 struct {
378 UCHAR DataMode : 4;
379 UCHAR FP : 1;
380 UCHAR Packet : 1;
381 UCHAR Blank : 1;
382 UCHAR RT : 1;
383 } Fields;
384 } DataParam;
385
386 UCHAR NWA_V;
387 ULONG TrackStartLBA;
388 ULONG NextWriteLBA;
389 ULONG FreeBlocks;
390 ULONG FixPacketSize;
391 ULONG TrackLength;
392
393 // MMC-3
394
395 ULONG LastRecordedAddr;
396 UCHAR _TrackNum2; // MSB
397 UCHAR _SesNum2; // MSB
398 UCHAR Reserved2[2];
399
400 // MMC-5
401
402 ULONG ReadCompatLBA;
403
404 // Additional
405
406 UCHAR TrackStartMSF[3];
407 UCHAR NextWriteMSF[3];
408 ULONG TrackNum;
409 ULONG SesNum;
410
411 } TRACK_INFO_BLOCK_USER_OUT, *PTRACK_INFO_BLOCK_USER_OUT;
412
413 //**********************************************************************************************
414
415 typedef struct _TRACK_INFO_BLOCK_USER_IN {
416 BOOLEAN Track;
417 ULONG LBA_TrkNum;
418 } TRACK_INFO_BLOCK_USER_IN, *PTRACK_INFO_BLOCK_USER_IN;
419
420 //**********************************************************************************************
421
422 typedef READ_CAPACITY_DATA READ_CAPACITY_USER_OUT;
423 typedef PREAD_CAPACITY_DATA PREAD_CAPACITY_USER_OUT;
424
425 //**********************************************************************************************
426
427 typedef struct _GET_SIGNATURE_USER_OUT {
428 ULONG MagicDword;
429 USHORT VersiomMajor ;
430 USHORT VersiomMinor ;
431 USHORT VersiomId ; // alfa/beta/...
432 USHORT Reserved;
433 UCHAR VendorId[32];
434 } GET_SIGNATURE_USER_OUT, *PGET_SIGNATURE_USER_OUT;
435
436 //**********************************************************************************************
437
438 /*
439 #ifndef BlankMedia_Mask
440 #define BlankMedia_Mask 0x07
441 #define BlankMedia_Complete 0x00
442 #define BlankMedia_Minimal 0x01
443 #define BlankMedia_Track 0x02
444 #define BlankMedia_UnreserveTrack 0x03
445 #define BlankMedia_TrackTail 0x04
446 #define BlankMedia_UncloseLastSes 0x05
447 #define BlankMedia_EraseSes 0x06
448 #define BlankMedia_Immed 0x10
449 #endif //BlankMedia_Mask
450 */
451
452 typedef struct _BLANK_MEDIA_USER_IN {
453 union {
454 UCHAR Flags;
455 ULONG Reserved;
456 struct {
457 UCHAR BlankType : 3;
458 UCHAR Reserved0 : 1;
459 UCHAR Immed : 1;
460 UCHAR Reserved1 : 3;
461 } Fields;
462 } Byte1;
463 ULONG StartAddr_TrkNum;
464 } BLANK_MEDIA_USER_IN, *PBLANK_MEDIA_USER_IN;
465
466 //**********************************************************************************************
467
468 typedef struct _RESERVE_TRACK_USER_IN {
469 ULONG Size;
470 } RESERVE_TRACK_USER_IN, *PRESERVE_TRACK_USER_IN;
471
472 #define RESERVE_TRACK_EX_SIZE 0x0
473 #define RESERVE_TRACK_EX_START_LBA 0x1
474 #define RESERVE_TRACK_EX_RMZ 0x2
475
476 typedef struct _RESERVE_TRACK_EX_USER_IN {
477 ULONG Flags;
478 union {
479 ULONG Size;
480 ULONG StartLBA;
481 };
482 } RESERVE_TRACK_EX_USER_IN, *PRESERVE_TRACK_EX_USER_IN;
483
484 //**********************************************************************************************
485
486 typedef struct _LL_WRITE_USER_IN {
487 union {
488 UCHAR Flags;
489 ULONG Reserved;
490 struct {
491 UCHAR RELADR : 1;
492 UCHAR Reserved0 : 2;
493 UCHAR FUA : 1;
494 UCHAR DPO : 1;
495 UCHAR Reserved1 : 3;
496 } Fields;
497 } Flags;
498 ULONG LBA;
499 USHORT NumOfBlocks;
500 UCHAR Reserved1[2];
501 } LL_WRITE_USER_IN, *PLL_WRITE_USER_IN;
502
503 //**********************************************************************************************
504
505 //#ifndef WITHOUT_FORMATTER
506
507 /*
508 #ifndef FormatDesc_Grow
509 #define FormatDesc_Grow 0x40
510 #define FormatDesc_Ses 0x80
511 #endif
512 */
513
514 #define FORMAT_UNIT_FORCE_STD_MODE 0x80000000
515 #define FORMAT_UNIT_FORCE_FULL_FMT 0x40000000
516 #define FORMAT_UNIT_RESTART_MRW 0x01000000
517
518 typedef struct _FORMAT_CDRW_PARAMETERS_USER_IN {
519 union {
520 UCHAR Flags;
521 ULONG FlagsEx;
522 struct {
523 UCHAR Reserved0: 6;
524 UCHAR Grow: 1;
525 UCHAR Ses: 1;
526 } Fields;
527 } Flags;
528 LONG BlockCount;
529 } FORMAT_CDRW_PARAMETERS_USER_IN, *PFORMAT_CDRW_PARAMETERS_USER_IN;
530
531 //#endif //WITHOUT_FORMATTER
532
533 //**********************************************************************************************
534
535 /*
536 #ifndef CloseTrkSes_Immed
537 #define CloseTrkSes_Immed 0x01
538
539 #define CloseTrkSes_Trk 0x01
540 #define CloseTrkSes_Ses 0x02
541
542 #define CloseTrkSes_LastTrkSes 0xff
543 #endif
544 */
545
546 typedef struct _CLOSE_TRK_SES_USER_IN {
547 union {
548 UCHAR Flags;
549 struct {
550 UCHAR Immed : 1;
551 UCHAR Reserved0 : 7;
552 } Fields;
553 } Byte1;
554 union {
555 UCHAR Flags;
556 struct {
557 UCHAR Track : 1;
558 UCHAR Session : 1;
559 UCHAR Reserved0 : 6;
560 } Fields;
561 } Byte2;
562 UCHAR TrackNum;
563 } CLOSE_TRK_SES_USER_IN, *PCLOSE_TRK_SES_USER_IN;
564
565 //**********************************************************************************************
566
567 typedef struct _PREVENT_MEDIA_REMOVAL_USER_IN {
568 BOOLEAN PreventMediaRemoval;
569 } PREVENT_MEDIA_REMOVAL_USER_IN, *PPREVENT_MEDIA_REMOVAL_USER_IN;
570
571 //**********************************************************************************************
572
573 typedef struct _SET_RANDOM_ACCESS_USER_IN {
574 BOOLEAN RandomAccessMode;
575 } SET_RANDOM_ACCESS_USER_IN, *PSET_RANDOM_ACCESS_USER_IN;
576
577 //**********************************************************************************************
578
579 /*
580 #ifndef DiscInfo_Disk_Mask
581 #define DiscInfo_Disk_Mask 0x03
582 #define DiscInfo_Disk_Empty 0x00
583 #define DiscInfo_Disk_Appendable 0x01
584 #define DiscInfo_Disk_Complete 0x02
585
586 #define DiscInfo_Ses_Mask 0x0C
587 #define DiscInfo_Ses_Empty 0x00
588 #define DiscInfo_Ses_Incomplete 0x04
589 #define DiscInfo_Ses_Complete 0x0C
590
591 #define DiscInfo_Disk_Erasable 0x10
592
593 #define DiscInfo_URU 0x10
594 #define DiscInfo_DBC_V 0x20
595 #define DiscInfo_DID_V 0x40
596
597 #define DiscInfo_Type_cdrom 0x00 // CD-DA / CD-ROM
598 #define DiscInfo_Type_cdi 0x10 // CD-I
599 #define DiscInfo_Type_cdromxa 0x20 // CD-ROM XA
600 #define DiscInfo_Type_unknown 0xFF // HZ ;)
601
602 #endif
603 */
604
605 typedef struct _DISC_STATUS_INFO_USER_OUT {
606 UCHAR ErrorCode;
607 UCHAR SenseKey;
608 UCHAR AdditionalSenseCode;
609 UCHAR AdditionalSenseCodeQualifier;
610 UCHAR SrbStatus;
611 BOOLEAN RandomAccessMode;
612 BOOLEAN CUE_sent;
613 UCHAR Flags;
614 LARGE_INTEGER MediaChangeTime;
615
616 UCHAR LastSesLeadInMSF[4];
617 UCHAR LastSesLeadOutMSF[4];
618
619 ULONG NumOfSes;
620 ULONG FirstTrackNumLastSes;
621 ULONG LastTrackNumLastSes;
622 ULONG Reserved1; // this is used to align data
623
624 } DISC_STATUS_INFO_USER_OUT, *PDISC_STATUS_INFO_USER_OUT;
625
626 #define DiscStatus_Formattable 0x01
627
628 typedef struct _DISC_INFO_BLOCK_USER_OUT { //
629
630 DISC_STATUS_INFO_USER_OUT Status;
631
632 USHORT DataLength;
633
634 union {
635 UCHAR Flags;
636 struct {
637 UCHAR DiscStat : 2;
638 UCHAR LastSesStat : 2;
639 UCHAR Erasable : 1;
640 UCHAR Reserved0: 3;
641 } Fields;
642 } DiscStat;
643
644 UCHAR FirstTrackNum;
645 UCHAR NumOfSes;
646 UCHAR FirstTrackNumLastSes;
647 UCHAR LastTrackNumLastSes;
648
649 union {
650 UCHAR Flags;
651 struct {
652 UCHAR Reserved1: 5;
653 UCHAR URU : 1;
654 UCHAR DBC_V : 1; // 0
655 UCHAR DID_V : 1;
656 } Fields;
657 } Flags;
658
659 UCHAR DiskType;
660 UCHAR NumOfSes2; // MSB MMC-3
661 UCHAR FirstTrackNumLastSes2; // MSB MMC-3
662 UCHAR LastTrackNumLastSes2; // MSB MMC-3
663 UCHAR DiskId [4];
664 ULONG LastSesLeadInLBA;
665 ULONG LastSesLeadOutLBA;
666 UCHAR DiskBarCode [8];
667 UCHAR Reserved3;
668 UCHAR OPCNum;
669 } DISC_INFO_BLOCK_USER_OUT, *PDISC_INFO_BLOCK_USER_OUT;
670
671 //**********************************************************************************************
672
673 typedef struct _TEST_UNIT_READY_USER_IN {
674 ULONG MaxReadyRetry;
675 } TEST_UNIT_READY_USER_IN, *PTEST_UNIT_READY_USER_IN;
676
677 typedef struct _TEST_UNIT_READY_USER_OUT {
678 UCHAR ErrorCode;
679 UCHAR SenseKey;
680 UCHAR AdditionalSenseCode;
681 UCHAR AdditionalSenseCodeQualifier;
682 } TEST_UNIT_READY_USER_OUT, *PTEST_UNIT_READY_USER_OUT;
683
684 //**********************************************************************************************
685
686 /*
687 #ifndef MediaType_Unknown
688
689 #define MediaType_Unknown 0x00
690 #define MediaType_120mm_CDROM_DataOnly 0x01
691 #define MediaType_120mm_CDROM_AudioOnly 0x02 //CDDA
692 #define MediaType_120mm_CDROM_DataAudioCombined 0x03
693 #define MediaType_120mm_CDROM_Hybrid_PhotoCD 0x04
694 #define MediaType_80mm_CDROM_DataOnly 0x05
695 #define MediaType_80mm_CDROM_AudioOnly 0x06 //CDDA
696 #define MediaType_80mm_CDROM_DataAudioCombined 0x07
697 #define MediaType_80mm_CDROM_Hybrid_PhotoCD 0x08
698
699 #define MediaType_UnknownSize_CDR 0x10
700 #define MediaType_120mm_CDR_DataOnly 0x11
701 #define MediaType_120mm_CDR_AudioOnly 0x12 //CDDA
702 #define MediaType_120mm_CDR_DataAudioCombined 0x13
703 #define MediaType_120mm_CDR_Hybrid_PhotoCD 0x14
704 #define MediaType_80mm_CDR_DataOnly 0x15
705 #define MediaType_80mm_CDR_AudioOnly 0x16 //CDDA
706 #define MediaType_80mm_CDR_DataAudioCombined 0x17
707 #define MediaType_80mm_CDR_Hybrid_Photo_CD 0x18
708
709 #define MediaType_UnknownSize_CDRW 0x20
710 #define MediaType_120mm_CDRW_DataOnly 0x21
711 #define MediaType_120mm_CDRW_AudioOnly 0x22 //CDDA
712 #define MediaType_120mm_CDRW_DataAudioCombined 0x23
713 #define MediaType_120mm_CDRW_Hybrid 0x24
714 #define MediaType_80mm_CDRW_DataOnly 0x25
715 #define MediaType_80mm_CDRW_AudioOnly 0x26 //CDDA
716 #define MediaType_80mm_CDRW_DataAudioCombined 0x27
717 #define MediaType_80mm_CDRW_Hybrid 0x28
718
719 #define MediaType_UnknownSize_Unknown 0x30
720
721 #define MediaType_NoDiscPresent 0x70
722 #define MediaType_DoorOpen 0x71
723
724 #endif
725 */
726
727 typedef struct _GET_MEDIA_TYPE_USER_OUT {
728 UCHAR MediaType;
729 } GET_MEDIA_TYPE_USER_OUT, *PGET_MEDIA_TYPE_USER_OUT;
730
731 typedef struct _GET_MEDIA_TYPE_EX_USER_OUT {
732 UCHAR OldStyleMediaType; // see GET_MEDIA_TYPE_USER_OUT
733 UCHAR MediaClass;
734 UCHAR MediaSize;
735 UCHAR DataType;
736 UCHAR MediaClassEx;
737 UCHAR DataClassEx;
738 UCHAR CapFlags;
739 UCHAR Layers; // Number of layers - 1 (e.g. 0 => 1 layer)
740 UCHAR Reserved[8]; // for future implementation
741 } GET_MEDIA_TYPE_EX_USER_OUT, *PGET_MEDIA_TYPE_EX_USER_OUT;
742
743 #define CdMediaClass_CDROM 0x00
744 #define CdMediaClass_CDR 0x01
745 #define CdMediaClass_CDRW 0x02
746 #define CdMediaClass_DVDROM 0x03
747 #define CdMediaClass_DVDRAM 0x05
748 #define CdMediaClass_DVDR 0x06
749 #define CdMediaClass_DVDRW 0x07
750 #define CdMediaClass_DVDpR 0x08
751 #define CdMediaClass_DVDpRW 0x09
752 #define CdMediaClass_DDCDROM 0x0a
753 #define CdMediaClass_DDCDR 0x0b
754 #define CdMediaClass_DDCDRW 0x0c
755 #define CdMediaClass_BDROM 0x0d
756 #define CdMediaClass_BDRE 0x0e
757 #define CdMediaClass_BDR 0x0f
758 #define CdMediaClass_HD_DVDROM 0x10
759 #define CdMediaClass_HD_DVDRAM 0x11
760 #define CdMediaClass_HD_DVDR 0x12
761 #define CdMediaClass_HD_DVDRW 0x13
762 #define CdMediaClass_NoDiscPresent 0x70
763 #define CdMediaClass_DoorOpen 0x71
764 #define CdMediaClass_Unknown 0xff
765
766 #define CdMediaClass_Max CdMediaClass_HD_DVDRW
767
768 #define CdMediaSize_Unknown 0
769 #define CdMediaSize_120mm 1
770 #define CdMediaSize_80mm 2
771
772 #define CdDataType_Unknown 0
773 #define CdDataType_DataOnly 1
774 #define CdDataType_AudioOnly 2 //CDDA
775 #define CdDataType_DataAudioCombined 3
776 #define CdDataType_Hybrid 4
777 #define CdDataType_DataOnlyMRW 5
778
779 #define CdMediaClassEx_CD 0x00
780 #define CdMediaClassEx_DVD 0x01
781 #define CdMediaClassEx_DDCD 0x02
782 #define CdMediaClassEx_BD 0x03
783 #define CdMediaClassEx_HD_DVD 0x04
784 #define CdMediaClassEx_None 0x70
785 #define CdMediaClassEx_Unknown 0xff
786
787 #define CdDataClassEx_ROM 0x00
788 #define CdDataClassEx_R 0x01
789 #define CdDataClassEx_RW 0x02
790 #define CdDataClassEx_Unknown 0xff
791
792 #define CdCapFlags_Writable 0x01
793 #define CdCapFlags_Erasable 0x02
794 #define CdCapFlags_Formatable 0x04
795 #define CdCapFlags_WriteParamsReq 0x08
796 #define CdCapFlags_RandomWritable 0x10
797 #define CdCapFlags_Cav 0x20
798
799 #define CdrwMediaClassEx_IsRAM(MediaClassEx) ( \
800 ((MediaClassEx) == CdMediaClass_DVDRAM) || \
801 ((MediaClassEx) == CdMediaClass_BDRE) || \
802 ((MediaClassEx) == CdMediaClass_HD_DVDRAM) )
803
804 #define CdrwIsDvdOverwritable(MediaClassEx) \
805 ((MediaClassEx) == CdMediaClass_DVDRW || \
806 (MediaClassEx) == CdMediaClass_DVDpRW || \
807 (MediaClassEx) == CdMediaClass_DVDRAM || \
808 (MediaClassEx) == CdMediaClass_BDRE || \
809 (MediaClassEx) == CdMediaClass_HD_DVDRW || \
810 (MediaClassEx) == CdMediaClass_HD_DVDRAM \
811 )
812
813 //**********************************************************************************************
814
815 /*
816 #ifndef MAX_PAGE_SIZE
817 #define MAX_PAGE_SIZE 0x100
818 #endif
819 */
820
821 typedef struct _MODE_SENSE_USER_IN {
822 union {
823 UCHAR Byte;
824 struct {
825 UCHAR PageCode : 6;
826 UCHAR Reserved0: 1;
827 UCHAR PageSavable : 1;
828 } Fields;
829 } PageCode;
830 } MODE_SENSE_USER_IN, *PMODE_SENSE_USER_IN;
831
832 typedef struct _MODE_SENSE_USER_OUT {
833 MODE_PARAMETER_HEADER Header;
834 } MODE_SENSE_USER_OUT, *PMODE_SENSE_USER_OUT;
835
836 //**********************************************************************************************
837
838 typedef struct _MODE_SELECT_USER_IN {
839 MODE_PARAMETER_HEADER Header;
840 } MODE_SELECT_USER_IN, *PMODE_SELECT_USER_IN;
841
842 //**********************************************************************************************
843
844 typedef struct _MODE_WRITE_PARAMS_PAGE_USER { // 0x05
845 UCHAR PageCode : 6;
846 UCHAR Reserved0: 1;
847 UCHAR PageSavable : 1;
848
849 UCHAR PageLength; // 0x32
850
851 /*
852 #ifndef WParam_WType_Mask
853 #define WParam_WType_Mask 0x0f
854 #define WParam_WType_Packet 0x00
855 #define WParam_WType_TAO 0x01
856 #define WParam_WType_Ses 0x02
857 #define WParam_WType_Raw 0x03
858 #define WParam_TestWrite 0x10
859 #define WParam_LS_V 0x20
860 #define WParam_BUFF 0x40
861 #endif
862 */
863
864 union {
865 UCHAR Flags;
866 struct {
867 UCHAR WriteType: 4; // 1
868 UCHAR TestWrite: 1;
869 UCHAR LS_V: 1;
870 UCHAR BUFF: 1;
871 UCHAR Reserved1: 1;
872 } Fields;
873 } Byte2;
874
875 /*
876 #ifndef WParam_TrkMode_Mask
877 #define WParam_TrkMode_Mask 0x0f
878 #define WParam_TrkMode_None 0x00
879 #define WParam_TrkMode_Audio 0x00
880 #define WParam_TrkMode_Audio_PreEmph 0x01
881 #define WParam_TrkMode_Data 0x04
882 #define WParam_TrkMode_IncrData 0x05
883 #define WParam_TrkMode_QAudio_PreEmph 0x08
884 #define WParam_TrkMode_AllowCpy 0x02
885 #define WParam_Copy 0x10
886 #define WParam_FP 0x20
887 #define WParam_MultiSes_Mask 0xc0
888 #define WParam_Multises_None 0x00
889 #define WParam_Multises_Final 0x80
890 #define WParam_Multises_Multi 0xc0
891 #endif
892 */
893
894 union {
895 UCHAR Flags;
896 struct {
897 UCHAR TrackMode: 4; // 4
898 UCHAR Copy : 1; // 0
899 UCHAR FP : 1; // 0
900 UCHAR Multisession: 2; // 11
901 } Fields;
902 } Byte3;
903
904 /*
905 #ifndef WParam_BlkType_Mask
906 #define WParam_BlkType_Mask 0x0f
907 #define WParam_BlkType_Raw_2352 0x00
908 #define WParam_BlkType_RawPQ_2368 0x01
909 #define WParam_BlkType_RawPW_2448 0x02
910 #define WParam_BlkType_RawPW_R_2448 0x03
911 #define WParam_BlkType_M1_2048 0x08
912 #define WParam_BlkType_M2_2336 0x09
913 #define WParam_BlkType_M2XAF1_2048 0x0a
914 #define WParam_BlkType_M2XAF1SH_2056 0x0b
915 #define WParam_BlkType_M2XAF2_2324 0x0c
916 #define WParam_BlkType_M2XAFXSH_2332 0x0d
917 #endif
918 */
919
920 union {
921 UCHAR Flags;
922 struct {
923 UCHAR DataBlockType: 4; // 8
924 UCHAR Reserved2: 4;
925 } Fields;
926 } Byte4;
927
928 UCHAR LinkSize;
929 UCHAR Reserved3;
930
931 union {
932 UCHAR Flags;
933 struct {
934 UCHAR HostAppCode : 6; // 0
935 UCHAR Reserved4: 2;
936 } Fields;
937 } Byte7;
938
939 /*
940 #ifndef WParam_SesFmt_CdRom
941 #define WParam_SesFmt_CdRom 0x00
942 #define WParam_SesFmt_CdI 0x10
943 #define WParam_SesFmt_CdRomXa 0x20
944 #endif
945 */
946
947 UCHAR SesFmt; // 0
948 UCHAR Reserved5;
949 ULONG PacketSize; // 0
950 USHORT AudioPause; // 150
951
952 UCHAR Reserved6: 7;
953 UCHAR MCVAL : 1;
954
955 UCHAR N[13];
956 UCHAR Zero;
957 UCHAR AFRAME;
958
959 UCHAR Reserved7: 7;
960 UCHAR TCVAL : 1;
961
962 UCHAR I[12];
963 UCHAR Zero_2;
964 UCHAR AFRAME_2;
965 UCHAR Reserved8;
966
967 struct {
968 union {
969 UCHAR MSF[3];
970 struct _SubHdrParams1 {
971 UCHAR FileNum;
972 UCHAR ChannelNum;
973
974 /*
975 #define WParam_SubHdr_SubMode0 0x00
976 #define WParam_SubHdr_SubMode1 0x08
977 */
978
979 UCHAR SubMode;
980 } Params1;
981 } Params;
982
983 /*
984 #define WParam_SubHdr_Mode_Mask 0x03
985 #define WParam_SubHdr_Mode0 0x00
986 #define WParam_SubHdr_Mode1 0x01
987 #define WParam_SubHdr_Mode2 0x02
988 #define WParam_SubHdr_Format_Mask 0xe0
989 #define WParam_SubHdr_Format_UserData 0x00
990 #define WParam_SubHdr_Format_RunIn4 0x20
991 #define WParam_SubHdr_Format_RunIn3 0x40
992 #define WParam_SubHdr_Format_RunIn2 0x60
993 #define WParam_SubHdr_Format_RunIn1 0x80
994 #define WParam_SubHdr_Format_Link 0xa0
995 #define WParam_SubHdr_Format_RunOut2 0xc0
996 #define WParam_SubHdr_Format_RunOut1 0xe0
997 */
998
999 union {
1000 UCHAR Flags;
1001 struct {
1002 UCHAR Mode : 2;
1003 UCHAR Reserved : 3;
1004 UCHAR Format : 3;
1005 } Fields;
1006 } Mode;
1007 } SubHeader;
1008 } MODE_WRITE_PARAMS_PAGE_USER, *PMODE_WRITE_PARAMS_PAGE_USER;
1009
1010 typedef MODE_WRITE_PARAMS_PAGE_USER GET_WRITE_MODE_USER_OUT;
1011 typedef PMODE_WRITE_PARAMS_PAGE_USER PGET_WRITE_MODE_USER_OUT;
1012
1013 typedef MODE_WRITE_PARAMS_PAGE_USER SET_WRITE_MODE_USER_IN;
1014 typedef PMODE_WRITE_PARAMS_PAGE_USER PSET_WRITE_MODE_USER_IN;
1015
1016 //**********************************************************************************************
1017
1018 #ifndef WITHOUT_FORMATTER
1019
1020 typedef MODE_MRW_PAGE GET_MRW_MODE_USER_OUT;
1021 typedef PMODE_MRW_PAGE PGET_MRW_MODE_USER_OUT;
1022
1023 typedef MODE_MRW_PAGE SET_MRW_MODE_USER_IN;
1024 typedef PMODE_MRW_PAGE PSET_MRW_MODE_USER_IN;
1025
1026 #endif //WITHOUT_FORMATTER
1027
1028 //**********************************************************************************************
1029
1030 typedef struct _SET_READ_AHEAD_USER_IN {
1031 ULONG TriggerLBA;
1032 ULONG ReadAheadLBA;
1033 } SET_READ_AHEAD_USER_IN, *PSET_READ_AHEAD_USER_IN;
1034
1035 //**********************************************************************************************
1036
1037 typedef struct _GET_CAPABILITIES_USER_OUT {
1038 UCHAR PageCode : 6;
1039 UCHAR Reserved1 : 1;
1040 UCHAR PSBit : 1;
1041
1042 UCHAR PageLength;
1043
1044 /*
1045 #ifndef DevCap_read_cd_r
1046 #define DevCap_read_cd_r 0x01 // reserved in 1.2
1047 #define DevCap_read_cd_rw 0x02 // reserved in 1.2
1048 #define DevCap_method2 0x04
1049 #define DevCap_read_dvd_rom 0x08
1050 #define DevCap_read_dvd_r 0x10
1051 #define DevCap_read_dvd_ram 0x20
1052 #endif //DevCap_cd_r_read
1053 */
1054
1055 UCHAR ReadCap; // DevCap_*_read
1056 /* UCHAR cd_r_read : 1; // reserved in 1.2
1057 UCHAR cd_rw_read : 1; // reserved in 1.2
1058 UCHAR method2 : 1;
1059 UCHAR dvd_rom : 1;
1060 UCHAR dvd_r_read : 1;
1061 UCHAR dvd_ram_read : 1;
1062 UCHAR Reserved2 : 2;*/
1063
1064 /*
1065 #ifndef DevCap_write_cd_r
1066 #define DevCap_write_cd_r 0x01 // reserved in 1.2
1067 #define DevCap_write_cd_rw 0x02 // reserved in 1.2
1068 #define DevCap_test_write 0x04
1069 #define DevCap_write_dvd_r 0x10
1070 #define DevCap_write_dvd_ram 0x20
1071 #endif //DevCap_cd_r_write
1072 */
1073
1074 UCHAR WriteCap; // DevCap_*_write
1075 /* UCHAR cd_r_write : 1; // reserved in 1.2
1076 UCHAR cd_rw_write : 1; // reserved in 1.2
1077 UCHAR dvd_ram_write : 1;
1078 UCHAR dvd_r_write : 1;
1079 UCHAR reserved3a : 1;
1080 UCHAR test_write : 1;
1081 UCHAR Reserved3 : 2;*/
1082
1083 /*
1084 #ifndef DevCap_audio_play
1085 #define DevCap_audio_play 0x01
1086 #define DevCap_composite 0x02
1087 #define DevCap_digport1 0x04
1088 #define DevCap_digport2 0x08
1089 #define DevCap_mode2_form1 0x10
1090 #define DevCap_mode2_form2 0x20
1091 #define DevCap_multisession 0x40
1092 #endif //DevCap_audio_play
1093 */
1094
1095 UCHAR Capabilities0;
1096 /* UCHAR audio_play : 1;
1097 UCHAR composite : 1;
1098 UCHAR digport1 : 1;
1099 UCHAR digport2 : 1;
1100 UCHAR mode2_form1 : 1;
1101 UCHAR mode2_form2 : 1;
1102 UCHAR multisession : 1;
1103 UCHAR Reserved4 : 1;*/
1104
1105 /*
1106 #ifndef DevCap_cdda
1107 #define DevCap_cdda 0x01
1108 #define DevCap_cdda_accurate 0x02
1109 #define DevCap_rw_supported 0x04
1110 #define DevCap_rw_corr 0x08
1111 #define DevCap_c2_pointers 0x10
1112 #define DevCap_isrc 0x20
1113 #define DevCap_upc 0x40
1114 #define DevCap_read_bar_code 0x80
1115 #endif //DevCap_cdda
1116 */
1117
1118 UCHAR Capabilities1;
1119 /* UCHAR cdda : 1;
1120 UCHAR cdda_accurate : 1;
1121 UCHAR rw_supported : 1;
1122 UCHAR rw_corr : 1;
1123 UCHAR c2_pointers : 1;
1124 UCHAR isrc : 1;
1125 UCHAR upc : 1;
1126 UCHAR Reserved5 : 1;*/
1127
1128 /*
1129 #ifndef DevCap_lock
1130 #define DevCap_lock 0x01
1131 #define DevCap_lock_state 0x02
1132 #define DevCap_prevent_jumper 0x04
1133 #define DevCap_eject 0x08
1134 #define DevCap_mechtype_mask 0xE0
1135 #define DevCap_mechtype_caddy 0x00
1136 #define DevCap_mechtype_tray (0x01<<5)
1137 #define DevCap_mechtype_popup (0x02<<5)
1138 #define DevCap_mechtype_individual_changer (0x04<<5)
1139 #define DevCap_mechtype_cartridge_changer (0x05<<5)
1140 #endif //DevCap_lock
1141 */
1142
1143 UCHAR Capabilities2;
1144 /* UCHAR lock : 1;
1145 UCHAR lock_state : 1;
1146 UCHAR prevent_jumper : 1;
1147 UCHAR eject : 1;
1148 UCHAR Reserved6 : 1;
1149 UCHAR mechtype : 3;*/
1150
1151 /*
1152 #ifndef DevCap_separate_volume
1153 #define DevCap_separate_volume 0x01
1154 #define DevCap_separate_mute 0x02
1155 #define DevCap_disc_present 0x04 // reserved in 1.2
1156 #define DevCap_sw_slot_select 0x08 // reserved in 1.2
1157 #define DevCap_change_side_cap 0x10
1158 #define DevCap_rw_leadin_read 0x20
1159 #endif //DevCap_separate_volume
1160 */
1161
1162 UCHAR Capabilities3;
1163 /* UCHAR separate_volume : 1;
1164 UCHAR separate_mute : 1;
1165 UCHAR disc_present : 1; // reserved in 1.2
1166 UCHAR sss : 1; // reserved in 1.2
1167 UCHAR Reserved7 : 4;*/
1168
1169 USHORT MaximumSpeedSupported;
1170 USHORT NumberVolumeLevels;
1171 USHORT BufferSize;
1172 USHORT CurrentSpeed;
1173
1174 UCHAR Reserved8;
1175
1176 UCHAR SpecialParameters0;
1177 /* UCHAR Reserved9 : 1;
1178 UCHAR BCK : 1;
1179 UCHAR RCK : 1;
1180 UCHAR LSBF : 1;
1181 UCHAR Length : 2;
1182 UCHAR Reserved10 : 2;*/
1183
1184 USHORT MaximumWriteSpeedSupported;
1185 USHORT CurrentWriteSpeed;
1186 USHORT CopyManagementRevision;
1187 UCHAR Reserved11[2];
1188
1189 } GET_CAPABILITIES_USER_OUT, *PGET_CAPABILITIES_USER_OUT;
1190
1191 typedef struct _GET_CAPABILITIES_3_USER_OUT {
1192
1193 UCHAR PageCode : 6;
1194 UCHAR Reserved1 : 1;
1195 UCHAR PSBit : 1;
1196
1197 UCHAR PageLength;
1198 UCHAR ReadCap; // DevCap_*_read
1199 UCHAR WriteCap; // DevCap_*_write
1200 UCHAR Capabilities0;
1201 UCHAR Capabilities1;
1202 UCHAR Capabilities2;
1203 UCHAR Capabilities3;
1204 USHORT MaximumSpeedSupported;
1205 USHORT NumberVolumeLevels;
1206 USHORT BufferSize;
1207 USHORT CurrentSpeed;
1208
1209 UCHAR Reserved8;
1210 UCHAR SpecialParameters0;
1211
1212 USHORT MaximumWriteSpeedSupported;
1213 USHORT CurrentWriteSpeed;
1214 USHORT CopyManagementRevision;
1215 UCHAR Reserved11[2];
1216
1217 // MMC 3
1218
1219 UCHAR Reserved12;
1220
1221 UCHAR SpecialParameters1;
1222 /* UCHAR RCS : 2; // rotation control selected
1223 UCHAR Reserved13 : 6; */
1224
1225 USHORT CurrentWriteSpeed3;
1226 USHORT LunWPerfDescriptorCount;
1227
1228 // LUN_WRITE_PERF_DESC_USER WritePerfDescs[0];
1229
1230 } GET_CAPABILITIES_3_USER_OUT, *PGET_CAPABILITIES_3_USER_OUT;
1231
1232 typedef struct _LUN_WRITE_PERF_DESC_USER {
1233 UCHAR Reserved;
1234
1235 #define LunWPerf_RotCtrl_Mask 0x07
1236 #define LunWPerf_RotCtrl_CLV 0x00
1237 #define LunWPerf_RotCtrl_CAV 0x01
1238
1239 UCHAR RotationControl;
1240 USHORT WriteSpeedSupported; // kbps
1241
1242 } LUN_WRITE_PERF_DESC_USER, *PLUN_WRITE_PERF_DESC_USER;
1243
1244 //**********************************************************************************************
1245
1246 typedef struct _SEND_OPC_INFO_USER_IN {
1247 USHORT Speed;
1248 UCHAR OpcValue[6];
1249 } SEND_OPC_INFO_USER_IN, *PSEND_OPC_INFO_USER_IN;
1250
1251 typedef struct _SEND_OPC_INFO_HEADER_USER_IN {
1252 BOOLEAN DoOpc;
1253 USHORT OpcBlocksNumber;
1254 } SEND_OPC_INFO_HEADER_USER_IN, *PSEND_OPC_INFO_HEADER_USER_IN;
1255
1256 //**********************************************************************************************
1257
1258 typedef struct _LL_READ_USER_IN {
1259
1260 #define ReadCd_BlkType_Mask 0x1c
1261 #define ReadCd_BlkType_Any (0x00<<2)
1262 #define ReadCd_BlkType_CDDA (0x01<<2)
1263 #define ReadCd_BlkType_M1 (0x02<<2)
1264 #define ReadCd_BlkType_M2FX (0x03<<2)
1265 #define ReadCd_BlkType_M2F1 (0x04<<2)
1266 #define ReadCd_BlkType_M2F2 (0x05<<2)
1267
1268 UCHAR ExpectedBlkType;
1269
1270 ULONG LBA; // negative value (-1) indicates tha (H)MSF must be used
1271 ULONG NumOfBlocks;
1272
1273 #define ReadCd_Error_Mask 0x0006
1274 #define ReadCd_Error_None 0x0000
1275 #define ReadCd_Error_C2 0x0002
1276 #define ReadCd_Error_C2ex 0x0004
1277 #define ReadCd_Include_EDC 0x0008
1278 #define ReadCd_Include_UsrData 0x0010
1279 #define ReadCd_Header_Mask 0x0060
1280 #define ReadCd_Header_None 0x0000
1281 #define ReadCd_Header_Hdr 0x0020
1282 #define ReadCd_Header_SubHdr 0x0040
1283 #define ReadCd_Header_AllHdr 0x0060
1284 #define ReadCd_Include_SyncData 0x0080
1285 #define ReadCd_SubChan_Mask 0x0700
1286 #define ReadCd_SubChan_None 0x0000
1287 #define ReadCd_SubChan_Raw 0x0100
1288 #define ReadCd_SubChan_Q 0x0200
1289 #define ReadCd_SubChan_PW 0x0400
1290 #define ReadCd_SubChan_All ReadCd_SubChan_Mask
1291
1292 union {
1293 USHORT Flags;
1294 struct {
1295 UCHAR Reserved2 : 1;
1296 UCHAR ErrorFlags : 2;
1297 UCHAR IncludeEDC : 1;
1298 UCHAR IncludeUserData : 1;
1299 UCHAR HeaderCode : 2;
1300 UCHAR IncludeSyncData : 1;
1301
1302 UCHAR SubChannelSelection : 3;
1303 UCHAR Reserved3 : 5;
1304 } Fields;
1305 } Flags;
1306
1307 BOOLEAN UseMFS;
1308 CHAR Starting_MSF[3];
1309 CHAR Ending_MSF[3];
1310
1311 } LL_READ_USER_IN, *PLL_READ_USER_IN;
1312
1313 //**********************************************************************************************
1314
1315 typedef struct _GET_LAST_ERROR_USER_OUT {
1316
1317 UCHAR ErrorCode;
1318 UCHAR SenseKey;
1319 UCHAR AdditionalSenseCode;
1320 UCHAR AdditionalSenseCodeQualifier;
1321 UCHAR SrbStatus;
1322 ULONG LastError;
1323 BOOLEAN RandomAccessMode;
1324 LARGE_INTEGER MediaChangeTime;
1325 ULONG MediaChangeCount;
1326
1327 } GET_LAST_ERROR_USER_OUT, *PGET_LAST_ERROR_USER_OUT;
1328
1329 //**********************************************************************************************
1330
1331 typedef struct _RAW_READ_USER_IN {
1332 LARGE_INTEGER DiskOffset;
1333 ULONG SectorCount;
1334 TRACK_MODE_TYPE TrackMode;
1335 } RAW_READ_USER_IN, *PRAW_READ_USER_IN;
1336
1337 //**********************************************************************************************
1338
1339 typedef struct _PLAY_AUDIO_MSF_USER_IN {
1340 UCHAR StartingMSF[3];
1341 UCHAR EndingMSF[3];
1342 } PLAY_AUDIO_MSF_USER_IN, *PPLAY_AUDIO_MSF_USER_IN;
1343
1344 //**********************************************************************************************
1345
1346 #define AudioStatus_NotSupported 0x00
1347 #define AudioStatus_InProgress 0x11
1348 #define AudioStatus_Paused 0x12
1349 #define AudioStatus_PlayComplete 0x13
1350 #define AudioStatus_PlayError 0x14
1351 #define AudioStatus_NoStatus 0x15
1352
1353 #define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
1354 #define IOCTL_CDROM_CURRENT_POSITION 0x01
1355 #define IOCTL_CDROM_MEDIA_CATALOG 0x02
1356 #define IOCTL_CDROM_TRACK_ISRC 0x03
1357
1358 typedef struct _SUB_Q_CHANNEL_DATA_USER_IN {
1359 UCHAR Format;
1360 UCHAR Track;
1361 } SUB_Q_CHANNEL_DATA_USER_IN, *PSUB_Q_CHANNEL_DATA_USER_IN;
1362
1363 //**********************************************************************************************
1364
1365 typedef struct _SEEK_AUDIO_MSF_USER_IN {
1366 UCHAR MSF[3];
1367 } SEEK_AUDIO_MSF_USER_IN, *PSEEK_AUDIO_MSF_USER_IN;
1368
1369 //**********************************************************************************************
1370
1371 typedef struct _AUDIO_CONTROL_USER_OUT {
1372 UCHAR LbaFormat;
1373 USHORT LogicalBlocksPerSecond;
1374 } AUDIO_CONTROL_USER_OUT, *PAUDIO_CONTROL_USER_OUT;
1375
1376 //**********************************************************************************************
1377
1378 typedef READ_TOC_TOC READ_TOC_USER_OUT;
1379 typedef PREAD_TOC_TOC PREAD_TOC_USER_OUT;
1380
1381 typedef READ_TOC_SES GET_LAST_SESSION_USER_OUT;
1382 typedef PREAD_TOC_SES PGET_LAST_SESSION_USER_OUT;
1383
1384 typedef READ_TOC_FULL_TOC READ_FULL_TOC_USER_OUT;
1385 typedef PREAD_TOC_FULL_TOC PREAD_FULL_TOC_USER_OUT;
1386
1387 typedef READ_TOC_FULL_TOC READ_PMA_USER_OUT;
1388 typedef PREAD_TOC_FULL_TOC PREAD_PMA_USER_OUT;
1389
1390 typedef READ_TOC_ATIP READ_ATIP_USER_OUT;
1391 typedef PREAD_TOC_ATIP PREAD_ATIP_USER_OUT;
1392
1393 typedef READ_TOC_CD_TEXT READ_CD_TEXT_USER_OUT;
1394 typedef PREAD_TOC_CD_TEXT PREAD_CD_TEXT_USER_OUT;
1395
1396 //**********************************************************************************************
1397
1398 typedef struct _INIT_DEINIT_USER_IN {
1399 BOOLEAN PassThrough;
1400 BOOLEAN Reserved; // For separate device (de)initialization
1401 } INIT_DEINIT_USER_IN, *PINIT_DEINIT_USER_IN;
1402
1403 typedef INIT_DEINIT_USER_IN INIT_DEINIT_USER_OUT;
1404 typedef PINIT_DEINIT_USER_IN PINIT_DEINIT_USER_OUT;
1405
1406 //**********************************************************************************************
1407
1408 typedef struct _READ_SESSION_INFO_USER_IN {
1409 BOOLEAN UseLBA;
1410 UCHAR Session;
1411 } READ_SESSION_INFO_USER_IN, *PREAD_SESSION_INFO_USER_IN;
1412
1413 typedef READ_TOC_SES READ_SESSION_INFO_USER_OUT;
1414 typedef PREAD_TOC_SES PREAD_SESSION_INFO_USER_OUT;
1415
1416 //**********************************************************************************************
1417
1418 typedef struct _READ_TOC_EX_USER_IN {
1419 BOOLEAN UseLBA;
1420 UCHAR Track;
1421 } READ_TOC_EX_USER_IN, *PREAD_TOC_EX_USER_IN;
1422
1423 typedef READ_TOC_SES READ_TOC_EX_USER_OUT;
1424 typedef PREAD_TOC_SES PREAD_TOC_EX_USER_OUT;
1425
1426 //**********************************************************************************************
1427
1428 #define DefSession_LastAvailable 0xff
1429
1430 typedef struct _SET_DEFAULT_SESSION_USER_IN {
1431 UCHAR LastSes;
1432 } SET_DEFAULT_SESSION_USER_IN, *PSET_DEFAULT_SESSION_USER_IN;
1433
1434 //**********************************************************************************************
1435
1436 typedef struct _NOTIFY_MEDIA_CHANGE_USER_IN {
1437 BOOLEAN Autorun;
1438 } NOTIFY_MEDIA_CHANGE_USER_IN, *PNOTIFY_MEDIA_CHANGE_USER_IN;
1439
1440 //**********************************************************************************************
1441
1442 typedef DISK_GEOMETRY GET_DRIVE_GEOMETRY_USER_OUT;
1443 typedef PDISK_GEOMETRY PGET_DRIVE_GEOMETRY_USER_OUT;
1444
1445 //**********************************************************************************************
1446
1447 typedef struct _GET_DEVICE_INFO_OLD_USER_OUT {
1448 UCHAR WModes [4][16];
1449 UCHAR VendorId[25];
1450 UCHAR SimulatedWModes [4][16];
1451 ULONG DeviceNumber;
1452 ULONG Features;
1453 INQUIRYDATA InquiryData;
1454 ULONG Features2[4]; // form GET_CONFIG 0 - 128
1455 } GET_DEVICE_INFO_OLD_USER_OUT, *PGET_DEVICE_INFO_OLD_USER_OUT;
1456
1457 typedef struct _GET_DEVICE_INFO_USER_OUT {
1458 ULONG Tag;
1459 ULONG Length;
1460 UCHAR WModes [4][16];
1461 UCHAR VendorId[25];
1462 UCHAR SimulatedWModes [4][16];
1463 ULONG DeviceNumber;
1464 ULONG Features;
1465 INQUIRYDATA InquiryData;
1466 ULONG Features2[4]; // from GET_CONFIG
1467 ULONG Features2ex[64-4]; // from GET_CONFIG (reserved for higher values)
1468 ULONG WriteCaps; // CDRW_DEV_CAPABILITY_xxx
1469 ULONG ReadCaps; // CDRW_DEV_CAPABILITY_xxx
1470 } GET_DEVICE_INFO_USER_OUT, *PGET_DEVICE_INFO_USER_OUT;
1471
1472 #define CDRW_DEV_CAPABILITY_TAG 0xCA10AB11
1473
1474 #define WMODE_SUPPORTED 0x01
1475 #define WMODE_SUPPORTED_FP 0x02
1476 #define WMODE_SUPPORTED_VP 0x04
1477 #define WMODE_NOT_SUPPORTED 0xff
1478 #define WMODE_NOT_TESTED 0x00
1479
1480 #define CDRW_FEATURE_OPC 0x00000001 // use OPC regardless of OPCn in DISK_INFO
1481 #define CDRW_FEATURE_EVENT 0x00000002
1482 #define CDRW_FEATURE_GET_CFG 0x00000004
1483 #define CDRW_FEATURE_NO_LOCK_REP 0x00000008 // device doesn't report tray lock state
1484 #define CDRW_FEATURE_SYNC_ON_WRITE 0x00000010 // device preferes Sync Cache after each Write
1485 #define CDRW_FEATURE_BAD_RW_SEEK 0x00000020 // seek error occures with status Illegal Sector Mode For This Track
1486 // on old CdRoms when they attempt to read outer sectors on FP formatted
1487 // disk. Workaround: perform sequence of seeks from lower address
1488 // to required with step about 0x800 blocks.
1489 #define CDRW_FEATURE_FP_ADDRESSING_PROBLEM 0x00000040
1490 #define CDRW_FEATURE_MRW_ADDRESSING_PROBLEM 0x00000080
1491 #define CDRW_FEATURE_FORCE_SYNC_ON_WRITE 0x00000100 // device requires Sync Cache after each Write
1492 #define CDRW_FEATURE_BAD_DVD_LAST_LBA 0x00000200 // device cannot determile LastLba on not closed DVD disks
1493 #define CDRW_FEATURE_FULL_BLANK_ON_FORMAT 0x00000400 // device cannot format disk until it is full-blanked
1494 #define CDRW_FEATURE_STREAMING 0x00000800 // device supports streaming read/write
1495 #define CDRW_FEATURE_FORCE_SYNC_BEFORE_READ 0x00001000 // device requires Sync Cache on Write -> Read state transition
1496 #define CDRW_FEATURE_CHANGER 0x80000000
1497
1498 #define DEV_CAP_GET_PROFILE(arr, pf) \
1499 (((pf) > PFNUM_Max) ? 0 : (((arr)[(pf)/32] >> (pf)%32) & 1))
1500
1501 #define CDRW_DEV_CAPABILITY_CDROM ((ULONG)1 << CdMediaClass_CDROM )
1502 #define CDRW_DEV_CAPABILITY_CDR ((ULONG)1 << CdMediaClass_CDR )
1503 #define CDRW_DEV_CAPABILITY_CDRW ((ULONG)1 << CdMediaClass_CDRW )
1504 #define CDRW_DEV_CAPABILITY_DVDROM ((ULONG)1 << CdMediaClass_DVDROM )
1505 #define CDRW_DEV_CAPABILITY_DVDRAM ((ULONG)1 << CdMediaClass_DVDRAM )
1506 #define CDRW_DEV_CAPABILITY_DVDR ((ULONG)1 << CdMediaClass_DVDR )
1507 #define CDRW_DEV_CAPABILITY_DVDRW ((ULONG)1 << CdMediaClass_DVDRW )
1508 #define CDRW_DEV_CAPABILITY_DVDpR ((ULONG)1 << CdMediaClass_DVDpR )
1509 #define CDRW_DEV_CAPABILITY_DVDpRW ((ULONG)1 << CdMediaClass_DVDpRW )
1510 #define CDRW_DEV_CAPABILITY_DDCDROM ((ULONG)1 << CdMediaClass_DDCDROM)
1511 #define CDRW_DEV_CAPABILITY_DDCDR ((ULONG)1 << CdMediaClass_DDCDR )
1512 #define CDRW_DEV_CAPABILITY_DDCDRW ((ULONG)1 << CdMediaClass_DDCDRW )
1513
1514 //**********************************************************************************************
1515
1516 typedef ULONG CHECK_VERIFY_USER_OUT, *PCHECK_VERIFY_USER_OUT;
1517
1518 //**********************************************************************************************
1519
1520 /*
1521 #ifndef EventStat_Class_OpChange
1522 #define EventStat_Class_OpChange 0x01
1523 #define EventStat_Class_PM 0x02
1524 #define EventStat_Class_Media 0x04
1525 #define EventStat_Class_DevBusy 0x06
1526 #endif // end EventStat_Class_OpChange
1527 */
1528
1529 typedef struct _GET_EVENT_USER_IN {
1530 UCHAR EventClass;
1531 BOOLEAN Immed;
1532 } GET_EVENT_USER_IN, *PGET_EVENT_USER_IN;
1533
1534 typedef union _GET_EVENT_USER_OUT {
1535 EVENT_STAT_OPERATIONAL_BLOCK Operational;
1536 EVENT_STAT_PM_BLOCK PowerManagement;
1537 EVENT_STAT_EXT_REQ_BLOCK ExternalReq;
1538 EVENT_STAT_MEDIA_BLOCK MediaChange;
1539 EVENT_STAT_DEV_BUSY_BLOCK DeviceBusy;
1540 } GET_EVENT_USER_OUT, *PGET_EVENT_USER_OUT;
1541
1542 //**********************************************************************************************
1543
1544 typedef ULONG DVD_SESSION_ID, *PDVD_SESSION_ID;
1545
1546 typedef struct _DVD_READ_STRUCTURE_USER_IN {
1547 LARGE_INTEGER BlockByteOffset;
1548 DVD_STRUCTURE_FORMAT Format;
1549 DVD_SESSION_ID SessionId;
1550 UCHAR LayerNumber;
1551 } DVD_READ_STRUCTURE_USER_IN, *PDVD_READ_STRUCTURE_USER_IN;
1552
1553 typedef struct _DVD_READ_STRUCTURE_USER_OUT {
1554 USHORT Length;
1555 UCHAR Reserved[2];
1556 // UCHAR Data[0];
1557 } DVD_READ_STRUCTURE_USER_OUT, *PDVD_READ_STRUCTURE_USER_OUT;
1558
1559 //**********************************************************************************************
1560
1561 typedef struct _DVD_START_SESSION_USER_OUT {
1562 DVD_SESSION_ID SessionId;
1563 } DVD_START_SESSION_USER_OUT, *PDVD_START_SESSION_USER_OUT;
1564
1565 //**********************************************************************************************
1566
1567 typedef struct _DVD_READ_KEY_USER_IN {
1568 ULONG KeyLength;
1569 DVD_SESSION_ID SessionId;
1570 DVD_KEY_TYPE KeyType;
1571 ULONG KeyFlags;
1572 union {
1573 HANDLE FileHandle;
1574 LARGE_INTEGER TitleOffset;
1575 } Parameters;
1576 // UCHAR KeyData[0];
1577 } DVD_READ_KEY_USER_IN, *PDVD_READ_KEY_USER_IN;
1578
1579 typedef DVD_READ_KEY_USER_IN DVD_READ_KEY_USER_OUT;
1580 typedef PDVD_READ_KEY_USER_IN PDVD_READ_KEY_USER_OUT;
1581
1582 //**********************************************************************************************
1583
1584 typedef DVD_START_SESSION_USER_OUT DVD_END_SESSION_USER_IN;
1585 typedef PDVD_START_SESSION_USER_OUT PDVD_END_SESSION_USER_IN;
1586
1587 //**********************************************************************************************
1588
1589 // Predefined (Mt. Fuji) key sizes
1590 // Add sizeof(DVD_COPY_PROTECT_KEY) to get allocation size for
1591 // the full key structure
1592
1593 #define DVD_CHALLENGE_KEY_LENGTH (12 + sizeof(DVD_COPY_PROTECT_KEY))
1594 #define DVD_BUS_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
1595 #define DVD_TITLE_KEY_LENGTH (8 + sizeof(DVD_COPY_PROTECT_KEY))
1596 #define DVD_DISK_KEY_LENGTH (2048 + sizeof(DVD_COPY_PROTECT_KEY))
1597 #define DVD_RPC_KEY_LENGTH (sizeof(DVD_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
1598 #define DVD_SET_RPC_KEY_LENGTH (sizeof(DVD_SET_RPC_KEY) + sizeof(DVD_COPY_PROTECT_KEY))
1599 #define DVD_ASF_LENGTH (sizeof(DVD_ASF) + sizeof(DVD_COPY_PROTECT_KEY))
1600
1601 //**********************************************************************************************
1602
1603 typedef struct _DISK_VERIFY_USER_IN {
1604 LONGLONG StartingOffset;
1605 ULONG Length;
1606 } DISK_VERIFY_USER_IN, *PDISK_VERIFY_USER_IN;
1607
1608 //**********************************************************************************************
1609
1610 typedef struct _CDROM_DISK_DATA_USER_OUT {
1611
1612 ULONG DiskData;
1613
1614 } CDROM_DISK_DATA_USER_OUT, *PCDROM_DISK_DATA_USER_OUT;
1615
1616 //**********************************************************************************************
1617
1618 typedef struct _CDRW_RESET_DRIVER_USER_IN {
1619 BOOLEAN UnlockTray;
1620 BOOLEAN Reserved[3];
1621 ULONG MagicWord;
1622 } CDRW_RESET_DRIVER_USER_IN, *PCDRW_RESET_DRIVER_USER_IN;
1623
1624 //**********************************************************************************************
1625
1626 typedef struct _MediaTrackMap {
1627 ULONG FirstLba;
1628 ULONG LastLba;
1629 ULONG NWA;
1630 ULONG PacketSize;
1631 ULONG Session;
1632 UCHAR TrackParam;
1633 UCHAR DataParam;
1634 UCHAR NWA_V;
1635
1636 UCHAR Flags;
1637 #define TrackMap_AllowCopyBit_variated 0x01
1638 #define TrackMap_CopyBit_variated 0x02
1639 #define TrackMap_Try_variation 0x04
1640 #define TrackMap_Use_variation 0x08
1641 #define TrackMap_FixFPAddressing 0x10
1642 #define TrackMap_FixMRWAddressing 0x20
1643
1644 // are used only if FixFPAddressing is enabled
1645 ULONG TrackFPOffset;
1646 ULONG PacketFPOffset;
1647
1648 } MediaTrackMap, *PMediaTrackMap;
1649
1650 typedef struct _GET_DISK_LAYOUT_USER_OUT {
1651 ULONG Tag;
1652 ULONG Length;
1653 ULONG DiskLayoutFlags;
1654 // Number of last session
1655 ULONG LastSession;
1656 ULONG FirstTrackNum;
1657 ULONG LastTrackNum;
1658 // First & Last LBA of the last session
1659 ULONG FirstLBA;
1660 ULONG LastLBA;
1661 // Last writable LBA
1662 ULONG LastPossibleLBA;
1663 // First writable LBA
1664 ULONG NWA;
1665 // sector type map
1666 struct _MediaTrackMap* TrackMap;
1667 //
1668 ULONG BlockSize;
1669 ULONG WriteBlockSize;
1670 // disk state
1671 BOOLEAN FP_disc;
1672 UCHAR OPCNum;
1673 UCHAR MediaClassEx;
1674 UCHAR DiscStat;
1675 ULONG PhSerialNumber;
1676 UCHAR PhErasable;
1677 UCHAR PhDiskType;
1678 UCHAR MRWStatus;
1679 } GET_DISK_LAYOUT_USER_OUT, *PGET_DISK_LAYOUT_USER_OUT;
1680
1681 #define DiskLayout_FLAGS_TRACKMAP (0x00002000)
1682 #define DiskLayout_FLAGS_RAW_DISK (0x00040000)
1683
1684 //**********************************************************************************************
1685
1686 // Error codes returned by IOCTL_CDRW_GEL_LAST_ERROR
1687
1688 //#ifndef CDRW_ERR_NO_ERROR
1689
1690 #define CDRW_ERR_NO_ERROR 0x0000
1691 #define CDRW_ERR_WRITE_IN_PROGRESS_BUSY 0x0001
1692 #define CDRW_ERR_FORMAT_IN_PROGRESS_BUSY 0x0002
1693 #define CDRW_ERR_CLOSE_IN_PROGRESS_BUSY 0x0003
1694 #define CDRW_ERR_BAD_ADDR_ALIGNMENT 0x0004
1695 #define CDRW_ERR_BAD_SIZE_ALIGNMENT 0x0005
1696 #define CDRW_ERR_STREAM_LOSS 0x0006
1697 #define CDRW_ERR_TEST_WRITE_UNSUPPORTED 0x0007
1698 #define CDRW_ERR_UNHANDLED_WRITE_TYPE 0x0008
1699 #define CDRW_ERR_CANT_ALLOC_TMP_BUFFER 0x0009
1700 #define CDRW_ERR_BUFFER_IS_FULL 0x000a
1701 #define CDRW_ERR_VERIFY_REQUIRED 0x000b
1702 #define CDRW_ERR_PLAY_IN_PROGRESS_BUSY 0x000c
1703 #define CDRW_ERR_TOO_LONG_BLOCK_TO_TRANSFER 0x000d
1704 #define CDRW_ERR_INWALID_WRITE_PARAMETERS 0x000e // use SET_WRITE_PARAMS properly
1705 #define CDRW_ERR_INVALID_IO_BUFFER_ADDRESS 0x000f
1706 #define CDRW_ERR_INVALID_INPUT_BUFFER_SIZE 0x0010
1707 #define CDRW_ERR_INVALID_OUTPUT_BUFFER_SIZE 0x0011
1708 #define CDRW_ERR_UNRECOGNIZED_MEDIA 0x0012
1709 #define CDRW_ERR_MEDIA_WRITE_PROTECTED 0x0013
1710 #define CDRW_ERR_NO_MEDIA 0x0014
1711 #define CDRW_ERR_TRAY_OPEN 0x0015
1712 #define CDRW_ERR_MEDIA_NOT_APPENDABLE 0x0016
1713 #define CDRW_ERR_INVALID_LBA 0x0017
1714 #define CDRW_ERR_INVALID_FIXED_PACKET_SIZE 0x0018
1715 #define CDRW_ERR_INVALID_WRITE_TYPE_FOR_MEDIA 0x0019
1716 #define CDRW_ERR_CUE_SHEET_REQUIRED 0x001a // you sould send cue sheet before SAO
1717 #define CDRW_ERR_CANT_DEINIT_IN_CLASS_MODE 0x001b // there is no underlayered driver
1718 #define CDRW_ERR_INVALID_FORMAT_UNIT_SETTINGS 0x001c // use SET_WRITE_PARAMS properly before
1719 // calling FormatUnit
1720 #define CDRW_ERR_UNHANDLED_FORMAT_UNIT_MODE 0x001d // this mode is not supported by
1721 // Workaround module
1722 #define CDRW_ERR_CANT_READ_BUFFER_CAPACITY 0x001e
1723 #define CDRW_ERR_DEVICE_WRITE_ERROR 0x001f
1724 #define CDRW_ERR_UNHANDLED_IOCTL 0x0020
1725 #define CDRW_ERR_UNHANDLED_FORMAT_WORKAROUND_MODE 0x0021 // check your Registry settings
1726 #define CDRW_ERR_DOOR_LOCKED_BUSY 0x0022
1727 #define CDRW_ERR_MAGIC_WORD_REQUIRED 0x0023
1728 #define CDRW_ERR_INVALID_SECTOR_MODE 0x0024
1729 #define CDRW_ERR_DVD_LICENSE_VIOLATION 0x0025
1730 #define CDRW_ERR_INVALID_DVD_KEY_TYPE 0x0026
1731 #define CDRW_ERR_INVALID_DVD_REGION_CODE 0x0027
1732 #define CDRW_ERR_PAGE_IS_NOT_SUPPORTED 0x0028
1733 #define CDRW_ERR_STD_FORMAT_REQUIRED 0x0029
1734 //#define CDRW_ERR_ 0x00
1735 //#define CDRW_ERR_ 0x00
1736 //#define CDRW_ERR_ 0x00
1737 //#define CDRW_ERR_ 0x00
1738
1739 //#endif
1740
1741 // Registry keys
1742 #define REG_TIMEOUT_NAME_USER ("TimeOutValue")
1743 #define REG_AUTORUN_NAME_USER ("Autorun")
1744 #define REG_LOADMODE_NAME_USER ("LoadMode")
1745
1746 #define LOADMODE_CDRW_ONLY 0
1747 #define LOADMODE_ALWAYS 1
1748 #define LOADMODE_NEVER 2
1749
1750 #define REG_PACKETSIZE_NAME_USER ("PacketSize") // Initial packet size (FP)
1751
1752 #define PACKETSIZE_STREAM 0
1753 #define PACKETSIZE_UDF 32
1754
1755 #ifndef WITHOUT_FORMATTER
1756 #define REG_FORMATUNIT_NAME_USER ("FormatUnitMode") // FORMAT_UNIT workaround mode
1757
1758 #define FORMATUNIT_FP 0 // simulation via FP
1759 #define FORMATUNIT_STD 1
1760 #endif //WITHOUT_FORMATTER
1761
1762 #define REG_R_SPLIT_SIZE_NAME_USER ("ReadSplitSize") // Read request spliting limit
1763 #define REG_W_SPLIT_SIZE_NAME_USER ("WriteSplitSize") // Write request spliting limit
1764
1765 #define REG_CDR_SIMULATION_NAME_USER ("CdRSimulationMode") // Influence on READ_DISC_INFO
1766 // capability check on startup
1767 #define CDR_SIMULATION_CDROM 0
1768 #define CDR_SIMULATION_ALWAYS 1
1769 #define CDR_SIMULATION_NEVER 2
1770
1771 #define REG_SPEEDMODE_NAME_USER ("SpeedDetectionMode")
1772
1773 #define SPEEDMODE_ASSUME_OK 0
1774 #define SPEEDMODE_REREAD 1
1775
1776 //#define REG_MAX_WRITE_SPEED_R_NAME_USER ("MaxWriteSpeedCDR")
1777 //#define REG_MAX_WRITE_SPEED_RW_NAME_USER ("MaxWriteSpeedCDRW")
1778
1779 //#define REG_SIMULATION_TABLE_NAME_USER ("WModeSimulationTable") // via Raw
1780
1781 #define REG_WMODE_SIMULATION_NAME_USER ("WModeSimulation") // via Raw
1782 #define WMODE_SIMULATION_ON 1
1783 #define WMODE_SIMULATION_OFF 0
1784 #define WMODE_ASSUME_OK 2
1785
1786 #define REG_SYNC_PACKETS_NAME_USER ("SyncPacketsMode")
1787 #define SYNC_PACKETS_ALWAYS 0
1788 #define SYNC_PACKETS_RESET_DRV 1
1789 #define SYNC_PACKETS_NEVER 2
1790 #define SYNC_PACKETS_FP 3
1791 #define SYNC_PACKETS_DISABLED 4
1792 #define SYNC_PACKETS_VP_ONLY 5
1793 #define SYNC_PACKETS_BY_W_THROUGH 6
1794
1795 #define REG_ASSURE_READY_NAME_USER ("AssureReadiness")
1796 #define ASSURE_READY_TEST_UNIT 0
1797 #define ASSURE_READY_DELAY_100 1
1798 #define ASSURE_READY_NONE 2
1799
1800 #define REG_WAIT_PACKETS_NAME_USER ("WaitPackets")
1801 #define WAIT_PACKETS_ALWAYS 0
1802 #define WAIT_PACKETS_STREAM 1
1803
1804 #define REG_BAD_RW_SEEK_NAME_USER ("BadRWSeek")
1805
1806 #define REG_ALLOW_PACKET_ON_CDR_NAME_USER ("AllowPacketOnCdR")
1807 #define ALLOW_PACKET_ON_CDR_OFF 0
1808 #define ALLOW_PACKET_ON_CDR_ON 1
1809
1810 #define REG_MAX_READY_RETRY_NAME_USER ("MaxReadyRetry")
1811
1812 #define REG_BAD_DVD_READ_TRACK_INFO_NAME_USER ("DvdBadReadTrackInfo")
1813 #define REG_BAD_DVD_READ_DISC_INFO_NAME_USER ("DvdBadReadDiscInfo")
1814 #define REG_BAD_DVD_READ_CAPACITY_NAME_USER ("DvdBadReadCapacity")
1815 #define REG_BAD_DVD_LAST_LBA_NAME_USER ("DvdBadLastLba")
1816 #define REG_BAD_DVD_LAST_LBA_NAME_USER ("DvdBadLastLba")
1817
1818 #define REG_FULL_BLANK_ON_FORMAT_NAME_USER ("FullEraseBeforeFormat")
1819
1820 #define DEFAULT_LAST_LBA_FP_CD 276159
1821 #define DEFAULT_LAST_LBA_DVD 0x23053f
1822 #define DEFAULT_LAST_LBA_BD (25*1000*1000/2-1)
1823
1824
1825 #pragma pack(pop)
1826
1827 #endif //__CDRW_PUBLIC_H__