#include <stdlib.h> instead of the non-standard <malloc.h>.
[wine] / include / ntddcdrm.h
1 /*
2  * DDK information for CD ROM
3  *
4  * Copyright (C) 2002 Eric Pouech
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __NTDDCDRM_H
22 #define __NTDDCDRM_H
23
24 #define IOCTL_CDROM_BASE                FILE_DEVICE_CD_ROM
25 #define IOCTL_CDROM_UNLOAD_DRIVER       CTL_CODE(IOCTL_CDROM_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS)
26 #define IOCTL_CDROM_READ_TOC            CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
27 #define IOCTL_CDROM_GET_CONTROL         CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
28 #define IOCTL_CDROM_PLAY_AUDIO_MSF      CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
29 #define IOCTL_CDROM_SEEK_AUDIO_MSF      CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
30 #define IOCTL_CDROM_STOP_AUDIO          CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
31 #define IOCTL_CDROM_PAUSE_AUDIO         CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
32 #define IOCTL_CDROM_RESUME_AUDIO        CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
33 #define IOCTL_CDROM_GET_VOLUME          CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_CDROM_SET_VOLUME          CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_CDROM_READ_Q_CHANNEL      CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
36 #define IOCTL_CDROM_GET_LAST_SESSION    CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_CDROM_RAW_READ            CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT,  FILE_READ_ACCESS)
38 #define IOCTL_CDROM_DISK_TYPE           CTL_CODE(IOCTL_CDROM_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
39 #define IOCTL_CDROM_GET_DRIVE_GEOMETRY  CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
40
41 #define IOCTL_CDROM_CHECK_VERIFY        CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
42 #define IOCTL_CDROM_MEDIA_REMOVAL       CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
43 #define IOCTL_CDROM_EJECT_MEDIA         CTL_CODE(IOCTL_CDROM_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
44 #define IOCTL_CDROM_LOAD_MEDIA          CTL_CODE(IOCTL_CDROM_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
45 #define IOCTL_CDROM_RESERVE             CTL_CODE(IOCTL_CDROM_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
46 #define IOCTL_CDROM_RELEASE             CTL_CODE(IOCTL_CDROM_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
47 #define IOCTL_CDROM_FIND_NEW_DEVICES    CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
48
49 #include "ntddstor.h"
50
51 #define MAXIMUM_NUMBER_TRACKS 100
52 #define MAXIMUM_CDROM_SIZE 804
53
54 typedef struct _TRACK_DATA {
55     UCHAR               Reserved;
56     UCHAR               Control : 4;
57     UCHAR               Adr : 4;
58     UCHAR               TrackNumber;
59     UCHAR               Reserved1;
60     UCHAR               Address[4];
61 } TRACK_DATA, *PTRACK_DATA;
62
63 typedef struct _CDROM_TOC {
64     UCHAR               Length[2];
65     UCHAR               FirstTrack;
66     UCHAR               LastTrack;
67     TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
68 } CDROM_TOC, *PCDROM_TOC;
69
70 #define CDROM_TOC_SIZE sizeof(CDROM_TOC)
71
72 typedef struct _CDROM_PLAY_AUDIO_MSF {
73     UCHAR               StartingM;
74     UCHAR               StartingS;
75     UCHAR               StartingF;
76     UCHAR               EndingM;
77     UCHAR               EndingS;
78     UCHAR               EndingF;
79 } CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
80
81 typedef struct _CDROM_SEEK_AUDIO_MSF {
82     UCHAR               M;
83     UCHAR               S;
84     UCHAR               F;
85 } CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
86
87 typedef struct _CDROM_DISK_DATA {
88     ULONG               DiskData;
89 } CDROM_DISK_DATA, *PCDROM_DISK_DATA;
90
91 #define CDROM_DISK_AUDIO_TRACK      (0x00000001)
92 #define CDROM_DISK_DATA_TRACK       (0x00000002)
93
94 #define IOCTL_CDROM_SUB_Q_CHANNEL    0x00
95 #define IOCTL_CDROM_CURRENT_POSITION 0x01
96 #define IOCTL_CDROM_MEDIA_CATALOG    0x02
97 #define IOCTL_CDROM_TRACK_ISRC       0x03
98
99 typedef struct _CDROM_SUB_Q_DATA_FORMAT {
100     UCHAR               Format;
101     UCHAR               Track;
102 } CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
103
104 typedef struct _SUB_Q_HEADER {
105     UCHAR               Reserved;
106     UCHAR               AudioStatus;
107     UCHAR               DataLength[2];
108 } SUB_Q_HEADER, *PSUB_Q_HEADER;
109
110 typedef struct _SUB_Q_CURRENT_POSITION {
111     SUB_Q_HEADER        Header;
112     UCHAR               FormatCode;
113     UCHAR               Control : 4;
114     UCHAR               ADR : 4;
115     UCHAR               TrackNumber;
116     UCHAR               IndexNumber;
117     UCHAR               AbsoluteAddress[4];
118     UCHAR               TrackRelativeAddress[4];
119 } SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
120
121 typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
122     SUB_Q_HEADER        Header;
123     UCHAR               FormatCode;
124     UCHAR               Reserved[3];
125     UCHAR               Reserved1 : 7;
126     UCHAR               Mcval : 1;
127     UCHAR               MediaCatalog[15];
128 } SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
129
130 typedef struct _SUB_Q_TRACK_ISRC {
131     SUB_Q_HEADER        Header;
132     UCHAR               FormatCode;
133     UCHAR               Reserved0;
134     UCHAR               Track;
135     UCHAR               Reserved1;
136     UCHAR               Reserved2 : 7;
137     UCHAR               Tcval : 1;
138     UCHAR               TrackIsrc[15];
139 } SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
140
141 typedef union _SUB_Q_CHANNEL_DATA {
142     SUB_Q_CURRENT_POSITION      CurrentPosition;
143     SUB_Q_MEDIA_CATALOG_NUMBER  MediaCatalog;
144     SUB_Q_TRACK_ISRC            TrackIsrc;
145 } SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
146
147 #define AUDIO_STATUS_NOT_SUPPORTED      0x00
148 #define AUDIO_STATUS_IN_PROGRESS        0x11
149 #define AUDIO_STATUS_PAUSED             0x12
150 #define AUDIO_STATUS_PLAY_COMPLETE      0x13
151 #define AUDIO_STATUS_PLAY_ERROR         0x14
152 #define AUDIO_STATUS_NO_STATUS          0x15
153
154 #define ADR_NO_MODE_INFORMATION         0x0
155 #define ADR_ENCODES_CURRENT_POSITION    0x1
156 #define ADR_ENCODES_MEDIA_CATALOG       0x2
157 #define ADR_ENCODES_ISRC                0x3
158
159 #define AUDIO_WITH_PREEMPHASIS          0x0
160 #define DIGITAL_COPY_PERMITTED          0x2
161 #define AUDIO_DATA_TRACK                0x4
162 #define TWO_FOUR_CHANNEL_AUDIO          0x8
163
164 typedef struct _CDROM_AUDIO_CONTROL {
165     UCHAR               LbaFormat;
166     USHORT              LogicalBlocksPerSecond;
167 } CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
168
169 typedef struct _VOLUME_CONTROL {
170     UCHAR               PortVolume[4];
171 } VOLUME_CONTROL, *PVOLUME_CONTROL;
172
173 typedef enum _TRACK_MODE_TYPE {
174     YellowMode2,
175     XAForm2,
176     CDDA
177 } TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
178
179 typedef struct __RAW_READ_INFO {
180     LARGE_INTEGER       DiskOffset;
181     ULONG               SectorCount;
182     TRACK_MODE_TYPE     TrackMode;
183 } RAW_READ_INFO, *PRAW_READ_INFO;
184
185 #endif /* __NTDDCDRM_H */