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