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