xref: /titanic_52/usr/src/uts/common/smbsrv/winioctl.h (revision 3c112a2b34403220c06c3e2fcac403358cfba168)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 #ifndef _SMBSRV_WINIOCTL_H
26 #define	_SMBSRV_WINIOCTL_H
27 
28 /*
29  * Standard Windows NT IOCTL/FSCTL definitions (derived from the VC++
30  * include file of the same name).
31  */
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #ifndef _DEVIOCTL_
38 #define	_DEVIOCTL_
39 
40 /*
41  * begin_ntddk begin_wdm begin_nthal begin_ntifs
42  *
43  * Define the various device type values.  Note that values used by Microsoft
44  * Corporation are in the range 0-32767, and 32768-65535 are reserved for use
45  * by customers.
46  */
47 
48 #define	DEVICE_TYPE DWORD
49 
50 #define	FILE_DEVICE_BEEP		0x00000001
51 #define	FILE_DEVICE_CD_ROM		0x00000002
52 #define	FILE_DEVICE_CD_ROM_FILE_SYSTEM	0x00000003
53 #define	FILE_DEVICE_CONTROLLER		0x00000004
54 #define	FILE_DEVICE_DATALINK		0x00000005
55 #define	FILE_DEVICE_DFS			0x00000006
56 #define	FILE_DEVICE_DISK		0x00000007
57 #define	FILE_DEVICE_DISK_FILE_SYSTEM	0x00000008
58 #define	FILE_DEVICE_FILE_SYSTEM		0x00000009
59 #define	FILE_DEVICE_INPORT_PORT		0x0000000a
60 #define	FILE_DEVICE_KEYBOARD		0x0000000b
61 #define	FILE_DEVICE_MAILSLOT		0x0000000c
62 #define	FILE_DEVICE_MIDI_IN		0x0000000d
63 #define	FILE_DEVICE_MIDI_OUT		0x0000000e
64 #define	FILE_DEVICE_MOUSE		0x0000000f
65 #define	FILE_DEVICE_MULTI_UNC_PROVIDER	0x00000010
66 #define	FILE_DEVICE_NAMED_PIPE		0x00000011
67 #define	FILE_DEVICE_NETWORK		0x00000012
68 #define	FILE_DEVICE_NETWORK_BROWSER	0x00000013
69 #define	FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
70 #define	FILE_DEVICE_NULL		0x00000015
71 #define	FILE_DEVICE_PARALLEL_PORT	0x00000016
72 #define	FILE_DEVICE_PHYSICAL_NETCARD	0x00000017
73 #define	FILE_DEVICE_PRINTER		0x00000018
74 #define	FILE_DEVICE_SCANNER		0x00000019
75 #define	FILE_DEVICE_SERIAL_MOUSE_PORT	0x0000001a
76 #define	FILE_DEVICE_SERIAL_PORT		0x0000001b
77 #define	FILE_DEVICE_SCREEN		0x0000001c
78 #define	FILE_DEVICE_SOUND		0x0000001d
79 #define	FILE_DEVICE_STREAMS		0x0000001e
80 #define	FILE_DEVICE_TAPE		0x0000001f
81 #define	FILE_DEVICE_TAPE_FILE_SYSTEM	0x00000020
82 #define	FILE_DEVICE_TRANSPORT		0x00000021
83 #define	FILE_DEVICE_UNKNOWN		0x00000022
84 #define	FILE_DEVICE_VIDEO		0x00000023
85 #define	FILE_DEVICE_VIRTUAL_DISK	0x00000024
86 #define	FILE_DEVICE_WAVE_IN		0x00000025
87 #define	FILE_DEVICE_WAVE_OUT		0x00000026
88 #define	FILE_DEVICE_8042_PORT		0x00000027
89 #define	FILE_DEVICE_NETWORK_REDIRECTOR	0x00000028
90 #define	FILE_DEVICE_BATTERY		0x00000029
91 #define	FILE_DEVICE_BUS_EXTENDER	0x0000002a
92 #define	FILE_DEVICE_MODEM		0x0000002b
93 #define	FILE_DEVICE_VDM			0x0000002c
94 #define	FILE_DEVICE_MASS_STORAGE	0x0000002d
95 #define	FILE_DEVICE_SMB			0x0000002e
96 #define	FILE_DEVICE_KS			0x0000002f
97 #define	FILE_DEVICE_CHANGER		0x00000030
98 #define	FILE_DEVICE_SMARTCARD		0x00000031
99 #define	FILE_DEVICE_ACPI		0x00000032
100 #define	FILE_DEVICE_DVD			0x00000033
101 #define	FILE_DEVICE_FULLSCREEN_VIDEO	0x00000034
102 #define	FILE_DEVICE_DFS_FILE_SYSTEM	0x00000035
103 #define	FILE_DEVICE_DFS_VOLUME		0x00000036
104 
105 /*
106  * Macro definition for defining IOCTL and FSCTL function control codes.  Note
107  * that function codes 0-2047 are reserved for Microsoft Corporation, and
108  * 2048-4095 are reserved for customers.
109  */
110 
111 #define	CTL_CODE(DeviceType, Function, Method, Access) \
112 	(((DeviceType) << 16) | ((Access) << 14) |     \
113 	((Function) << 2) | (Method))
114 
115 /*
116  * Define the method codes for how buffers are passed for I/O and FS controls
117  */
118 
119 #define	METHOD_BUFFERED			0
120 #define	METHOD_IN_DIRECT		1
121 #define	METHOD_OUT_DIRECT		2
122 #define	METHOD_NEITHER			3
123 
124 /*
125  * Define the access check value for any access
126  */
127 
128 #define	FILE_ANY_ACCESS			0
129 #define	FILE_READ_ACCESS		0x0001	/* file & pipe */
130 #define	FILE_WRITE_ACCESS		0x0002	/* file & pipe */
131 
132 /* end_ntddk end_wdm end_nthal end_ntifs */
133 
134 #endif /* _DEVIOCTL_ */
135 
136 
137 #ifndef _NTDDSTOR_H_
138 #define	_NTDDSTOR_H_
139 
140 #ifdef __cplusplus
141 extern "C" {
142 #endif
143 
144 /*
145  * IoControlCode values for storage devices
146  */
147 
148 #define	IOCTL_STORAGE_BASE FILE_DEVICE_MASS_STORAGE
149 
150 /*
151  * The following device control codes are common for all class drivers.  They
152  * should be used in place of the older IOCTL_DISK, IOCTL_CDROM and IOCTL_TAPE
153  * common codes
154  */
155 
156 #define	IOCTL_STORAGE_CHECK_VERIFY \
157 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
158 #define	IOCTL_STORAGE_MEDIA_REMOVAL \
159 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
160 #define	IOCTL_STORAGE_EJECT_MEDIA \
161 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
162 #define	IOCTL_STORAGE_LOAD_MEDIA \
163 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
164 #define	IOCTL_STORAGE_RESERVE \
165 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
166 #define	IOCTL_STORAGE_RELEASE \
167 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
168 #define	IOCTL_STORAGE_FIND_NEW_DEVICES \
169 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
170 
171 #define	IOCTL_STORAGE_GET_MEDIA_TYPES \
172 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
173 #define	IOCTL_STORAGE_GET_MEDIA_TYPES_EX \
174 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0301, METHOD_BUFFERED, FILE_ANY_ACCESS)
175 
176 #define	IOCTL_STORAGE_RESET_BUS \
177 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0400, METHOD_BUFFERED, FILE_READ_ACCESS)
178 #define	IOCTL_STORAGE_RESET_DEVICE \
179 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS)
180 
181 #define	IOCTL_STORAGE_GET_DEVICE_NUMBER \
182 	CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS)
183 
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 #endif /* _NTDDSTOR_H_ */
189 
190 /*
191  * IoControlCode values for disk devices.
192  */
193 
194 #define	IOCTL_DISK_BASE			FILE_DEVICE_DISK
195 #define	IOCTL_DISK_GET_DRIVE_GEOMETRY \
196 	CTL_CODE(IOCTL_DISK_BASE, 0x0000, METHOD_BUFFERED, FILE_ANY_ACCESS)
197 #define	IOCTL_DISK_GET_PARTITION_INFO \
198 	CTL_CODE(IOCTL_DISK_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
199 #define	IOCTL_DISK_SET_PARTITION_INFO \
200 	CTL_CODE(IOCTL_DISK_BASE, 0x0002, METHOD_BUFFERED, \
201 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
202 #define	IOCTL_DISK_GET_DRIVE_LAYOUT \
203 	CTL_CODE(IOCTL_DISK_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
204 #define	IOCTL_DISK_SET_DRIVE_LAYOUT \
205 	CTL_CODE(IOCTL_DISK_BASE, 0x0004, METHOD_BUFFERED, \
206 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
207 #define	IOCTL_DISK_VERIFY \
208 	CTL_CODE(IOCTL_DISK_BASE, 0x0005, METHOD_BUFFERED, FILE_ANY_ACCESS)
209 #define	IOCTL_DISK_FORMAT_TRACKS \
210 	CTL_CODE(IOCTL_DISK_BASE, 0x0006, METHOD_BUFFERED,	\
211 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
212 #define	IOCTL_DISK_REASSIGN_BLOCKS \
213 	CTL_CODE(IOCTL_DISK_BASE, 0x0007, METHOD_BUFFERED, \
214 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
215 #define	IOCTL_DISK_PERFORMANCE \
216 	CTL_CODE(IOCTL_DISK_BASE, 0x0008, METHOD_BUFFERED, FILE_ANY_ACCESS)
217 #define	IOCTL_DISK_IS_WRITABLE \
218 	CTL_CODE(IOCTL_DISK_BASE, 0x0009, METHOD_BUFFERED, FILE_ANY_ACCESS)
219 #define	IOCTL_DISK_LOGGING \
220 	CTL_CODE(IOCTL_DISK_BASE, 0x000a, METHOD_BUFFERED, FILE_ANY_ACCESS)
221 #define	IOCTL_DISK_FORMAT_TRACKS_EX \
222 	CTL_CODE(IOCTL_DISK_BASE, 0x000b, METHOD_BUFFERED, \
223 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
224 #define	IOCTL_DISK_HISTOGRAM_STRUCTURE \
225 	CTL_CODE(IOCTL_DISK_BASE, 0x000c, METHOD_BUFFERED, FILE_ANY_ACCESS)
226 #define	IOCTL_DISK_HISTOGRAM_DATA \
227 	CTL_CODE(IOCTL_DISK_BASE, 0x000d, METHOD_BUFFERED, FILE_ANY_ACCESS)
228 #define	IOCTL_DISK_HISTOGRAM_RESET \
229 	CTL_CODE(IOCTL_DISK_BASE, 0x000e, METHOD_BUFFERED, FILE_ANY_ACCESS)
230 #define	IOCTL_DISK_REQUEST_STRUCTURE \
231 	CTL_CODE(IOCTL_DISK_BASE, 0x000f, METHOD_BUFFERED, FILE_ANY_ACCESS)
232 #define	IOCTL_DISK_REQUEST_DATA \
233 	CTL_CODE(IOCTL_DISK_BASE, 0x0010, METHOD_BUFFERED, FILE_ANY_ACCESS)
234 #define	IOCTL_DISK_CONTROLLER_NUMBER \
235 	CTL_CODE(IOCTL_DISK_BASE, 0x0011, METHOD_BUFFERED, FILE_ANY_ACCESS)
236 
237 /*
238  * IOCTL support for SMART drive fault prediction.
239  */
240 
241 #define	SMART_GET_VERSION \
242 	CTL_CODE(IOCTL_DISK_BASE, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
243 #define	SMART_SEND_DRIVE_COMMAND \
244 	CTL_CODE(IOCTL_DISK_BASE, 0x0021, METHOD_BUFFERED,	\
245 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
246 #define	SMART_RCV_DRIVE_DATA \
247 	CTL_CODE(IOCTL_DISK_BASE, 0x0022, METHOD_BUFFERED, \
248 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
249 
250 
251 /*
252  * The following device control codes are common for all class drivers.  The
253  * functions codes defined here must match all of the other class drivers.
254  *
255  * Warning: these codes will be replaced in the future by equivalent
256  * IOCTL_STORAGE codes
257  */
258 
259 #define	IOCTL_DISK_CHECK_VERIFY \
260 	CTL_CODE(IOCTL_DISK_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
261 #define	IOCTL_DISK_MEDIA_REMOVAL \
262 	CTL_CODE(IOCTL_DISK_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
263 #define	IOCTL_DISK_EJECT_MEDIA \
264 	CTL_CODE(IOCTL_DISK_BASE, 0x0202, METHOD_BUFFERED, FILE_READ_ACCESS)
265 #define	IOCTL_DISK_LOAD_MEDIA \
266 	CTL_CODE(IOCTL_DISK_BASE, 0x0203, METHOD_BUFFERED, FILE_READ_ACCESS)
267 #define	IOCTL_DISK_RESERVE \
268 	CTL_CODE(IOCTL_DISK_BASE, 0x0204, METHOD_BUFFERED, FILE_READ_ACCESS)
269 #define	IOCTL_DISK_RELEASE \
270 	CTL_CODE(IOCTL_DISK_BASE, 0x0205, METHOD_BUFFERED, FILE_READ_ACCESS)
271 #define	IOCTL_DISK_FIND_NEW_DEVICES \
272 	CTL_CODE(IOCTL_DISK_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
273 #define	IOCTL_DISK_GET_MEDIA_TYPES \
274 	CTL_CODE(IOCTL_DISK_BASE, 0x0300, METHOD_BUFFERED, FILE_ANY_ACCESS)
275 
276 #define	IOCTL_CHANGER_BASE		FILE_DEVICE_CHANGER
277 
278 #define	IOCTL_CHANGER_GET_PARAMETERS \
279 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
280 #define	IOCTL_CHANGER_GET_STATUS \
281 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
282 #define	IOCTL_CHANGER_GET_PRODUCT_DATA \
283 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
284 #define	IOCTL_CHANGER_SET_ACCESS \
285 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0004, METHOD_BUFFERED, \
286 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
287 #define	IOCTL_CHANGER_GET_ELEMENT_STATUS \
288 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0005, METHOD_BUFFERED, \
289 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
290 #define	IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS \
291 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
292 #define	IOCTL_CHANGER_SET_POSITION \
293 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
294 #define	IOCTL_CHANGER_EXCHANGE_MEDIUM \
295 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
296 #define	IOCTL_CHANGER_MOVE_MEDIUM \
297 	CTL_CODE(IOCTL_CHANGER_BASE, 0x0009, METHOD_BUFFERED, FILE_READ_ACCESS)
298 #define	IOCTL_CHANGER_REINITIALIZE_TRANSPORT \
299 	CTL_CODE(IOCTL_CHANGER_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
300 #define	IOCTL_CHANGER_QUERY_VOLUME_TAGS \
301 	CTL_CODE(IOCTL_CHANGER_BASE, 0x000B, METHOD_BUFFERED, \
302 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
303 
304 #ifndef _FILESYSTEMFSCTL_
305 #define	_FILESYSTEMFSCTL_
306 /*
307  * The following is a list of the native file system fsctls followed by
308  * additional network file system fsctls, DFS fsctls and Named Pipe fsctls.
309  * Some values have been decommissioned.
310  */
311 
312 /* FILE_DEVICE_FILE_SYSTEM */
313 #define	FSCTL_REQUEST_OPLOCK_LEVEL_1 \
314 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  0, METHOD_BUFFERED, FILE_ANY_ACCESS)
315 #define	FSCTL_REQUEST_OPLOCK_LEVEL_2 \
316 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  1, METHOD_BUFFERED, FILE_ANY_ACCESS)
317 #define	FSCTL_REQUEST_BATCH_OPLOCK \
318 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  2, METHOD_BUFFERED, FILE_ANY_ACCESS)
319 #define	FSCTL_OPLOCK_BREAK_ACKNOWLEDGE \
320 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  3, METHOD_BUFFERED, FILE_ANY_ACCESS)
321 #define	FSCTL_OPBATCH_ACK_CLOSE_PENDING \
322 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  4, METHOD_BUFFERED, FILE_ANY_ACCESS)
323 #define	FSCTL_OPLOCK_BREAK_NOTIFY \
324 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  5, METHOD_BUFFERED, FILE_ANY_ACCESS)
325 #define	FSCTL_LOCK_VOLUME \
326 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  6, METHOD_BUFFERED, FILE_ANY_ACCESS)
327 #define	FSCTL_UNLOCK_VOLUME \
328 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  7, METHOD_BUFFERED, FILE_ANY_ACCESS)
329 #define	FSCTL_DISMOUNT_VOLUME \
330 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM,  8, METHOD_BUFFERED, FILE_ANY_ACCESS)
331 /* decommissioned fsctl value 9 */
332 #define	FSCTL_IS_VOLUME_MOUNTED \
333 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
334 /* PATHNAME_BUFFER, */
335 #define	FSCTL_IS_PATHNAME_VALID \
336 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
337 #define	FSCTL_MARK_VOLUME_DIRTY \
338 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
339 /* decommissioned fsctl value 13 */
340 #define	FSCTL_QUERY_RETRIEVAL_POINTERS \
341 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14,  METHOD_NEITHER, FILE_ANY_ACCESS)
342 #define	FSCTL_GET_COMPRESSION \
343 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
344 #define	FSCTL_SET_COMPRESSION \
345 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, \
346 	FILE_READ_ACCESS | FILE_WRITE_ACCESS)
347 /* decommissioned fsctl value 17 */
348 /* decommissioned fsctl value 18 */
349 #define	FSCTL_MARK_AS_SYSTEM_HIVE \
350 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19,  METHOD_NEITHER, FILE_ANY_ACCESS)
351 #define	FSCTL_OPLOCK_BREAK_ACK_NO_2 \
352 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
353 #define	FSCTL_INVALIDATE_VOLUMES \
354 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
355 /* FSCTL_QUERY_FAT_BPB_BUFFER */
356 #define	FSCTL_QUERY_FAT_BPB \
357 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
358 #define	FSCTL_REQUEST_FILTER_OPLOCK \
359 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
360 /* FILESYSTEM_STATISTICS */
361 #define	FSCTL_FILESYSTEM_GET_STATISTICS \
362 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
363 /* NTFS_VOLUME_DATA_BUFFER */
364 #define	FSCTL_GET_NTFS_VOLUME_DATA \
365 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
366 /* NTFS_FILE_RECORD_INPUT_BUFFER, NTFS_FILE_RECORD_OUTPUT_BUFFER */
367 #define	FSCTL_GET_NTFS_FILE_RECORD \
368 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
369 /* STARTING_LCN_INPUT_BUFFER, VOLUME_BITMAP_BUFFER */
370 #define	FSCTL_GET_VOLUME_BITMAP \
371 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27,  METHOD_NEITHER, FILE_ANY_ACCESS)
372 /* STARTING_VCN_INPUT_BUFFER, RETRIEVAL_POINTERS_BUFFER */
373 #define	FSCTL_GET_RETRIEVAL_POINTERS \
374 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28,  METHOD_NEITHER, FILE_ANY_ACCESS)
375 /* MOVE_FILE_DATA, */
376 #define	FSCTL_MOVE_FILE \
377 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
378 #define	FSCTL_IS_VOLUME_DIRTY \
379 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
380 #define	FSCTL_GET_HFS_INFORMATION \
381 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
382 #define	FSCTL_ALLOW_EXTENDED_DASD_IO \
383 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER,  FILE_ANY_ACCESS)
384 #define	FSCTL_READ_PROPERTY_DATA \
385 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 33, METHOD_NEITHER, FILE_ANY_ACCESS)
386 #define	FSCTL_WRITE_PROPERTY_DATA \
387 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 34, METHOD_NEITHER, FILE_ANY_ACCESS)
388 #define	FSCTL_FIND_FILES_BY_SID \
389 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
390 /* decommissioned fsctl value 36 */
391 #define	FSCTL_DUMP_PROPERTY_DATA \
392 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 37,  METHOD_NEITHER, FILE_ANY_ACCESS)
393 /* FILE_OBJECTID_BUFFER */
394 #define	FSCTL_SET_OBJECT_ID \
395 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, \
396 	FILE_WRITE_ACCESS)
397 /* FILE_OBJECTID_BUFFER */
398 #define	FSCTL_GET_OBJECT_ID \
399 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
400 #define	FSCTL_DELETE_OBJECT_ID \
401 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, \
402 	FILE_WRITE_ACCESS)
403 /* REPARSE_DATA_BUFFER, */
404 #define	FSCTL_SET_REPARSE_POINT \
405 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, \
406 	    FILE_WRITE_ACCESS)
407 /* REPARSE_DATA_BUFFER */
408 #define	FSCTL_GET_REPARSE_POINT \
409 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
410 /* REPARSE_DATA_BUFFER, */
411 #define	FSCTL_DELETE_REPARSE_POINT \
412 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, \
413 	FILE_WRITE_ACCESS)
414 /* MFT_ENUM_DATA, */
415 #define	FSCTL_ENUM_USN_DATA \
416 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44,  METHOD_NEITHER, FILE_READ_ACCESS)
417 /* BULK_SECURITY_TEST_DATA, */
418 #define	FSCTL_SECURITY_ID_CHECK \
419 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45,  METHOD_NEITHER, FILE_READ_ACCESS)
420 /* READ_USN_JOURNAL_DATA, USN */
421 #define	FSCTL_READ_USN_JOURNAL \
422 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46,  METHOD_NEITHER, FILE_READ_ACCESS)
423 #define	FSCTL_SET_OBJECT_ID_EXTENDED \
424 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, \
425 	FILE_WRITE_ACCESS)
426 /* FILE_OBJECTID_BUFFER */
427 #define	FSCTL_CREATE_OR_GET_OBJECT_ID \
428 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
429 #define	FSCTL_SET_SPARSE \
430 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_ANY_ACCESS)
431 /* FILE_ZERO_DATA_INFORMATION, */
432 #define	FSCTL_SET_ZERO_DATA \
433 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, \
434 	FILE_WRITE_ACCESS)
435 /* FILE_ALLOCATED_RANGE_BUFFER, FILE_ALLOCATED_RANGE_BUFFER */
436 #define	FSCTL_QUERY_ALLOCATED_RANGES \
437 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51,  METHOD_NEITHER, FILE_READ_ACCESS)
438 #define	FSCTL_ENABLE_UPGRADE \
439 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, \
440 	FILE_WRITE_ACCESS)
441 /* ENCRYPTION_BUFFER, */
442 #define	FSCTL_SET_ENCRYPTION \
443 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
444 #define	FSCTL_ENCRYPTION_FSCTL_IO \
445 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54,  METHOD_NEITHER, FILE_ANY_ACCESS)
446 /* ENCRYPTED_DATA_INFO, */
447 #define	FSCTL_WRITE_RAW_ENCRYPTED \
448 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55,  METHOD_NEITHER, FILE_ANY_ACCESS)
449 /* REQUEST_RAW_ENCRYPTED_DATA, ENCRYPTED_DATA_INFO */
450 #define	FSCTL_READ_RAW_ENCRYPTED \
451 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56,  METHOD_NEITHER, FILE_ANY_ACCESS)
452 /* CREATE_USN_JOUNRAL_DATA, */
453 #define	FSCTL_CREATE_USN_JOURNAL \
454 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57,  METHOD_NEITHER, FILE_READ_ACCESS)
455 /* Read the Usn Record for a file */
456 #define	FSCTL_READ_FILE_USN_DATA \
457 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58,  METHOD_NEITHER, FILE_READ_ACCESS)
458 /* Generate Close Usn Record */
459 #define	FSCTL_WRITE_USN_CLOSE_RECORD \
460 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59,  METHOD_NEITHER, FILE_READ_ACCESS)
461 #define	FSCTL_EXTEND_VOLUME \
462 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
463 #define	FSCTL_SIS_COPYFILE \
464 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
465 #define	FSCTL_RECALL_FILE \
466 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
467 #define	FSCTL_SET_DEFECT_MANAGEMENT \
468 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 77, \
469 	METHOD_BUFFERED, FILE_WRITE_ACCESS)
470 #define	FSCTL_QUERY_SPARING_INFO \
471 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 78, METHOD_BUFFERED, FILE_ANY_ACCESS)
472 #define	FSCTL_QUERY_ON_DISK_VOLUME_INFO \
473 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 79, METHOD_BUFFERED, FILE_ANY_ACCESS)
474 #define	FSCTL_SET_ZERO_ON_DEALLOCATION \
475 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 101, METHOD_BUFFERED, FILE_ANY_ACCESS)
476 #define	FSCTL_SET_SHORT_NAME_BEHAVIOR \
477 	CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 109, METHOD_BUFFERED, FILE_ANY_ACCESS)
478 
479 /* FILE_DEVICE_NETWORK_FILE_SYSTEM */
480 /* Read the snapshot info for Volume Shadow Copy Services */
481 #define	FSCTL_SRV_ENUMERATE_SNAPSHOTS \
482 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x19, \
483 	METHOD_BUFFERED, FILE_READ_ACCESS)
484 /* Retrieve an opaque file reference for server-side data movement */
485 #define	FSCTL_SRV_REQUEST_RESUME_KEY \
486 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x1e, \
487 	METHOD_BUFFERED, FILE_ANY_ACCESS)
488 #define	FSCTL_SRV_LMR_GET_LINK_TRACKING_INFORMATION \
489 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x3a, \
490 	METHOD_BUFFERED, FILE_ACCESS_ANY)
491 #define	FSCTL_SRV_LMR_SET_LINK_TRACKING_INFORMATION \
492 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x3b, \
493 	METHOD_BUFFERED, FILE_ACCESS_ANY)
494 /* server-side data movement */
495 #define	FSCTL_SRV_COPYCHUNK \
496 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x3c, \
497 	METHOD_OUT_DIRECT, FILE_READ_ACCESS)
498 /* server-side data movement */
499 #define	FSCTL_SRV_COPYCHUNK_WRITE \
500 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x3c, \
501 	METHOD_OUT_DIRECT, FILE_WRITE_ACCESS)
502 #define	FSCTL_SRV_NOTIFY_TRANSACTION \
503 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x46, \
504 	METHOD_BUFFERED, FILE_WRITE_ACCESS)
505 #define	FSCTL_SRV_READ_HASH \
506 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x6e, \
507 	METHOD_NEITHER, FILE_READ_ACCESS)
508 #define	FSCTL_SRV_UNKNOWN_x71 \
509 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x71, \
510 	METHOD_BUFFERED, FILE_ACCESS_ANY)
511 #define	FSCTL_SRV_LMR_REQUEST_RESILIENCY \
512 	CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 0x75, \
513 	METHOD_BUFFERED, FILE_ANY_ACCESS)
514 
515 /* FILE_DEVICE_DFS */
516 #define	FSCTL_DFS_GET_REFERRALS \
517 	CTL_CODE(FILE_DEVICE_DFS, 0x65, METHOD_BUFFERED, FILE_ACCESS_ANY)
518 
519 /* FILE_DEVICE_NAMED_PIPE */
520 #define	FSCTL_PIPE_PEEK \
521 	CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0x3, METHOD_BUFFERED, FILE_READ_ACCESS)
522 #define	FSCTL_PIPE_TRANSCEIVE \
523 	CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0x5, \
524 	METHOD_NEITHER, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
525 #define	FSCTL_PIPE_WAIT \
526 	CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0x6, METHOD_BUFFERED, FILE_ANY_ACCESS)
527 
528 #endif /* _FILESYSTEMFSCTL_ */
529 
530 #ifdef __cplusplus
531 }
532 #endif
533 
534 #endif /* _SMBSRV_WINIOCTL_H */
535