26677801eda3d7991b2ca4c9e4675f92364bd9f1
[reactos.git] / reactos / include / ddk / ntifs.h
1 /*
2 * ntifs.h
3 *
4 * Windows NT Filesystem Driver Developer Kit
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Bo Brantén <bosse@acc.umu.se>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef _NTIFS_
24 #define _NTIFS_
25 #define _GNU_NTIFS_
26
27 #if __GNUC__ >= 3
28 #pragma GCC system_header
29 #endif
30
31 #ifdef _NTOSKRNL_
32 /* HACKHACKHACK!!! We shouldn't include this header from ntoskrnl! */
33 #define NTKERNELAPI
34 #else
35 #define NTKERNELAPI DECLSPEC_IMPORT
36 #endif
37
38 #include "ntddk.h"
39
40 #define _NTIFS_INCLUDED_
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 #pragma pack(push,4)
46
47 #ifndef VER_PRODUCTBUILD
48 #define VER_PRODUCTBUILD 10000
49 #endif
50
51 #ifndef NTSYSAPI
52 #define NTSYSAPI
53 #endif
54
55 #define EX_PUSH_LOCK ULONG_PTR
56 #define PEX_PUSH_LOCK PULONG_PTR
57
58 #include "csq.h"
59
60 typedef struct _SE_EXPORTS *PSE_EXPORTS;
61
62 #ifdef _NTOSKRNL_
63 extern PUCHAR FsRtlLegalAnsiCharacterArray;
64 #else
65 extern DECLSPEC_IMPORT PUCHAR FsRtlLegalAnsiCharacterArray;
66 #endif
67 extern PSE_EXPORTS SeExports;
68 extern PACL SePublicDefaultDacl;
69 extern PACL SeSystemDefaultDacl;
70
71 extern KSPIN_LOCK IoStatisticsLock;
72 extern ULONG IoReadOperationCount;
73 extern ULONG IoWriteOperationCount;
74 extern ULONG IoOtherOperationCount;
75 extern LARGE_INTEGER IoReadTransferCount;
76 extern LARGE_INTEGER IoWriteTransferCount;
77 extern LARGE_INTEGER IoOtherTransferCount;
78
79 typedef STRING LSA_STRING, *PLSA_STRING;
80 typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
81
82 typedef enum _SECURITY_LOGON_TYPE
83 {
84 UndefinedLogonType = 0,
85 Interactive = 2,
86 Network,
87 Batch,
88 Service,
89 Proxy,
90 Unlock,
91 NetworkCleartext,
92 NewCredentials,
93 #if (_WIN32_WINNT >= 0x0501)
94 RemoteInteractive,
95 CachedInteractive,
96 #endif
97 #if (_WIN32_WINNT >= 0x0502)
98 CachedRemoteInteractive,
99 CachedUnlock
100 #endif
101 } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
102
103 #define ANSI_DOS_STAR ('<')
104 #define ANSI_DOS_QM ('>')
105 #define ANSI_DOS_DOT ('"')
106
107 #define DOS_STAR (L'<')
108 #define DOS_QM (L'>')
109 #define DOS_DOT (L'"')
110
111 /* also in winnt.h */
112 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
113 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
114 #define ACCESS_DENIED_ACE_TYPE (0x1)
115 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
116 #define SYSTEM_ALARM_ACE_TYPE (0x3)
117 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
118 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
119 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
120 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
121 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
122 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
123 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
124 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
125 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
126 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
127 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
128 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
129 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
130 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
131 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
132 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
133 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
134 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
135 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
136 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x10)
137
138 #define COMPRESSION_FORMAT_NONE (0x0000)
139 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
140 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
141 #define COMPRESSION_ENGINE_STANDARD (0x0000)
142 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
143 #define COMPRESSION_ENGINE_HIBER (0x0200)
144
145 #define FILE_ACTION_ADDED 0x00000001
146 #define FILE_ACTION_REMOVED 0x00000002
147 #define FILE_ACTION_MODIFIED 0x00000003
148 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
149 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
150 #define FILE_ACTION_ADDED_STREAM 0x00000006
151 #define FILE_ACTION_REMOVED_STREAM 0x00000007
152 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
153 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
154 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
155 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
156 /* end winnt.h */
157
158 #define FILE_EA_TYPE_BINARY 0xfffe
159 #define FILE_EA_TYPE_ASCII 0xfffd
160 #define FILE_EA_TYPE_BITMAP 0xfffb
161 #define FILE_EA_TYPE_METAFILE 0xfffa
162 #define FILE_EA_TYPE_ICON 0xfff9
163 #define FILE_EA_TYPE_EA 0xffee
164 #define FILE_EA_TYPE_MVMT 0xffdf
165 #define FILE_EA_TYPE_MVST 0xffde
166 #define FILE_EA_TYPE_ASN1 0xffdd
167 #define FILE_EA_TYPE_FAMILY_IDS 0xff01
168
169 #define FILE_NEED_EA 0x00000080
170
171 /* also in winnt.h */
172 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
173 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
174 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
175 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
176 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
177 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
178 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
179 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
180 #define FILE_NOTIFY_CHANGE_EA 0x00000080
181 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
182 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
183 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
184 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
185 #define FILE_NOTIFY_VALID_MASK 0x00000fff
186 /* end winnt.h */
187
188 #define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007
189 #define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008
190
191 #define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009
192
193 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
194 #define FILE_CASE_PRESERVED_NAMES 0x00000002
195 #define FILE_UNICODE_ON_DISK 0x00000004
196 #define FILE_PERSISTENT_ACLS 0x00000008
197 #define FILE_FILE_COMPRESSION 0x00000010
198 #define FILE_VOLUME_QUOTAS 0x00000020
199 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
200 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
201 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
202 #define FS_LFN_APIS 0x00004000
203 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
204 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
205 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
206 #define FILE_NAMED_STREAMS 0x00040000
207
208 #define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
209 #define FILE_PIPE_MESSAGE_TYPE 0x00000001
210
211 #define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
212 #define FILE_PIPE_MESSAGE_MODE 0x00000001
213
214 #define FILE_PIPE_QUEUE_OPERATION 0x00000000
215 #define FILE_PIPE_COMPLETE_OPERATION 0x00000001
216
217 #define FILE_PIPE_INBOUND 0x00000000
218 #define FILE_PIPE_OUTBOUND 0x00000001
219 #define FILE_PIPE_FULL_DUPLEX 0x00000002
220
221 #define FILE_PIPE_DISCONNECTED_STATE 0x00000001
222 #define FILE_PIPE_LISTENING_STATE 0x00000002
223 #define FILE_PIPE_CONNECTED_STATE 0x00000003
224 #define FILE_PIPE_CLOSING_STATE 0x00000004
225
226 #define FILE_PIPE_CLIENT_END 0x00000000
227 #define FILE_PIPE_SERVER_END 0x00000001
228
229 #define FILE_PIPE_READ_DATA 0x00000000
230 #define FILE_PIPE_WRITE_SPACE 0x00000001
231
232 #define FILE_STORAGE_TYPE_SPECIFIED 0x00000041 /* FILE_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE */
233 #define FILE_STORAGE_TYPE_DEFAULT (StorageTypeDefault << FILE_STORAGE_TYPE_SHIFT)
234 #define FILE_STORAGE_TYPE_DIRECTORY (StorageTypeDirectory << FILE_STORAGE_TYPE_SHIFT)
235 #define FILE_STORAGE_TYPE_FILE (StorageTypeFile << FILE_STORAGE_TYPE_SHIFT)
236 #define FILE_STORAGE_TYPE_DOCFILE (StorageTypeDocfile << FILE_STORAGE_TYPE_SHIFT)
237 #define FILE_STORAGE_TYPE_JUNCTION_POINT (StorageTypeJunctionPoint << FILE_STORAGE_TYPE_SHIFT)
238 #define FILE_STORAGE_TYPE_CATALOG (StorageTypeCatalog << FILE_STORAGE_TYPE_SHIFT)
239 #define FILE_STORAGE_TYPE_STRUCTURED_STORAGE (StorageTypeStructuredStorage << FILE_STORAGE_TYPE_SHIFT)
240 #define FILE_STORAGE_TYPE_EMBEDDING (StorageTypeEmbedding << FILE_STORAGE_TYPE_SHIFT)
241 #define FILE_STORAGE_TYPE_STREAM (StorageTypeStream << FILE_STORAGE_TYPE_SHIFT)
242 #define FILE_MINIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_DEFAULT
243 #define FILE_MAXIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_STREAM
244 #define FILE_STORAGE_TYPE_MASK 0x000f0000
245 #define FILE_STORAGE_TYPE_SHIFT 16
246
247 #define FILE_VC_QUOTA_NONE 0x00000000
248 #define FILE_VC_QUOTA_TRACK 0x00000001
249 #define FILE_VC_QUOTA_ENFORCE 0x00000002
250 #define FILE_VC_QUOTA_MASK 0x00000003
251
252 #define FILE_VC_QUOTAS_LOG_VIOLATIONS 0x00000004
253 #define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
254
255 #define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
256 #define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
257 #define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
258 #define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
259
260 #define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
261 #define FILE_VC_QUOTAS_REBUILDING 0x00000200
262
263 #define FILE_VC_VALID_MASK 0x000003ff
264
265 #define FSRTL_FLAG_FILE_MODIFIED (0x01)
266 #define FSRTL_FLAG_FILE_LENGTH_CHANGED (0x02)
267 #define FSRTL_FLAG_LIMIT_MODIFIED_PAGES (0x04)
268 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08)
269 #define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10)
270 #define FSRTL_FLAG_USER_MAPPED_FILE (0x20)
271 #define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80)
272
273 #define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
274
275 #define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
276 #define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
277 #define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
278 #define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
279 #define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
280
281 #define FSRTL_VOLUME_DISMOUNT 1
282 #define FSRTL_VOLUME_DISMOUNT_FAILED 2
283 #define FSRTL_VOLUME_LOCK 3
284 #define FSRTL_VOLUME_LOCK_FAILED 4
285 #define FSRTL_VOLUME_UNLOCK 5
286 #define FSRTL_VOLUME_MOUNT 6
287
288 #define FSRTL_WILD_CHARACTER 0x08
289
290 #define FSRTL_FAT_LEGAL 0x01
291 #define FSRTL_HPFS_LEGAL 0x02
292 #define FSRTL_NTFS_LEGAL 0x04
293 #define FSRTL_WILD_CHARACTER 0x08
294 #define FSRTL_OLE_LEGAL 0x10
295 #define FSRTL_NTFS_STREAM_LEGAL 0x14
296
297 #ifdef _X86_
298 #define HARDWARE_PTE HARDWARE_PTE_X86
299 #define PHARDWARE_PTE PHARDWARE_PTE_X86
300 #else
301 #define HARDWARE_PTE ULONG
302 #define PHARDWARE_PTE PULONG
303 #endif
304
305 #define IO_CHECK_CREATE_PARAMETERS 0x0200
306 #define IO_ATTACH_DEVICE 0x0400
307
308 #define IO_ATTACH_DEVICE_API 0x80000000
309
310 #define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64
311 #define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024
312
313 #define IO_TYPE_APC 18
314 #define IO_TYPE_DPC 19
315 #define IO_TYPE_DEVICE_QUEUE 20
316 #define IO_TYPE_EVENT_PAIR 21
317 #define IO_TYPE_INTERRUPT 22
318 #define IO_TYPE_PROFILE 23
319
320 #define IRP_BEING_VERIFIED 0x10
321
322 #define MAILSLOT_CLASS_FIRSTCLASS 1
323 #define MAILSLOT_CLASS_SECONDCLASS 2
324
325 #define MAILSLOT_SIZE_AUTO 0
326
327 #define MAP_PROCESS 1L
328 #define MAP_SYSTEM 2L
329 #define MEM_DOS_LIM 0x40000000
330
331 #define OB_TYPE_TYPE 1
332 #define OB_TYPE_DIRECTORY 2
333 #define OB_TYPE_SYMBOLIC_LINK 3
334 #define OB_TYPE_TOKEN 4
335 #define OB_TYPE_PROCESS 5
336 #define OB_TYPE_THREAD 6
337 #define OB_TYPE_EVENT 7
338 #define OB_TYPE_EVENT_PAIR 8
339 #define OB_TYPE_MUTANT 9
340 #define OB_TYPE_SEMAPHORE 10
341 #define OB_TYPE_TIMER 11
342 #define OB_TYPE_PROFILE 12
343 #define OB_TYPE_WINDOW_STATION 13
344 #define OB_TYPE_DESKTOP 14
345 #define OB_TYPE_SECTION 15
346 #define OB_TYPE_KEY 16
347 #define OB_TYPE_PORT 17
348 #define OB_TYPE_ADAPTER 18
349 #define OB_TYPE_CONTROLLER 19
350 #define OB_TYPE_DEVICE 20
351 #define OB_TYPE_DRIVER 21
352 #define OB_TYPE_IO_COMPLETION 22
353 #define OB_TYPE_FILE 23
354
355 #define PIN_WAIT (1)
356 #define PIN_EXCLUSIVE (2)
357 #define PIN_NO_READ (4)
358 #define PIN_IF_BCB (8)
359
360 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
361 #define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
362
363 #define SEC_BASED 0x00200000
364
365 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
366 #define SECURITY_WORLD_RID (0x00000000L)
367
368 #define SID_REVISION 1
369 #define SID_MAX_SUB_AUTHORITIES 15
370 #define SID_RECOMMENDED_SUB_AUTHORITIES 1
371
372 #define TOKEN_ASSIGN_PRIMARY (0x0001)
373 #define TOKEN_DUPLICATE (0x0002)
374 #define TOKEN_IMPERSONATE (0x0004)
375 #define TOKEN_QUERY (0x0008)
376 #define TOKEN_QUERY_SOURCE (0x0010)
377 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
378 #define TOKEN_ADJUST_GROUPS (0x0040)
379 #define TOKEN_ADJUST_DEFAULT (0x0080)
380 #define TOKEN_ADJUST_SESSIONID (0x0100)
381
382 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
383 TOKEN_ASSIGN_PRIMARY |\
384 TOKEN_DUPLICATE |\
385 TOKEN_IMPERSONATE |\
386 TOKEN_QUERY |\
387 TOKEN_QUERY_SOURCE |\
388 TOKEN_ADJUST_PRIVILEGES |\
389 TOKEN_ADJUST_GROUPS |\
390 TOKEN_ADJUST_DEFAULT |\
391 TOKEN_ADJUST_SESSIONID)
392
393 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
394 TOKEN_QUERY)
395
396 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
397 TOKEN_ADJUST_PRIVILEGES |\
398 TOKEN_ADJUST_GROUPS |\
399 TOKEN_ADJUST_DEFAULT)
400
401 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
402
403 #define TOKEN_SOURCE_LENGTH 8
404 /* end winnt.h */
405
406 #define TOKEN_HAS_TRAVERSE_PRIVILEGE 0x01
407 #define TOKEN_HAS_BACKUP_PRIVILEGE 0x02
408 #define TOKEN_HAS_RESTORE_PRIVILEGE 0x04
409 #define TOKEN_HAS_ADMIN_GROUP 0x08
410 #define TOKEN_WRITE_RESTRICTED 0x08
411 #define TOKEN_IS_RESTRICTED 0x10
412 #define SE_BACKUP_PRIVILEGES_CHECKED 0x0100
413
414 #define VACB_MAPPING_GRANULARITY (0x40000)
415 #define VACB_OFFSET_SHIFT (18)
416
417 #define SE_OWNER_DEFAULTED 0x0001
418 #define SE_GROUP_DEFAULTED 0x0002
419 #define SE_DACL_PRESENT 0x0004
420 #define SE_DACL_DEFAULTED 0x0008
421 #define SE_SACL_PRESENT 0x0010
422 #define SE_SACL_DEFAULTED 0x0020
423 #define SE_DACL_UNTRUSTED 0x0040
424 #define SE_SERVER_SECURITY 0x0080
425 #define SE_DACL_AUTO_INHERIT_REQ 0x0100
426 #define SE_SACL_AUTO_INHERIT_REQ 0x0200
427 #define SE_DACL_AUTO_INHERITED 0x0400
428 #define SE_SACL_AUTO_INHERITED 0x0800
429 #define SE_DACL_PROTECTED 0x1000
430 #define SE_SACL_PROTECTED 0x2000
431 #define SE_RM_CONTROL_VALID 0x4000
432 #define SE_SELF_RELATIVE 0x8000
433
434 #ifndef _WINNT_H
435 #define _AUDIT_EVENT_TYPE_HACK 0
436 #endif
437 #if (_AUDIT_EVENT_TYPE_HACK == 1)
438
439 #else
440 typedef enum _AUDIT_EVENT_TYPE
441 {
442 AuditEventObjectAccess,
443 AuditEventDirectoryServiceAccess
444 } AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE;
445 #endif
446
447 #define AUDIT_ALLOW_NO_PRIVILEGE 0x1
448
449 #define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
450 #define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
451 #define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
452 #define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
453 #define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
454 #define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
455 #define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
456 #define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
457 #define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
458
459 #define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
460 #define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
461 #define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
462
463 #define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
464 #define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
465 #define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
466
467
468 #define FSCTL_MARK_AS_SYSTEM_HIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS)
469 #define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
470 #define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
471 #define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
472 #define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
473 #define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
474
475 #if (VER_PRODUCTBUILD >= 1381)
476
477 #define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
478 #define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
479 #define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS)
480 #define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS)
481 #define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
482 #define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
483 #define FSCTL_GET_HFS_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
484 #define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS)
485
486 #endif /* (VER_PRODUCTBUILD >= 1381) */
487
488 #if (VER_PRODUCTBUILD >= 2195)
489
490 #define FSCTL_READ_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 33, METHOD_NEITHER, FILE_ANY_ACCESS)
491 #define FSCTL_WRITE_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 34, METHOD_NEITHER, FILE_ANY_ACCESS)
492 #define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
493
494 #define FSCTL_DUMP_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 37, METHOD_NEITHER, FILE_ANY_ACCESS)
495 #define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_WRITE_DATA)
496 #define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
497 #define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_WRITE_DATA)
498 #define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_WRITE_DATA)
499 #define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
500 #define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_WRITE_DATA)
501 #define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_READ_DATA)
502 #define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA)
503 #define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_READ_DATA)
504 #define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_WRITE_DATA)
505 #define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
506 #define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA)
507 #define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
508 #define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA)
509 #define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
510 #define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
511 #define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS)
512 #define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_ANY_ACCESS)
513 #define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_ANY_ACCESS)
514 #define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_READ_DATA)
515 #define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_READ_DATA)
516 #define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_READ_DATA)
517 #define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
518 #define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)
519 #define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS)
520 #define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)
521 #define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
522 #define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
523 #define FSCTL_HSM_MSG CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 66, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
524 #define FSCTL_NSS_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 67, METHOD_BUFFERED, FILE_WRITE_DATA)
525 #define FSCTL_HSM_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 68, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
526 #define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
527 #define FSCTL_NSS_RCONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 70, METHOD_BUFFERED, FILE_READ_DATA)
528 #define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA)
529 #define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
530
531 #endif /* (VER_PRODUCTBUILD >= 2195) */
532
533 #define FSCTL_MAILSLOT_PEEK CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
534
535 #define FSCTL_NETWORK_SET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 102, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
536 #define FSCTL_NETWORK_GET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 103, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
537 #define FSCTL_NETWORK_GET_CONNECTION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 104, METHOD_NEITHER, FILE_ANY_ACCESS)
538 #define FSCTL_NETWORK_ENUMERATE_CONNECTIONS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 105, METHOD_NEITHER, FILE_ANY_ACCESS)
539 #define FSCTL_NETWORK_DELETE_CONNECTION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 107, METHOD_BUFFERED, FILE_ANY_ACCESS)
540 #define FSCTL_NETWORK_GET_STATISTICS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 116, METHOD_BUFFERED, FILE_ANY_ACCESS)
541 #define FSCTL_NETWORK_SET_DOMAIN_NAME CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_ANY_ACCESS)
542 #define FSCTL_NETWORK_REMOTE_BOOT_INIT_SCRT CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 250, METHOD_BUFFERED, FILE_ANY_ACCESS)
543
544 #define FSCTL_PIPE_ASSIGN_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
545 #define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
546 #define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
547 #define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
548 #define FSCTL_PIPE_QUERY_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
549 #define FSCTL_PIPE_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
550 #define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
551 #define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
552 #define FSCTL_PIPE_SET_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
553 #define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
554 #define FSCTL_PIPE_INTERNAL_READ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
555 #define FSCTL_PIPE_INTERNAL_WRITE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
556 #define FSCTL_PIPE_INTERNAL_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
557 #define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
558
559 #define IOCTL_REDIR_QUERY_PATH CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 99, METHOD_NEITHER, FILE_ANY_ACCESS)
560
561 typedef PVOID OPLOCK, *POPLOCK;
562
563 typedef struct _CACHE_MANAGER_CALLBACKS *PCACHE_MANAGER_CALLBACKS;
564 typedef struct _FILE_GET_QUOTA_INFORMATION *PFILE_GET_QUOTA_INFORMATION;
565 typedef struct _HANDLE_TABLE *PHANDLE_TABLE;
566 typedef struct _KPROCESS *PKPROCESS;
567 typedef struct _KQUEUE *PKQUEUE;
568 typedef struct _KTRAP_FRAME *PKTRAP_FRAME;
569 typedef struct _OBJECT_DIRECTORY *POBJECT_DIRECTORY;
570 typedef struct _SHARED_CACHE_MAP *PSHARED_CACHE_MAP;
571 typedef struct _VACB *PVACB;
572 typedef struct _VAD_HEADER *PVAD_HEADER;
573
574 typedef ULONG LBN;
575 typedef LBN *PLBN;
576
577 typedef ULONG VBN;
578 typedef VBN *PVBN;
579
580 typedef struct _NOTIFY_SYNC
581 {
582 ULONG Unknown0;
583 ULONG Unknown1;
584 ULONG Unknown2;
585 USHORT Unknown3;
586 USHORT Unknown4;
587 ULONG Unknown5;
588 ULONG Unknown6;
589 ULONG Unknown7;
590 ULONG Unknown8;
591 ULONG Unknown9;
592 ULONG Unknown10;
593 } NOTIFY_SYNC, * PNOTIFY_SYNC;
594
595 typedef enum _FAST_IO_POSSIBLE {
596 FastIoIsNotPossible,
597 FastIoIsPossible,
598 FastIoIsQuestionable
599 } FAST_IO_POSSIBLE;
600
601 typedef enum _FILE_STORAGE_TYPE {
602 StorageTypeDefault = 1,
603 StorageTypeDirectory,
604 StorageTypeFile,
605 StorageTypeJunctionPoint,
606 StorageTypeCatalog,
607 StorageTypeStructuredStorage,
608 StorageTypeEmbedding,
609 StorageTypeStream
610 } FILE_STORAGE_TYPE;
611
612 typedef enum _OBJECT_INFO_CLASS {
613 ObjectBasicInfo,
614 ObjectNameInfo,
615 ObjectTypeInfo,
616 ObjectAllTypesInfo,
617 ObjectProtectionInfo
618 } OBJECT_INFO_CLASS;
619
620 typedef struct _KAPC_STATE {
621 LIST_ENTRY ApcListHead[2];
622 PKPROCESS Process;
623 BOOLEAN KernelApcInProgress;
624 BOOLEAN KernelApcPending;
625 BOOLEAN UserApcPending;
626 } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE;
627
628 typedef struct _BITMAP_RANGE {
629 LIST_ENTRY Links;
630 LARGE_INTEGER BasePage;
631 ULONG FirstDirtyPage;
632 ULONG LastDirtyPage;
633 ULONG DirtyPages;
634 PULONG Bitmap;
635 } BITMAP_RANGE, *PBITMAP_RANGE;
636
637 typedef struct _CACHE_UNINITIALIZE_EVENT {
638 struct _CACHE_UNINITIALIZE_EVENT *Next;
639 KEVENT Event;
640 } CACHE_UNINITIALIZE_EVENT, *PCACHE_UNINITIALIZE_EVENT;
641
642 typedef struct _CC_FILE_SIZES {
643 LARGE_INTEGER AllocationSize;
644 LARGE_INTEGER FileSize;
645 LARGE_INTEGER ValidDataLength;
646 } CC_FILE_SIZES, *PCC_FILE_SIZES;
647
648 typedef struct _COMPRESSED_DATA_INFO {
649 USHORT CompressionFormatAndEngine;
650 UCHAR CompressionUnitShift;
651 UCHAR ChunkShift;
652 UCHAR ClusterShift;
653 UCHAR Reserved;
654 USHORT NumberOfChunks;
655 ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
656 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
657
658 typedef struct _SID_IDENTIFIER_AUTHORITY {
659 BYTE Value[6];
660 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
661 typedef PVOID PSID;
662 typedef struct _SID {
663 BYTE Revision;
664 BYTE SubAuthorityCount;
665 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
666 DWORD SubAuthority[ANYSIZE_ARRAY];
667 } SID, *PISID;
668 typedef struct _SID_AND_ATTRIBUTES {
669 PSID Sid;
670 DWORD Attributes;
671 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
672 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
673 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
674 typedef struct _TOKEN_SOURCE {
675 CHAR SourceName[TOKEN_SOURCE_LENGTH];
676 LUID SourceIdentifier;
677 } TOKEN_SOURCE,*PTOKEN_SOURCE;
678 typedef struct _TOKEN_CONTROL {
679 LUID TokenId;
680 LUID AuthenticationId;
681 LUID ModifiedId;
682 TOKEN_SOURCE TokenSource;
683 } TOKEN_CONTROL,*PTOKEN_CONTROL;
684 typedef struct _TOKEN_DEFAULT_DACL {
685 PACL DefaultDacl;
686 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
687 typedef struct _TOKEN_GROUPS {
688 DWORD GroupCount;
689 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
690 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
691 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
692 ULONG SidCount;
693 ULONG SidLength;
694 PSID_AND_ATTRIBUTES Sids;
695 ULONG RestrictedSidCount;
696 ULONG RestrictedSidLength;
697 PSID_AND_ATTRIBUTES RestrictedSids;
698 ULONG PrivilegeCount;
699 ULONG PrivilegeLength;
700 PLUID_AND_ATTRIBUTES Privileges;
701 LUID AuthenticationId;
702 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
703 typedef struct _TOKEN_ORIGIN {
704 LUID OriginatingLogonSession;
705 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
706 typedef struct _TOKEN_OWNER {
707 PSID Owner;
708 } TOKEN_OWNER,*PTOKEN_OWNER;
709 typedef struct _TOKEN_PRIMARY_GROUP {
710 PSID PrimaryGroup;
711 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
712 typedef struct _TOKEN_PRIVILEGES {
713 DWORD PrivilegeCount;
714 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
715 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
716 typedef enum tagTOKEN_TYPE {
717 TokenPrimary = 1,
718 TokenImpersonation
719 } TOKEN_TYPE,*PTOKEN_TYPE;
720 typedef struct _TOKEN_STATISTICS {
721 LUID TokenId;
722 LUID AuthenticationId;
723 LARGE_INTEGER ExpirationTime;
724 TOKEN_TYPE TokenType;
725 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
726 DWORD DynamicCharged;
727 DWORD DynamicAvailable;
728 DWORD GroupCount;
729 DWORD PrivilegeCount;
730 LUID ModifiedId;
731 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
732 typedef struct _TOKEN_USER {
733 SID_AND_ATTRIBUTES User;
734 } TOKEN_USER, *PTOKEN_USER;
735 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
736 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
737 typedef struct _SECURITY_DESCRIPTOR {
738 BYTE Revision;
739 BYTE Sbz1;
740 SECURITY_DESCRIPTOR_CONTROL Control;
741 PSID Owner;
742 PSID Group;
743 PACL Sacl;
744 PACL Dacl;
745 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
746 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
747 BYTE Revision;
748 BYTE Sbz1;
749 SECURITY_DESCRIPTOR_CONTROL Control;
750 DWORD Owner;
751 DWORD Group;
752 DWORD Sacl;
753 DWORD Dacl;
754 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
755 typedef enum _TOKEN_INFORMATION_CLASS {
756 TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner,
757 TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,
758 TokenImpersonationLevel,TokenStatistics,TokenRestrictedSids,
759 TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,
760 TokenSandBoxInert,TokenAuditPolicy,TokenOrigin,
761 } TOKEN_INFORMATION_CLASS;
762
763 #define SYMLINK_FLAG_RELATIVE 1
764
765 typedef struct _REPARSE_DATA_BUFFER {
766 ULONG ReparseTag;
767 USHORT ReparseDataLength;
768 USHORT Reserved;
769 union {
770 struct {
771 USHORT SubstituteNameOffset;
772 USHORT SubstituteNameLength;
773 USHORT PrintNameOffset;
774 USHORT PrintNameLength;
775 ULONG Flags;
776 WCHAR PathBuffer[1];
777 } SymbolicLinkReparseBuffer;
778 struct {
779 USHORT SubstituteNameOffset;
780 USHORT SubstituteNameLength;
781 USHORT PrintNameOffset;
782 USHORT PrintNameLength;
783 WCHAR PathBuffer[1];
784 } MountPointReparseBuffer;
785 struct {
786 UCHAR DataBuffer[1];
787 } GenericReparseBuffer;
788 };
789 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
790
791 #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
792
793 typedef struct _FILE_ACCESS_INFORMATION {
794 ACCESS_MASK AccessFlags;
795 } FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
796
797 typedef struct _FILE_ALLOCATION_INFORMATION {
798 LARGE_INTEGER AllocationSize;
799 } FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
800
801 typedef struct _FILE_BOTH_DIR_INFORMATION {
802 ULONG NextEntryOffset;
803 ULONG FileIndex;
804 LARGE_INTEGER CreationTime;
805 LARGE_INTEGER LastAccessTime;
806 LARGE_INTEGER LastWriteTime;
807 LARGE_INTEGER ChangeTime;
808 LARGE_INTEGER EndOfFile;
809 LARGE_INTEGER AllocationSize;
810 ULONG FileAttributes;
811 ULONG FileNameLength;
812 ULONG EaSize;
813 CCHAR ShortNameLength;
814 WCHAR ShortName[12];
815 WCHAR FileName[1];
816 } FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
817
818 typedef struct _FILE_COMPLETION_INFORMATION {
819 HANDLE Port;
820 PVOID Key;
821 } FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
822
823 typedef struct _FILE_COMPRESSION_INFORMATION {
824 LARGE_INTEGER CompressedFileSize;
825 USHORT CompressionFormat;
826 UCHAR CompressionUnitShift;
827 UCHAR ChunkShift;
828 UCHAR ClusterShift;
829 UCHAR Reserved[3];
830 } FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
831
832 typedef struct _FILE_COPY_ON_WRITE_INFORMATION {
833 BOOLEAN ReplaceIfExists;
834 HANDLE RootDirectory;
835 ULONG FileNameLength;
836 WCHAR FileName[1];
837 } FILE_COPY_ON_WRITE_INFORMATION, *PFILE_COPY_ON_WRITE_INFORMATION;
838
839 typedef struct _FILE_DIRECTORY_INFORMATION {
840 ULONG NextEntryOffset;
841 ULONG FileIndex;
842 LARGE_INTEGER CreationTime;
843 LARGE_INTEGER LastAccessTime;
844 LARGE_INTEGER LastWriteTime;
845 LARGE_INTEGER ChangeTime;
846 LARGE_INTEGER EndOfFile;
847 LARGE_INTEGER AllocationSize;
848 ULONG FileAttributes;
849 ULONG FileNameLength;
850 WCHAR FileName[1];
851 } FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
852
853 typedef struct _FILE_FULL_DIRECTORY_INFORMATION {
854 ULONG NextEntryOffset;
855 ULONG FileIndex;
856 LARGE_INTEGER CreationTime;
857 LARGE_INTEGER LastAccessTime;
858 LARGE_INTEGER LastWriteTime;
859 LARGE_INTEGER ChangeTime;
860 LARGE_INTEGER EndOfFile;
861 LARGE_INTEGER AllocationSize;
862 ULONG FileAttributes;
863 ULONG FileNameLength;
864 ULONG EaSize;
865 WCHAR FileName[0];
866 } FILE_FULL_DIRECTORY_INFORMATION, *PFILE_FULL_DIRECTORY_INFORMATION;
867
868 typedef struct _FILE_BOTH_DIRECTORY_INFORMATION {
869 ULONG NextEntryOffset;
870 ULONG FileIndex;
871 LARGE_INTEGER CreationTime;
872 LARGE_INTEGER LastAccessTime;
873 LARGE_INTEGER LastWriteTime;
874 LARGE_INTEGER ChangeTime;
875 LARGE_INTEGER EndOfFile;
876 LARGE_INTEGER AllocationSize;
877 ULONG FileAttributes;
878 ULONG FileNameLength;
879 ULONG EaSize;
880 CHAR ShortNameLength;
881 WCHAR ShortName[12];
882 WCHAR FileName[0];
883 } FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION;
884
885 typedef struct _FILE_EA_INFORMATION {
886 ULONG EaSize;
887 } FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
888
889 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
890 ULONG FileSystemAttributes;
891 ULONG MaximumComponentNameLength;
892 ULONG FileSystemNameLength;
893 WCHAR FileSystemName[1];
894 } FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
895
896 typedef struct _FILE_FS_CONTROL_INFORMATION {
897 LARGE_INTEGER FreeSpaceStartFiltering;
898 LARGE_INTEGER FreeSpaceThreshold;
899 LARGE_INTEGER FreeSpaceStopFiltering;
900 LARGE_INTEGER DefaultQuotaThreshold;
901 LARGE_INTEGER DefaultQuotaLimit;
902 ULONG FileSystemControlFlags;
903 } FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
904
905 typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
906 LARGE_INTEGER TotalAllocationUnits;
907 LARGE_INTEGER CallerAvailableAllocationUnits;
908 LARGE_INTEGER ActualAvailableAllocationUnits;
909 ULONG SectorsPerAllocationUnit;
910 ULONG BytesPerSector;
911 } FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
912
913 typedef struct _FILE_FS_LABEL_INFORMATION {
914 ULONG VolumeLabelLength;
915 WCHAR VolumeLabel[1];
916 } FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
917
918 #if (VER_PRODUCTBUILD >= 2195)
919
920 typedef struct _FILE_FS_OBJECT_ID_INFORMATION {
921 UCHAR ObjectId[16];
922 UCHAR ExtendedInfo[48];
923 } FILE_FS_OBJECT_ID_INFORMATION, *PFILE_FS_OBJECT_ID_INFORMATION;
924
925 #endif /* (VER_PRODUCTBUILD >= 2195) */
926
927 typedef struct _FILE_FS_SIZE_INFORMATION {
928 LARGE_INTEGER TotalAllocationUnits;
929 LARGE_INTEGER AvailableAllocationUnits;
930 ULONG SectorsPerAllocationUnit;
931 ULONG BytesPerSector;
932 } FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
933
934 typedef struct _FILE_FS_VOLUME_INFORMATION {
935 LARGE_INTEGER VolumeCreationTime;
936 ULONG VolumeSerialNumber;
937 ULONG VolumeLabelLength;
938 BOOLEAN SupportsObjects;
939 WCHAR VolumeLabel[1];
940 } FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
941
942 typedef struct _FILE_FS_OBJECTID_INFORMATION
943 {
944 UCHAR ObjectId[16];
945 UCHAR ExtendedInfo[48];
946 } FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
947
948 typedef struct _FILE_FS_DRIVER_PATH_INFORMATION
949 {
950 BOOLEAN DriverInPath;
951 ULONG DriverNameLength;
952 WCHAR DriverName[1];
953 } FILE_FS_DRIVER_PATH_INFORMATION, *PFILE_FS_DRIVER_PATH_INFORMATION;
954
955 typedef struct _FILE_FULL_DIR_INFORMATION {
956 ULONG NextEntryOffset;
957 ULONG FileIndex;
958 LARGE_INTEGER CreationTime;
959 LARGE_INTEGER LastAccessTime;
960 LARGE_INTEGER LastWriteTime;
961 LARGE_INTEGER ChangeTime;
962 LARGE_INTEGER EndOfFile;
963 LARGE_INTEGER AllocationSize;
964 ULONG FileAttributes;
965 ULONG FileNameLength;
966 ULONG EaSize;
967 WCHAR FileName[1];
968 } FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
969
970 typedef struct _FILE_GET_EA_INFORMATION {
971 ULONG NextEntryOffset;
972 UCHAR EaNameLength;
973 CHAR EaName[1];
974 } FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
975
976 typedef struct _FILE_GET_QUOTA_INFORMATION {
977 ULONG NextEntryOffset;
978 ULONG SidLength;
979 SID Sid;
980 } FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
981
982 typedef struct _FILE_QUOTA_INFORMATION
983 {
984 ULONG NextEntryOffset;
985 ULONG SidLength;
986 LARGE_INTEGER ChangeTime;
987 LARGE_INTEGER QuotaUsed;
988 LARGE_INTEGER QuotaThreshold;
989 LARGE_INTEGER QuotaLimit;
990 SID Sid;
991 } FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
992
993 typedef struct _FILE_INTERNAL_INFORMATION {
994 LARGE_INTEGER IndexNumber;
995 } FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
996
997 typedef struct _FILE_LINK_INFORMATION {
998 BOOLEAN ReplaceIfExists;
999 HANDLE RootDirectory;
1000 ULONG FileNameLength;
1001 WCHAR FileName[1];
1002 } FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
1003
1004 typedef struct _FILE_LOCK_INFO
1005 {
1006 LARGE_INTEGER StartingByte;
1007 LARGE_INTEGER Length;
1008 BOOLEAN ExclusiveLock;
1009 ULONG Key;
1010 PFILE_OBJECT FileObject;
1011 PVOID ProcessId;
1012 LARGE_INTEGER EndingByte;
1013 } FILE_LOCK_INFO, *PFILE_LOCK_INFO;
1014
1015 typedef struct _FILE_REPARSE_POINT_INFORMATION
1016 {
1017 LONGLONG FileReference;
1018 ULONG Tag;
1019 } FILE_REPARSE_POINT_INFORMATION, *PFILE_REPARSE_POINT_INFORMATION;
1020
1021 typedef struct _FILE_MOVE_CLUSTER_INFORMATION
1022 {
1023 ULONG ClusterCount;
1024 HANDLE RootDirectory;
1025 ULONG FileNameLength;
1026 WCHAR FileName[1];
1027 } FILE_MOVE_CLUSTER_INFORMATION, *PFILE_MOVE_CLUSTER_INFORMATION;
1028
1029 /* raw internal file lock struct returned from FsRtlGetNextFileLock */
1030 typedef struct _FILE_SHARED_LOCK_ENTRY {
1031 PVOID Unknown1;
1032 PVOID Unknown2;
1033 FILE_LOCK_INFO FileLock;
1034 } FILE_SHARED_LOCK_ENTRY, *PFILE_SHARED_LOCK_ENTRY;
1035
1036 /* raw internal file lock struct returned from FsRtlGetNextFileLock */
1037 typedef struct _FILE_EXCLUSIVE_LOCK_ENTRY {
1038 LIST_ENTRY ListEntry;
1039 PVOID Unknown1;
1040 PVOID Unknown2;
1041 FILE_LOCK_INFO FileLock;
1042 } FILE_EXCLUSIVE_LOCK_ENTRY, *PFILE_EXCLUSIVE_LOCK_ENTRY;
1043
1044 typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) (
1045 IN PVOID Context,
1046 IN PIRP Irp
1047 );
1048
1049 typedef VOID (NTAPI *PUNLOCK_ROUTINE) (
1050 IN PVOID Context,
1051 IN PFILE_LOCK_INFO FileLockInfo
1052 );
1053
1054 typedef struct _FILE_LOCK {
1055 PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine;
1056 PUNLOCK_ROUTINE UnlockRoutine;
1057 BOOLEAN FastIoIsQuestionable;
1058 BOOLEAN Pad[3];
1059 PVOID LockInformation;
1060 FILE_LOCK_INFO LastReturnedLockInfo;
1061 PVOID LastReturnedLock;
1062 } FILE_LOCK, *PFILE_LOCK;
1063
1064 typedef struct _FILE_MAILSLOT_PEEK_BUFFER {
1065 ULONG ReadDataAvailable;
1066 ULONG NumberOfMessages;
1067 ULONG MessageLength;
1068 } FILE_MAILSLOT_PEEK_BUFFER, *PFILE_MAILSLOT_PEEK_BUFFER;
1069
1070 typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
1071 ULONG MaximumMessageSize;
1072 ULONG MailslotQuota;
1073 ULONG NextMessageSize;
1074 ULONG MessagesAvailable;
1075 LARGE_INTEGER ReadTimeout;
1076 } FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
1077
1078 typedef struct _FILE_MAILSLOT_SET_INFORMATION {
1079 PLARGE_INTEGER ReadTimeout;
1080 } FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
1081
1082 typedef struct _FILE_MODE_INFORMATION {
1083 ULONG Mode;
1084 } FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
1085
1086 typedef struct _FILE_ALL_INFORMATION {
1087 FILE_BASIC_INFORMATION BasicInformation;
1088 FILE_STANDARD_INFORMATION StandardInformation;
1089 FILE_INTERNAL_INFORMATION InternalInformation;
1090 FILE_EA_INFORMATION EaInformation;
1091 FILE_ACCESS_INFORMATION AccessInformation;
1092 FILE_POSITION_INFORMATION PositionInformation;
1093 FILE_MODE_INFORMATION ModeInformation;
1094 FILE_ALIGNMENT_INFORMATION AlignmentInformation;
1095 FILE_NAME_INFORMATION NameInformation;
1096 } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
1097
1098 typedef struct _FILE_NAMES_INFORMATION {
1099 ULONG NextEntryOffset;
1100 ULONG FileIndex;
1101 ULONG FileNameLength;
1102 WCHAR FileName[1];
1103 } FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
1104
1105 typedef struct _FILE_OBJECTID_INFORMATION {
1106 LONGLONG FileReference;
1107 UCHAR ObjectId[16];
1108 _ANONYMOUS_UNION union {
1109 struct {
1110 UCHAR BirthVolumeId[16];
1111 UCHAR BirthObjectId[16];
1112 UCHAR DomainId[16];
1113 } ;
1114 UCHAR ExtendedInfo[48];
1115 } DUMMYUNIONNAME;
1116 } FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;
1117
1118 typedef struct _FILE_OLE_CLASSID_INFORMATION {
1119 GUID ClassId;
1120 } FILE_OLE_CLASSID_INFORMATION, *PFILE_OLE_CLASSID_INFORMATION;
1121
1122 typedef struct _FILE_OLE_ALL_INFORMATION {
1123 FILE_BASIC_INFORMATION BasicInformation;
1124 FILE_STANDARD_INFORMATION StandardInformation;
1125 FILE_INTERNAL_INFORMATION InternalInformation;
1126 FILE_EA_INFORMATION EaInformation;
1127 FILE_ACCESS_INFORMATION AccessInformation;
1128 FILE_POSITION_INFORMATION PositionInformation;
1129 FILE_MODE_INFORMATION ModeInformation;
1130 FILE_ALIGNMENT_INFORMATION AlignmentInformation;
1131 USN LastChangeUsn;
1132 USN ReplicationUsn;
1133 LARGE_INTEGER SecurityChangeTime;
1134 FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
1135 FILE_OBJECTID_INFORMATION ObjectIdInformation;
1136 FILE_STORAGE_TYPE StorageType;
1137 ULONG OleStateBits;
1138 ULONG OleId;
1139 ULONG NumberOfStreamReferences;
1140 ULONG StreamIndex;
1141 ULONG SecurityId;
1142 BOOLEAN ContentIndexDisable;
1143 BOOLEAN InheritContentIndexDisable;
1144 FILE_NAME_INFORMATION NameInformation;
1145 } FILE_OLE_ALL_INFORMATION, *PFILE_OLE_ALL_INFORMATION;
1146
1147 typedef struct _FILE_OLE_DIR_INFORMATION {
1148 ULONG NextEntryOffset;
1149 ULONG FileIndex;
1150 LARGE_INTEGER CreationTime;
1151 LARGE_INTEGER LastAccessTime;
1152 LARGE_INTEGER LastWriteTime;
1153 LARGE_INTEGER ChangeTime;
1154 LARGE_INTEGER EndOfFile;
1155 LARGE_INTEGER AllocationSize;
1156 ULONG FileAttributes;
1157 ULONG FileNameLength;
1158 FILE_STORAGE_TYPE StorageType;
1159 GUID OleClassId;
1160 ULONG OleStateBits;
1161 BOOLEAN ContentIndexDisable;
1162 BOOLEAN InheritContentIndexDisable;
1163 WCHAR FileName[1];
1164 } FILE_OLE_DIR_INFORMATION, *PFILE_OLE_DIR_INFORMATION;
1165
1166 typedef struct _FILE_OLE_INFORMATION {
1167 LARGE_INTEGER SecurityChangeTime;
1168 FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
1169 FILE_OBJECTID_INFORMATION ObjectIdInformation;
1170 FILE_STORAGE_TYPE StorageType;
1171 ULONG OleStateBits;
1172 BOOLEAN ContentIndexDisable;
1173 BOOLEAN InheritContentIndexDisable;
1174 } FILE_OLE_INFORMATION, *PFILE_OLE_INFORMATION;
1175
1176 typedef struct _FILE_OLE_STATE_BITS_INFORMATION {
1177 ULONG StateBits;
1178 ULONG StateBitsMask;
1179 } FILE_OLE_STATE_BITS_INFORMATION, *PFILE_OLE_STATE_BITS_INFORMATION;
1180
1181 typedef struct _FILE_PIPE_ASSIGN_EVENT_BUFFER {
1182 HANDLE EventHandle;
1183 ULONG KeyValue;
1184 } FILE_PIPE_ASSIGN_EVENT_BUFFER, *PFILE_PIPE_ASSIGN_EVENT_BUFFER;
1185
1186 typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER {
1187 PVOID ClientSession;
1188 PVOID ClientProcess;
1189 } FILE_PIPE_CLIENT_PROCESS_BUFFER, *PFILE_PIPE_CLIENT_PROCESS_BUFFER;
1190
1191 typedef struct _FILE_PIPE_EVENT_BUFFER {
1192 ULONG NamedPipeState;
1193 ULONG EntryType;
1194 ULONG ByteCount;
1195 ULONG KeyValue;
1196 ULONG NumberRequests;
1197 } FILE_PIPE_EVENT_BUFFER, *PFILE_PIPE_EVENT_BUFFER;
1198
1199 typedef struct _FILE_PIPE_PEEK_BUFFER
1200 {
1201 ULONG NamedPipeState;
1202 ULONG ReadDataAvailable;
1203 ULONG NumberOfMessages;
1204 ULONG MessageLength;
1205 CHAR Data[1];
1206 } FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
1207
1208 typedef struct _FILE_PIPE_INFORMATION {
1209 ULONG ReadMode;
1210 ULONG CompletionMode;
1211 } FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
1212
1213 typedef struct _FILE_PIPE_LOCAL_INFORMATION {
1214 ULONG NamedPipeType;
1215 ULONG NamedPipeConfiguration;
1216 ULONG MaximumInstances;
1217 ULONG CurrentInstances;
1218 ULONG InboundQuota;
1219 ULONG ReadDataAvailable;
1220 ULONG OutboundQuota;
1221 ULONG WriteQuotaAvailable;
1222 ULONG NamedPipeState;
1223 ULONG NamedPipeEnd;
1224 } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
1225
1226 typedef struct _FILE_PIPE_REMOTE_INFORMATION {
1227 LARGE_INTEGER CollectDataTime;
1228 ULONG MaximumCollectionCount;
1229 } FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
1230
1231 typedef struct _FILE_PIPE_WAIT_FOR_BUFFER {
1232 LARGE_INTEGER Timeout;
1233 ULONG NameLength;
1234 BOOLEAN TimeoutSpecified;
1235 WCHAR Name[1];
1236 } FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
1237
1238 typedef struct _FILE_RENAME_INFORMATION {
1239 BOOLEAN ReplaceIfExists;
1240 HANDLE RootDirectory;
1241 ULONG FileNameLength;
1242 WCHAR FileName[1];
1243 } FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
1244
1245 typedef struct _FILE_STREAM_INFORMATION {
1246 ULONG NextEntryOffset;
1247 ULONG StreamNameLength;
1248 LARGE_INTEGER StreamSize;
1249 LARGE_INTEGER StreamAllocationSize;
1250 WCHAR StreamName[1];
1251 } FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
1252
1253 typedef struct _FILE_TRACKING_INFORMATION {
1254 HANDLE DestinationFile;
1255 ULONG ObjectInformationLength;
1256 CHAR ObjectInformation[1];
1257 } FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
1258
1259 #if (VER_PRODUCTBUILD >= 2195)
1260 typedef struct _FILE_ZERO_DATA_INFORMATION {
1261 LARGE_INTEGER FileOffset;
1262 LARGE_INTEGER BeyondFinalZero;
1263 } FILE_ZERO_DATA_INFORMATION, *PFILE_ZERO_DATA_INFORMATION;
1264
1265 typedef struct FILE_ALLOCATED_RANGE_BUFFER {
1266 LARGE_INTEGER FileOffset;
1267 LARGE_INTEGER Length;
1268 } FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER;
1269 #endif /* (VER_PRODUCTBUILD >= 2195) */
1270
1271 typedef struct _FSRTL_COMMON_FCB_HEADER {
1272 CSHORT NodeTypeCode;
1273 CSHORT NodeByteSize;
1274 UCHAR Flags;
1275 UCHAR IsFastIoPossible;
1276 #if (VER_PRODUCTBUILD >= 1381)
1277 UCHAR Flags2;
1278 UCHAR Reserved;
1279 #endif /* (VER_PRODUCTBUILD >= 1381) */
1280 PERESOURCE Resource;
1281 PERESOURCE PagingIoResource;
1282 LARGE_INTEGER AllocationSize;
1283 LARGE_INTEGER FileSize;
1284 LARGE_INTEGER ValidDataLength;
1285 } FSRTL_COMMON_FCB_HEADER, *PFSRTL_COMMON_FCB_HEADER;
1286
1287 #if (VER_PRODUCTBUILD >= 2600)
1288
1289 typedef struct _FSRTL_ADVANCED_FCB_HEADER {
1290 CSHORT NodeTypeCode;
1291 CSHORT NodeByteSize;
1292 UCHAR Flags;
1293 UCHAR IsFastIoPossible;
1294 UCHAR Flags2;
1295 UCHAR Reserved;
1296 PERESOURCE Resource;
1297 PERESOURCE PagingIoResource;
1298 LARGE_INTEGER AllocationSize;
1299 LARGE_INTEGER FileSize;
1300 LARGE_INTEGER ValidDataLength;
1301 PFAST_MUTEX FastMutex;
1302 LIST_ENTRY FilterContexts;
1303 } FSRTL_ADVANCED_FCB_HEADER, *PFSRTL_ADVANCED_FCB_HEADER;
1304
1305 typedef struct _FSRTL_PER_STREAM_CONTEXT {
1306 LIST_ENTRY Links;
1307 PVOID OwnerId;
1308 PVOID InstanceId;
1309 PFREE_FUNCTION FreeCallback;
1310 } FSRTL_PER_STREAM_CONTEXT, *PFSRTL_PER_STREAM_CONTEXT;
1311
1312 typedef struct _FSRTL_PER_FILEOBJECT_CONTEXT
1313 {
1314 LIST_ENTRY Links;
1315 PVOID OwnerId;
1316 PVOID InstanceId;
1317 } FSRTL_PER_FILEOBJECT_CONTEXT, *PFSRTL_PER_FILEOBJECT_CONTEXT;
1318
1319 #endif /* (VER_PRODUCTBUILD >= 2600) */
1320
1321 typedef struct _BASE_MCB
1322 {
1323 ULONG MaximumPairCount;
1324 ULONG PairCount;
1325 USHORT PoolType;
1326 USHORT Flags;
1327 PVOID Mapping;
1328 } BASE_MCB, *PBASE_MCB;
1329
1330 typedef struct _LARGE_MCB
1331 {
1332 PKGUARDED_MUTEX GuardedMutex;
1333 BASE_MCB BaseMcb;
1334 } LARGE_MCB, *PLARGE_MCB;
1335
1336 typedef struct _MCB
1337 {
1338 LARGE_MCB DummyFieldThatSizesThisStructureCorrectly;
1339 } MCB, *PMCB;
1340
1341 typedef struct _GENERATE_NAME_CONTEXT {
1342 USHORT Checksum;
1343 BOOLEAN CheckSumInserted;
1344 UCHAR NameLength;
1345 WCHAR NameBuffer[8];
1346 ULONG ExtensionLength;
1347 WCHAR ExtensionBuffer[4];
1348 ULONG LastIndexValue;
1349 } GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
1350
1351 typedef struct _MAPPING_PAIR {
1352 ULONGLONG Vcn;
1353 ULONGLONG Lcn;
1354 } MAPPING_PAIR, *PMAPPING_PAIR;
1355
1356 typedef struct _GET_RETRIEVAL_DESCRIPTOR {
1357 ULONG NumberOfPairs;
1358 ULONGLONG StartVcn;
1359 MAPPING_PAIR Pair[1];
1360 } GET_RETRIEVAL_DESCRIPTOR, *PGET_RETRIEVAL_DESCRIPTOR;
1361
1362 typedef struct _KQUEUE {
1363 DISPATCHER_HEADER Header;
1364 LIST_ENTRY EntryListHead;
1365 ULONG CurrentCount;
1366 ULONG MaximumCount;
1367 LIST_ENTRY ThreadListHead;
1368 } KQUEUE, *PKQUEUE, *RESTRICTED_POINTER PRKQUEUE;
1369
1370 #define ASSERT_QUEUE(Q) ASSERT(((Q)->Header.Type & KOBJECT_TYPE_MASK) == QueueObject);
1371
1372 typedef struct _MBCB {
1373 CSHORT NodeTypeCode;
1374 CSHORT NodeIsInZone;
1375 ULONG PagesToWrite;
1376 ULONG DirtyPages;
1377 ULONG Reserved;
1378 LIST_ENTRY BitmapRanges;
1379 LONGLONG ResumeWritePage;
1380 BITMAP_RANGE BitmapRange1;
1381 BITMAP_RANGE BitmapRange2;
1382 BITMAP_RANGE BitmapRange3;
1383 } MBCB, *PMBCB;
1384
1385 typedef struct _MOVEFILE_DESCRIPTOR {
1386 HANDLE FileHandle;
1387 ULONG Reserved;
1388 LARGE_INTEGER StartVcn;
1389 LARGE_INTEGER TargetLcn;
1390 ULONG NumVcns;
1391 ULONG Reserved1;
1392 } MOVEFILE_DESCRIPTOR, *PMOVEFILE_DESCRIPTOR;
1393
1394 typedef struct _OBJECT_BASIC_INFO {
1395 ULONG Attributes;
1396 ACCESS_MASK GrantedAccess;
1397 ULONG HandleCount;
1398 ULONG ReferenceCount;
1399 ULONG PagedPoolUsage;
1400 ULONG NonPagedPoolUsage;
1401 ULONG Reserved[3];
1402 ULONG NameInformationLength;
1403 ULONG TypeInformationLength;
1404 ULONG SecurityDescriptorLength;
1405 LARGE_INTEGER CreateTime;
1406 } OBJECT_BASIC_INFO, *POBJECT_BASIC_INFO;
1407
1408 typedef struct _OBJECT_HANDLE_ATTRIBUTE_INFO {
1409 BOOLEAN Inherit;
1410 BOOLEAN ProtectFromClose;
1411 } OBJECT_HANDLE_ATTRIBUTE_INFO, *POBJECT_HANDLE_ATTRIBUTE_INFO;
1412
1413 typedef struct _OBJECT_NAME_INFO {
1414 UNICODE_STRING ObjectName;
1415 WCHAR ObjectNameBuffer[1];
1416 } OBJECT_NAME_INFO, *POBJECT_NAME_INFO;
1417
1418 typedef struct _OBJECT_PROTECTION_INFO {
1419 BOOLEAN Inherit;
1420 BOOLEAN ProtectHandle;
1421 } OBJECT_PROTECTION_INFO, *POBJECT_PROTECTION_INFO;
1422
1423 typedef struct _OBJECT_TYPE_INFO {
1424 UNICODE_STRING ObjectTypeName;
1425 UCHAR Unknown[0x58];
1426 WCHAR ObjectTypeNameBuffer[1];
1427 } OBJECT_TYPE_INFO, *POBJECT_TYPE_INFO;
1428
1429 typedef struct _OBJECT_ALL_TYPES_INFO {
1430 ULONG NumberOfObjectTypes;
1431 OBJECT_TYPE_INFO ObjectsTypeInfo[1];
1432 } OBJECT_ALL_TYPES_INFO, *POBJECT_ALL_TYPES_INFO;
1433
1434
1435 typedef struct _PATHNAME_BUFFER {
1436 ULONG PathNameLength;
1437 WCHAR Name[1];
1438 } PATHNAME_BUFFER, *PPATHNAME_BUFFER;
1439
1440 typedef enum _RTL_GENERIC_COMPARE_RESULTS
1441 {
1442 GenericLessThan,
1443 GenericGreaterThan,
1444 GenericEqual
1445 } RTL_GENERIC_COMPARE_RESULTS;
1446
1447 typedef enum _TABLE_SEARCH_RESULT
1448 {
1449 TableEmptyTree,
1450 TableFoundNode,
1451 TableInsertAsLeft,
1452 TableInsertAsRight
1453 } TABLE_SEARCH_RESULT;
1454
1455 typedef NTSTATUS
1456 (NTAPI *PRTL_AVL_MATCH_FUNCTION)(
1457 struct _RTL_AVL_TABLE *Table,
1458 PVOID UserData,
1459 PVOID MatchData
1460 );
1461
1462 typedef RTL_GENERIC_COMPARE_RESULTS
1463 (NTAPI *PRTL_AVL_COMPARE_ROUTINE) (
1464 struct _RTL_AVL_TABLE *Table,
1465 PVOID FirstStruct,
1466 PVOID SecondStruct
1467 );
1468
1469 typedef RTL_GENERIC_COMPARE_RESULTS
1470 (NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) (
1471 struct _RTL_GENERIC_TABLE *Table,
1472 PVOID FirstStruct,
1473 PVOID SecondStruct
1474 );
1475
1476 typedef PVOID
1477 (NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) (
1478 struct _RTL_GENERIC_TABLE *Table,
1479 CLONG ByteSize
1480 );
1481
1482 typedef VOID
1483 (NTAPI *PRTL_GENERIC_FREE_ROUTINE) (
1484 struct _RTL_GENERIC_TABLE *Table,
1485 PVOID Buffer
1486 );
1487
1488 typedef PVOID
1489 (NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) (
1490 struct _RTL_AVL_TABLE *Table,
1491 CLONG ByteSize
1492 );
1493
1494 typedef VOID
1495 (NTAPI *PRTL_AVL_FREE_ROUTINE) (
1496 struct _RTL_AVL_TABLE *Table,
1497 PVOID Buffer
1498 );
1499
1500 typedef struct _PUBLIC_BCB {
1501 CSHORT NodeTypeCode;
1502 CSHORT NodeByteSize;
1503 ULONG MappedLength;
1504 LARGE_INTEGER MappedFileOffset;
1505 } PUBLIC_BCB, *PPUBLIC_BCB;
1506
1507 typedef struct _QUERY_PATH_REQUEST {
1508 ULONG PathNameLength;
1509 PIO_SECURITY_CONTEXT SecurityContext;
1510 WCHAR FilePathName[1];
1511 } QUERY_PATH_REQUEST, *PQUERY_PATH_REQUEST;
1512
1513 typedef struct _QUERY_PATH_RESPONSE {
1514 ULONG LengthAccepted;
1515 } QUERY_PATH_RESPONSE, *PQUERY_PATH_RESPONSE;
1516
1517 typedef struct _RETRIEVAL_POINTERS_BUFFER {
1518 ULONG ExtentCount;
1519 LARGE_INTEGER StartingVcn;
1520 struct {
1521 LARGE_INTEGER NextVcn;
1522 LARGE_INTEGER Lcn;
1523 } Extents[1];
1524 } RETRIEVAL_POINTERS_BUFFER, *PRETRIEVAL_POINTERS_BUFFER;
1525
1526 typedef struct _RTL_SPLAY_LINKS {
1527 struct _RTL_SPLAY_LINKS *Parent;
1528 struct _RTL_SPLAY_LINKS *LeftChild;
1529 struct _RTL_SPLAY_LINKS *RightChild;
1530 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
1531
1532 typedef struct _RTL_BALANCED_LINKS
1533 {
1534 struct _RTL_BALANCED_LINKS *Parent;
1535 struct _RTL_BALANCED_LINKS *LeftChild;
1536 struct _RTL_BALANCED_LINKS *RightChild;
1537 CHAR Balance;
1538 UCHAR Reserved[3];
1539 } RTL_BALANCED_LINKS, *PRTL_BALANCED_LINKS;
1540
1541 typedef struct _RTL_GENERIC_TABLE
1542 {
1543 PRTL_SPLAY_LINKS TableRoot;
1544 LIST_ENTRY InsertOrderList;
1545 PLIST_ENTRY OrderedPointer;
1546 ULONG WhichOrderedElement;
1547 ULONG NumberGenericTableElements;
1548 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
1549 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
1550 PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
1551 PVOID TableContext;
1552 } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE;
1553
1554 typedef struct _RTL_AVL_TABLE
1555 {
1556 RTL_BALANCED_LINKS BalancedRoot;
1557 PVOID OrderedPointer;
1558 ULONG WhichOrderedElement;
1559 ULONG NumberGenericTableElements;
1560 ULONG DepthOfTree;
1561 PRTL_BALANCED_LINKS RestartKey;
1562 ULONG DeleteCount;
1563 PRTL_AVL_COMPARE_ROUTINE CompareRoutine;
1564 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine;
1565 PRTL_AVL_FREE_ROUTINE FreeRoutine;
1566 PVOID TableContext;
1567 } RTL_AVL_TABLE, *PRTL_AVL_TABLE;
1568
1569 NTSYSAPI
1570 VOID
1571 NTAPI
1572 RtlInitializeGenericTableAvl(
1573 PRTL_AVL_TABLE Table,
1574 PRTL_AVL_COMPARE_ROUTINE CompareRoutine,
1575 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine,
1576 PRTL_AVL_FREE_ROUTINE FreeRoutine,
1577 PVOID TableContext
1578 );
1579
1580 #if defined(USE_LPC6432)
1581 #define LPC_CLIENT_ID CLIENT_ID64
1582 #define LPC_SIZE_T ULONGLONG
1583 #define LPC_PVOID ULONGLONG
1584 #define LPC_HANDLE ULONGLONG
1585 #else
1586 #define LPC_CLIENT_ID CLIENT_ID
1587 #define LPC_SIZE_T SIZE_T
1588 #define LPC_PVOID PVOID
1589 #define LPC_HANDLE HANDLE
1590 #endif
1591
1592 typedef struct _PORT_MESSAGE
1593 {
1594 union
1595 {
1596 struct
1597 {
1598 CSHORT DataLength;
1599 CSHORT TotalLength;
1600 } s1;
1601 ULONG Length;
1602 } u1;
1603 union
1604 {
1605 struct
1606 {
1607 CSHORT Type;
1608 CSHORT DataInfoOffset;
1609 } s2;
1610 ULONG ZeroInit;
1611 } u2;
1612 union
1613 {
1614 LPC_CLIENT_ID ClientId;
1615 double DoNotUseThisField;
1616 };
1617 ULONG MessageId;
1618 union
1619 {
1620 LPC_SIZE_T ClientViewSize;
1621 ULONG CallbackId;
1622 };
1623 } PORT_MESSAGE, *PPORT_MESSAGE;
1624
1625 #define LPC_KERNELMODE_MESSAGE (CSHORT)((USHORT)0x8000)
1626
1627 typedef struct _PORT_VIEW
1628 {
1629 ULONG Length;
1630 LPC_HANDLE SectionHandle;
1631 ULONG SectionOffset;
1632 LPC_SIZE_T ViewSize;
1633 LPC_PVOID ViewBase;
1634 LPC_PVOID ViewRemoteBase;
1635 } PORT_VIEW, *PPORT_VIEW;
1636
1637 typedef struct _REMOTE_PORT_VIEW
1638 {
1639 ULONG Length;
1640 LPC_SIZE_T ViewSize;
1641 LPC_PVOID ViewBase;
1642 } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
1643
1644 typedef struct _SE_EXPORTS {
1645
1646 LUID SeCreateTokenPrivilege;
1647 LUID SeAssignPrimaryTokenPrivilege;
1648 LUID SeLockMemoryPrivilege;
1649 LUID SeIncreaseQuotaPrivilege;
1650 LUID SeUnsolicitedInputPrivilege;
1651 LUID SeTcbPrivilege;
1652 LUID SeSecurityPrivilege;
1653 LUID SeTakeOwnershipPrivilege;
1654 LUID SeLoadDriverPrivilege;
1655 LUID SeCreatePagefilePrivilege;
1656 LUID SeIncreaseBasePriorityPrivilege;
1657 LUID SeSystemProfilePrivilege;
1658 LUID SeSystemtimePrivilege;
1659 LUID SeProfileSingleProcessPrivilege;
1660 LUID SeCreatePermanentPrivilege;
1661 LUID SeBackupPrivilege;
1662 LUID SeRestorePrivilege;
1663 LUID SeShutdownPrivilege;
1664 LUID SeDebugPrivilege;
1665 LUID SeAuditPrivilege;
1666 LUID SeSystemEnvironmentPrivilege;
1667 LUID SeChangeNotifyPrivilege;
1668 LUID SeRemoteShutdownPrivilege;
1669
1670 PSID SeNullSid;
1671 PSID SeWorldSid;
1672 PSID SeLocalSid;
1673 PSID SeCreatorOwnerSid;
1674 PSID SeCreatorGroupSid;
1675
1676 PSID SeNtAuthoritySid;
1677 PSID SeDialupSid;
1678 PSID SeNetworkSid;
1679 PSID SeBatchSid;
1680 PSID SeInteractiveSid;
1681 PSID SeLocalSystemSid;
1682 PSID SeAliasAdminsSid;
1683 PSID SeAliasUsersSid;
1684 PSID SeAliasGuestsSid;
1685 PSID SeAliasPowerUsersSid;
1686 PSID SeAliasAccountOpsSid;
1687 PSID SeAliasSystemOpsSid;
1688 PSID SeAliasPrintOpsSid;
1689 PSID SeAliasBackupOpsSid;
1690
1691 PSID SeAuthenticatedUsersSid;
1692
1693 PSID SeRestrictedSid;
1694 PSID SeAnonymousLogonSid;
1695
1696 LUID SeUndockPrivilege;
1697 LUID SeSyncAgentPrivilege;
1698 LUID SeEnableDelegationPrivilege;
1699
1700 } SE_EXPORTS, *PSE_EXPORTS;
1701
1702 typedef struct
1703 {
1704 LARGE_INTEGER StartingLcn;
1705 } STARTING_LCN_INPUT_BUFFER, *PSTARTING_LCN_INPUT_BUFFER;
1706
1707 typedef struct _STARTING_VCN_INPUT_BUFFER {
1708 LARGE_INTEGER StartingVcn;
1709 } STARTING_VCN_INPUT_BUFFER, *PSTARTING_VCN_INPUT_BUFFER;
1710
1711 typedef struct _SECURITY_CLIENT_CONTEXT {
1712 SECURITY_QUALITY_OF_SERVICE SecurityQos;
1713 PACCESS_TOKEN ClientToken;
1714 BOOLEAN DirectlyAccessClientToken;
1715 BOOLEAN DirectAccessEffectiveOnly;
1716 BOOLEAN ServerIsRemote;
1717 TOKEN_CONTROL ClientTokenControl;
1718 } SECURITY_CLIENT_CONTEXT, *PSECURITY_CLIENT_CONTEXT;
1719
1720 typedef struct _ACE_HEADER
1721 {
1722 UCHAR AceType;
1723 UCHAR AceFlags;
1724 USHORT AceSize;
1725 } ACE_HEADER, *PACE_HEADER;
1726
1727 typedef struct _TUNNEL {
1728 FAST_MUTEX Mutex;
1729 PRTL_SPLAY_LINKS Cache;
1730 LIST_ENTRY TimerQueue;
1731 USHORT NumEntries;
1732 } TUNNEL, *PTUNNEL;
1733
1734 typedef struct _VAD_HEADER {
1735 PVOID StartVPN;
1736 PVOID EndVPN;
1737 PVAD_HEADER ParentLink;
1738 PVAD_HEADER LeftLink;
1739 PVAD_HEADER RightLink;
1740 ULONG Flags; /* LSB = CommitCharge */
1741 PVOID ControlArea;
1742 PVOID FirstProtoPte;
1743 PVOID LastPTE;
1744 ULONG Unknown;
1745 LIST_ENTRY Secured;
1746 } VAD_HEADER, *PVAD_HEADER;
1747
1748 typedef struct
1749 {
1750 LARGE_INTEGER StartingLcn;
1751 LARGE_INTEGER BitmapSize;
1752 UCHAR Buffer[1];
1753 } VOLUME_BITMAP_BUFFER, *PVOLUME_BITMAP_BUFFER;
1754
1755 #if (VER_PRODUCTBUILD >= 2600)
1756
1757 typedef BOOLEAN
1758 (NTAPI *PFILTER_REPORT_CHANGE) (
1759 IN PVOID NotifyContext,
1760 IN PVOID FilterContext
1761 );
1762
1763 typedef enum _FS_FILTER_SECTION_SYNC_TYPE {
1764 SyncTypeOther = 0,
1765 SyncTypeCreateSection
1766 } FS_FILTER_SECTION_SYNC_TYPE, *PFS_FILTER_SECTION_SYNC_TYPE;
1767
1768 typedef union _FS_FILTER_PARAMETERS {
1769 struct {
1770 PLARGE_INTEGER EndingOffset;
1771 } AcquireForModifiedPageWriter;
1772
1773 struct {
1774 PERESOURCE ResourceToRelease;
1775 } ReleaseForModifiedPageWriter;
1776
1777 struct {
1778 FS_FILTER_SECTION_SYNC_TYPE SyncType;
1779 ULONG PageProtection;
1780 } AcquireForSectionSynchronization;
1781
1782 struct {
1783 PVOID Argument1;
1784 PVOID Argument2;
1785 PVOID Argument3;
1786 PVOID Argument4;
1787 PVOID Argument5;
1788 } Others;
1789 } FS_FILTER_PARAMETERS, *PFS_FILTER_PARAMETERS;
1790
1791 typedef struct _FS_FILTER_CALLBACK_DATA {
1792 ULONG SizeOfFsFilterCallbackData;
1793 UCHAR Operation;
1794 UCHAR Reserved;
1795 struct _DEVICE_OBJECT *DeviceObject;
1796 struct _FILE_OBJECT *FileObject;
1797 FS_FILTER_PARAMETERS Parameters;
1798 } FS_FILTER_CALLBACK_DATA, *PFS_FILTER_CALLBACK_DATA;
1799
1800 typedef NTSTATUS
1801 (NTAPI *PFS_FILTER_CALLBACK) (
1802 IN PFS_FILTER_CALLBACK_DATA Data,
1803 OUT PVOID *CompletionContext
1804 );
1805
1806 typedef VOID
1807 (NTAPI *PFS_FILTER_COMPLETION_CALLBACK) (
1808 IN PFS_FILTER_CALLBACK_DATA Data,
1809 IN NTSTATUS OperationStatus,
1810 IN PVOID CompletionContext
1811 );
1812
1813 typedef struct _FS_FILTER_CALLBACKS {
1814 ULONG SizeOfFsFilterCallbacks;
1815 ULONG Reserved;
1816 PFS_FILTER_CALLBACK PreAcquireForSectionSynchronization;
1817 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForSectionSynchronization;
1818 PFS_FILTER_CALLBACK PreReleaseForSectionSynchronization;
1819 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForSectionSynchronization;
1820 PFS_FILTER_CALLBACK PreAcquireForCcFlush;
1821 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForCcFlush;
1822 PFS_FILTER_CALLBACK PreReleaseForCcFlush;
1823 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForCcFlush;
1824 PFS_FILTER_CALLBACK PreAcquireForModifiedPageWriter;
1825 PFS_FILTER_COMPLETION_CALLBACK PostAcquireForModifiedPageWriter;
1826 PFS_FILTER_CALLBACK PreReleaseForModifiedPageWriter;
1827 PFS_FILTER_COMPLETION_CALLBACK PostReleaseForModifiedPageWriter;
1828 } FS_FILTER_CALLBACKS, *PFS_FILTER_CALLBACKS;
1829
1830 typedef struct _READ_LIST {
1831 PFILE_OBJECT FileObject;
1832 ULONG NumberOfEntries;
1833 LOGICAL IsImage;
1834 FILE_SEGMENT_ELEMENT List[ANYSIZE_ARRAY];
1835 } READ_LIST, *PREAD_LIST;
1836
1837 #endif
1838
1839 typedef NTSTATUS
1840 (NTAPI * PRTL_HEAP_COMMIT_ROUTINE) (
1841 IN PVOID Base,
1842 IN OUT PVOID *CommitAddress,
1843 IN OUT PSIZE_T CommitSize
1844 );
1845
1846 typedef struct _RTL_HEAP_PARAMETERS {
1847 ULONG Length;
1848 SIZE_T SegmentReserve;
1849 SIZE_T SegmentCommit;
1850 SIZE_T DeCommitFreeBlockThreshold;
1851 SIZE_T DeCommitTotalFreeThreshold;
1852 SIZE_T MaximumAllocationSize;
1853 SIZE_T VirtualMemoryThreshold;
1854 SIZE_T InitialCommit;
1855 SIZE_T InitialReserve;
1856 PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
1857 SIZE_T Reserved[2];
1858 } RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
1859
1860 NTKERNELAPI
1861 BOOLEAN
1862 NTAPI
1863 CcCanIWrite (
1864 IN PFILE_OBJECT FileObject,
1865 IN ULONG BytesToWrite,
1866 IN BOOLEAN Wait,
1867 IN BOOLEAN Retrying
1868 );
1869
1870 NTKERNELAPI
1871 BOOLEAN
1872 NTAPI
1873 CcCopyRead (
1874 IN PFILE_OBJECT FileObject,
1875 IN PLARGE_INTEGER FileOffset,
1876 IN ULONG Length,
1877 IN BOOLEAN Wait,
1878 OUT PVOID Buffer,
1879 OUT PIO_STATUS_BLOCK IoStatus
1880 );
1881
1882 NTKERNELAPI
1883 BOOLEAN
1884 NTAPI
1885 CcCopyWrite (
1886 IN PFILE_OBJECT FileObject,
1887 IN PLARGE_INTEGER FileOffset,
1888 IN ULONG Length,
1889 IN BOOLEAN Wait,
1890 IN PVOID Buffer
1891 );
1892
1893 #define CcCopyWriteWontFlush(FO, FOFF, LEN) ((LEN) <= 0x10000)
1894
1895 typedef VOID (NTAPI *PCC_POST_DEFERRED_WRITE) (
1896 IN PVOID Context1,
1897 IN PVOID Context2
1898 );
1899
1900 NTKERNELAPI
1901 VOID
1902 NTAPI
1903 CcDeferWrite (
1904 IN PFILE_OBJECT FileObject,
1905 IN PCC_POST_DEFERRED_WRITE PostRoutine,
1906 IN PVOID Context1,
1907 IN PVOID Context2,
1908 IN ULONG BytesToWrite,
1909 IN BOOLEAN Retrying
1910 );
1911
1912 NTKERNELAPI
1913 VOID
1914 NTAPI
1915 CcFastCopyRead (
1916 IN PFILE_OBJECT FileObject,
1917 IN ULONG FileOffset,
1918 IN ULONG Length,
1919 IN ULONG PageCount,
1920 OUT PVOID Buffer,
1921 OUT PIO_STATUS_BLOCK IoStatus
1922 );
1923
1924 NTKERNELAPI
1925 VOID
1926 NTAPI
1927 CcFastCopyWrite (
1928 IN PFILE_OBJECT FileObject,
1929 IN ULONG FileOffset,
1930 IN ULONG Length,
1931 IN PVOID Buffer
1932 );
1933
1934 NTKERNELAPI
1935 VOID
1936 NTAPI
1937 CcFlushCache (
1938 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
1939 IN PLARGE_INTEGER FileOffset OPTIONAL,
1940 IN ULONG Length,
1941 OUT PIO_STATUS_BLOCK IoStatus OPTIONAL
1942 );
1943
1944 typedef VOID (*PDIRTY_PAGE_ROUTINE) (
1945 IN PFILE_OBJECT FileObject,
1946 IN PLARGE_INTEGER FileOffset,
1947 IN ULONG Length,
1948 IN PLARGE_INTEGER OldestLsn,
1949 IN PLARGE_INTEGER NewestLsn,
1950 IN PVOID Context1,
1951 IN PVOID Context2
1952 );
1953
1954 NTKERNELAPI
1955 LARGE_INTEGER
1956 NTAPI
1957 CcGetDirtyPages (
1958 IN PVOID LogHandle,
1959 IN PDIRTY_PAGE_ROUTINE DirtyPageRoutine,
1960 IN PVOID Context1,
1961 IN PVOID Context2
1962 );
1963
1964 NTKERNELAPI
1965 PFILE_OBJECT
1966 NTAPI
1967 CcGetFileObjectFromBcb (
1968 IN PVOID Bcb
1969 );
1970
1971 NTKERNELAPI
1972 PFILE_OBJECT
1973 NTAPI
1974 CcGetFileObjectFromSectionPtrs (
1975 IN PSECTION_OBJECT_POINTERS SectionObjectPointer
1976 );
1977
1978 #define CcGetFileSizePointer(FO) ( \
1979 ((PLARGE_INTEGER)((FO)->SectionObjectPointer->SharedCacheMap) + 1) \
1980 )
1981
1982 #if (VER_PRODUCTBUILD >= 2195)
1983
1984 NTKERNELAPI
1985 LARGE_INTEGER
1986 NTAPI
1987 CcGetFlushedValidData (
1988 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
1989 IN BOOLEAN BcbListHeld
1990 );
1991
1992 #endif /* (VER_PRODUCTBUILD >= 2195) */
1993
1994 NTKERNELAPI
1995 LARGE_INTEGER
1996 NTAPI
1997 CcGetLsnForFileObject (
1998 IN PFILE_OBJECT FileObject,
1999 OUT PLARGE_INTEGER OldestLsn OPTIONAL
2000 );
2001
2002 typedef BOOLEAN (NTAPI *PACQUIRE_FOR_LAZY_WRITE) (
2003 IN PVOID Context,
2004 IN BOOLEAN Wait
2005 );
2006
2007 typedef VOID (NTAPI *PRELEASE_FROM_LAZY_WRITE) (
2008 IN PVOID Context
2009 );
2010
2011 typedef BOOLEAN (NTAPI *PACQUIRE_FOR_READ_AHEAD) (
2012 IN PVOID Context,
2013 IN BOOLEAN Wait
2014 );
2015
2016 typedef VOID (NTAPI *PRELEASE_FROM_READ_AHEAD) (
2017 IN PVOID Context
2018 );
2019
2020 typedef struct _CACHE_MANAGER_CALLBACKS {
2021 PACQUIRE_FOR_LAZY_WRITE AcquireForLazyWrite;
2022 PRELEASE_FROM_LAZY_WRITE ReleaseFromLazyWrite;
2023 PACQUIRE_FOR_READ_AHEAD AcquireForReadAhead;
2024 PRELEASE_FROM_READ_AHEAD ReleaseFromReadAhead;
2025 } CACHE_MANAGER_CALLBACKS, *PCACHE_MANAGER_CALLBACKS;
2026
2027 NTKERNELAPI
2028 VOID
2029 NTAPI
2030 CcInitializeCacheMap (
2031 IN PFILE_OBJECT FileObject,
2032 IN PCC_FILE_SIZES FileSizes,
2033 IN BOOLEAN PinAccess,
2034 IN PCACHE_MANAGER_CALLBACKS Callbacks,
2035 IN PVOID LazyWriteContext
2036 );
2037
2038 #define CcIsFileCached(FO) ( \
2039 ((FO)->SectionObjectPointer != NULL) && \
2040 (((PSECTION_OBJECT_POINTERS)(FO)->SectionObjectPointer)->SharedCacheMap != NULL) \
2041 )
2042
2043 extern ULONG CcFastMdlReadWait;
2044
2045 NTKERNELAPI
2046 BOOLEAN
2047 NTAPI
2048 CcIsThereDirtyData (
2049 IN PVPB Vpb
2050 );
2051
2052 NTKERNELAPI
2053 BOOLEAN
2054 NTAPI
2055 CcMapData (
2056 IN PFILE_OBJECT FileObject,
2057 IN PLARGE_INTEGER FileOffset,
2058 IN ULONG Length,
2059 IN ULONG Flags,
2060 OUT PVOID *Bcb,
2061 OUT PVOID *Buffer
2062 );
2063
2064 NTKERNELAPI
2065 VOID
2066 NTAPI
2067 CcMdlRead (
2068 IN PFILE_OBJECT FileObject,
2069 IN PLARGE_INTEGER FileOffset,
2070 IN ULONG Length,
2071 OUT PMDL *MdlChain,
2072 OUT PIO_STATUS_BLOCK IoStatus
2073 );
2074
2075 NTKERNELAPI
2076 VOID
2077 NTAPI
2078 CcMdlReadComplete (
2079 IN PFILE_OBJECT FileObject,
2080 IN PMDL MdlChain
2081 );
2082
2083 NTKERNELAPI
2084 VOID
2085 NTAPI
2086 CcMdlWriteComplete (
2087 IN PFILE_OBJECT FileObject,
2088 IN PLARGE_INTEGER FileOffset,
2089 IN PMDL MdlChain
2090 );
2091
2092 #define MAP_WAIT 1
2093
2094 NTKERNELAPI
2095 BOOLEAN
2096 NTAPI
2097 CcPinMappedData (
2098 IN PFILE_OBJECT FileObject,
2099 IN PLARGE_INTEGER FileOffset,
2100 IN ULONG Length,
2101 IN ULONG Flags,
2102 IN OUT PVOID *Bcb
2103 );
2104
2105 NTKERNELAPI
2106 BOOLEAN
2107 NTAPI
2108 CcPinRead (
2109 IN PFILE_OBJECT FileObject,
2110 IN PLARGE_INTEGER FileOffset,
2111 IN ULONG Length,
2112 IN ULONG Flags,
2113 OUT PVOID *Bcb,
2114 OUT PVOID *Buffer
2115 );
2116
2117 NTKERNELAPI
2118 VOID
2119 NTAPI
2120 CcPrepareMdlWrite (
2121 IN PFILE_OBJECT FileObject,
2122 IN PLARGE_INTEGER FileOffset,
2123 IN ULONG Length,
2124 OUT PMDL *MdlChain,
2125 OUT PIO_STATUS_BLOCK IoStatus
2126 );
2127
2128 NTKERNELAPI
2129 BOOLEAN
2130 NTAPI
2131 CcPreparePinWrite (
2132 IN PFILE_OBJECT FileObject,
2133 IN PLARGE_INTEGER FileOffset,
2134 IN ULONG Length,
2135 IN BOOLEAN Zero,
2136 IN ULONG Flags,
2137 OUT PVOID *Bcb,
2138 OUT PVOID *Buffer
2139 );
2140
2141 NTKERNELAPI
2142 BOOLEAN
2143 NTAPI
2144 CcPurgeCacheSection (
2145 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
2146 IN PLARGE_INTEGER FileOffset OPTIONAL,
2147 IN ULONG Length,
2148 IN BOOLEAN UninitializeCacheMaps
2149 );
2150
2151 #define CcReadAhead(FO, FOFF, LEN) ( \
2152 if ((LEN) >= 256) { \
2153 CcScheduleReadAhead((FO), (FOFF), (LEN)); \
2154 } \
2155 )
2156
2157 #if (VER_PRODUCTBUILD >= 2195)
2158
2159 NTKERNELAPI
2160 PVOID
2161 NTAPI
2162 CcRemapBcb (
2163 IN PVOID Bcb
2164 );
2165
2166 #endif /* (VER_PRODUCTBUILD >= 2195) */
2167
2168 NTKERNELAPI
2169 VOID
2170 NTAPI
2171 CcRepinBcb (
2172 IN PVOID Bcb
2173 );
2174
2175 NTKERNELAPI
2176 VOID
2177 NTAPI
2178 CcScheduleReadAhead (
2179 IN PFILE_OBJECT FileObject,
2180 IN PLARGE_INTEGER FileOffset,
2181 IN ULONG Length
2182 );
2183
2184 NTKERNELAPI
2185 VOID
2186 NTAPI
2187 CcSetAdditionalCacheAttributes (
2188 IN PFILE_OBJECT FileObject,
2189 IN BOOLEAN DisableReadAhead,
2190 IN BOOLEAN DisableWriteBehind
2191 );
2192
2193 NTKERNELAPI
2194 VOID
2195 NTAPI
2196 CcSetBcbOwnerPointer (
2197 IN PVOID Bcb,
2198 IN PVOID OwnerPointer
2199 );
2200
2201 NTKERNELAPI
2202 VOID
2203 NTAPI
2204 CcSetDirtyPageThreshold (
2205 IN PFILE_OBJECT FileObject,
2206 IN ULONG DirtyPageThreshold
2207 );
2208
2209 NTKERNELAPI
2210 VOID
2211 NTAPI
2212 CcSetDirtyPinnedData (
2213 IN PVOID BcbVoid,
2214 IN PLARGE_INTEGER Lsn OPTIONAL
2215 );
2216
2217 NTKERNELAPI
2218 VOID
2219 NTAPI
2220 CcSetFileSizes (
2221 IN PFILE_OBJECT FileObject,
2222 IN PCC_FILE_SIZES FileSizes
2223 );
2224
2225 typedef VOID (NTAPI *PFLUSH_TO_LSN) (
2226 IN PVOID LogHandle,
2227 IN PLARGE_INTEGER Lsn
2228 );
2229
2230 NTKERNELAPI
2231 VOID
2232 NTAPI
2233 CcSetLogHandleForFile (
2234 IN PFILE_OBJECT FileObject,
2235 IN PVOID LogHandle,
2236 IN PFLUSH_TO_LSN FlushToLsnRoutine
2237 );
2238
2239 NTKERNELAPI
2240 VOID
2241 NTAPI
2242 CcSetReadAheadGranularity (
2243 IN PFILE_OBJECT FileObject,
2244 IN ULONG Granularity /* default: PAGE_SIZE */
2245 /* allowed: 2^n * PAGE_SIZE */
2246 );
2247
2248 NTKERNELAPI
2249 BOOLEAN
2250 NTAPI
2251 CcUninitializeCacheMap (
2252 IN PFILE_OBJECT FileObject,
2253 IN PLARGE_INTEGER TruncateSize OPTIONAL,
2254 IN PCACHE_UNINITIALIZE_EVENT UninitializeCompleteEvent OPTIONAL
2255 );
2256
2257 NTKERNELAPI
2258 VOID
2259 NTAPI
2260 CcUnpinData (
2261 IN PVOID Bcb
2262 );
2263
2264 NTKERNELAPI
2265 VOID
2266 NTAPI
2267 CcUnpinDataForThread (
2268 IN PVOID Bcb,
2269 IN ERESOURCE_THREAD ResourceThreadId
2270 );
2271
2272 NTKERNELAPI
2273 VOID
2274 NTAPI
2275 CcUnpinRepinnedBcb (
2276 IN PVOID Bcb,
2277 IN BOOLEAN WriteThrough,
2278 OUT PIO_STATUS_BLOCK IoStatus
2279 );
2280
2281 #if (VER_PRODUCTBUILD >= 2195)
2282
2283 NTKERNELAPI
2284 NTSTATUS
2285 NTAPI
2286 CcWaitForCurrentLazyWriterActivity (
2287 VOID
2288 );
2289
2290 #endif /* (VER_PRODUCTBUILD >= 2195) */
2291
2292 NTKERNELAPI
2293 BOOLEAN
2294 NTAPI
2295 CcZeroData (
2296 IN PFILE_OBJECT FileObject,
2297 IN PLARGE_INTEGER StartOffset,
2298 IN PLARGE_INTEGER EndOffset,
2299 IN BOOLEAN Wait
2300 );
2301
2302 NTKERNELAPI
2303 VOID
2304 NTAPI
2305 ExDisableResourceBoostLite (
2306 IN PERESOURCE Resource
2307 );
2308
2309 NTKERNELAPI
2310 ULONG
2311 NTAPI
2312 ExQueryPoolBlockSize (
2313 IN PVOID PoolBlock,
2314 OUT PBOOLEAN QuotaCharged
2315 );
2316
2317 #if (VER_PRODUCTBUILD >= 2600)
2318
2319 #ifndef __NTOSKRNL__
2320 NTKERNELAPI
2321 VOID
2322 FASTCALL
2323 ExInitializeRundownProtection (
2324 IN PEX_RUNDOWN_REF RunRef
2325 );
2326
2327 NTKERNELAPI
2328 VOID
2329 FASTCALL
2330 ExReInitializeRundownProtection (
2331 IN PEX_RUNDOWN_REF RunRef
2332 );
2333
2334 NTKERNELAPI
2335 BOOLEAN
2336 FASTCALL
2337 ExAcquireRundownProtection (
2338 IN PEX_RUNDOWN_REF RunRef
2339 );
2340
2341 NTKERNELAPI
2342 BOOLEAN
2343 FASTCALL
2344 ExAcquireRundownProtectionEx (
2345 IN PEX_RUNDOWN_REF RunRef,
2346 IN ULONG Count
2347 );
2348
2349 NTKERNELAPI
2350 VOID
2351 FASTCALL
2352 ExReleaseRundownProtection (
2353 IN PEX_RUNDOWN_REF RunRef
2354 );
2355
2356 NTKERNELAPI
2357 VOID
2358 FASTCALL
2359 ExReleaseRundownProtectionEx (
2360 IN PEX_RUNDOWN_REF RunRef,
2361 IN ULONG Count
2362 );
2363
2364 NTKERNELAPI
2365 VOID
2366 FASTCALL
2367 ExRundownCompleted (
2368 IN PEX_RUNDOWN_REF RunRef
2369 );
2370
2371 NTKERNELAPI
2372 VOID
2373 FASTCALL
2374 ExWaitForRundownProtectionRelease (
2375 IN PEX_RUNDOWN_REF RunRef
2376 );
2377
2378 #endif
2379 #endif /* (VER_PRODUCTBUILD >= 2600) */
2380
2381 #define FlagOn(x, f) ((x) & (f))
2382
2383 NTKERNELAPI
2384 VOID
2385 NTAPI
2386 FsRtlAddToTunnelCache (
2387 IN PTUNNEL Cache,
2388 IN ULONGLONG DirectoryKey,
2389 IN PUNICODE_STRING ShortName,
2390 IN PUNICODE_STRING LongName,
2391 IN BOOLEAN KeyByShortName,
2392 IN ULONG DataLength,
2393 IN PVOID Data
2394 );
2395
2396 #if (VER_PRODUCTBUILD >= 2195)
2397
2398 PFILE_LOCK
2399 NTAPI
2400 FsRtlAllocateFileLock (
2401 IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
2402 IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
2403 );
2404
2405 #endif /* (VER_PRODUCTBUILD >= 2195) */
2406
2407 NTKERNELAPI
2408 PVOID
2409 NTAPI
2410 FsRtlAllocatePool (
2411 IN POOL_TYPE PoolType,
2412 IN ULONG NumberOfBytes
2413 );
2414
2415 NTKERNELAPI
2416 PVOID
2417 NTAPI
2418 FsRtlAllocatePoolWithQuota (
2419 IN POOL_TYPE PoolType,
2420 IN ULONG NumberOfBytes
2421 );
2422
2423 NTKERNELAPI
2424 PVOID
2425 NTAPI
2426 FsRtlAllocatePoolWithQuotaTag (
2427 IN POOL_TYPE PoolType,
2428 IN ULONG NumberOfBytes,
2429 IN ULONG Tag
2430 );
2431
2432 NTKERNELAPI
2433 PVOID
2434 NTAPI
2435 FsRtlAllocatePoolWithTag (
2436 IN POOL_TYPE PoolType,
2437 IN ULONG NumberOfBytes,
2438 IN ULONG Tag
2439 );
2440
2441 NTKERNELAPI
2442 BOOLEAN
2443 NTAPI
2444 FsRtlAreNamesEqual (
2445 IN PCUNICODE_STRING Name1,
2446 IN PCUNICODE_STRING Name2,
2447 IN BOOLEAN IgnoreCase,
2448 IN PCWCH UpcaseTable OPTIONAL
2449 );
2450
2451 #define FsRtlAreThereCurrentFileLocks(FL) ( \
2452 ((FL)->FastIoIsQuestionable) \
2453 )
2454
2455 /*
2456 FsRtlCheckLockForReadAccess:
2457
2458 All this really does is pick out the lock parameters from the irp (io stack
2459 location?), get IoGetRequestorProcess, and pass values on to
2460 FsRtlFastCheckLockForRead.
2461 */
2462 NTKERNELAPI
2463 BOOLEAN
2464 NTAPI
2465 FsRtlCheckLockForReadAccess (
2466 IN PFILE_LOCK FileLock,
2467 IN PIRP Irp
2468 );
2469
2470 /*
2471 FsRtlCheckLockForWriteAccess:
2472
2473 All this really does is pick out the lock parameters from the irp (io stack
2474 location?), get IoGetRequestorProcess, and pass values on to
2475 FsRtlFastCheckLockForWrite.
2476 */
2477 NTKERNELAPI
2478 BOOLEAN
2479 NTAPI
2480 FsRtlCheckLockForWriteAccess (
2481 IN PFILE_LOCK FileLock,
2482 IN PIRP Irp
2483 );
2484
2485 typedef
2486 VOID
2487 (NTAPI*POPLOCK_WAIT_COMPLETE_ROUTINE) (
2488 IN PVOID Context,
2489 IN PIRP Irp
2490 );
2491
2492 typedef
2493 VOID
2494 (NTAPI*POPLOCK_FS_PREPOST_IRP) (
2495 IN PVOID Context,
2496 IN PIRP Irp
2497 );
2498
2499 NTKERNELAPI
2500 NTSTATUS
2501 NTAPI
2502 FsRtlCheckOplock (
2503 IN POPLOCK Oplock,
2504 IN PIRP Irp,
2505 IN PVOID Context,
2506 IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL,
2507 IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL
2508 );
2509
2510 NTKERNELAPI
2511 BOOLEAN
2512 NTAPI
2513 FsRtlCopyRead (
2514 IN PFILE_OBJECT FileObject,
2515 IN PLARGE_INTEGER FileOffset,
2516 IN ULONG Length,
2517 IN BOOLEAN Wait,
2518 IN ULONG LockKey,
2519 OUT PVOID Buffer,
2520 OUT PIO_STATUS_BLOCK IoStatus,
2521 IN PDEVICE_OBJECT DeviceObject
2522 );
2523
2524 NTKERNELAPI
2525 BOOLEAN
2526 NTAPI
2527 FsRtlCopyWrite (
2528 IN PFILE_OBJECT FileObject,
2529 IN PLARGE_INTEGER FileOffset,
2530 IN ULONG Length,
2531 IN BOOLEAN Wait,
2532 IN ULONG LockKey,
2533 IN PVOID Buffer,
2534 OUT PIO_STATUS_BLOCK IoStatus,
2535 IN PDEVICE_OBJECT DeviceObject
2536 );
2537
2538 NTSYSAPI
2539 PVOID
2540 NTAPI
2541 RtlCreateHeap (
2542 IN ULONG Flags,
2543 IN PVOID HeapBase OPTIONAL,
2544 IN SIZE_T ReserveSize OPTIONAL,
2545 IN SIZE_T CommitSize OPTIONAL,
2546 IN PVOID Lock OPTIONAL,
2547 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
2548 );
2549
2550 NTKERNELAPI
2551 BOOLEAN
2552 NTAPI
2553 FsRtlCurrentBatchOplock (
2554 IN POPLOCK Oplock
2555 );
2556
2557 NTKERNELAPI
2558 VOID
2559 NTAPI
2560 FsRtlDeleteKeyFromTunnelCache (
2561 IN PTUNNEL Cache,
2562 IN ULONGLONG DirectoryKey
2563 );
2564
2565 NTKERNELAPI
2566 VOID
2567 NTAPI
2568 FsRtlDeleteTunnelCache (
2569 IN PTUNNEL Cache
2570 );
2571
2572 NTKERNELAPI
2573 VOID
2574 NTAPI
2575 FsRtlDeregisterUncProvider (
2576 IN HANDLE Handle
2577 );
2578
2579 NTSYSAPI
2580 PVOID
2581 NTAPI
2582 RtlDestroyHeap(
2583 IN PVOID HeapHandle
2584 );
2585
2586 NTKERNELAPI
2587 VOID
2588 NTAPI
2589 FsRtlDissectDbcs (
2590 IN ANSI_STRING Name,
2591 OUT PANSI_STRING FirstPart,
2592 OUT PANSI_STRING RemainingPart
2593 );
2594
2595 NTKERNELAPI
2596 VOID
2597 NTAPI
2598 FsRtlDissectName (
2599 IN UNICODE_STRING Name,
2600 OUT PUNICODE_STRING FirstPart,
2601 OUT PUNICODE_STRING RemainingPart
2602 );
2603
2604 NTKERNELAPI
2605 BOOLEAN
2606 NTAPI
2607 FsRtlDoesDbcsContainWildCards (
2608 IN PANSI_STRING Name
2609 );
2610
2611 NTKERNELAPI
2612 BOOLEAN
2613 NTAPI
2614 FsRtlDoesNameContainWildCards (
2615 IN PUNICODE_STRING Name
2616 );
2617
2618 #define FsRtlCompleteRequest(IRP,STATUS) { \
2619 (IRP)->IoStatus.Status = (STATUS); \
2620 IoCompleteRequest( (IRP), IO_DISK_INCREMENT ); \
2621 }
2622
2623 #define FsRtlEnterFileSystem KeEnterCriticalRegion
2624
2625 #define FsRtlExitFileSystem KeLeaveCriticalRegion
2626
2627 NTKERNELAPI
2628 BOOLEAN
2629 NTAPI
2630 FsRtlFastCheckLockForRead (
2631 IN PFILE_LOCK FileLock,
2632 IN PLARGE_INTEGER FileOffset,
2633 IN PLARGE_INTEGER Length,
2634 IN ULONG Key,
2635 IN PFILE_OBJECT FileObject,
2636 IN PEPROCESS Process
2637 );
2638
2639 NTKERNELAPI
2640 BOOLEAN
2641 NTAPI
2642 FsRtlFastCheckLockForWrite (
2643 IN PFILE_LOCK FileLock,
2644 IN PLARGE_INTEGER FileOffset,
2645 IN PLARGE_INTEGER Length,
2646 IN ULONG Key,
2647 IN PFILE_OBJECT FileObject,
2648 IN PEPROCESS Process
2649 );
2650
2651 #define FsRtlFastLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) ( \
2652 FsRtlPrivateLock(A1, A2, A3, A4, A5, A6, A7, A8, A9, NULL, A10, A11) \
2653 )
2654
2655 NTKERNELAPI
2656 NTSTATUS
2657 NTAPI
2658 FsRtlFastUnlockAll (
2659 IN PFILE_LOCK FileLock,
2660 IN PFILE_OBJECT FileObject,
2661 IN PEPROCESS Process,
2662 IN PVOID Context OPTIONAL
2663 );
2664 /* ret: STATUS_RANGE_NOT_LOCKED */
2665
2666 NTKERNELAPI
2667 NTSTATUS
2668 NTAPI
2669 FsRtlFastUnlockAllByKey (
2670 IN PFILE_LOCK FileLock,
2671 IN PFILE_OBJECT FileObject,
2672 IN PEPROCESS Process,
2673 IN ULONG Key,
2674 IN PVOID Context OPTIONAL
2675 );
2676 /* ret: STATUS_RANGE_NOT_LOCKED */
2677
2678 NTKERNELAPI
2679 NTSTATUS
2680 NTAPI
2681 FsRtlFastUnlockSingle (
2682 IN PFILE_LOCK FileLock,
2683 IN PFILE_OBJECT FileObject,
2684 IN PLARGE_INTEGER FileOffset,
2685 IN PLARGE_INTEGER Length,
2686 IN PEPROCESS Process,
2687 IN ULONG Key,
2688 IN PVOID Context OPTIONAL,
2689 IN BOOLEAN AlreadySynchronized
2690 );
2691 /* ret: STATUS_RANGE_NOT_LOCKED */
2692
2693 NTKERNELAPI
2694 BOOLEAN
2695 NTAPI
2696 FsRtlFindInTunnelCache (
2697 IN PTUNNEL Cache,
2698 IN ULONGLONG DirectoryKey,
2699 IN PUNICODE_STRING Name,
2700 OUT PUNICODE_STRING ShortName,
2701 OUT PUNICODE_STRING LongName,
2702 IN OUT PULONG DataLength,
2703 OUT PVOID Data
2704 );
2705
2706 #if (VER_PRODUCTBUILD >= 2195)
2707
2708 NTKERNELAPI
2709 VOID
2710 NTAPI
2711 FsRtlFreeFileLock (
2712 IN PFILE_LOCK FileLock
2713 );
2714
2715 #endif /* (VER_PRODUCTBUILD >= 2195) */
2716
2717 NTKERNELAPI
2718 NTSTATUS
2719 NTAPI
2720 FsRtlGetFileSize (
2721 IN PFILE_OBJECT FileObject,
2722 IN OUT PLARGE_INTEGER FileSize
2723 );
2724
2725 /*
2726 FsRtlGetNextFileLock:
2727
2728 ret: NULL if no more locks
2729
2730 Internals:
2731 FsRtlGetNextFileLock uses FileLock->LastReturnedLockInfo and
2732 FileLock->LastReturnedLock as storage.
2733 LastReturnedLock is a pointer to the 'raw' lock inkl. double linked
2734 list, and FsRtlGetNextFileLock needs this to get next lock on subsequent
2735 calls with Restart = FALSE.
2736 */
2737 NTKERNELAPI
2738 PFILE_LOCK_INFO
2739 NTAPI
2740 FsRtlGetNextFileLock (
2741 IN PFILE_LOCK FileLock,
2742 IN BOOLEAN Restart
2743 );
2744
2745 NTKERNELAPI
2746 VOID
2747 NTAPI
2748 FsRtlInitializeFileLock (
2749 IN PFILE_LOCK FileLock,
2750 IN PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine OPTIONAL,
2751 IN PUNLOCK_ROUTINE UnlockRoutine OPTIONAL
2752 );
2753
2754 NTKERNELAPI
2755 VOID
2756 NTAPI
2757 FsRtlInitializeOplock (
2758 IN OUT POPLOCK Oplock
2759 );
2760
2761 NTKERNELAPI
2762 VOID
2763 NTAPI
2764 FsRtlInitializeTunnelCache (
2765 IN PTUNNEL Cache
2766 );
2767
2768 NTKERNELAPI
2769 BOOLEAN
2770 NTAPI
2771 FsRtlIsNameInExpression (
2772 IN PUNICODE_STRING Expression,
2773 IN PUNICODE_STRING Name,
2774 IN BOOLEAN IgnoreCase,
2775 IN PWCHAR UpcaseTable OPTIONAL
2776 );
2777
2778 NTKERNELAPI
2779 BOOLEAN
2780 NTAPI
2781 FsRtlIsNtstatusExpected (
2782 IN NTSTATUS Ntstatus
2783 );
2784
2785 #define NLS_OEM_LEAD_BYTE_INFO NlsOemLeadByteInfo
2786
2787 extern PUSHORT NlsOemLeadByteInfo;
2788
2789 #define FsRtlIsLeadDbcsCharacter(DBCS_CHAR) ( \
2790 (BOOLEAN)((UCHAR)(DBCS_CHAR) < 0x80 ? FALSE : \
2791 (NLS_MB_CODE_PAGE_TAG && \
2792 (NLS_OEM_LEAD_BYTE_INFO[(UCHAR)(DBCS_CHAR)] != 0))) \
2793 )
2794
2795 #define FsRtlIsAnsiCharacterWild(C) ( \
2796 FlagOn(FsRtlLegalAnsiCharacterArray[(UCHAR)(C)], FSRTL_WILD_CHARACTER ) \
2797 )
2798
2799 #define FsRtlIsUnicodeCharacterWild(C) ( \
2800 (((C) >= 0x40) ? \
2801 FALSE : \
2802 FlagOn(FsRtlLegalAnsiCharacterArray[(C)], FSRTL_WILD_CHARACTER )) \
2803 )
2804
2805 NTKERNELAPI
2806 BOOLEAN
2807 NTAPI
2808 FsRtlMdlReadDev (
2809 IN PFILE_OBJECT FileObject,
2810 IN PLARGE_INTEGER FileOffset,
2811 IN ULONG Length,
2812 IN ULONG LockKey,
2813 OUT PMDL *MdlChain,
2814 OUT PIO_STATUS_BLOCK IoStatus,
2815 IN PDEVICE_OBJECT DeviceObject
2816 );
2817
2818 NTKERNELAPI
2819 BOOLEAN
2820 NTAPI
2821 FsRtlMdlReadComplete (
2822 IN PFILE_OBJECT FileObject,
2823 IN PMDL MdlChain
2824 );
2825
2826 NTKERNELAPI
2827 BOOLEAN
2828 NTAPI
2829 FsRtlMdlReadCompleteDev (
2830 IN PFILE_OBJECT FileObject,
2831 IN PMDL MdlChain,
2832 IN PDEVICE_OBJECT DeviceObject
2833 );
2834
2835 NTKERNELAPI
2836 BOOLEAN
2837 NTAPI
2838 FsRtlPrepareMdlWriteDev (
2839 IN PFILE_OBJECT FileObject,
2840 IN PLARGE_INTEGER FileOffset,
2841 IN ULONG Length,
2842 IN ULONG LockKey,
2843 OUT PMDL *MdlChain,
2844 OUT PIO_STATUS_BLOCK IoStatus,
2845 IN PDEVICE_OBJECT DeviceObject
2846 );
2847
2848 NTKERNELAPI
2849 BOOLEAN
2850 NTAPI
2851 FsRtlMdlWriteComplete (
2852 IN PFILE_OBJECT FileObject,
2853 IN PLARGE_INTEGER FileOffset,
2854 IN PMDL MdlChain
2855 );
2856
2857 NTKERNELAPI
2858 BOOLEAN
2859 NTAPI
2860 FsRtlMdlWriteCompleteDev (
2861 IN PFILE_OBJECT FileObject,
2862 IN PLARGE_INTEGER FileOffset,
2863 IN PMDL MdlChain,
2864 IN PDEVICE_OBJECT DeviceObject
2865 );
2866
2867 NTKERNELAPI
2868 NTSTATUS
2869 NTAPI
2870 FsRtlNormalizeNtstatus (
2871 IN NTSTATUS Exception,
2872 IN NTSTATUS GenericException
2873 );
2874
2875 NTKERNELAPI
2876 VOID
2877 NTAPI
2878 FsRtlNotifyChangeDirectory (
2879 IN PNOTIFY_SYNC NotifySync,
2880 IN PVOID FsContext,
2881 IN PSTRING FullDirectoryName,
2882 IN PLIST_ENTRY NotifyList,
2883 IN BOOLEAN WatchTree,
2884 IN ULONG CompletionFilter,
2885 IN PIRP NotifyIrp
2886 );
2887
2888 NTKERNELAPI
2889 VOID
2890 NTAPI
2891 FsRtlNotifyCleanup (
2892 IN PNOTIFY_SYNC NotifySync,
2893 IN PLIST_ENTRY NotifyList,
2894 IN PVOID FsContext
2895 );
2896
2897 typedef BOOLEAN (*PCHECK_FOR_TRAVERSE_ACCESS) (
2898 IN PVOID NotifyContext,
2899 IN PVOID TargetContext,
2900 IN PSECURITY_SUBJECT_CONTEXT SubjectContext
2901 );
2902
2903 NTKERNELAPI
2904 VOID
2905 NTAPI
2906 FsRtlNotifyFullChangeDirectory (
2907 IN PNOTIFY_SYNC NotifySync,
2908 IN PLIST_ENTRY NotifyList,
2909 IN PVOID FsContext,
2910 IN PSTRING FullDirectoryName,
2911 IN BOOLEAN WatchTree,
2912 IN BOOLEAN IgnoreBuffer,
2913 IN ULONG CompletionFilter,
2914 IN PIRP NotifyIrp,
2915 IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL,
2916 IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL
2917 );
2918
2919 NTKERNELAPI
2920 VOID
2921 NTAPI
2922 FsRtlNotifyFullReportChange (
2923 IN PNOTIFY_SYNC NotifySync,
2924 IN PLIST_ENTRY NotifyList,
2925 IN PSTRING FullTargetName,
2926 IN USHORT TargetNameOffset,
2927 IN PSTRING StreamName OPTIONAL,
2928 IN PSTRING NormalizedParentName OPTIONAL,
2929 IN ULONG FilterMatch,
2930 IN ULONG Action,
2931 IN PVOID TargetContext
2932 );
2933
2934 NTKERNELAPI
2935 VOID
2936 NTAPI
2937 FsRtlNotifyInitializeSync (
2938 IN PNOTIFY_SYNC *NotifySync
2939 );
2940
2941 NTKERNELAPI
2942 VOID
2943 NTAPI
2944 FsRtlNotifyReportChange (
2945 IN PNOTIFY_SYNC NotifySync,
2946 IN PLIST_ENTRY NotifyList,
2947 IN PSTRING FullTargetName,
2948 IN PUSHORT FileNamePartLength,
2949 IN ULONG FilterMatch
2950 );
2951
2952 NTKERNELAPI
2953 VOID
2954 NTAPI
2955 FsRtlNotifyUninitializeSync (
2956 IN PNOTIFY_SYNC *NotifySync
2957 );
2958
2959 #if (VER_PRODUCTBUILD >= 2195)
2960
2961 NTKERNELAPI
2962 NTSTATUS
2963 NTAPI
2964 FsRtlNotifyVolumeEvent (
2965 IN PFILE_OBJECT FileObject,
2966 IN ULONG EventCode
2967 );
2968
2969 #endif /* (VER_PRODUCTBUILD >= 2195) */
2970
2971 NTKERNELAPI
2972 NTSTATUS
2973 NTAPI
2974 FsRtlOplockFsctrl (
2975 IN POPLOCK Oplock,
2976 IN PIRP Irp,
2977 IN ULONG OpenCount
2978 );
2979
2980 NTKERNELAPI
2981 BOOLEAN
2982 NTAPI
2983 FsRtlOplockIsFastIoPossible (
2984 IN POPLOCK Oplock
2985 );
2986
2987 /*
2988 FsRtlPrivateLock:
2989
2990 ret: IoStatus->Status: STATUS_PENDING, STATUS_LOCK_NOT_GRANTED
2991
2992 Internals:
2993 -Calls IoCompleteRequest if Irp
2994 -Uses exception handling / ExRaiseStatus with STATUS_INSUFFICIENT_RESOURCES
2995 */
2996 NTKERNELAPI
2997 BOOLEAN
2998 NTAPI
2999 FsRtlPrivateLock (
3000 IN PFILE_LOCK FileLock,
3001 IN PFILE_OBJECT FileObject,
3002 IN PLARGE_INTEGER FileOffset,
3003 IN PLARGE_INTEGER Length,
3004 IN PEPROCESS Process,
3005 IN ULONG Key,
3006 IN BOOLEAN FailImmediately,
3007 IN BOOLEAN ExclusiveLock,
3008 OUT PIO_STATUS_BLOCK IoStatus,
3009 IN PIRP Irp OPTIONAL,
3010 IN PVOID Context,
3011 IN BOOLEAN AlreadySynchronized
3012 );
3013
3014 /*
3015 FsRtlProcessFileLock:
3016
3017 ret:
3018 -STATUS_INVALID_DEVICE_REQUEST
3019 -STATUS_RANGE_NOT_LOCKED from unlock routines.
3020 -STATUS_PENDING, STATUS_LOCK_NOT_GRANTED from FsRtlPrivateLock
3021 (redirected IoStatus->Status).
3022
3023 Internals:
3024 -switch ( Irp->CurrentStackLocation->MinorFunction )
3025 lock: return FsRtlPrivateLock;
3026 unlocksingle: return FsRtlFastUnlockSingle;
3027 unlockall: return FsRtlFastUnlockAll;
3028 unlockallbykey: return FsRtlFastUnlockAllByKey;
3029 default: IofCompleteRequest with STATUS_INVALID_DEVICE_REQUEST;
3030 return STATUS_INVALID_DEVICE_REQUEST;
3031
3032 -'AllwaysZero' is passed thru as 'AllwaysZero' to lock / unlock routines.
3033 -'Irp' is passet thru as 'Irp' to FsRtlPrivateLock.
3034 */
3035 NTKERNELAPI
3036 NTSTATUS
3037 NTAPI
3038 FsRtlProcessFileLock (
3039 IN PFILE_LOCK FileLock,
3040 IN PIRP Irp,
3041 IN PVOID Context OPTIONAL
3042 );
3043
3044 NTKERNELAPI
3045 NTSTATUS
3046 NTAPI
3047 FsRtlRegisterUncProvider (
3048 IN OUT PHANDLE MupHandle,
3049 IN PUNICODE_STRING RedirectorDeviceName,
3050 IN BOOLEAN MailslotsSupported
3051 );
3052
3053 typedef VOID
3054 (NTAPI *PFSRTL_STACK_OVERFLOW_ROUTINE) (
3055 IN PVOID Context,
3056 IN PKEVENT Event
3057 );
3058
3059 NTKERNELAPI
3060 VOID
3061 NTAPI
3062 FsRtlPostStackOverflow (
3063 IN PVOID Context,
3064 IN PKEVENT Event,
3065 IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
3066 );
3067
3068 NTKERNELAPI
3069 VOID
3070 NTAPI
3071 FsRtlPostPagingFileStackOverflow (
3072 IN PVOID Context,
3073 IN PKEVENT Event,
3074 IN PFSRTL_STACK_OVERFLOW_ROUTINE StackOverflowRoutine
3075 );
3076
3077 NTKERNELAPI
3078 VOID
3079 NTAPI
3080 FsRtlUninitializeFileLock (
3081 IN PFILE_LOCK FileLock
3082 );
3083
3084 NTKERNELAPI
3085 VOID
3086 NTAPI
3087 FsRtlUninitializeOplock (
3088 IN OUT POPLOCK Oplock
3089 );
3090
3091 NTHALAPI
3092 VOID
3093 NTAPI
3094 HalDisplayString (
3095 IN PCHAR String
3096 );
3097
3098 NTKERNELAPI
3099 UCHAR
3100 NTAPI
3101 KeSetIdealProcessorThread(
3102 IN OUT PKTHREAD Thread,
3103 IN UCHAR Processor
3104 );
3105
3106 NTKERNELAPI
3107 NTSTATUS
3108 NTAPI
3109 IoAttachDeviceToDeviceStackSafe(
3110 IN PDEVICE_OBJECT SourceDevice,
3111 IN PDEVICE_OBJECT TargetDevice,
3112 OUT PDEVICE_OBJECT *AttachedToDeviceObject
3113 );
3114
3115 NTKERNELAPI
3116 VOID
3117 NTAPI
3118 IoAcquireVpbSpinLock (
3119 OUT PKIRQL Irql
3120 );
3121
3122 NTKERNELAPI
3123 NTSTATUS
3124 NTAPI
3125 IoCheckDesiredAccess (
3126 IN OUT PACCESS_MASK DesiredAccess,
3127 IN ACCESS_MASK GrantedAccess
3128 );
3129
3130 NTKERNELAPI
3131 NTSTATUS
3132 NTAPI
3133 IoCheckEaBufferValidity (
3134 IN PFILE_FULL_EA_INFORMATION EaBuffer,
3135 IN ULONG EaLength,
3136 OUT PULONG ErrorOffset
3137 );
3138
3139 NTKERNELAPI
3140 NTSTATUS
3141 NTAPI
3142 IoCheckFunctionAccess (
3143 IN ACCESS_MASK GrantedAccess,
3144 IN UCHAR MajorFunction,
3145 IN UCHAR MinorFunction,
3146 IN ULONG IoControlCode,
3147 IN PVOID Argument1 OPTIONAL,
3148 IN PVOID Argument2 OPTIONAL
3149 );
3150
3151 #if (VER_PRODUCTBUILD >= 2195)
3152
3153 NTKERNELAPI
3154 NTSTATUS
3155 NTAPI
3156 IoCheckQuotaBufferValidity (
3157 IN PFILE_QUOTA_INFORMATION QuotaBuffer,
3158 IN ULONG QuotaLength,
3159 OUT PULONG ErrorOffset
3160 );
3161
3162 #endif /* (VER_PRODUCTBUILD >= 2195) */
3163
3164 NTKERNELAPI
3165 PFILE_OBJECT
3166 NTAPI
3167 IoCreateStreamFileObject (
3168 IN PFILE_OBJECT FileObject OPTIONAL,
3169 IN PDEVICE_OBJECT DeviceObject OPTIONAL
3170 );
3171
3172 #if (VER_PRODUCTBUILD >= 2195)
3173
3174 NTKERNELAPI
3175 PFILE_OBJECT
3176 NTAPI
3177 IoCreateStreamFileObjectLite (
3178 IN PFILE_OBJECT FileObject OPTIONAL,
3179 IN PDEVICE_OBJECT DeviceObject OPTIONAL
3180 );
3181
3182 #endif /* (VER_PRODUCTBUILD >= 2195) */
3183
3184 NTKERNELAPI
3185 BOOLEAN
3186 NTAPI
3187 IoFastQueryNetworkAttributes (
3188 IN POBJECT_ATTRIBUTES ObjectAttributes,
3189 IN ACCESS_MASK DesiredAccess,
3190 IN ULONG OpenOptions,
3191 OUT PIO_STATUS_BLOCK IoStatus,
3192 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer
3193 );
3194
3195 NTKERNELAPI
3196 PDEVICE_OBJECT
3197 NTAPI
3198 IoGetAttachedDevice (
3199 IN PDEVICE_OBJECT DeviceObject
3200 );
3201
3202 NTKERNELAPI
3203 PDEVICE_OBJECT
3204 NTAPI
3205 IoGetBaseFileSystemDeviceObject (
3206 IN PFILE_OBJECT FileObject
3207 );
3208
3209 NTKERNELAPI
3210 PEPROCESS
3211 NTAPI
3212 IoGetRequestorProcess (
3213 IN PIRP Irp
3214 );
3215
3216 #if (VER_PRODUCTBUILD >= 2195)
3217
3218 NTKERNELAPI
3219 ULONG
3220 NTAPI
3221 IoGetRequestorProcessId (
3222 IN PIRP Irp
3223 );
3224
3225 #endif /* (VER_PRODUCTBUILD >= 2195) */
3226
3227 NTKERNELAPI
3228 PIRP
3229 NTAPI
3230 IoGetTopLevelIrp (
3231 VOID
3232 );
3233
3234 #define IoIsFileOpenedExclusively(FileObject) ( \
3235 (BOOLEAN) !( \
3236 (FileObject)->SharedRead || \
3237 (FileObject)->SharedWrite || \
3238 (FileObject)->SharedDelete \
3239 ) \
3240 )
3241
3242 NTKERNELAPI
3243 BOOLEAN
3244 NTAPI
3245 IoIsOperationSynchronous (
3246 IN PIRP Irp
3247 );
3248
3249 NTKERNELAPI
3250 BOOLEAN
3251 NTAPI
3252 IoIsSystemThread (
3253 IN PETHREAD Thread
3254 );
3255
3256 #if (VER_PRODUCTBUILD >= 2195)
3257
3258 NTKERNELAPI
3259 BOOLEAN
3260 NTAPI
3261 IoIsValidNameGraftingBuffer (
3262 IN PIRP Irp,
3263 IN PREPARSE_DATA_BUFFER ReparseBuffer
3264 );
3265
3266 #endif /* (VER_PRODUCTBUILD >= 2195) */
3267
3268 NTKERNELAPI
3269 NTSTATUS
3270 NTAPI
3271 IoPageRead (
3272 IN PFILE_OBJECT FileObject,
3273 IN PMDL Mdl,
3274 IN PLARGE_INTEGER Offset,
3275 IN PKEVENT Event,
3276 OUT PIO_STATUS_BLOCK IoStatusBlock
3277 );
3278
3279 NTKERNELAPI
3280 NTSTATUS
3281 NTAPI
3282 IoQueryFileInformation (
3283 IN PFILE_OBJECT FileObject,
3284 IN FILE_INFORMATION_CLASS FileInformationClass,
3285 IN ULONG Length,
3286 OUT PVOID FileInformation,
3287 OUT PULONG ReturnedLength
3288 );
3289
3290 NTKERNELAPI
3291 NTSTATUS
3292 NTAPI
3293 IoQueryVolumeInformation (
3294 IN PFILE_OBJECT FileObject,
3295 IN FS_INFORMATION_CLASS FsInformationClass,
3296 IN ULONG Length,
3297 OUT PVOID FsInformation,
3298 OUT PULONG ReturnedLength
3299 );
3300
3301 NTKERNELAPI
3302 VOID
3303 NTAPI
3304 IoQueueThreadIrp(
3305 IN PIRP Irp
3306 );
3307
3308 NTKERNELAPI
3309 VOID
3310 NTAPI
3311 IoRegisterFileSystem (
3312 IN OUT PDEVICE_OBJECT DeviceObject
3313 );
3314
3315 #if (VER_PRODUCTBUILD >= 1381)
3316
3317 typedef VOID (NTAPI *PDRIVER_FS_NOTIFICATION) (
3318 IN PDEVICE_OBJECT DeviceObject,
3319 IN BOOLEAN DriverActive
3320 );
3321
3322 NTKERNELAPI
3323 NTSTATUS
3324 NTAPI
3325 IoRegisterFsRegistrationChange (
3326 IN PDRIVER_OBJECT DriverObject,
3327 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
3328 );
3329
3330 #endif /* (VER_PRODUCTBUILD >= 1381) */
3331
3332 NTKERNELAPI
3333 VOID
3334 NTAPI
3335 IoReleaseVpbSpinLock (
3336 IN KIRQL Irql
3337 );
3338
3339 NTKERNELAPI
3340 VOID
3341 NTAPI
3342 IoSetDeviceToVerify (
3343 IN PETHREAD Thread,
3344 IN PDEVICE_OBJECT DeviceObject
3345 );
3346
3347 NTKERNELAPI
3348 NTSTATUS
3349 NTAPI
3350 IoSetInformation (
3351 IN PFILE_OBJECT FileObject,
3352 IN FILE_INFORMATION_CLASS FileInformationClass,
3353 IN ULONG Length,
3354 IN PVOID FileInformation
3355 );
3356
3357 NTKERNELAPI
3358 VOID
3359 NTAPI
3360 IoSetTopLevelIrp (
3361 IN PIRP Irp
3362 );
3363
3364 NTKERNELAPI
3365 NTSTATUS
3366 NTAPI
3367 IoSynchronousPageWrite (
3368 IN PFILE_OBJECT FileObject,
3369 IN PMDL Mdl,
3370 IN PLARGE_INTEGER FileOffset,
3371 IN PKEVENT Event,
3372 OUT PIO_STATUS_BLOCK IoStatusBlock
3373 );
3374
3375 NTKERNELAPI
3376 PEPROCESS
3377 NTAPI
3378 IoThreadToProcess (
3379 IN PETHREAD Thread
3380 );
3381
3382 NTKERNELAPI
3383 VOID
3384 NTAPI
3385 IoUnregisterFileSystem (
3386 IN OUT PDEVICE_OBJECT DeviceObject
3387 );
3388
3389 #if (VER_PRODUCTBUILD >= 1381)
3390
3391 NTKERNELAPI
3392 VOID
3393 NTAPI
3394 IoUnregisterFsRegistrationChange (
3395 IN PDRIVER_OBJECT DriverObject,
3396 IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine
3397 );
3398
3399 #endif /* (VER_PRODUCTBUILD >= 1381) */
3400
3401 NTKERNELAPI
3402 NTSTATUS
3403 NTAPI
3404 IoVerifyVolume (
3405 IN PDEVICE_OBJECT DeviceObject,
3406 IN BOOLEAN AllowRawMount
3407 );
3408
3409 NTKERNELAPI
3410 VOID
3411 NTAPI
3412 KeAttachProcess (
3413 IN PKPROCESS Process
3414 );
3415
3416 NTKERNELAPI
3417 VOID
3418 NTAPI
3419 KeDetachProcess (
3420 VOID
3421 );
3422
3423 NTKERNELAPI
3424 VOID
3425 NTAPI
3426 KeInitializeQueue (
3427 IN PRKQUEUE Queue,
3428 IN ULONG Count OPTIONAL
3429 );
3430
3431 NTKERNELAPI
3432 LONG
3433 NTAPI
3434 KeInsertHeadQueue (
3435 IN PRKQUEUE Queue,
3436 IN PLIST_ENTRY Entry
3437 );
3438
3439 NTKERNELAPI
3440 LONG
3441 NTAPI
3442 KeInsertQueue (
3443 IN PRKQUEUE Queue,
3444 IN PLIST_ENTRY Entry
3445 );
3446
3447 NTKERNELAPI
3448 LONG
3449 NTAPI
3450 KeReadStateQueue (
3451 IN PRKQUEUE Queue
3452 );
3453
3454 NTKERNELAPI
3455 PLIST_ENTRY
3456 NTAPI
3457 KeRemoveQueue (
3458 IN PRKQUEUE Queue,
3459 IN KPROCESSOR_MODE WaitMode,
3460 IN PLARGE_INTEGER Timeout OPTIONAL
3461 );
3462
3463 NTKERNELAPI
3464 PLIST_ENTRY
3465 NTAPI
3466 KeRundownQueue (
3467 IN PRKQUEUE Queue
3468 );
3469
3470 NTKERNELAPI
3471 VOID
3472 NTAPI
3473 KeInitializeMutant (
3474 IN PRKMUTANT Mutant,
3475 IN BOOLEAN InitialOwner
3476 );
3477
3478 NTKERNELAPI
3479 LONG
3480 NTAPI
3481 KeReadStateMutant (
3482 IN PRKMUTANT Mutant
3483 );
3484
3485 NTKERNELAPI
3486 LONG
3487 NTAPI
3488 KeReleaseMutant (
3489 IN PRKMUTANT Mutant,
3490 IN KPRIORITY Increment,
3491 IN BOOLEAN Abandoned,
3492 IN BOOLEAN Wait
3493 );
3494
3495 #if (VER_PRODUCTBUILD >= 2195)
3496
3497 NTKERNELAPI
3498 VOID
3499 NTAPI
3500 KeStackAttachProcess (
3501 IN PKPROCESS Process,
3502 OUT PKAPC_STATE ApcState
3503 );
3504
3505 NTKERNELAPI
3506 VOID
3507 NTAPI
3508 KeUnstackDetachProcess (
3509 IN PKAPC_STATE ApcState
3510 );
3511
3512 #endif /* (VER_PRODUCTBUILD >= 2195) */
3513
3514 NTKERNELAPI
3515 BOOLEAN
3516 NTAPI
3517 KeSetKernelStackSwapEnable(
3518 IN BOOLEAN Enable
3519 );
3520
3521 NTKERNELAPI
3522 BOOLEAN
3523 NTAPI
3524 MmCanFileBeTruncated (
3525 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
3526 IN PLARGE_INTEGER NewFileSize
3527 );
3528
3529 NTKERNELAPI
3530 BOOLEAN
3531 NTAPI
3532 MmFlushImageSection (
3533 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
3534 IN MMFLUSH_TYPE FlushType
3535 );
3536
3537 NTKERNELAPI
3538 BOOLEAN
3539 NTAPI
3540 MmForceSectionClosed (
3541 IN PSECTION_OBJECT_POINTERS SectionObjectPointer,
3542 IN BOOLEAN DelayClose
3543 );
3544
3545 #if (VER_PRODUCTBUILD >= 1381)
3546
3547 NTKERNELAPI
3548 BOOLEAN
3549 NTAPI
3550 MmIsRecursiveIoFault (
3551 VOID
3552 );
3553
3554 #else
3555
3556 #define MmIsRecursiveIoFault() ( \
3557 (PsGetCurrentThread()->DisablePageFaultClustering) | \
3558 (PsGetCurrentThread()->ForwardClusterOnly) \
3559 )
3560
3561 #endif
3562
3563
3564 NTKERNELAPI
3565 BOOLEAN
3566 NTAPI
3567 MmSetAddressRangeModified (
3568 IN PVOID Address,
3569 IN ULONG Length
3570 );
3571
3572 NTKERNELAPI
3573 NTSTATUS
3574 NTAPI
3575 ObCreateObject (
3576 IN KPROCESSOR_MODE ObjectAttributesAccessMode OPTIONAL,
3577 IN POBJECT_TYPE ObjectType,
3578 IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
3579 IN KPROCESSOR_MODE AccessMode,
3580 IN OUT PVOID ParseContext OPTIONAL,
3581 IN ULONG ObjectSize,
3582 IN ULONG PagedPoolCharge OPTIONAL,
3583 IN ULONG NonPagedPoolCharge OPTIONAL,
3584 OUT PVOID *Object
3585 );
3586
3587 NTKERNELAPI
3588 ULONG
3589 NTAPI
3590 ObGetObjectPointerCount (
3591 IN PVOID Object
3592 );
3593
3594 NTKERNELAPI
3595 NTSTATUS
3596 NTAPI
3597 ObInsertObject (
3598 IN PVOID Object,
3599 IN PACCESS_STATE PassedAccessState OPTIONAL,
3600 IN ACCESS_MASK DesiredAccess,
3601 IN ULONG AdditionalReferences,
3602 OUT PVOID *ReferencedObject OPTIONAL,
3603 OUT PHANDLE Handle
3604 );
3605
3606 NTKERNELAPI
3607 VOID
3608 NTAPI
3609 ObMakeTemporaryObject (
3610 IN PVOID Object
3611 );
3612
3613 NTKERNELAPI
3614 NTSTATUS
3615 NTAPI
3616 ObOpenObjectByPointer (
3617 IN PVOID Object,
3618 IN ULONG HandleAttributes,
3619 IN PACCESS_STATE PassedAccessState OPTIONAL,
3620 IN ACCESS_MASK DesiredAccess OPTIONAL,
3621 IN POBJECT_TYPE ObjectType OPTIONAL,
3622 IN KPROCESSOR_MODE AccessMode,
3623 OUT PHANDLE Handle
3624 );
3625
3626 NTKERNELAPI
3627 NTSTATUS
3628 NTAPI
3629 ObQueryNameString (
3630 IN PVOID Object,
3631 OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
3632 IN ULONG Length,
3633 OUT PULONG ReturnLength
3634 );
3635
3636 NTKERNELAPI
3637 NTSTATUS
3638 NTAPI
3639 ObQueryObjectAuditingByHandle (
3640 IN HANDLE Handle,
3641 OUT PBOOLEAN GenerateOnClose
3642 );
3643
3644 NTKERNELAPI
3645 NTSTATUS
3646 NTAPI
3647 ObReferenceObjectByName (
3648 IN PUNICODE_STRING ObjectName,
3649 IN ULONG Attributes,
3650 IN PACCESS_STATE PassedAccessState OPTIONAL,
3651 IN ACCESS_MASK DesiredAccess OPTIONAL,
3652 IN POBJECT_TYPE ObjectType,
3653 IN KPROCESSOR_MODE AccessMode,
3654 IN OUT PVOID ParseContext OPTIONAL,
3655 OUT PVOID *Object
3656 );
3657
3658 NTKERNELAPI
3659 NTSTATUS
3660 NTAPI
3661 PsAssignImpersonationToken (
3662 IN PETHREAD Thread,
3663 IN HANDLE Token
3664 );
3665
3666 NTKERNELAPI
3667 VOID
3668 NTAPI
3669 PsChargePoolQuota (
3670 IN PEPROCESS Process,
3671 IN POOL_TYPE PoolType,
3672 IN ULONG Amount
3673 );
3674
3675 NTKERNELAPI
3676 NTSTATUS
3677 NTAPI
3678 PsChargeProcessPoolQuota (
3679 IN PEPROCESS Process,
3680 IN POOL_TYPE PoolType,
3681 IN ULONG_PTR Amount
3682 );
3683
3684 #define PsDereferenceImpersonationToken(T) \
3685 {if (ARGUMENT_PRESENT(T)) { \
3686 (ObDereferenceObject((T))); \
3687 } else { \
3688 ; \
3689 } \
3690 }
3691
3692 #define PsDereferencePrimaryToken(T) (ObDereferenceObject((T)))
3693
3694 NTKERNELAPI
3695 BOOLEAN
3696 NTAPI
3697 PsDisableImpersonation(
3698 IN PETHREAD Thread,
3699 IN PSE_IMPERSONATION_STATE ImpersonationState
3700 );
3701
3702 NTKERNELAPI
3703 LARGE_INTEGER
3704 NTAPI
3705 PsGetProcessExitTime (
3706 VOID
3707 );
3708
3709 NTKERNELAPI
3710 NTSTATUS
3711 NTAPI
3712 PsImpersonateClient(
3713 IN PETHREAD Thread,
3714 IN PACCESS_TOKEN Token,
3715 IN BOOLEAN CopyOnOpen,
3716 IN BOOLEAN EffectiveOnly,
3717 IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
3718 );
3719
3720 NTKERNELAPI
3721 BOOLEAN
3722 NTAPI
3723 PsIsSystemThread(
3724 IN PETHREAD Thread
3725 );
3726
3727 NTKERNELAPI
3728 BOOLEAN
3729 NTAPI
3730 PsIsThreadTerminating (
3731 IN PETHREAD Thread
3732 );
3733
3734 NTKERNELAPI
3735 NTSTATUS
3736 NTAPI
3737 PsLookupProcessByProcessId (
3738 IN HANDLE ProcessId,
3739 OUT PEPROCESS *Process
3740 );
3741
3742 NTKERNELAPI
3743 NTSTATUS
3744 NTAPI
3745 PsLookupProcessThreadByCid (
3746 IN PCLIENT_ID Cid,
3747 OUT PEPROCESS *Process OPTIONAL,
3748 OUT PETHREAD *Thread
3749 );
3750
3751 NTKERNELAPI
3752 NTSTATUS
3753 NTAPI
3754 PsLookupThreadByThreadId (
3755 IN HANDLE UniqueThreadId,
3756 OUT PETHREAD *Thread
3757 );
3758
3759 NTKERNELAPI
3760 PACCESS_TOKEN
3761 NTAPI
3762 PsReferenceImpersonationToken (
3763 IN PETHREAD Thread,
3764 OUT PBOOLEAN CopyOnUse,
3765 OUT PBOOLEAN EffectiveOnly,
3766 OUT PSECURITY_IMPERSONATION_LEVEL Level
3767 );
3768
3769 NTKERNELAPI
3770 HANDLE
3771 NTAPI
3772 PsReferencePrimaryToken (
3773 IN PEPROCESS Process
3774 );
3775
3776 NTKERNELAPI
3777 VOID
3778 NTAPI
3779 PsRestoreImpersonation(
3780 IN PETHREAD Thread,
3781 IN PSE_IMPERSONATION_STATE ImpersonationState
3782 );
3783
3784 NTKERNELAPI
3785 VOID
3786 NTAPI
3787 PsReturnPoolQuota (
3788 IN PEPROCESS Process,
3789 IN POOL_TYPE PoolType,
3790 IN ULONG Amount
3791 );
3792
3793 NTKERNELAPI
3794 VOID
3795 NTAPI
3796 PsRevertToSelf (
3797 VOID
3798 );
3799
3800 NTSYSAPI
3801 NTSTATUS
3802 NTAPI
3803 RtlAbsoluteToSelfRelativeSD (
3804 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
3805 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
3806 IN PULONG BufferLength
3807 );
3808
3809 NTSYSAPI
3810 PVOID
3811 NTAPI
3812 RtlAllocateHeap (
3813 IN HANDLE HeapHandle,
3814 IN ULONG Flags,
3815 IN ULONG Size
3816 );
3817
3818 NTSYSAPI
3819 USHORT
3820 NTAPI
3821 RtlCaptureStackBackTrace (
3822 IN ULONG FramesToSkip,
3823 IN ULONG FramesToCapture,
3824 OUT PVOID *BackTrace,
3825 OUT PULONG BackTraceHash OPTIONAL
3826 );
3827
3828 NTSYSAPI
3829 NTSTATUS
3830 NTAPI
3831 RtlCompressBuffer (
3832 IN USHORT CompressionFormatAndEngine,
3833 IN PUCHAR UncompressedBuffer,
3834 IN ULONG UncompressedBufferSize,
3835 OUT PUCHAR CompressedBuffer,
3836 IN ULONG CompressedBufferSize,
3837 IN ULONG UncompressedChunkSize,
3838 OUT PULONG FinalCompressedSize,
3839 IN PVOID WorkSpace
3840 );
3841
3842 NTSYSAPI
3843 NTSTATUS
3844 NTAPI
3845 RtlCompressChunks (
3846 IN PUCHAR UncompressedBuffer,
3847 IN ULONG UncompressedBufferSize,
3848 OUT PUCHAR CompressedBuffer,
3849 IN ULONG CompressedBufferSize,
3850 IN OUT PCOMPRESSED_DATA_INFO CompressedDataInfo,
3851 IN ULONG CompressedDataInfoLength,
3852 IN PVOID WorkSpace
3853 );
3854
3855 NTSYSAPI
3856 NTSTATUS
3857 NTAPI
3858 RtlConvertSidToUnicodeString (
3859 OUT PUNICODE_STRING DestinationString,
3860 IN PSID Sid,
3861 IN BOOLEAN AllocateDestinationString
3862 );
3863
3864 NTSYSAPI
3865 NTSTATUS
3866 NTAPI
3867 RtlCopySid (
3868 IN ULONG Length,
3869 IN PSID Destination,
3870 IN PSID Source
3871 );
3872
3873 NTSYSAPI
3874 BOOLEAN
3875 NTAPI
3876 RtlCreateUnicodeString(
3877 PUNICODE_STRING DestinationString,
3878 PCWSTR SourceString
3879 );
3880
3881 NTSYSAPI
3882 NTSTATUS
3883 NTAPI
3884 RtlDecompressBuffer (
3885 IN USHORT CompressionFormat,
3886 OUT PUCHAR UncompressedBuffer,
3887 IN ULONG UncompressedBufferSize,
3888 IN PUCHAR CompressedBuffer,
3889 IN ULONG CompressedBufferSize,
3890 OUT PULONG FinalUncompressedSize
3891 );
3892
3893 NTSYSAPI
3894 NTSTATUS
3895 NTAPI
3896 RtlDecompressChunks (
3897 OUT PUCHAR UncompressedBuffer,
3898 IN ULONG UncompressedBufferSize,
3899 IN PUCHAR CompressedBuffer,
3900 IN ULONG CompressedBufferSize,
3901 IN PUCHAR CompressedTail,
3902 IN ULONG CompressedTailSize,
3903 IN PCOMPRESSED_DATA_INFO CompressedDataInfo
3904 );
3905
3906 NTSYSAPI
3907 NTSTATUS