qmgr: Only have one BackgroundCopyManager per system.
[wine] / include / winioctl.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __WINE_WINIOCTL_H
20 #define __WINE_WINIOCTL_H
21
22 #define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
23     (DWORD)((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
24 )
25
26 #define DEVICE_TYPE DWORD
27
28 #define FILE_DEVICE_BEEP                0x00000001
29 #define FILE_DEVICE_CD_ROM              0x00000002
30 #define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
31 #define FILE_DEVICE_CONTROLLER          0x00000004
32 #define FILE_DEVICE_DATALINK            0x00000005
33 #define FILE_DEVICE_DFS                 0x00000006
34 #define FILE_DEVICE_DISK                0x00000007
35 #define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
36 #define FILE_DEVICE_FILE_SYSTEM         0x00000009
37 #define FILE_DEVICE_INPORT_PORT         0x0000000a
38 #define FILE_DEVICE_KEYBOARD            0x0000000b
39 #define FILE_DEVICE_MAILSLOT            0x0000000c
40 #define FILE_DEVICE_MIDI_IN             0x0000000d
41 #define FILE_DEVICE_MIDI_OUT            0x0000000e
42 #define FILE_DEVICE_MOUSE               0x0000000f
43 #define FILE_DEVICE_MULTI_UNC_PROVIDER  0x00000010
44 #define FILE_DEVICE_NAMED_PIPE          0x00000011
45 #define FILE_DEVICE_NETWORK             0x00000012
46 #define FILE_DEVICE_NETWORK_BROWSER     0x00000013
47 #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
48 #define FILE_DEVICE_NULL                0x00000015
49 #define FILE_DEVICE_PARALLEL_PORT       0x00000016
50 #define FILE_DEVICE_PHYSICAL_NETCARD    0x00000017
51 #define FILE_DEVICE_PRINTER             0x00000018
52 #define FILE_DEVICE_SCANNER             0x00000019
53 #define FILE_DEVICE_SERIAL_MOUSE_PORT   0x0000001a
54 #define FILE_DEVICE_SERIAL_PORT         0x0000001b
55 #define FILE_DEVICE_SCREEN              0x0000001c
56 #define FILE_DEVICE_SOUND               0x0000001d
57 #define FILE_DEVICE_STREAMS             0x0000001e
58 #define FILE_DEVICE_TAPE                0x0000001f
59 #define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
60 #define FILE_DEVICE_TRANSPORT           0x00000021
61 #define FILE_DEVICE_UNKNOWN             0x00000022
62 #define FILE_DEVICE_VIDEO               0x00000023
63 #define FILE_DEVICE_VIRTUAL_DISK        0x00000024
64 #define FILE_DEVICE_WAVE_IN             0x00000025
65 #define FILE_DEVICE_WAVE_OUT            0x00000026
66 #define FILE_DEVICE_8042_PORT           0x00000027
67 #define FILE_DEVICE_NETWORK_REDIRECTOR  0x00000028
68 #define FILE_DEVICE_BATTERY             0x00000029
69 #define FILE_DEVICE_BUS_EXTENDER        0x0000002a
70 #define FILE_DEVICE_MODEM               0x0000002b
71 #define FILE_DEVICE_VDM                 0x0000002c
72 #define FILE_DEVICE_MASS_STORAGE        0x0000002d
73 #define FILE_DEVICE_SMB                 0x0000002e
74 #define FILE_DEVICE_KS                  0x0000002f
75 #define FILE_DEVICE_CHANGER             0x00000030
76 #define FILE_DEVICE_SMARTCARD           0x00000031
77 #define FILE_DEVICE_ACPI                0x00000032
78 #define FILE_DEVICE_DVD                 0x00000033
79 #define FILE_DEVICE_FULLSCREEN_VIDEO    0x00000034
80 #define FILE_DEVICE_DFS_FILE_SYSTEM     0x00000035
81 #define FILE_DEVICE_DFS_VOLUME          0x00000036
82 #define FILE_DEVICE_SERENUM             0x00000037
83 #define FILE_DEVICE_TERMSRV             0x00000038
84 #define FILE_DEVICE_KSEC                0x00000039
85
86 #define METHOD_BUFFERED                 0
87 #define METHOD_IN_DIRECT                1
88 #define METHOD_OUT_DIRECT               2
89 #define METHOD_NEITHER                  3
90
91 #define FILE_ANY_ACCESS                 0
92 #define FILE_READ_ACCESS                FILE_READ_DATA  /* file & pipe */
93 #define FILE_WRITE_ACCESS               FILE_WRITE_DATA /* file & pipe */
94
95 #define FSCTL_REQUEST_OPLOCK_LEVEL_1    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  0, METHOD_BUFFERED, FILE_ANY_ACCESS)
96 #define FSCTL_REQUEST_OPLOCK_LEVEL_2    CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  1, METHOD_BUFFERED, FILE_ANY_ACCESS)
97 #define FSCTL_REQUEST_BATCH_OPLOCK      CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  2, METHOD_BUFFERED, FILE_ANY_ACCESS)
98 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE  CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  3, METHOD_BUFFERED, FILE_ANY_ACCESS)
99 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  4, METHOD_BUFFERED, FILE_ANY_ACCESS)
100 #define FSCTL_OPLOCK_BREAK_NOTIFY       CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  5, METHOD_BUFFERED, FILE_ANY_ACCESS)
101 #define FSCTL_LOCK_VOLUME               CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  6, METHOD_BUFFERED, FILE_ANY_ACCESS)
102 #define FSCTL_UNLOCK_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  7, METHOD_BUFFERED, FILE_ANY_ACCESS)
103 #define FSCTL_DISMOUNT_VOLUME           CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  8, METHOD_BUFFERED, FILE_ANY_ACCESS)
104 /* decommissioned fsctl value                                              9                                     */
105 #define FSCTL_IS_VOLUME_MOUNTED         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
106 #define FSCTL_IS_PATHNAME_VALID         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
107 #define FSCTL_MARK_VOLUME_DIRTY         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
108 /* decommissioned fsctl value                                             13                                     */
109 #define FSCTL_QUERY_RETRIEVAL_POINTERS  CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14,  METHOD_NEITHER, FILE_ANY_ACCESS)
110 #define FSCTL_GET_COMPRESSION           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
111 #define FSCTL_SET_COMPRESSION           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
112 /* decommissioned fsctl value                                             17                                     */
113 /* decommissioned fsctl value                                             18                                     */
114 #define FSCTL_MARK_AS_SYSTEM_HIVE       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19,  METHOD_NEITHER, FILE_ANY_ACCESS)
115 #define FSCTL_OPLOCK_BREAK_ACK_NO_2     CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
116 #define FSCTL_INVALIDATE_VOLUMES        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
117 #define FSCTL_QUERY_FAT_BPB             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
118 #define FSCTL_REQUEST_FILTER_OPLOCK     CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
119 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
120 /* Start: _WIN32_WINNT >= 0x0400 */
121 #define FSCTL_GET_NTFS_VOLUME_DATA      CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
122 #define FSCTL_GET_NTFS_FILE_RECORD      CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
123 #define FSCTL_GET_VOLUME_BITMAP         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27,  METHOD_NEITHER, FILE_ANY_ACCESS)
124 #define FSCTL_GET_RETRIEVAL_POINTERS    CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28,  METHOD_NEITHER, FILE_ANY_ACCESS)
125 #define FSCTL_MOVE_FILE                 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
126 #define FSCTL_IS_VOLUME_DIRTY           CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
127 #define FSCTL_GET_HFS_INFORMATION       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
128 #define FSCTL_ALLOW_EXTENDED_DASD_IO    CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER,  FILE_ANY_ACCESS)
129 /* End: _WIN32_WINNT >= 0x0400 */
130
131 /* Start: _WIN32_WINNT >= 0x0500 */
132 #define FSCTL_READ_PROPERTY_DATA        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 33, METHOD_NEITHER, FILE_ANY_ACCESS)
133 #define FSCTL_WRITE_PROPERTY_DATA       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 34, METHOD_NEITHER, FILE_ANY_ACCESS)
134 #define FSCTL_FIND_FILES_BY_SID         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
135 /* decommissioned fsctl value                                             36                                     */
136 #define FSCTL_DUMP_PROPERTY_DATA        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 37,  METHOD_NEITHER, FILE_ANY_ACCESS)
137 #define FSCTL_SET_OBJECT_ID             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_WRITE_DATA)
138 #define FSCTL_GET_OBJECT_ID             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
139 #define FSCTL_DELETE_OBJECT_ID          CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_WRITE_DATA)
140 #define FSCTL_SET_REPARSE_POINT         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_WRITE_DATA)
141 #define FSCTL_GET_REPARSE_POINT         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
142 #define FSCTL_DELETE_REPARSE_POINT      CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_WRITE_DATA)
143 #define FSCTL_ENUM_USN_DATA             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44,  METHOD_NEITHER, FILE_READ_DATA)
144 #define FSCTL_SECURITY_ID_CHECK         CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45,  METHOD_NEITHER, FILE_READ_DATA)
145 #define FSCTL_READ_USN_JOURNAL          CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46,  METHOD_NEITHER, FILE_READ_DATA)
146 #define FSCTL_SET_OBJECT_ID_EXTENDED    CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_WRITE_DATA
147 #define FSCTL_CREATE_OR_GET_OBJECT_ID   CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
148 #define FSCTL_SET_SPARSE                CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA)
149 #define FSCTL_SET_ZERO_DATA             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
150 #define FSCTL_QUERY_ALLOCATED_RANGES    CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51,  METHOD_NEITHER, FILE_READ_DATA)
151 #define FSCTL_ENABLE_UPGRADE            CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
152 #define FSCTL_SET_ENCRYPTION            CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
153 #define FSCTL_ENCRYPTION_FSCTL_IO       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54,  METHOD_NEITHER, FILE_ANY_ACCESS)
154 #define FSCTL_WRITE_RAW_ENCRYPTED       CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55,  METHOD_NEITHER, FILE_ANY_ACCESS)
155 #define FSCTL_READ_RAW_ENCRYPTED        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56,  METHOD_NEITHER, FILE_ANY_ACCESS)
156 #define FSCTL_CREATE_USN_JOURNAL        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57,  METHOD_NEITHER, FILE_READ_DATA)
157 #define FSCTL_READ_FILE_USN_DATA        CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58,  METHOD_NEITHER, FILE_READ_DATA)
158 #define FSCTL_WRITE_USN_CLOSE_RECORD    CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59,  METHOD_NEITHER, FILE_READ_DATA)
159 #define FSCTL_EXTEND_VOLUME             CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
160 /* End: _WIN32_WINNT >= 0x0500 */
161
162 #define FSCTL_PIPE_ASSIGN_EVENT         CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
163 #define FSCTL_PIPE_DISCONNECT           CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
164 #define FSCTL_PIPE_LISTEN               CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
165 #define FSCTL_PIPE_PEEK                 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
166 #define FSCTL_PIPE_QUERY_EVENT          CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
167 #define FSCTL_PIPE_TRANSCEIVE           CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER,  FILE_READ_DATA | FILE_WRITE_DATA)
168 #define FSCTL_PIPE_WAIT                 CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
169 #define FSCTL_PIPE_IMPERSONATE          CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
170 #define FSCTL_PIPE_SET_CLIENT_PROCESS   CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
171 #define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
172 #define FSCTL_PIPE_INTERNAL_READ        CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
173 #define FSCTL_PIPE_INTERNAL_WRITE       CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
174 #define FSCTL_PIPE_INTERNAL_TRANSCEIVE  CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
175 #define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
176
177 #define IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
178 #define IOCTL_STORAGE_CHECK_VERIFY       CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
179 #define IOCTL_STORAGE_CHECK_VERIFY2      CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_ANY_ACCESS)
180 #define IOCTL_STORAGE_MEDIA_REMOVAL      CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
181 #define IOCTL_STORAGE_EJECT_MEDIA        CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
182 #define IOCTL_STORAGE_LOAD_MEDIA         CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
183 #define IOCTL_STORAGE_LOAD_MEDIA2        CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_ANY_ACCESS)
184 #define IOCTL_STORAGE_RESERVE            CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
185 #define IOCTL_STORAGE_RELEASE            CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
186 #define IOCTL_STORAGE_FIND_NEW_DEVICES   CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
187 #define IOCTL_STORAGE_EJECTION_CONTROL   CTL_CODE(IOCTL_STORAGE_BASE, 0x0250, METHOD_BUFFERED, FILE_ANY_ACCESS)
188 #define IOCTL_STORAGE_MCN_CONTROL        CTL_CODE(IOCTL_STORAGE_BASE, 0x0251, METHOD_BUFFERED, FILE_ANY_ACCESS)
189
190 #define IOCTL_STORAGE_GET_MEDIA_TYPES         CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
191 #define IOCTL_STORAGE_GET_MEDIA_TYPES_EX      CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
192 #define IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER CTL_CODE(IOCTL_STORAGE_BASE, 0x0304, METHOD_BUFFERED, FILE_ANY_ACCESS)
193 #define IOCTL_STORAGE_GET_HOTPLUG_INFO        CTL_CODE(IOCTL_STORAGE_BASE, 0x0305, METHOD_BUFFERED, FILE_ANY_ACCESS)
194 #define IOCTL_STORAGE_SET_HOTPLUG_INFO        CTL_CODE(IOCTL_STORAGE_BASE, 0x0306, METHOD_BUFFERED, FILE_READ_ACCESS)
195
196 #define IOCTL_STORAGE_RESET_BUS          CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
197 #define IOCTL_STORAGE_RESET_DEVICE       CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
198 #define IOCTL_STORAGE_BREAK_RESERCATION  CTL_CODE(IOCTL_STORAGE_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS);
199 #define IOCTL_STORAGE_PERSISTENT_RESERVE_IN   CTL_CODE(IOCTL_STORAGE_BASE, 0x0406, METHOD_BUFFERED, FILE_READ_ACCESS);
200 #define IOCTL_STORAGE_PERSISTENT_RESERVE_OUT  CTL_CODE(IOCTL_STORAGE_BASE, 0x0407, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS);
201
202 #define IOCTL_STORAGE_GET_DEVICE_NUMBER  CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
203
204 #define IOCTL_DISK_BASE                 FILE_DEVICE_DISK
205 #define IOCTL_DISK_GET_DRIVE_GEOMETRY   CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
206 #define IOCTL_DISK_GET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
207 #define IOCTL_DISK_SET_PARTITION_INFO   CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
208 #define IOCTL_DISK_GET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
209 #define IOCTL_DISK_SET_DRIVE_LAYOUT     CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
210 #define IOCTL_DISK_VERIFY               CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
211 #define IOCTL_DISK_FORMAT_TRACKS        CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
212 #define IOCTL_DISK_REASSIGN_BLOCKS      CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
213 #define IOCTL_DISK_PERFORMANCE          CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
214 #define IOCTL_DISK_IS_WRITABLE          CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
215 #define IOCTL_DISK_LOGGING              CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
216 #define IOCTL_DISK_FORMAT_TRACKS_EX     CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
217 #define IOCTL_DISK_HISTOGRAM_STRUCTURE  CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
218 #define IOCTL_DISK_HISTOGRAM_DATA       CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
219 #define IOCTL_DISK_HISTOGRAM_RESET      CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
220 #define IOCTL_DISK_REQUEST_STRUCTURE    CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
221 #define IOCTL_DISK_REQUEST_DATA         CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
222 #define IOCTL_DISK_CHECK_VERIFY         CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
223 #define IOCTL_DISK_MEDIA_REMOVAL        CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
224 #define IOCTL_DISK_EJECT_MEDIA          CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
225 #define IOCTL_DISK_LOAD_MEDIA           CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
226 #define IOCTL_DISK_RESERVE              CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
227 #define IOCTL_DISK_RELEASE              CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
228 #define IOCTL_DISK_FIND_NEW_DEVICES     CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
229 #define IOCTL_DISK_GET_MEDIA_TYPES      CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
230
231
232 /* Start: For _WIN32_WINNT >= 0x0400 */
233 #define IOCTL_DISK_CONTROLLER_NUMBER    CTL_CODE(IOCTL_DISK_BASE, 0x0011, METHOD_BUFFERED, FILE_ANY_ACCESS)
234 #define SMART_GET_VERSION               CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
235 #define SMART_SEND_DRIVE_COMMAND        CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
236 #define SMART_RCV_DRIVE_DATA            CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
237
238 #define IOCTL_VOLUME_BASE ((DWORD)'V')
239 #define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS      CTL_CODE(IOCTL_VOLUME_BASE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
240 /* End: For _WIN32_WINNT >= 0x0400 */
241
242 #define IOCTL_SERIAL_LSRMST_INSERT      CTL_CODE(FILE_DEVICE_SERIAL_PORT,31,METHOD_BUFFERED,FILE_ANY_ACCESS)
243
244
245 /* Return Codes... should these be the same as something somewhere? */
246 #define PARTITION_ENTRY_UNUSED          0x00      /* Entry unused */
247 #define PARTITION_FAT_12                0x01      /* 12-bit FAT entries */
248 #define PARTITION_XENIX_1               0x02      /* Xenix */
249 #define PARTITION_XENIX_2               0x03      /* Xenix */
250 #define PARTITION_FAT_16                0x04      /* 16-bit FAT entries */
251 #define PARTITION_EXTENDED              0x05      /* Extended partition entry */
252 #define PARTITION_HUGE                  0x06      /* Huge partition MS-DOS V4 */
253 #define PARTITION_IFS                   0x07      /* IFS Partition */
254 #define PARTITION_FAT32                 0x0B      /* FAT32 */
255 #define PARTITION_FAT32_XINT13          0x0C      /* FAT32 using extended int13 services */
256 #define PARTITION_XINT13                0x0E      /* Win95 partition using extended int13 services */
257 #define PARTITION_XINT13_EXTENDED       0x0F      /* Same as type 5 but uses extended int13 services */
258 #define PARTITION_PREP                  0x41      /* PowerPC Reference Platform (PReP) Boot Partition */
259 #define PARTITION_LDM                   0x42      /* Logical Disk Manager partition */
260 #define PARTITION_UNIX                  0x63      /* Unix */
261
262 typedef enum _MEDIA_TYPE {
263     Unknown, F5_1Pt2_512, F3_1Pt44_512, F3_2Pt88_512, F3_20Pt8_512, F3_720_512, F5_360_512,
264     F5_320_512, F5_320_1024, F5_180_512, F5_160_512, RemovableMedia, FixedMedia, F3_120M_512,
265     F3_640_512, F5_640_512, F5_720_512, F3_1Pt2_512, F3_1Pt23_1024, F5_1Pt23_1024, F3_128Mb_512,
266     F3_230Mb_512, F8_256_128
267 } MEDIA_TYPE, *PMEDIA_TYPE;
268
269 typedef struct _FORMAT_PARAMETERS {
270    MEDIA_TYPE           MediaType;
271    DWORD                StartCylinderNumber;
272    DWORD                EndCylinderNumber;
273    DWORD                StartHeadNumber;
274    DWORD                EndHeadNumber;
275 } FORMAT_PARAMETERS, *PFORMAT_PARAMETERS;
276
277 typedef WORD   BAD_TRACK_NUMBER;
278 typedef WORD   *PBAD_TRACK_NUMBER;
279
280 typedef struct _FORMAT_EX_PARAMETERS {
281    MEDIA_TYPE           MediaType;
282    DWORD                StartCylinderNumber;
283    DWORD                EndCylinderNumber;
284    DWORD                StartHeadNumber;
285    DWORD                EndHeadNumber;
286    WORD                 FormatGapLength;
287    WORD                 SectorsPerTrack;
288    WORD                 SectorNumber[1];
289 } FORMAT_EX_PARAMETERS, *PFORMAT_EX_PARAMETERS;
290
291 typedef struct _DISK_GEOMETRY {
292     LARGE_INTEGER       Cylinders;
293     MEDIA_TYPE          MediaType;
294     DWORD               TracksPerCylinder;
295     DWORD               SectorsPerTrack;
296     DWORD               BytesPerSector;
297 } DISK_GEOMETRY, *PDISK_GEOMETRY;
298
299 typedef struct _PARTITION_INFORMATION {
300     LARGE_INTEGER       StartingOffset;
301     LARGE_INTEGER       PartitionLength;
302     DWORD               HiddenSectors;
303     DWORD               PartitionNumber;
304     BYTE                PartitionType;
305     BOOLEAN             BootIndicator;
306     BOOLEAN             RecognizedPartition;
307     BOOLEAN             RewritePartition;
308 } PARTITION_INFORMATION, *PPARTITION_INFORMATION;
309
310 typedef struct _SET_PARTITION_INFORMATION {
311     BYTE                PartitionType;
312 } SET_PARTITION_INFORMATION, *PSET_PARTITION_INFORMATION;
313
314 typedef struct _DRIVE_LAYOUT_INFORMATION {
315     DWORD               PartitionCount;
316     DWORD               Signature;
317     PARTITION_INFORMATION PartitionEntry[1];
318 } DRIVE_LAYOUT_INFORMATION, *PDRIVE_LAYOUT_INFORMATION;
319
320 typedef struct _VERIFY_INFORMATION {
321     LARGE_INTEGER       StartingOffset;
322     DWORD               Length;
323 } VERIFY_INFORMATION, *PVERIFY_INFORMATION;
324
325 typedef struct _REASSIGN_BLOCKS {
326     WORD                Reserved;
327     WORD                Count;
328     DWORD               BlockNumber[1];
329 } REASSIGN_BLOCKS, *PREASSIGN_BLOCKS;
330
331 /* Start: _WIN32_WINNT >= 0x0400 */
332
333 typedef struct _DISK_CONTROLLER_NUMBER {
334     DWORD               ControllerNumber;
335     DWORD               DiskNumber;
336 } DISK_CONTROLLER_NUMBER, *PDISK_CONTROLLER_NUMBER;
337
338 /* VOLUME_GET_VOLUME_DISK_EXTENTS */
339 typedef struct _DISK_EXTENT {
340     DWORD               DiskNumber;
341     LARGE_INTEGER       StartingOffset;
342     LARGE_INTEGER       ExtentLength;
343 } DISK_EXTENT;
344
345 typedef struct _VOLUME_DISK_EXTENTS {
346     DWORD               NumberOfDiskExtents;
347     DISK_EXTENT         Extents[1];
348 } VOLUME_DISK_EXTENTS;
349
350 /* End: _WIN32_WINNT >= 0x0400 */
351
352 /* Device Io Stuff - Most VxD support.
353  * NOTE: All VxD messages seem to start with a hiword or 0
354  */
355 typedef struct tagDIOCRegs {
356     DWORD   reg_EBX;
357     DWORD   reg_EDX;
358     DWORD   reg_ECX;
359     DWORD   reg_EAX;
360     DWORD   reg_EDI;
361     DWORD   reg_ESI;
362     DWORD   reg_Flags;
363 } DIOC_REGISTERS, *PDIOC_REGISTERS;
364
365 /* Start VWIN32 information:
366  * VWIN32 is a VxD which supports the MSDOS Io routines.
367  */
368 #define VWIN32_DIOC_DOS_IOCTL     1 /* This is the specified MS-DOS device I/O ctl - Interrupt 21h Function 4400h - 4411h */
369 #define VWIN32_DIOC_DOS_INT25     2 /* This is the Absolute Disk Read command - Interrupt 25h */
370 #define VWIN32_DIOC_DOS_INT26     3 /* This is the Absolute Disk Write command - Interrupt 25h */
371 #define VWIN32_DIOC_DOS_INT13     4 /* This is Interrupt 13h commands */
372 #define VWIN32_DIOC_SIMCTRLC      5 /* Simulate Ctrl-C */
373 #define VWIN32_DIOC_DOS_DRIVEINFO 6 /* This is Interrupt 21h Function 730X commands */
374
375 /* Important: All MS_DOS data structures must be packed on a one-byte boundary - good old 16 bit. */
376
377 #include <pshpack1.h>
378 typedef struct tagMID {
379     WORD  midInfoLevel;
380     DWORD midSerialNum;
381     BYTE  midVolLabel[11];
382     BYTE  midFileSysType[8];
383 } MID, *PMID;
384 #include <poppack.h>
385
386 /* End VWIN32 information */
387
388 /*
389  *      NT I/O-Manager
390  */
391
392 /*
393  * structures for NtQueryVolumeInformationFile
394  * (wdm.h)
395  */
396
397 /* FileFsVolumeInformation = 1 */
398 typedef struct _FILE_FS_VOLUME_INFORMATION {
399         LARGE_INTEGER   VolumeCreationTime;
400         ULONG           VolumeSerialNumber;
401         ULONG           VolumeLabelLength;
402         BOOLEAN         SupportsObjects;
403         WCHAR           VolumeLabel[1];
404 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
405
406 /* FileFsLabelInformation = 2 */
407 /*
408  unknown
409 */
410
411 /* FileFsSizeInformation = 3 */
412 typedef struct _FILE_FS_SIZE_INFORMATION {
413         LARGE_INTEGER   TotalAllocationUnits;
414         LARGE_INTEGER   AvailableAllocationUnits;
415         ULONG           SectorsPerAllocationUnit;
416         ULONG           BytesPerSector;
417 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
418
419 /* FileFsDeviceInformation = 4 */
420 typedef struct _FILE_FS_DEVICE_INFORMATION {
421         DEVICE_TYPE DeviceType;
422         ULONG Characteristics;
423 } FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
424
425 /* FileFsAttributeInformation = 5 */
426 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
427         ULONG   FileSystemAttribute;
428         LONG    MaximumComponentNameLength;
429         ULONG   FileSystemNameLength;
430         WCHAR   FileSystemName[1];
431 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
432
433 typedef struct _FILE_PIPE_WAIT_FOR_BUFFER {
434     LARGE_INTEGER   Timeout;
435     ULONG           NameLength;
436     BOOLEAN         TimeoutSpecified;
437     WCHAR           Name[1];
438 } FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
439
440 typedef struct _FILE_PIPE_PEEK_BUFFER {
441     ULONG   NamedPipeState;
442     ULONG   ReadDataAvailable;
443     ULONG   NumberOfMessages;
444     ULONG   MessageLength;
445     CHAR    Data[1];
446 } FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
447
448 /* Device GUIDs */
449 #ifdef DEFINE_GUID
450
451 DEFINE_GUID(GUID_DEVINTERFACE_COMPORT, 0x86E0D1E0L, 0x8089,
452  0x11D0, 0x9C, 0xE4, 0x08, 0x00, 0x3E, 0x30, 0x1F, 0x73);
453 DEFINE_GUID(GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR, 0x4D36E978L, 0xE325,
454  0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18);
455
456 /* obsolete GUID names */
457 #define GUID_CLASS_COMPORT          GUID_DEVINTERFACE_COMPORT
458 #define GUID_SERENUM_BUS_ENUMERATOR GUID_DEVINTERFACE_SERENUM_BUS_ENUMERATOR
459
460 #endif /* DEFINE_GUID */
461
462 #endif