summaryrefslogtreecommitdiffhomepage
path: root/include/ntapi/nt_file.h
blob: cb27bdf1c36f997ea2e2ae9bc56f1293b80feab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
#ifndef _NT_FILE_H_
#define _NT_FILE_H_

#include "nt_abi.h"
#include "nt_object.h"
#include "nt_device.h"

typedef enum _nt_file_info_class {
	NT_FILE_DIRECTORY_INFORMATION			= 1,
	NT_FILE_FULL_DIRECTORY_INFORMATION		= 2,
	NT_FILE_BOTH_DIRECTORY_INFORMATION		= 3,
	NT_FILE_BASIC_INFORMATION			= 4,
	NT_FILE_STANDARD_INFORMATION			= 5,
	NT_FILE_INTERNAL_INFORMATION			= 6,
	NT_FILE_EA_INFORMATION				= 7,
	NT_FILE_ACCESS_INFORMATION			= 8,
	NT_FILE_NAME_INFORMATION			= 9,
	NT_FILE_RENAME_INFORMATION			= 10,
	NT_FILE_LINK_INFORMATION			= 11,
	NT_FILE_NAMES_INFORMATION			= 12,
	NT_FILE_DISPOSITION_INFORMATION			= 13,
	NT_FILE_POSITION_INFORMATION			= 14,
	NT_FILE_FULL_EA_INFORMATION			= 15,
	NT_FILE_MODE_INFORMATION			= 16,
	NT_FILE_ALIGNMENT_INFORMATION			= 17,
	NT_FILE_ALL_INFORMATION				= 18,
	NT_FILE_ALLOCATION_INFORMATION			= 19,
	NT_FILE_END_OF_FILE_INFORMATION			= 20,
	NT_FILE_ALTERNATE_NAME_INFORMATION		= 21,
	NT_FILE_STREAM_INFORMATION			= 22,
	NT_FILE_PIPE_INFORMATION			= 23,
	NT_FILE_PIPE_LOCAL_INFORMATION			= 24,
	NT_FILE_PIPE_REMOTE_INFORMATION			= 25,
	NT_FILE_MAILSLOT_QUERY_INFORMATION		= 26,
	NT_FILE_MAILSLOT_SET_INFORMATION		= 27,
	NT_FILE_COMPRESSION_INFORMATION			= 28,
	NT_FILE_OBJECT_ID_INFORMATION			= 29,
	NT_FILE_COMPLETION_INFORMATION			= 30,
	NT_FILE_MOVE_CLUSTER_INFORMATION		= 31,
	NT_FILE_QUOTA_INFORMATION			= 32,
	NT_FILE_REPARSE_POINT_INFORMATION		= 33,
	NT_FILE_NETWORK_OPEN_INFORMATION		= 34,
	NT_FILE_ATTRIBUTE_TAG_INFORMATION		= 35,
	NT_FILE_TRACKING_INFORMATION			= 36,
	NT_FILE_ID_BOTH_DIRECTORY_INFORMATION		= 37,
	NT_FILE_ID_FULL_DIRECTORY_INFORMATION		= 38,
	NT_FILE_VALID_DATA_LENGTH_INFORMATION		= 39,
	NT_FILE_SHORT_NAME_INFORMATION			= 40,
	NT_FILE_IO_COMPLETION_NOTIFICATION_INFORMATION	= 41,
	NT_FILE_IO_STATUS_BLOCK_RANGE_INFORMATION	= 42,
	NT_FILE_IO_PRIORITY_HINT_INFORMATION		= 43,
	NT_FILE_SFIO_RESERVE_INFORMATION		= 44,
	NT_FILE_SFIO_VOLUME_INFORMATION			= 45,
	NT_FILE_HARD_LINK_INFORMATION			= 46,
	NT_FILE_PROCESS_IDS_USING_FILE_INFORMATION	= 47,
	NT_FILE_NORMALIZED_NAME_INFORMATION		= 48,
	NT_FILE_NETWORK_PHYSICAL_NAME_INFORMATION	= 49,
	NT_FILE_ID_GLOBAL_TX_DIRECTORY_INFORMATION	= 50,
	NT_FILE_IS_REMOTE_DEVICE_INFORMATION		= 51,
	NT_FILE_ATTRIBUTE_CACHE_INFORMATION		= 52,
	NT_FILE_NUMA_NODE_INFORMATION			= 53,
	NT_FILE_STANDARD_LINK_INFORMATION		= 54,
	NT_FILE_REMOTE_PROTOCOL_INFORMATION		= 55,
	NT_FILE_REPLACE_COMPLETION_INFORMATION		= 56,
	NT_FILE_INFORMATION_CAP				= 57
} nt_file_info_class;


typedef enum _nt_file_create_disposition {
	NT_FILE_SUPERSEDE	= 0x00000000,
	NT_FILE_OPEN		= 0x00000001,
	NT_FILE_CREATE		= 0x00000002,
	NT_FILE_OPEN_IF		= 0x00000003,
	NT_FILE_OVERWRITE	= 0x00000004,
	NT_FILE_OVERWRITE_IF	= 0x00000005
} nt_file_create_disposition;


typedef enum _nt_file_status {
	NT_FILE_SUPERSEDED	= 0x00000000,
	NT_FILE_OPENED		= 0x00000001,
	NT_FILE_CREATED		= 0x00000002,
	NT_FILE_OVERWRITTEN	= 0x00000003,
	NT_FILE_EXISTS		= 0x00000004,
	NT_FILE_DOES_NOT_EXIST	= 0x00000005
} nt_file_status;


typedef enum _nt_file_action {
	NT_FILE_ACTION_ADDED			= 0x00000001,
	NT_FILE_ACTION_REMOVED			= 0x00000002,
	NT_FILE_ACTION_MODIFIED			= 0x00000003,
	NT_FILE_ACTION_RENAMED_OLD_NAME		= 0x00000004,
	NT_FILE_ACTION_RENAMED_NEW_NAME		= 0x00000005,
	NT_FILE_ACTION_ADDED_STREAM		= 0x00000006,
	NT_FILE_ACTION_REMOVED_STREAM		= 0x00000007,
	NT_FILE_ACTION_MODIFIED_STREAM		= 0x00000008,
	NT_FILE_ACTION_REMOVED_BY_DELETE	= 0x00000009,
} nt_file_action;


typedef enum _nt_file_pipe_flags {
	NT_FILE_PIPE_BYTE_STREAM_MODE	= 0x00000000,
	NT_FILE_PIPE_MESSAGE_MODE	= 0x00000001,

	NT_FILE_PIPE_QUEUE_OPERATION	= 0x00000000,
	NT_FILE_PIPE_COMPLETE_OPERATION	= 0x00000001,

	NT_FILE_PIPE_BYTE_STREAM_TYPE	= 0x00000000,
	NT_FILE_PIPE_MESSAGE_TYPE	= 0x00000001,

	NT_FILE_PIPE_INBOUND		= 0x00000000,
	NT_FILE_PIPE_OUTBOUND		= 0x00000001,
	NT_FILE_PIPE_FULL_DUPLEX	= 0x00000002,

	NT_FILE_PIPE_DISCONNECTED_STATE	= 0x00000001,
	NT_FILE_PIPE_LISTENING_STATE	= 0x00000002,
	NT_FILE_PIPE_CONNECTED_STATE	= 0x00000003,
	NT_FILE_PIPE_CLOSING_STATE	= 0x00000004,

	NT_FILE_PIPE_CLIENT_END		= 0x00000000,
	NT_FILE_PIPE_SERVER_END		= 0x00000001,
} nt_file_pipe_flags;


typedef enum _nt_io_priority_hint {
	NT_IO_PRIORITY_VERY_LOW		= 0,
	NT_IO_PRIORITY_LOW		= 1,
	NT_IO_PRIORITY_NORMAL		= 2,
	NT_IO_PRIORITY_HIGH		= 3,
	NT_IO_PRIORITY_CRITICAL		= 4,
	NT_MAX_IO_PRIORITY_TYPES	= 5
} nt_io_priority_hint;


typedef enum _nt_fs_info_class {
	NT_FILE_FS_VOLUME_INFORMATION		= 1,
	NT_FILE_FS_LABEL_INFORMATION		= 2,
	NT_FILE_FS_SIZE_INFORMATION		= 3,
	NT_FILE_FS_DEVICE_INFORMATION		= 4,
	NT_FILE_FS_ATTRIBUTE_INFORMATION	= 5,
	NT_FILE_FS_CONTROL_INFORMATION		= 6,
	NT_FILE_FS_FULL_SIZE_INFORMATION	= 7,
	NT_FILE_FS_OBJECT_ID_INFORMATION	= 8,
	NT_FILE_FS_DRIVER_PATH_INFORMATION	= 9,
	NT_FILE_FS_VOLUME_FLAGS_INFORMATION	= 10,
	NT_FILE_FS_SECTOR_SIZE_INFORMATION	= 11,
} nt_fs_info_class;


/* file attributes */
#define NT_FILE_ATTRIBUTE_READONLY		0x00000001
#define NT_FILE_ATTRIBUTE_HIDDEN		0x00000002
#define NT_FILE_ATTRIBUTE_SYSTEM		0x00000004
#define NT_FILE_ATTRIBUTE_DIRECTORY		0x00000010
#define NT_FILE_ATTRIBUTE_ARCHIVE		0x00000020
#define NT_FILE_ATTRIBUTE_DEVICE		0x00000040
#define NT_FILE_ATTRIBUTE_NORMAL		0x00000080
#define NT_FILE_ATTRIBUTE_TEMPORARY		0x00000100
#define NT_FILE_ATTRIBUTE_SPARSE_FILE		0x00000200
#define NT_FILE_ATTRIBUTE_REPARSE_POINT		0x00000400
#define NT_FILE_ATTRIBUTE_COMPRESSED		0x00000800
#define NT_FILE_ATTRIBUTE_OFFLINE		0x00001000
#define NT_FILE_ATTRIBUTE_NOT_CONTENT_INDEXED	0x00002000
#define NT_FILE_ATTRIBUTE_ENCRYPTED		0x00004000
#define NT_FILE_ATTRIBUTE_INTEGRITY_STREAM	0x00008000
#define NT_FILE_ATTRIBUTE_VIRTUAL		0x00010000
#define NT_FILE_ATTRIBUTE_NO_SCRUB_DATA		0x00020000


/* file create options */
#define NT_FILE_ASYNCHRONOUS_IO			0x00000000
#define NT_FILE_DIRECTORY_FILE			0x00000001
#define NT_FILE_WRITE_THROUGH			0x00000002
#define NT_FILE_SEQUENTIAL_ONLY			0x00000004
#define NT_FILE_NO_INTERMEDIATE_BUFFERING	0x00000008
#define NT_FILE_SYNCHRONOUS_IO_ALERT		0x00000010
#define NT_FILE_SYNCHRONOUS_IO_NONALERT		0x00000020
#define NT_FILE_NON_DIRECTORY_FILE		0x00000040
#define NT_FILE_CREATE_TREE_CONNECTION		0x00000080
#define NT_FILE_COMPLETE_IF_OPLOCKED		0x00000100
#define NT_FILE_NO_EA_KNOWLEDGE			0x00000200
#define NT_FILE_OPEN_REMOTE_INSTANCE		0x00000400
#define NT_FILE_RANDOM_ACCESS			0x00000800
#define NT_FILE_DELETE_ON_CLOSE			0x00001000
#define NT_FILE_OPEN_BY_FILE_ID			0x00002000
#define NT_FILE_OPEN_FOR_BACKUP_INTENT		0x00004000
#define NT_FILE_NO_COMPRESSION			0x00008000
#define NT_FILE_SESSION_AWARE			0x00040000
#define NT_FILE_RESERVE_OPFILTER		0x00100000
#define NT_FILE_OPEN_REPARSE_POINT		0x00200000
#define NT_FILE_OPEN_NO_RECALL			0x00400000
#define NT_FILE_OPEN_FOR_FREE_SPACE_QUERY	0x00800000


/* file share access */
#define NT_FILE_SHARE_READ			0x00000001
#define NT_FILE_SHARE_WRITE			0x00000002
#define NT_FILE_SHARE_DELETE			0x00000004


/* file notify */
#define NT_FILE_NOTIFY_CHANGE_FILE_NAME		0x00000001
#define NT_FILE_NOTIFY_CHANGE_DIR_NAME		0x00000002
#define NT_FILE_NOTIFY_CHANGE_ATTRIBUTES	0x00000004
#define NT_FILE_NOTIFY_CHANGE_SIZE		0x00000008
#define NT_FILE_NOTIFY_CHANGE_LAST_WRITE	0x00000010
#define NT_FILE_NOTIFY_CHANGE_LAST_ACCESS	0x00000020
#define NT_FILE_NOTIFY_CHANGE_CREATION		0x00000040
#define NT_FILE_NOTIFY_CHANGE_EA		0x00000040
#define NT_FILE_NOTIFY_CHANGE_SECURITY		0x00000100
#define NT_FILE_NOTIFY_CHANGE_STREAM_NAME	0x00000100
#define NT_FILE_NOTIFY_CHANGE_STREAM_SIZE	0x00000100
#define NT_FILE_NOTIFY_CHANGE_STREAM_WRITE	0x00000100


/* file system flags */
#define NT_FILE_CASE_SENSITIVE_SEARCH		0x00000001
#define NT_FILE_CASE_PRESERVED_NAMES		0x00000002
#define NT_FILE_UNICODE_ON_DISK			0x00000004
#define NT_FILE_PERSISTENT_ACLS			0x00000008
#define NT_FILE_FILE_COMPRESSION		0x00000010
#define NT_FILE_VOLUME_QUOTAS			0x00000020
#define NT_FILE_SUPPORTS_SPARSE_FILES		0x00000040
#define NT_FILE_SUPPORTS_REPARSE_POINTS		0x00000080
#define NT_FILE_SUPPORTS_REMOTE_STORAGE		0x00000100
#define NT_FILE_VOLUME_IS_COMPRESSED		0x00008000
#define NT_FILE_SUPPORTS_OBJECT_IDS		0x00010000
#define NT_FILE_SUPPORTS_ENCRYPTION		0x00020000
#define NT_FILE_NAMED_STREAMS			0x00040000
#define NT_FILE_READ_ONLY_VOLUME		0x00080000
#define NT_FILE_SEQUENTIAL_WRITE_ONCE		0x00100000
#define NT_FILE_SUPPORTS_TRANSACTIONS		0x00200000
#define NT_FILE_SUPPORTS_HARD_LINKS		0x00400000
#define NT_FILE_SUPPORTS_EXTENDED_ATTRIBUTES	0x00800000
#define NT_FILE_SUPPORTS_OPEN_BY_FILE_ID	0x01000000
#define NT_FILE_SUPPORTS_USN_JOURNAL		0x02000000
#define NT_FILE_SUPPORT_INTEGRITY_STREAMS	0x04000000


/* file sector size flags */
#define NT_SSINFO_FLAGS_ALIGNED_DEVICE			0x00000001
#define NT_SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE	0x00000002
#define NT_SSINFO_FLAGS_NO_SEEK_PENALTY			0x00000004
#define NT_SSINFO_FLAGS_TRIM_ENABLED			0x00000008


/* file alignment flags */
#define NT_FILE_BYTE_ALIGNMENT		0x00000000
#define NT_FILE_WORD_ALIGNMENT		0x00000001
#define NT_FILE_LONG_ALIGNMENT		0x00000003
#define NT_FILE_QUAD_ALIGNMENT		0x00000007
#define NT_FILE_OCTA_ALIGNMENT		0x0000000f
#define NT_FILE_32_BYTE_ALIGNMENT	0x0000001f
#define NT_FILE_64_BYTE_ALIGNMENT	0x0000003f
#define NT_FILE_128_BYTE_ALIGNMENT	0x0000007f
#define NT_FILE_256_BYTE_ALIGNMENT	0x000000ff
#define NT_FILE_512_BYTE_ALIGNMENT	0x000001ff


/* file tx info flags */
#define NT_FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_WRITELOCKED		0x00000001
#define NT_FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_TO_TX	0x00000002
#define NT_FILE_ID_GLOBAL_TX_DIR_INFO_FLAG_VISIBLE_OUTSIDE_TX	0x00000004


/* friendly file type bits */
#define NT_FILE_TYPE_UNKNOWN		(0x0000u)
#define NT_FILE_TYPE_FILE		(0x0001u)
#define NT_FILE_TYPE_DIRECTORY		(0x0002u)
#define NT_FILE_TYPE_PIPE		(0x0004u)
#define NT_FILE_TYPE_SOCKET		(0x0008u)
#define NT_FILE_TYPE_MAILSLOT		(0x0010u)
#define NT_FILE_TYPE_CSRSS		(0x0020u)
#define NT_FILE_TYPE_PTY		(0x0040u)
#define NT_FILE_TYPE_VFD		(0x0080u)


/* file access bits */
#define	NT_FILE_ANY_ACCESS		(0x0000u)
#define	NT_FILE_READ_ACCESS		(0x0001u)
#define	NT_FILE_READ_DATA		(0x0001u)
#define	NT_FILE_LIST_DIRECTORY		(0x0001u)
#define	NT_FILE_WRITE_ACCESS		(0x0002u)
#define	NT_FILE_WRITE_DATA		(0x0002u)
#define	NT_FILE_ADD_FILE		(0x0002u)
#define	NT_FILE_APPEND_DATA		(0x0004u)
#define	NT_FILE_ADD_SUBDIRECTORY	(0x0004u)
#define	NT_FILE_CREATE_PIPE_INSTANCE	(0x0004u)
#define	NT_FILE_READ_EA			(0x0008u)
#define	NT_FILE_WRITE_EA		(0x0010u)
#define	NT_FILE_EXECUTE			(0x0020u)
#define	NT_FILE_TRAVERSE		(0x0020u)
#define	NT_FILE_DELETE_CHILD		(0x0040u)
#define	NT_FILE_READ_ATTRIBUTES		(0x0080u)
#define	NT_FILE_WRITE_ATTRIBUTES	(0x0100u)

#define NT_FILE_GENERIC_WRITE		NT_FILE_WRITE_ATTRIBUTES \
					| NT_FILE_WRITE_DATA \
					| NT_FILE_WRITE_EA \
					| NT_FILE_APPEND_DATA \
					| NT_SEC_READ_CONTROL \
					| NT_SEC_SYNCHRONIZE

#define NT_FILE_ALL_ACCESS		NT_FILE_ANY_ACCESS \
					| NT_FILE_READ_ACCESS \
					| NT_FILE_WRITE_ACCESS \
					| NT_FILE_APPEND_DATA \
					| NT_FILE_READ_EA \
					| NT_FILE_WRITE_EA \
					| NT_FILE_EXECUTE \
					| NT_FILE_TRAVERSE \
					| NT_FILE_DELETE_CHILD \
					| NT_FILE_READ_ATTRIBUTES \
					| NT_FILE_WRITE_ATTRIBUTES \
					| NT_SEC_SYNCHRONIZE \
					| NT_SEC_STANDARD_RIGHTS_ALL


/* structures related to nt_fs_info_class */
typedef struct _nt_file_fs_volume_information {
	nt_large_integer	volume_creation_time;
	uint32_t		volume_serial_number;
	uint32_t		volume_label_length;
	unsigned char		supports_objects ;
	unsigned char		reserved;
	wchar16_t		volume_label[];
} nt_file_fs_volume_information, nt_fsvi;


typedef struct _nt_file_fs_label_information {
	uint32_t		volume_label_length;
	wchar16_t		volume_label[];
} nt_file_fs_label_information;


typedef struct _nt_file_fs_size_information {
	nt_large_integer	total_allocation_units;
	nt_large_integer	available_allocation_units;
	uint32_t		sectors_per_allocation_unit;
	uint32_t		bytes_per_sector;
} nt_file_fs_size_information, nt_fssi;


typedef struct _nt_file_fs_device_information {
	nt_device_type	device_type;
	uint32_t	characteristics;
} nt_file_fs_device_information, nt_fsdi;


typedef struct _nt_file_fs_attribute_information {
	uint32_t	file_system_attributes;
	uint32_t	maximum_component_name_length;
	uint32_t	file_system_name_length;
	wchar16_t	file_system_name[];
} nt_file_fs_attribute_information, nt_fsai;


typedef struct _nt_file_fs_control_information {
	nt_large_integer	free_space_start_filtering;
	nt_large_integer	free_space_threshold;
	nt_large_integer	free_space_stop_filtering;
	nt_large_integer	default_quota_threshold;
	nt_large_integer	default_quota_limit;
	uint32_t		file_system_control_flags;
	uint32_t		padding;
} nt_file_fs_control_information, nt_fsci;


typedef struct _nt_file_fs_full_size_information {
	nt_large_integer	total_allocation_units;
	nt_large_integer	caller_available_allocation_units;
	nt_large_integer	actual_available_allocation_units;
	uint32_t		sectors_per_allocation_unit;
	uint32_t		bytes_per_sector;
} nt_file_fs_full_size_information, nt_fsfsi;


typedef struct _nt_file_fs_object_id_information {
	nt_uuid		volume_object_id;
	uint32_t	volume_object_id_extended_info;
} nt_file_fs_object_id_information, nt_fsoii;


typedef struct _nt_file_fs_driver_path_information {
	unsigned char 		driver_in_path;
	unsigned char		reserved[3];
	uint32_t		driver_name_length;
	wchar16_t		driver_name[];
} nt_file_fs_driver_path_information, nt_fsdpi;


typedef struct _nt_file_fs_sector_size_information {
	uint32_t	logical_bytes_per_sector;
	uint32_t	physical_bytes_per_sector_for_atomicity;
	uint32_t	physical_bytes_per_sector_for_performance;
	uint32_t	effective_physical_bytes_per_sector_for_atomicity;
	uint32_t	flags;
	uint32_t	byte_offset_for_sector_alignment;
	uint32_t	byte_offset_for_partition_alignment;
} nt_file_fs_sector_size_information, nt_fsssi;


typedef struct _nt_file_fs_persistent_volume_information {
	uint32_t	volume_flags;
	uint32_t	flag_mask;
	uint32_t	version;
	uint32_t	reserved;
} nt_file_fs_persistent_volume_information;


/* structures related to zw_query_quota_information_file */
typedef struct _nt_file_user_quota_information {
	uint32_t		next_entry_offset;
	uint32_t		sid_length;
	nt_large_integer	change_time;
	nt_large_integer	quota_used;
	nt_large_integer	quota_threshold;
	nt_large_integer	quota_limit;
	nt_sid			sid[];
} nt_file_user_quota_information;


typedef struct _nt_file_quota_list_information {
	uint32_t	next_entry_offset;
	uint32_t	sid_length;
	nt_sid		sid[];
} nt_file_quota_list_information;



/* structures included in nt_file_all_information */
typedef struct _nt_file_basic_information {
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	uint32_t		file_attr;
} nt_file_basic_information, nt_fbi;


typedef struct _nt_file_standard_information {
	nt_large_integer	allocation_size;
	nt_large_integer	end_of_file;
	uint32_t		number_of_links;
	unsigned char		delete_pending;
	unsigned char		directory;
	unsigned char		reserved[2];
} nt_file_standard_information, nt_fsi;


typedef struct _nt_file_internal_information {
	nt_large_integer	index_number;
} nt_file_internal_information, nt_fii;


typedef struct _nt_file_ea_information {
	uint32_t	ea_size;
} nt_file_ea_information, nt_fei;


typedef struct _nt_file_access_information {
	uint32_t	access_flags;
} nt_file_access_information, nt_facci;


typedef struct _nt_file_position_information {
	nt_large_integer	current_byte_offset;
} nt_file_position_information, nt_fpi;


typedef struct _nt_file_mode_information {
	uint32_t	mode;
} nt_file_mode_information, nt_fmi;


typedef struct _nt_file_alignment_information {
	uint32_t	alignment_requirement;
} nt_file_alignment_information, nt_falii;


typedef struct _nt_file_name_information {
	uint32_t	file_name_length;
	wchar16_t	file_name[];
} nt_file_name_information, nt_fni;


typedef struct _nt_file_all_information {
	nt_file_basic_information	basic_info;
	nt_file_standard_information	standard_info;
	nt_file_internal_information	internal_info;
	nt_file_ea_information		ea_info;
	nt_file_access_information	access_info;
	nt_file_position_information	position_info;
	nt_file_mode_information	mode_info;
	nt_file_alignment_information	alignment_info;
	nt_file_name_information	name_info;
} nt_file_all_information, nt_fai;



/* structures related to nt_file_info_class */
typedef struct _nt_file_directory_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	wchar16_t		file_name[];
} nt_file_directory_information, nt_fdiri;


typedef struct _nt_file_full_dir_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	uint32_t		ea_size;
	wchar16_t		file_name[];
} nt_file_full_dir_information;


typedef struct _nt_file_both_dir_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	uint32_t		ea_size;
	char			short_name_length;
	char			reserved;
	wchar16_t		short_name[12];
	wchar16_t		file_name[];
} nt_file_both_dir_information;


typedef struct _nt_file_rename_information {
	unsigned char		replace_if_exists;
	void *			root_directory;
	uint32_t		file_name_length;
	wchar16_t		file_name[];
} nt_file_rename_information, nt_frni;


typedef struct _nt_file_link_information {
	unsigned char		replace_if_exists;
	void *			root_directory;
	uint32_t		file_name_length;
	wchar16_t		file_name[];
} nt_file_link_information;


typedef struct _nt_file_names_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	uint32_t		file_name_length;
	wchar16_t		file_name[];
} nt_file_names_information, nt_fnamesi;


typedef struct _nt_file_disposition_information {
	unsigned char	delete_file;
} nt_file_disposition_information, nt_fdi;


typedef struct _nt_file_full_ea_information {
	uint32_t	next_entry_offset;
	unsigned char	flags;
	unsigned char	ea_name_length;
	uint16_t	ea_value_length;
	char		ea_name[];
} nt_file_full_ea_information;


typedef struct _nt_file_allocation_information {
	nt_large_integer	allocation_size;
} nt_file_allocation_information;


typedef struct _nt_file_end_of_file_information {
	nt_large_integer	end_of_file;
} nt_file_end_of_file_information, nt_eof;


typedef struct _nt_file_stream_information {
	uint32_t		next_entry_offset;
	uint32_t		stream_name_length;
	nt_large_integer	stream_size;
	nt_large_integer	stream_allocation_size;
	wchar16_t		stream_name[];
} nt_file_stream_information;


typedef struct _nt_file_pipe_information {
	uint32_t	read_mode;
	uint32_t	completion_mode;
} nt_file_pipe_information;


typedef struct _nt_file_pipe_local_information {
	uint32_t	named_pipe_type;
	uint32_t	named_pipe_configuration;
	uint32_t	maximum_instances;
	uint32_t	current_instances;
	uint32_t	inbound_quota;
	uint32_t	read_data_available;
	uint32_t	outbound_quota;
	uint32_t	write_quota_available;
	uint32_t	named_pipe_state;
	uint32_t	named_pipe_end;
} nt_file_pipe_local_information;


typedef struct _nt_file_pipe_remote_information {
	nt_large_integer	collect_data_time;
	uint32_t		maximum_collection_count;
} nt_file_pipe_remote_information;


typedef struct _nt_file_mailslot_query_information {
	uint32_t		maximum_message_size;
	uint32_t		mailslot_quota;
	uint32_t		next_message_size;
	uint32_t		messages_available;
	nt_large_integer	read_timeout;
} nt_file_mailslot_query_information;


typedef struct _nt_file_mailslot_set_information {
	nt_large_integer *	read_timeout;
} nt_file_mailslot_set_information;


typedef struct _nt_file_compression_information {
	nt_large_integer		CompressedFileSize;
	uint16_t			CompressionFormat;
	unsigned char			CompressionUnitShift;
	unsigned char			ChunkShift;
	unsigned char			ClusterShift;
	unsigned char			Reserved[3];
} nt_file_compression_information;


typedef struct _nt_file_object_id_buffer {
	unsigned char	obj_id[16];
	unsigned char	birth_volume_id[16];
	unsigned char	birth_object_id[16];
	unsigned char	domain_id[16];
} nt_file_object_id_buffer;


typedef struct _nt_file_object_id_information {
	int64_t		file_reference;
	unsigned char	object_id[16];

	union {
		struct {
			unsigned char	birth_volume_id[16];
			unsigned char	birth_object_id[16];
			unsigned char	domain_id[16];
		};
		unsigned char	extended_info[48];
	};
} nt_file_object_id_information;


typedef struct _nt_file_quota_information {
	uint32_t		next_entry_offset;
	uint32_t		sid_length;
	nt_large_integer	change_time;
	nt_large_integer	quota_used;
	nt_large_integer	quota_threshold;
	nt_large_integer	quota_limit;
	nt_sid			sid;
} nt_file_quota_information;


typedef struct _nt_file_reparse_point_information {
	int64_t		file_reference;
	uint32_t	tag;
} nt_file_reparse_point_information, nt_frpi;


typedef struct _nt_file_network_open_information {
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	allocation_size;
	nt_large_integer	end_of_file;
	uint32_t		file_attributes;
} nt_file_network_open_information;


typedef struct _nt_file_attribute_tag_information {
	uint32_t	file_attr;
	uint32_t	reparse_tag;
} nt_file_attribute_tag_information, nt_ftagi;


typedef struct _nt_file_id_both_dir_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	uint32_t		ea_size;
	char			short_name_length;
	char			reserved;
	wchar16_t		short_name[12];
	nt_large_integer	file_id;
	wchar16_t		file_name[];
} nt_file_id_both_dir_information, nt_fsdirent;


typedef struct _nt_file_id_full_dir_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	uint32_t		ea_size;
	nt_large_integer	FileId;
	wchar16_t		file_name[];
} nt_file_id_full_dir_information;


typedef struct _nt_file_valid_data_length_information {
	nt_large_integer	valid_data_length;
} nt_file_valid_data_length_information;


typedef struct _nt_file_io_priority_hint_information {
	nt_io_priority_hint	priority_hint;
} nt_file_io_priority_hint_information;


typedef struct _nt_file_link_entry_information {
	uint32_t	next_entry_offset;
	int64_t		parent_file_id;
	uint32_t	file_name_length;
	wchar16_t	file_name[];
} nt_file_link_entry_information;


typedef struct _nt_file_links_information {
	uint32_t	bytes_needed;
	uint32_t	entries_returned;
	nt_file_link_entry_information	entry;
} nt_file_links_information;


typedef struct _nt_file_id_global_tx_dir_information {
	uint32_t		next_entry_offset;
	uint32_t		file_index;
	nt_large_integer	creation_time;
	nt_large_integer	last_access_time;
	nt_large_integer	last_write_time;
	nt_large_integer	change_time;
	nt_large_integer	end_of_file;
	nt_large_integer	allocation_size;
	uint32_t		file_attributes;
	uint32_t		file_name_length;
	nt_large_integer	file_id;
	nt_guid			locking_transaction_id;
	uint32_t		tx_info_flags;
	wchar16_t		file_name[];
} nt_file_id_global_tx_dir_information;


typedef struct _nt_file_completion_information {
	void *	port;
	void *	key;
} nt_file_completion_information;



/* file extended attributes */
typedef struct _nt_file_get_ea_information {
	uint32_t	next_entry_offset;
	unsigned char	ea_name_length;
	char		ea_name[];
} nt_file_get_ea_information;


/* quota information */
typedef struct _nt_file_get_quota_information {
	uint32_t	next_entry_offset;
	uint32_t	sid_length;
	nt_sid		sid;
} nt_file_get_quota_information;


/* file change notification */
typedef struct _nt_file_notify_information {
	uint32_t	next_entry_offset;
	uint32_t	action;
	uint32_t	file_name_length;
	wchar16_t	file_name[];
} nt_file_notify_information;


/* file segment element */
typedef union _nt_file_segment_element {
  uint64_t *	buffer;
  uint64_t	alignment;
} nt_file_segment_element;


/* section object pointers */
typedef struct _nt_section_object_pointers {
	void *	data_section_object;
	void *	shared_cache_map;
	void *	image_section_object;
} nt_section_object_pointers;


/* reparse guid data buffer */
typedef struct _nt_reparse_guid_data_buffer {
	uint32_t	reparse_tag;
	uint16_t	reparse_data_length;
	uint16_t	reserved;
	nt_guid		reparse_guid;
	unsigned char	generic_reparse_buffer[];
} nt_reparse_guid_data_buffer;


/* reparse data buffer */
typedef struct _nt_reparse_data_buffer {
	uint32_t	reparse_tag;
	uint16_t	reparse_data_length;
	uint16_t	reserved;

	union {
		struct {
			uint16_t	substitute_name_offset;
			uint16_t	substitute_name_length;
			uint16_t	print_name_offset;
			uint16_t	print_name_length;
			uint32_t	flags;
		} symbolic_link_reparse_buffer;

		struct {
			uint16_t	substitute_name_offset;
			uint16_t	substitute_name_length;
			uint16_t	print_name_offset;
			uint16_t	print_name_length;
		} mount_point_reparse_buffer;
	};

	wchar16_t	path_buffer[];
} nt_reparse_data_buffer;


/* file object */
typedef struct _nt_file_object {
	int16_t				type;
	int16_t				size;
	nt_device_object *		dev_obj;
	nt_vpb				vpb;
	void *				fs_context;
	void *				fs_context_2nd;
	nt_section_object_pointers *	sec_obj_ptr;
	void *				private_cache_map;
	int32_t				final_status;
	struct _nt_file_object *	related_file_obj;
	unsigned char			lock_operation;
	unsigned char			delete_pending;
	unsigned char			read_access;
	unsigned char			write_access;
	unsigned char			delete_access;
	unsigned char			shared_read;
	unsigned char			shared_write;
	unsigned char			shared_delete;
	uint32_t			flags;
	nt_unicode_string		file_name;
	nt_large_integer		current_byte_offset;
	uint32_t			waiters;
	uint32_t			busy;
	void *				last_lock;
	nt_kevent			lock;
	nt_kevent			event;
	nt_io_completion_context *	completion_context;
	uint32_t			irp_list_lock;
	nt_list_entry			irp_list;
	void *				file_obj_ext;
} nt_file_object;




/* file-related function signatures */
typedef int32_t __stdcall ntapi_zw_create_file(
	__out	void **			hfile,
	__in	uint32_t		desired_access,
	__in	nt_object_attributes *	obj_attr,
	__out	nt_io_status_block *	io_status_block,
	__in	nt_large_integer *	allocation_size		__optional,
	__in	uint32_t		file_attr,
	__in	uint32_t		share_access,
	__in	uint32_t		create_disposition,
	__in	uint32_t		create_options,
	__in	void *			ea_buffer		__optional,
	__in	uint32_t		ea_length);


typedef int32_t	__stdcall ntapi_zw_open_file(
	__out	void **			hfile,
	__in	uint32_t		desired_access,
	__in	nt_object_attributes *	obj_attr,
	__out	nt_io_status_block *	io_status_block,
	__in	uint32_t		share_access,
	__in	uint32_t		open_options);


typedef int32_t	__stdcall ntapi_zw_delete_file(
	__in	nt_object_attributes *	obj_attr);


typedef int32_t	__stdcall ntapi_zw_flush_buffers_file(
	__in	void *			hfile,
	__out	nt_io_status_block *	io_status_block);


typedef int32_t	__stdcall ntapi_zw_cancel_io_file(
	__in	void *			hfile,
	__out	nt_io_status_block *	io_status_block);


typedef int32_t	__stdcall ntapi_zw_cancel_io_file_ex(
	__in	void *			hfile,
	__in	nt_io_status_block *	request_iosb	__optional,
	__out	nt_io_status_block *	cancel_iosb);


typedef int32_t	__stdcall ntapi_zw_read_file(
	__in	void *			hfile,
	__in	void *			hevent		__optional,
	__in	nt_io_apc_routine *	apc_routine	__optional,
	__in	void *			apc_context	__optional,
	__out	nt_iosb volatile *	io_status_block,
	__out	void *			buffer,
	__in	uint32_t		bytes_to_read,
	__in	nt_large_integer *	byte_offset	__optional,
	__in	uint32_t *		key		__optional);


typedef int32_t __stdcall ntapi_zw_write_file(
	__in	void *			hfile,
	__in 	void *			hevent		__optional,
	__in	nt_io_apc_routine *	apc_routine	__optional,
	__in	void * 			apc_context	__optional,
	__out	nt_iosb volatile *	io_status_block,
	__in	void * 			buffer,
	__in	uint32_t		bytes_sent,
	__in	nt_large_integer *	byte_offset	__optional,
	__in	uint32_t *		key		__optional);


typedef int32_t	__stdcall ntapi_zw_read_file_scatter(
	__in	void *				hfile,
	__in	void *				hevent		__optional,
	__in	nt_io_apc_routine *		apc_routine	__optional,
	__in	void *				apc_context	__optional,
	__out	nt_iosb volatile *		io_status_block,
	__in	nt_file_segment_element *	buffer,
	__in	uint32_t			bytes_to_read,
	__in	nt_large_integer *		byte_offset	__optional,
	__in	uint32_t *			key		__optional);


typedef int32_t	__stdcall ntapi_zw_write_file_gather(
	__in	void *				hfile,
	__in	void *				hevent		__optional,
	__in	nt_io_apc_routine *		apc_routine	__optional,
	__in	void *				apc_context	__optional,
	__out	nt_iosb volatile *		io_status_block,
	__in	nt_file_segment_element *	buffer,
	__in	uint32_t			bytes_to_read,
	__in	nt_large_integer *		byte_offset	__optional,
	__in	uint32_t *			key		__optional);


typedef int32_t	__stdcall ntapi_zw_lock_file(
	__in	void *				hfile,
	__in	void *				hevent		__optional,
	__in	nt_io_apc_routine *		apc_routine	__optional,
	__in	void *				apc_context	__optional,
	__out	nt_iosb volatile *		io_status_block,
	__in	nt_large_integer *		lock_offset,
	__in	nt_large_integer *		lock_length,
	__in	uint32_t			key,
	__in	unsigned char			fail_immediately,
	__in	unsigned char			exclusive_lock);


typedef int32_t	__stdcall ntapi_zw_unlock_file(
	__in	void *				hfile,
	__out	nt_io_status_block *		io_status_block,
	__in	nt_large_integer *		lock_offset,
	__in	nt_large_integer *		lock_length,
	__in	uint32_t			key);


typedef int32_t	__stdcall ntapi_zw_device_io_control_file(
	__in	void *				hfile,
	__in	void *				hevent			__optional,
	__in	nt_io_apc_routine *		apc_routine		__optional,
	__in	void *				apc_context		__optional,
	__out	nt_iosb volatile *		io_status_block,
	__in	uint32_t			io_control_code,
	__in	void *				input_buffer		__optional,
	__in	uint32_t			input_buffer_length,
	__out	void *				output_buffer		__optional,
	__in	uint32_t			output_buffer_length);


typedef int32_t	__stdcall ntapi_zw_fs_control_file(
	__in	void *				hfile,
	__in	void *				hevent			__optional,
	__in	nt_io_apc_routine *		apc_routine		__optional,
	__in	void *				apc_context		__optional,
	__out	nt_iosb volatile *		io_status_block,
	__in	uint32_t			fs_control_code,
	__in	void *				input_buffer		__optional,
	__in	uint32_t			input_buffer_length,
	__out	void *				output_buffer		__optional,
	__in	uint32_t			output_buffer_length);


typedef int32_t	__stdcall ntapi_zw_notify_change_directory_file(
	__in	void *				hfile	,
	__in	void *				hevent			__optional,
	__in	nt_io_apc_routine *		apc_routine		__optional,
	__in	void *				apc_context		__optional,
	__out	nt_iosb volatile *		io_status_block,
	__out	nt_file_notify_information *	buffer,
	__in	uint32_t			buffer_length,
	__in	uint32_t			notify_filter,
	__in	unsigned char			watch_subtree);


typedef int32_t	__stdcall ntapi_zw_query_ea_file(
	__in	void *				hfile	,
	__out	nt_io_status_block *		io_status_block,
	__out	nt_file_full_ea_information *	buffer,
	__in	uint32_t			buffer_length,
	__in	unsigned char			return_single_entry,
	__in	nt_file_get_ea_information *	ea_list			__optional,
	__in	uint32_t			ea_list_length,
	__in	uint32_t *			ea_index		__optional,
	__in	unsigned char			restart_scan);


typedef int32_t	__stdcall ntapi_zw_set_ea_file(
	__in	void *				hfile	,
	__out	nt_io_status_block *		io_status_block,
	__in	nt_file_full_ea_information *	buffer,
	__in	uint32_t			buffer_length);


typedef int32_t	__stdcall ntapi_zw_create_named_pipe_file(
	__out	void **			hfile,
	__in	uint32_t		desired_access,
	__in	nt_object_attributes *	obj_attr,
	__out	nt_io_status_block *	io_status_block,
	__in	uint32_t		share_access,
	__in	uint32_t		create_disposition,
	__in	uint32_t		create_options,
	__in	uint32_t		type_message,
	__in	uint32_t		readmode_message,
	__in	uint32_t		non_blocking,
	__in	uint32_t		max_instances,
	__in	size_t			in_buffer_size,
	__in	size_t			out_buffer_size,
	__in	nt_large_integer *	default_timeout	__optional);


typedef int32_t	__stdcall ntapi_zw_create_mailslot_file(
	__out	void **			hfile,
	__in	uint32_t		desired_access,
	__in	nt_object_attributes *	obj_attr,
	__out	nt_io_status_block *	io_status_block,
	__in	uint32_t		create_options,
	__in	uint32_t		in_buffer_size,
	__in	uint32_t		max_message_size,
	__in	nt_large_integer *	read_timeout	__optional);


typedef int32_t	__stdcall ntapi_zw_query_volume_information_file(
	__in	void *				hfile	,
	__out	nt_io_status_block *		io_status_block,
	__out	void *				vol_info,
	__in	uint32_t			vol_info_length,
	__in	nt_fs_info_class		vol_info_class);


typedef int32_t	__stdcall ntapi_zw_set_volume_information_file(
	__in	void *				hfile	,
	__out	nt_io_status_block *		io_status_block,
	__in	void *				vol_info,
	__in	uint32_t			vol_info_length,
	__in	nt_fs_info_class		vol_info_class);


typedef int32_t	__stdcall ntapi_zw_query_quota_information_file(
	__in	void *					hfile	,
	__out	nt_io_status_block *			io_status_block,
	__out	nt_file_user_quota_information *	buffer,
	__in	uint32_t				buffer_length,
	__in	unsigned char				returning_single_entry,
	__in	nt_file_quota_list_information *	sid_list		__optional,
	__in	uint32_t				sid_list_length,
	__in	nt_sid *				start_sid		__optional,
	__in	unsigned char				restart_scan);


typedef int32_t	__stdcall ntapi_zw_set_quota_information_file(
	__in	void *					hfile	,
	__out	nt_io_status_block *			io_status_block,
	__in	nt_file_user_quota_information *	buffer,
	__in	uint32_t				buffer_length);


typedef int32_t	__stdcall ntapi_zw_query_attributes_file(
	__in	nt_object_attributes *		obj_attr,
	__out	nt_file_basic_information *	file_info);


typedef int32_t	__stdcall ntapi_zw_query_full_attributes_file(
	__in	nt_object_attributes *			obj_attr,
	__out	nt_file_network_open_information *	file_info);


typedef int32_t	__stdcall ntapi_zw_query_directory_file(
	__in	void *			hfile,
	__in	void *			hevent		__optional,
	__in	nt_io_apc_routine *	apc_routine	__optional,
	__in	void *			apc_context	__optional,
	__out	nt_iosb volatile *	io_status_block,
	__out	void *			file_info,
	__in	uint32_t		file_info_length,
	__in	nt_file_info_class	file_info_class,
	__in	unsigned char		return_single_entry,
	__in	nt_unicode_string *	file_name	__optional,
	__in	unsigned char		restart_scan);


typedef int32_t	__stdcall ntapi_zw_query_information_file(
	__in	void *			hfile,
	__out	nt_io_status_block *	io_status_block,
	__out	void *			file_info,
	__in	uint32_t		file_info_length,
	__in	nt_file_info_class	file_info_class);


typedef int32_t	__stdcall ntapi_zw_set_information_file(
	__in	void *			hfile,
	__out	nt_io_status_block *	io_status_block,
	__in	void *			file_info,
	__in	uint32_t		file_info_length,
	__in	nt_file_info_class	file_info_class);

/* extension functions */
typedef int32_t __stdcall ntapi_tt_get_file_handle_type(
	__in	void *		handle,
	__out	int32_t *	type);

typedef int32_t __stdcall ntapi_tt_open_logical_parent_directory(
	__out	void **		hparent,
	__in	void *		hdir,
	__out	uintptr_t *	buffer,
	__in	uint32_t	buffer_size,
	__in	uint32_t	oattr,
	__in	uint32_t	desired_access,
	__in	uint32_t	share_access,
	__in	uint32_t	open_options,
	__out	int *		reserved);

typedef int32_t __stdcall ntapi_tt_open_physical_parent_directory(
	__out	void **		hparent,
	__in	void *		hdir,
	__out	uintptr_t *	buffer,
	__in	uint32_t	buffer_size,
	__in	uint32_t	oattr,
	__in	uint32_t	desired_access,
	__in	uint32_t	share_access,
	__in	uint32_t	open_options,
	__out	int *		reserved);

typedef int32_t	__stdcall ntapi_tt_open_volume_by_guid(
	__out	void **			hfile,
	__in	const nt_guid *		guid,
	__in	uint32_t		desired_access,
	__in	nt_object_attributes *	obj_attr,
	__out	nt_io_status_block *	io_status_block,
	__in	uint32_t		share_access,
	__in	uint32_t		open_options);

#endif