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