[NTOSKRNL] Fix CcIdleDelay initializer for old msvc versions (#339)
[reactos.git] / sdk / include / ndk / rtltypes.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 rtltypes.h
8
9 Abstract:
10
11 Type definitions for the Run-Time Library
12
13 Author:
14
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16
17 --*/
18
19 #ifndef _RTLTYPES_H
20 #define _RTLTYPES_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <mmtypes.h>
27 #include <ldrtypes.h>
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 //
34 // Maximum Atom Length
35 //
36 #define RTL_MAXIMUM_ATOM_LENGTH 255
37
38 //
39 // Process Parameters Flags
40 //
41 #define RTL_USER_PROCESS_PARAMETERS_NORMALIZED 0x01
42 #define RTL_USER_PROCESS_PARAMETERS_PROFILE_USER 0x02
43 #define RTL_USER_PROCESS_PARAMETERS_PROFILE_KERNEL 0x04
44 #define RTL_USER_PROCESS_PARAMETERS_PROFILE_SERVER 0x08
45 #define RTL_USER_PROCESS_PARAMETERS_UNKNOWN 0x10
46 #define RTL_USER_PROCESS_PARAMETERS_RESERVE_1MB 0x20
47 #define RTL_USER_PROCESS_PARAMETERS_RESERVE_16MB 0x40
48 #define RTL_USER_PROCESS_PARAMETERS_CASE_SENSITIVE 0x80
49 #define RTL_USER_PROCESS_PARAMETERS_DISABLE_HEAP_CHECKS 0x100
50 #define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_1 0x200
51 #define RTL_USER_PROCESS_PARAMETERS_PROCESS_OR_2 0x400
52 #define RTL_USER_PROCESS_PARAMETERS_PRIVATE_DLL_PATH 0x1000
53 #define RTL_USER_PROCESS_PARAMETERS_LOCAL_DLL_PATH 0x2000
54 #define RTL_USER_PROCESS_PARAMETERS_IMAGE_KEY_MISSING 0x4000
55 #define RTL_USER_PROCESS_PARAMETERS_NX 0x20000
56
57 #define RTL_MAX_DRIVE_LETTERS 32
58 #define RTL_DRIVE_LETTER_VALID (USHORT)0x0001
59
60 //
61 // End of Exception List
62 //
63 #define EXCEPTION_CHAIN_END ((PEXCEPTION_REGISTRATION_RECORD)-1)
64
65 //
66 // Thread Error Mode Flags
67 //
68 /* Also defined in psdk/winbase.h */
69 #define SEM_FAILCRITICALERRORS 0x0001
70 #define SEM_NOGPFAULTERRORBOX 0x0002
71 #define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
72 #define SEM_NOOPENFILEERRORBOX 0x8000
73
74 #define RTL_SEM_FAILCRITICALERRORS (SEM_FAILCRITICALERRORS << 4)
75 #define RTL_SEM_NOGPFAULTERRORBOX (SEM_NOGPFAULTERRORBOX << 4)
76 #define RTL_SEM_NOALIGNMENTFAULTEXCEPT (SEM_NOALIGNMENTFAULTEXCEPT << 4)
77
78 //
79 // Range and Range List Flags
80 //
81 #define RTL_RANGE_LIST_ADD_IF_CONFLICT 0x00000001
82 #define RTL_RANGE_LIST_ADD_SHARED 0x00000002
83
84 #define RTL_RANGE_SHARED 0x01
85 #define RTL_RANGE_CONFLICT 0x02
86
87 //
88 // Flags in RTL_ACTIVATION_CONTEXT_STACK_FRAME (from Checked NTDLL)
89 //
90 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_RELEASE_ON_DEACTIVATION 0x01
91 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_NO_DEACTIVATE 0x02
92 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_ON_FREE_LIST 0x04
93 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_HEAP_ALLOCATED 0x08
94 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_NOT_REALLY_ACTIVATED 0x10
95 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_ACTIVATED 0x20
96 #define RTL_ACTIVATION_CONTEXT_STACK_FRAME_FLAG_DEACTIVATED 0x40
97
98 //
99 // Activation Context Frame Flags (from Checked NTDLL)
100 //
101 #define RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER 0x01
102
103 //
104 // RtlActivateActivationContextEx Flags (from Checked NTDLL)
105 //
106 #define RTL_ACTIVATE_ACTIVATION_CONTEXT_EX_FLAG_RELEASE_ON_STACK_DEALLOCATION 0x01
107
108 //
109 // RtlDeactivateActivationContext Flags (based on Win32 flag and name of above)
110 //
111 #define RTL_DEACTIVATE_ACTIVATION_CONTEXT_FLAG_FORCE_EARLY_DEACTIVATION 0x01
112
113 //
114 // RtlQueryActivationContext Flags (based on Win32 flag and name of above)
115 //
116 #define RTL_QUERY_ACTIVATION_CONTEXT_FLAG_USE_ACTIVE_ACTIVATION_CONTEXT 0x01
117 #define RTL_QUERY_ACTIVATION_CONTEXT_FLAG_IS_HMODULE 0x02
118 #define RTL_QUERY_ACTIVATION_CONTEXT_FLAG_IS_ADDRESS 0x04
119 #define RTL_QUERY_ACTIVATION_CONTEXT_FLAG_NO_ADDREF 0x80000000
120
121 //
122 // Public Heap Flags
123 //
124 #if !defined(NTOS_MODE_USER) && !defined(_NTIFS_)
125 #define HEAP_NO_SERIALIZE 0x00000001
126 #define HEAP_GROWABLE 0x00000002
127 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
128 #define HEAP_ZERO_MEMORY 0x00000008
129 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
130 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
131 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
132 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
133 #define HEAP_CREATE_ALIGN_16 0x00010000
134 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
135 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
136 #endif
137
138 //
139 // User-Defined Heap Flags and Classes
140 //
141 #define HEAP_SETTABLE_USER_VALUE 0x00000100
142 #define HEAP_SETTABLE_USER_FLAG1 0x00000200
143 #define HEAP_SETTABLE_USER_FLAG2 0x00000400
144 #define HEAP_SETTABLE_USER_FLAG3 0x00000800
145 #define HEAP_SETTABLE_USER_FLAGS 0x00000E00
146 #define HEAP_CLASS_0 0x00000000
147 #define HEAP_CLASS_1 0x00001000
148 #define HEAP_CLASS_2 0x00002000
149 #define HEAP_CLASS_3 0x00003000
150 #define HEAP_CLASS_4 0x00004000
151 #define HEAP_CLASS_5 0x00005000
152 #define HEAP_CLASS_6 0x00006000
153 #define HEAP_CLASS_7 0x00007000
154 #define HEAP_CLASS_8 0x00008000
155 #define HEAP_CLASS_MASK 0x0000F000
156
157 //
158 // Internal HEAP Structure Flags
159 //
160 #define HEAP_FLAG_PAGE_ALLOCS 0x01000000
161 #define HEAP_PROTECTION_ENABLED 0x02000000
162 #define HEAP_BREAK_WHEN_OUT_OF_VM 0x04000000
163 #define HEAP_NO_ALIGNMENT 0x08000000
164 #define HEAP_CAPTURE_STACK_BACKTRACES 0x08000000
165 #define HEAP_SKIP_VALIDATION_CHECKS 0x10000000
166 #define HEAP_VALIDATE_ALL_ENABLED 0x20000000
167 #define HEAP_VALIDATE_PARAMETERS_ENABLED 0x40000000
168 #define HEAP_LOCK_USER_ALLOCATED 0x80000000
169
170 //
171 // Heap Validation Flags
172 //
173 #define HEAP_CREATE_VALID_MASK \
174 (HEAP_NO_SERIALIZE | \
175 HEAP_GROWABLE | \
176 HEAP_GENERATE_EXCEPTIONS | \
177 HEAP_ZERO_MEMORY | \
178 HEAP_REALLOC_IN_PLACE_ONLY | \
179 HEAP_TAIL_CHECKING_ENABLED | \
180 HEAP_FREE_CHECKING_ENABLED | \
181 HEAP_DISABLE_COALESCE_ON_FREE | \
182 HEAP_CLASS_MASK | \
183 HEAP_CREATE_ALIGN_16 | \
184 HEAP_CREATE_ENABLE_TRACING | \
185 HEAP_CREATE_ENABLE_EXECUTE)
186 #ifdef C_ASSERT
187 C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF);
188 #endif
189
190 //
191 // Native image architecture
192 //
193 #if defined(_M_IX86)
194 #define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_I386
195 #elif defined(_M_ARM)
196 #define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARM
197 #elif defined(_M_AMD64)
198 #define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_AMD64
199 #else
200 #error Define these please!
201 #endif
202
203 //
204 // Registry Keys
205 //
206 #define RTL_REGISTRY_ABSOLUTE 0
207 #define RTL_REGISTRY_SERVICES 1
208 #define RTL_REGISTRY_CONTROL 2
209 #define RTL_REGISTRY_WINDOWS_NT 3
210 #define RTL_REGISTRY_DEVICEMAP 4
211 #define RTL_REGISTRY_USER 5
212 #define RTL_REGISTRY_MAXIMUM 6
213 #define RTL_REGISTRY_HANDLE 0x40000000
214 #define RTL_REGISTRY_OPTIONAL 0x80000000
215 #define RTL_QUERY_REGISTRY_SUBKEY 0x00000001
216 #define RTL_QUERY_REGISTRY_TOPKEY 0x00000002
217 #define RTL_QUERY_REGISTRY_REQUIRED 0x00000004
218 #define RTL_QUERY_REGISTRY_NOVALUE 0x00000008
219 #define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010
220 #define RTL_QUERY_REGISTRY_DIRECT 0x00000020
221 #define RTL_QUERY_REGISTRY_DELETE 0x00000040
222
223 //
224 // Versioning
225 //
226 #define VER_MINORVERSION 0x0000001
227 #define VER_MAJORVERSION 0x0000002
228 #define VER_BUILDNUMBER 0x0000004
229 #define VER_PLATFORMID 0x0000008
230 #define VER_SERVICEPACKMINOR 0x0000010
231 #define VER_SERVICEPACKMAJOR 0x0000020
232 #define VER_SUITENAME 0x0000040
233 #define VER_PRODUCT_TYPE 0x0000080
234 #define VER_PLATFORM_WIN32s 0
235 #define VER_PLATFORM_WIN32_WINDOWS 1
236 #define VER_PLATFORM_WIN32_NT 2
237 #define VER_EQUAL 1
238 #define VER_GREATER 2
239 #define VER_GREATER_EQUAL 3
240 #define VER_LESS 4
241 #define VER_LESS_EQUAL 5
242 #define VER_AND 6
243 #define VER_OR 7
244 #define VER_CONDITION_MASK 7
245 #define VER_NUM_BITS_PER_CONDITION_MASK 3
246
247 //
248 // Timezone IDs
249 //
250 #define TIME_ZONE_ID_UNKNOWN 0
251 #define TIME_ZONE_ID_STANDARD 1
252 #define TIME_ZONE_ID_DAYLIGHT 2
253
254 //
255 // Maximum Path Length
256 //
257 #define MAX_PATH 260
258
259 //
260 // RTL Lock Type (Critical Section or Resource)
261 //
262 #define RTL_CRITSECT_TYPE 0
263 #define RTL_RESOURCE_TYPE 1
264
265 //
266 // RtlAcquirePrivileges Flags
267 //
268 #define RTL_ACQUIRE_PRIVILEGE_IMPERSONATE 1
269 #define RTL_ACQUIRE_PRIVILEGE_PROCESS 2
270
271 #ifdef NTOS_MODE_USER
272
273 //
274 // String Hash Algorithms
275 //
276 #define HASH_STRING_ALGORITHM_DEFAULT 0
277 #define HASH_STRING_ALGORITHM_X65599 1
278 #define HASH_STRING_ALGORITHM_INVALID 0xffffffff
279
280 //
281 // RtlDuplicateString Flags
282 //
283 #define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE 1
284 #define RTL_DUPLICATE_UNICODE_STRING_ALLOCATE_NULL_STRING 2
285
286 //
287 // RtlFindCharInUnicodeString Flags
288 //
289 #define RTL_FIND_CHAR_IN_UNICODE_STRING_START_AT_END 1
290 #define RTL_FIND_CHAR_IN_UNICODE_STRING_COMPLEMENT_CHAR_SET 2
291 #define RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE 4
292
293 //
294 // RtlImageNtHeaderEx Flags
295 //
296 #define RTL_IMAGE_NT_HEADER_EX_FLAG_NO_RANGE_CHECK 0x00000001
297
298 //
299 // RtlDosApplyFileIsolationRedirection_Ustr Flags
300 //
301 #define RTL_DOS_APPLY_FILE_REDIRECTION_USTR_FLAG_RESPECT_DOT_LOCAL 0x01
302
303 //
304 // Codepages
305 //
306 #define NLS_MB_CODE_PAGE_TAG NlsMbCodePageTag
307 #define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag
308 #define NLS_OEM_LEAD_BYTE_INFO NlsOemLeadByteInfo
309
310 //
311 // Activation Contexts
312 //
313 #define INVALID_ACTIVATION_CONTEXT (PVOID)0xFFFFFFFF
314
315 //
316 // C++ CONST casting
317 //
318 #if defined(__cplusplus)
319 #define RTL_CONST_CAST(type) const_cast<type>
320 #else
321 #define RTL_CONST_CAST(type) (type)
322 #endif
323
324 //
325 // Constant String Macro
326 //
327 #define RTL_CONSTANT_STRING(__SOURCE_STRING__) \
328 { \
329 sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \
330 sizeof(__SOURCE_STRING__), \
331 (__SOURCE_STRING__) \
332 }
333
334 //
335 // Constant Object Attributes Macro
336 //
337 #define RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a) \
338 { \
339 sizeof(OBJECT_ATTRIBUTES), \
340 NULL, \
341 RTL_CONST_CAST(PUNICODE_STRING)(n), \
342 a, \
343 NULL, \
344 NULL \
345 }
346
347 #define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \
348 RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a)
349
350 #else /* NTOS_MODE_USER */
351 //
352 // Message Resource Flag
353 //
354 #define MESSAGE_RESOURCE_UNICODE 0x0001
355
356 #endif /* !NTOS_MODE_USER */
357 #define MAXIMUM_LEADBYTES 12
358
359 //
360 // RTL Debug Queries
361 //
362 #define RTL_DEBUG_QUERY_MODULES 0x01
363 #define RTL_DEBUG_QUERY_BACKTRACES 0x02
364 #define RTL_DEBUG_QUERY_HEAPS 0x04
365 #define RTL_DEBUG_QUERY_HEAP_TAGS 0x08
366 #define RTL_DEBUG_QUERY_HEAP_BLOCKS 0x10
367 #define RTL_DEBUG_QUERY_LOCKS 0x20
368
369 //
370 // RTL Handle Flags
371 //
372 #define RTL_HANDLE_VALID 0x1
373
374 //
375 // RTL Atom Flags
376 //
377 #define RTL_ATOM_IS_PINNED 0x1
378
379 //
380 // Critical section lock bits
381 //
382 #define CS_LOCK_BIT 0x1
383 #define CS_LOCK_BIT_V 0x0
384 #define CS_LOCK_WAITER_WOKEN 0x2
385 #define CS_LOCK_WAITER_INC 0x4
386
387 //
388 // Codepage Tags
389 //
390 #ifdef NTOS_MODE_USER
391 extern BOOLEAN NTSYSAPI NLS_MB_CODE_PAGE_TAG;
392 extern BOOLEAN NTSYSAPI NLS_MB_OEM_CODE_PAGE_TAG;
393
394 //
395 // Constant String Macro
396 //
397 #define RTL_CONSTANT_STRING(__SOURCE_STRING__) \
398 { \
399 sizeof(__SOURCE_STRING__) - sizeof((__SOURCE_STRING__)[0]), \
400 sizeof(__SOURCE_STRING__), \
401 (__SOURCE_STRING__) \
402 }
403
404 #endif /* NTOS_MODE_USER */
405
406 //
407 // Constant Large Integer Macro
408 //
409 #ifdef NONAMELESSUNION
410 C_ASSERT(FIELD_OFFSET(LARGE_INTEGER, u.LowPart) == 0);
411 #else
412 C_ASSERT(FIELD_OFFSET(LARGE_INTEGER, LowPart) == 0);
413 #endif
414 #define RTL_CONSTANT_LARGE_INTEGER(quad_part) { { (quad_part), (quad_part)>>32 } }
415 #define RTL_MAKE_LARGE_INTEGER(low_part, high_part) { { (low_part), (high_part) } }
416
417
418 #ifdef NTOS_MODE_USER
419
420 //
421 // Boot Status Data Field Types
422 //
423 typedef enum _RTL_BSD_ITEM_TYPE
424 {
425 RtlBsdItemVersionNumber,
426 RtlBsdItemProductType,
427 RtlBsdItemAabEnabled,
428 RtlBsdItemAabTimeout,
429 RtlBsdItemBootGood,
430 RtlBsdItemBootShutdown,
431 RtlBsdItemMax
432 } RTL_BSD_ITEM_TYPE, *PRTL_BSD_ITEM_TYPE;
433
434 //
435 // Table and Compare result types
436 //
437 typedef enum _TABLE_SEARCH_RESULT
438 {
439 TableEmptyTree,
440 TableFoundNode,
441 TableInsertAsLeft,
442 TableInsertAsRight
443 } TABLE_SEARCH_RESULT;
444
445 typedef enum _RTL_GENERIC_COMPARE_RESULTS
446 {
447 GenericLessThan,
448 GenericGreaterThan,
449 GenericEqual
450 } RTL_GENERIC_COMPARE_RESULTS;
451
452 #endif /* NTOS_MODE_USER */
453
454 //
455 // RTL Path Types
456 //
457 typedef enum _RTL_PATH_TYPE
458 {
459 RtlPathTypeUnknown,
460 RtlPathTypeUncAbsolute,
461 RtlPathTypeDriveAbsolute,
462 RtlPathTypeDriveRelative,
463 RtlPathTypeRooted,
464 RtlPathTypeRelative,
465 RtlPathTypeLocalDevice,
466 RtlPathTypeRootLocalDevice,
467 } RTL_PATH_TYPE;
468
469 #ifndef NTOS_MODE_USER
470
471 //
472 // Heap Information Class
473 //
474 typedef enum _HEAP_INFORMATION_CLASS
475 {
476 HeapCompatibilityInformation,
477 HeapEnableTerminationOnCorruption
478 } HEAP_INFORMATION_CLASS;
479
480 //
481 // Callback function for RTL Timers or Registered Waits
482 //
483 typedef VOID
484 (NTAPI *WAITORTIMERCALLBACKFUNC)(
485 PVOID pvContext,
486 BOOLEAN fTimerOrWaitFired
487 );
488
489 //
490 // Handler during Vectored RTL Exceptions
491 //
492 typedef LONG
493 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
494 PEXCEPTION_POINTERS ExceptionPointers
495 );
496
497 //
498 // Worker Thread Callback for Rtl
499 //
500 typedef VOID
501 (NTAPI *WORKERCALLBACKFUNC)(
502 _In_ PVOID Context
503 );
504
505 #else /* !NTOS_MODE_USER */
506
507 //
508 // RTL Library Allocation/Free Routines
509 //
510 typedef PVOID
511 (NTAPI *PRTL_ALLOCATE_STRING_ROUTINE)(
512 SIZE_T NumberOfBytes
513 );
514
515 typedef PVOID
516 (NTAPI *PRTL_REALLOCATE_STRING_ROUTINE)(
517 SIZE_T NumberOfBytes,
518 PVOID Buffer
519 );
520
521 typedef
522 VOID
523 (NTAPI *PRTL_FREE_STRING_ROUTINE)(
524 PVOID Buffer
525 );
526
527 extern const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine;
528 extern const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine;
529 extern const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine;
530
531 #endif /* NTOS_MODE_USER */
532
533 //
534 // Unhandled Exception Filter
535 //
536 typedef ULONG
537 (NTAPI *RTLP_UNHANDLED_EXCEPTION_FILTER)(
538 _In_ struct _EXCEPTION_POINTERS *ExceptionInfo
539 );
540 typedef RTLP_UNHANDLED_EXCEPTION_FILTER *PRTLP_UNHANDLED_EXCEPTION_FILTER;
541
542 //
543 // Callback for RTL Heap Enumeration
544 //
545 typedef NTSTATUS
546 (NTAPI *PHEAP_ENUMERATION_ROUTINE)(
547 _In_ PVOID HeapHandle,
548 _In_ PVOID UserParam
549 );
550
551 //
552 // Thread and Process Start Routines for RtlCreateUserThread/Process
553 //
554 typedef ULONG (NTAPI *PTHREAD_START_ROUTINE)(
555 PVOID Parameter
556 );
557
558 typedef VOID
559 (NTAPI *PRTL_BASE_PROCESS_START_ROUTINE)(
560 PTHREAD_START_ROUTINE StartAddress,
561 PVOID Parameter
562 );
563
564 //
565 // Worker Start/Exit Function
566 //
567 typedef NTSTATUS
568 (NTAPI *PRTL_START_POOL_THREAD)(
569 _In_ PTHREAD_START_ROUTINE Function,
570 _In_ PVOID Parameter,
571 _Out_ PHANDLE ThreadHandle
572 );
573
574 typedef NTSTATUS
575 (NTAPI *PRTL_EXIT_POOL_THREAD)(
576 _In_ NTSTATUS ExitStatus
577 );
578
579 //
580 // Declare empty structure definitions so that they may be referenced by
581 // routines before they are defined
582 //
583 struct _RTL_AVL_TABLE;
584 struct _RTL_GENERIC_TABLE;
585 struct _RTL_RANGE;
586
587 //
588 // Routines and callbacks for the RTL AVL/Generic Table package
589 //
590 #ifdef NTOS_MODE_USER
591 typedef NTSTATUS
592 (NTAPI RTL_AVL_MATCH_FUNCTION)(
593 struct _RTL_AVL_TABLE *Table,
594 PVOID UserData,
595 PVOID MatchData
596 );
597 typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION;
598
599 typedef RTL_GENERIC_COMPARE_RESULTS
600 (NTAPI RTL_AVL_COMPARE_ROUTINE) (
601 struct _RTL_AVL_TABLE *Table,
602 PVOID FirstStruct,
603 PVOID SecondStruct
604 );
605 typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE;
606
607 typedef RTL_GENERIC_COMPARE_RESULTS
608 (NTAPI RTL_GENERIC_COMPARE_ROUTINE) (
609 struct _RTL_GENERIC_TABLE *Table,
610 PVOID FirstStruct,
611 PVOID SecondStruct
612 );
613 typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE;
614
615 typedef PVOID
616 (NTAPI RTL_GENERIC_ALLOCATE_ROUTINE) (
617 struct _RTL_GENERIC_TABLE *Table,
618 CLONG ByteSize
619 );
620 typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE;
621
622 typedef PVOID
623 (NTAPI RTL_AVL_ALLOCATE_ROUTINE) (
624 struct _RTL_AVL_TABLE *Table,
625 CLONG ByteSize
626 );
627 typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE;
628
629 typedef VOID
630 (NTAPI RTL_GENERIC_FREE_ROUTINE) (
631 struct _RTL_GENERIC_TABLE *Table,
632 PVOID Buffer
633 );
634 typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE;
635
636 typedef VOID
637 (NTAPI RTL_AVL_FREE_ROUTINE) (
638 struct _RTL_AVL_TABLE *Table,
639 PVOID Buffer
640 );
641 typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE;
642
643 #ifdef RTL_USE_AVL_TABLES
644 #undef RTL_GENERIC_COMPARE_ROUTINE
645 #undef PRTL_GENERIC_COMPARE_ROUTINE
646 #undef RTL_GENERIC_ALLOCATE_ROUTINE
647 #undef PRTL_GENERIC_ALLOCATE_ROUTINE
648 #undef RTL_GENERIC_FREE_ROUTINE
649 #undef PRTL_GENERIC_FREE_ROUTINE
650
651 #define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE
652 #define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE
653 #define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE
654 #define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE
655 #define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE
656 #define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE
657 #endif /* RTL_USE_AVL_TABLES */
658
659 #endif /* NTOS_MODE_USER */
660
661 //
662 // RTL Query Registry callback
663 //
664 #ifdef NTOS_MODE_USER
665 typedef NTSTATUS
666 (NTAPI *PRTL_QUERY_REGISTRY_ROUTINE)(
667 _In_ PWSTR ValueName,
668 _In_ ULONG ValueType,
669 _In_ PVOID ValueData,
670 _In_ ULONG ValueLength,
671 _In_ PVOID Context,
672 _In_ PVOID EntryContext
673 );
674 #endif
675
676 //
677 // RTL Secure Memory callbacks
678 //
679 #ifdef NTOS_MODE_USER
680 typedef NTSTATUS
681 (NTAPI *PRTL_SECURE_MEMORY_CACHE_CALLBACK)(
682 _In_ PVOID Address,
683 _In_ SIZE_T Length
684 );
685 #endif
686
687 //
688 // RTL Range List callbacks
689 //
690 #ifdef NTOS_MODE_USER
691 typedef BOOLEAN
692 (NTAPI *PRTL_CONFLICT_RANGE_CALLBACK)(
693 PVOID Context,
694 struct _RTL_RANGE *Range
695 );
696
697 //
698 // Custom Heap Commit Routine for RtlCreateHeap
699 //
700 typedef NTSTATUS
701 (NTAPI * PRTL_HEAP_COMMIT_ROUTINE)(
702 _In_ PVOID Base,
703 _Inout_ PVOID *CommitAddress,
704 _Inout_ PSIZE_T CommitSize
705 );
706
707 //
708 // Parameters for RtlCreateHeap
709 //
710 typedef struct _RTL_HEAP_PARAMETERS
711 {
712 ULONG Length;
713 SIZE_T SegmentReserve;
714 SIZE_T SegmentCommit;
715 SIZE_T DeCommitFreeBlockThreshold;
716 SIZE_T DeCommitTotalFreeThreshold;
717 SIZE_T MaximumAllocationSize;
718 SIZE_T VirtualMemoryThreshold;
719 SIZE_T InitialCommit;
720 SIZE_T InitialReserve;
721 PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
722 SIZE_T Reserved[2];
723 } RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
724
725 //
726 // RTL Bitmap structures
727 //
728 typedef struct _RTL_BITMAP
729 {
730 ULONG SizeOfBitMap;
731 PULONG Buffer;
732 } RTL_BITMAP, *PRTL_BITMAP;
733
734 typedef struct _RTL_BITMAP_RUN
735 {
736 ULONG StartingIndex;
737 ULONG NumberOfBits;
738 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
739
740 //
741 // RtlGenerateXxxName context
742 //
743 typedef struct _GENERATE_NAME_CONTEXT
744 {
745 USHORT Checksum;
746 BOOLEAN CheckSumInserted;
747 UCHAR NameLength;
748 WCHAR NameBuffer[8];
749 ULONG ExtensionLength;
750 WCHAR ExtensionBuffer[4];
751 ULONG LastIndexValue;
752 } GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
753
754 //
755 // RTL Splay and Balanced Links structures
756 //
757 typedef struct _RTL_SPLAY_LINKS
758 {
759 struct _RTL_SPLAY_LINKS *Parent;
760 struct _RTL_SPLAY_LINKS *LeftChild;
761 struct _RTL_SPLAY_LINKS *RightChild;
762 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
763
764 typedef struct _RTL_BALANCED_LINKS
765 {
766 struct _RTL_BALANCED_LINKS *Parent;
767 struct _RTL_BALANCED_LINKS *LeftChild;
768 struct _RTL_BALANCED_LINKS *RightChild;
769 CHAR Balance;
770 UCHAR Reserved[3];
771 } RTL_BALANCED_LINKS, *PRTL_BALANCED_LINKS;
772
773 //
774 // RTL Avl/Generic Tables
775 //
776 #ifndef RTL_USE_AVL_TABLES
777 typedef struct _RTL_GENERIC_TABLE
778 {
779 PRTL_SPLAY_LINKS TableRoot;
780 LIST_ENTRY InsertOrderList;
781 PLIST_ENTRY OrderedPointer;
782 ULONG WhichOrderedElement;
783 ULONG NumberGenericTableElements;
784 PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
785 PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
786 PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
787 PVOID TableContext;
788 } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE;
789 #endif /* !RTL_USE_AVL_TABLES */
790
791 typedef struct _RTL_AVL_TABLE
792 {
793 RTL_BALANCED_LINKS BalancedRoot;
794 PVOID OrderedPointer;
795 ULONG WhichOrderedElement;
796 ULONG NumberGenericTableElements;
797 ULONG DepthOfTree;
798 PRTL_BALANCED_LINKS RestartKey;
799 ULONG DeleteCount;
800 PRTL_AVL_COMPARE_ROUTINE CompareRoutine;
801 PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine;
802 PRTL_AVL_FREE_ROUTINE FreeRoutine;
803 PVOID TableContext;
804 } RTL_AVL_TABLE, *PRTL_AVL_TABLE;
805
806 #ifdef RTL_USE_AVL_TABLES
807 #undef RTL_GENERIC_TABLE
808 #undef PRTL_GENERIC_TABLE
809
810 #define RTL_GENERIC_TABLE RTL_AVL_TABLE
811 #define PRTL_GENERIC_TABLE PRTL_AVL_TABLE
812 #endif /* RTL_USE_AVL_TABLES */
813
814 //
815 // RTL Compression Buffer
816 //
817 typedef struct _COMPRESSED_DATA_INFO {
818 USHORT CompressionFormatAndEngine;
819 UCHAR CompressionUnitShift;
820 UCHAR ChunkShift;
821 UCHAR ClusterShift;
822 UCHAR Reserved;
823 USHORT NumberOfChunks;
824 ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
825 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
826
827 //
828 // RtlQueryRegistry Data
829 //
830 typedef struct _RTL_QUERY_REGISTRY_TABLE
831 {
832 PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
833 ULONG Flags;
834 PCWSTR Name;
835 PVOID EntryContext;
836 ULONG DefaultType;
837 PVOID DefaultData;
838 ULONG DefaultLength;
839 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
840
841 //
842 // RTL Unicode Table Structures
843 //
844 typedef struct _UNICODE_PREFIX_TABLE_ENTRY
845 {
846 CSHORT NodeTypeCode;
847 CSHORT NameLength;
848 struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
849 struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
850 RTL_SPLAY_LINKS Links;
851 PUNICODE_STRING Prefix;
852 } UNICODE_PREFIX_TABLE_ENTRY, *PUNICODE_PREFIX_TABLE_ENTRY;
853
854 typedef struct _UNICODE_PREFIX_TABLE
855 {
856 CSHORT NodeTypeCode;
857 CSHORT NameLength;
858 PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
859 PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
860 } UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
861
862 //
863 // Pfx* routines' table structures
864 //
865 typedef struct _PREFIX_TABLE_ENTRY
866 {
867 CSHORT NodeTypeCode;
868 CSHORT NameLength;
869 struct _PREFIX_TABLE_ENTRY *NextPrefixTree;
870 RTL_SPLAY_LINKS Links;
871 PSTRING Prefix;
872 } PREFIX_TABLE_ENTRY, *PPREFIX_TABLE_ENTRY;
873
874 typedef struct _PREFIX_TABLE
875 {
876 CSHORT NodeTypeCode;
877 CSHORT NameLength;
878 PPREFIX_TABLE_ENTRY NextPrefixTree;
879 } PREFIX_TABLE, *PPREFIX_TABLE;
880
881 //
882 // Time Structure for RTL Time calls
883 //
884 typedef struct _TIME_FIELDS
885 {
886 CSHORT Year;
887 CSHORT Month;
888 CSHORT Day;
889 CSHORT Hour;
890 CSHORT Minute;
891 CSHORT Second;
892 CSHORT Milliseconds;
893 CSHORT Weekday;
894 } TIME_FIELDS, *PTIME_FIELDS;
895
896 //
897 // Activation Context Frame
898 //
899 typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME
900 {
901 struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME *Previous;
902 PACTIVATION_CONTEXT ActivationContext;
903 ULONG Flags;
904 } RTL_ACTIVATION_CONTEXT_STACK_FRAME, *PRTL_ACTIVATION_CONTEXT_STACK_FRAME;
905
906 typedef struct _RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC
907 {
908 SIZE_T Size;
909 ULONG Format;
910 RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame;
911 } RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC, *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC;
912
913 typedef struct _RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED
914 {
915 SIZE_T Size;
916 ULONG Format;
917 RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame;
918 PVOID Extra1;
919 PVOID Extra2;
920 PVOID Extra3;
921 PVOID Extra4;
922 } RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED, *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED;
923
924 typedef RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME;
925 typedef PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME;
926
927 typedef struct _RTL_HEAP_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME
928 {
929 RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame;
930 ULONG_PTR Cookie;
931 PVOID ActivationStackBackTrace[8];
932 } RTL_HEAP_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME, *PRTL_HEAP_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME;
933
934 typedef struct _ACTIVATION_CONTEXT_DATA
935 {
936 ULONG Magic;
937 ULONG HeaderSize;
938 ULONG FormatVersion;
939 ULONG TotalSize;
940 ULONG DefaultTocOffset;
941 ULONG ExtendedTocOffset;
942 ULONG AssemblyRosterOffset;
943 ULONG Flags;
944 } ACTIVATION_CONTEXT_DATA, *PACTIVATION_CONTEXT_DATA;
945
946 typedef struct _ACTIVATION_CONTEXT_STACK_FRAMELIST
947 {
948 ULONG Magic;
949 ULONG FramesInUse;
950 LIST_ENTRY Links;
951 ULONG Flags;
952 ULONG NotFramesInUse;
953 RTL_HEAP_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME Frames[32];
954 } ACTIVATION_CONTEXT_STACK_FRAMELIST, *PACTIVATION_CONTEXT_STACK_FRAMELIST;
955
956 #endif /* NTOS_MODE_USER */
957
958 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
959 typedef struct _ACTIVATION_CONTEXT_STACK
960 {
961 struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME *ActiveFrame;
962 LIST_ENTRY FrameListCache;
963 ULONG Flags;
964 ULONG NextCookieSequenceNumber;
965 ULONG StackId;
966 } ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
967 #else
968 typedef struct _ACTIVATION_CONTEXT_STACK
969 {
970 ULONG Flags;
971 ULONG NextCookieSequenceNumber;
972 struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME *ActiveFrame;
973 LIST_ENTRY FrameListCache;
974 } ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
975 #endif
976
977 //
978 // ACE Structure
979 //
980 typedef struct _ACE
981 {
982 ACE_HEADER Header;
983 ACCESS_MASK AccessMask;
984 } ACE, *PACE;
985
986 //
987 // Information Structures for RTL Debug Functions
988 //
989 typedef struct _RTL_PROCESS_MODULE_INFORMATION
990 {
991 ULONG Section;
992 PVOID MappedBase;
993 PVOID ImageBase;
994 ULONG ImageSize;
995 ULONG Flags;
996 USHORT LoadOrderIndex;
997 USHORT InitOrderIndex;
998 USHORT LoadCount;
999 USHORT OffsetToFileName;
1000 CHAR FullPathName[256];
1001 } RTL_PROCESS_MODULE_INFORMATION, *PRTL_PROCESS_MODULE_INFORMATION;
1002
1003 typedef struct _RTL_PROCESS_MODULES
1004 {
1005 ULONG NumberOfModules;
1006 RTL_PROCESS_MODULE_INFORMATION Modules[1];
1007 } RTL_PROCESS_MODULES, *PRTL_PROCESS_MODULES;
1008
1009 typedef struct _RTL_PROCESS_MODULE_INFORMATION_EX
1010 {
1011 ULONG NextOffset;
1012 RTL_PROCESS_MODULE_INFORMATION BaseInfo;
1013 ULONG ImageCheckSum;
1014 ULONG TimeDateStamp;
1015 PVOID DefaultBase;
1016 } RTL_PROCESS_MODULE_INFORMATION_EX, *PRTL_PROCESS_MODULE_INFORMATION_EX;
1017
1018 typedef struct _RTL_HEAP_TAG_INFO
1019 {
1020 ULONG NumberOfAllocations;
1021 ULONG NumberOfFrees;
1022 SIZE_T BytesAllocated;
1023 } RTL_HEAP_TAG_INFO, *PRTL_HEAP_TAG_INFO;
1024
1025 typedef struct _RTL_HEAP_USAGE_ENTRY
1026 {
1027 struct _RTL_HEAP_USAGE_ENTRY *Next;
1028 PVOID Address;
1029 SIZE_T Size;
1030 USHORT AllocatorBackTraceIndex;
1031 USHORT TagIndex;
1032 } RTL_HEAP_USAGE_ENTRY, *PRTL_HEAP_USAGE_ENTRY;
1033
1034 typedef struct _RTL_HEAP_USAGE
1035 {
1036 ULONG Length;
1037 SIZE_T BytesAllocated;
1038 SIZE_T BytesCommitted;
1039 SIZE_T BytesReserved;
1040 SIZE_T BytesReservedMaximum;
1041 PRTL_HEAP_USAGE_ENTRY Entries;
1042 PRTL_HEAP_USAGE_ENTRY AddedEntries;
1043 PRTL_HEAP_USAGE_ENTRY RemovedEntries;
1044 ULONG_PTR Reserved[8];
1045 } RTL_HEAP_USAGE, *PRTL_HEAP_USAGE;
1046
1047 typedef struct _RTL_HEAP_WALK_ENTRY
1048 {
1049 PVOID DataAddress;
1050 SIZE_T DataSize;
1051 UCHAR OverheadBytes;
1052 UCHAR SegmentIndex;
1053 USHORT Flags;
1054 union
1055 {
1056 struct
1057 {
1058 SIZE_T Settable;
1059 USHORT TagIndex;
1060 USHORT AllocatorBackTraceIndex;
1061 ULONG Reserved[2];
1062 } Block;
1063 struct
1064 {
1065 ULONG_PTR CommittedSize;
1066 ULONG_PTR UnCommittedSize;
1067 PVOID FirstEntry;
1068 PVOID LastEntry;
1069 } Segment;
1070 };
1071 } RTL_HEAP_WALK_ENTRY, *PRTL_HEAP_WALK_ENTRY;
1072
1073 typedef struct _RTL_HEAP_ENTRY
1074 {
1075 SIZE_T Size;
1076 USHORT Flags;
1077 USHORT AllocatorBackTraceIndex;
1078 union
1079 {
1080 struct
1081 {
1082 SIZE_T Settable;
1083 ULONG Tag;
1084 } s1;
1085 struct
1086 {
1087 SIZE_T CommittedSize;
1088 PVOID FirstBlock;
1089 } s2;
1090 } u;
1091 } RTL_HEAP_ENTRY, *PRTL_HEAP_ENTRY;
1092
1093 typedef struct _RTL_HEAP_TAG
1094 {
1095 ULONG NumberOfAllocations;
1096 ULONG NumberOfFrees;
1097 SIZE_T BytesAllocated;
1098 USHORT TagIndex;
1099 USHORT CreatorBackTraceIndex;
1100 WCHAR TagName[24];
1101 } RTL_HEAP_TAG, *PRTL_HEAP_TAG;
1102
1103 typedef struct _RTL_HEAP_INFORMATION
1104 {
1105 PVOID BaseAddress;
1106 ULONG Flags;
1107 USHORT EntryOverhead;
1108 USHORT CreatorBackTraceIndex;
1109 SIZE_T BytesAllocated;
1110 SIZE_T BytesCommitted;
1111 ULONG NumberOfTags;
1112 ULONG NumberOfEntries;
1113 ULONG NumberOfPseudoTags;
1114 ULONG PseudoTagGranularity;
1115 ULONG Reserved[5];
1116 PRTL_HEAP_TAG Tags;
1117 PRTL_HEAP_ENTRY Entries;
1118 } RTL_HEAP_INFORMATION, *PRTL_HEAP_INFORMATION;
1119
1120 typedef struct _RTL_PROCESS_HEAPS
1121 {
1122 ULONG NumberOfHeaps;
1123 RTL_HEAP_INFORMATION Heaps[1];
1124 } RTL_PROCESS_HEAPS, *PRTL_PROCESS_HEAPS;
1125
1126 typedef struct _RTL_PROCESS_LOCK_INFORMATION
1127 {
1128 PVOID Address;
1129 USHORT Type;
1130 USHORT CreatorBackTraceIndex;
1131 ULONG OwnerThreadId;
1132 ULONG ActiveCount;
1133 ULONG ContentionCount;
1134 ULONG EntryCount;
1135 ULONG RecursionCount;
1136 ULONG NumberOfSharedWaiters;
1137 ULONG NumberOfExclusiveWaiters;
1138 } RTL_PROCESS_LOCK_INFORMATION, *PRTL_PROCESS_LOCK_INFORMATION;
1139
1140 typedef struct _RTL_PROCESS_LOCKS
1141 {
1142 ULONG NumberOfLocks;
1143 RTL_PROCESS_LOCK_INFORMATION Locks[1];
1144 } RTL_PROCESS_LOCKS, *PRTL_PROCESS_LOCKS;
1145
1146 typedef struct _RTL_PROCESS_BACKTRACE_INFORMATION
1147 {
1148 PVOID SymbolicBackTrace;
1149 ULONG TraceCount;
1150 USHORT Index;
1151 USHORT Depth;
1152 PVOID BackTrace[16];
1153 } RTL_PROCESS_BACKTRACE_INFORMATION, *PRTL_PROCESS_BACKTRACE_INFORMATION;
1154
1155 typedef struct _RTL_PROCESS_BACKTRACES
1156 {
1157 ULONG CommittedMemory;
1158 ULONG ReservedMemory;
1159 ULONG NumberOfBackTraceLookups;
1160 ULONG NumberOfBackTraces;
1161 RTL_PROCESS_BACKTRACE_INFORMATION BackTraces[1];
1162 } RTL_PROCESS_BACKTRACES, *PRTL_PROCESS_BACKTRACES;
1163
1164 typedef struct _RTL_PROCESS_VERIFIER_OPTIONS
1165 {
1166 ULONG SizeStruct;
1167 ULONG Option;
1168 UCHAR OptionData[1];
1169 //
1170 // Option array continues below
1171 //
1172 } RTL_PROCESS_VERIFIER_OPTIONS, *PRTL_PROCESS_VERIFIER_OPTIONS;
1173
1174 typedef struct _RTL_DEBUG_INFORMATION
1175 {
1176 HANDLE SectionHandleClient;
1177 PVOID ViewBaseClient;
1178 PVOID ViewBaseTarget;
1179 ULONG ViewBaseDelta;
1180 HANDLE EventPairClient;
1181 PVOID EventPairTarget;
1182 HANDLE TargetProcessId;
1183 HANDLE TargetThreadHandle;
1184 ULONG Flags;
1185 ULONG OffsetFree;
1186 ULONG CommitSize;
1187 ULONG ViewSize;
1188 union
1189 {
1190 PRTL_PROCESS_MODULES Modules;
1191 PRTL_PROCESS_MODULE_INFORMATION_EX ModulesEx;
1192 };
1193 PRTL_PROCESS_BACKTRACES BackTraces;
1194 PRTL_PROCESS_HEAPS Heaps;
1195 PRTL_PROCESS_LOCKS Locks;
1196 HANDLE SpecificHeap;
1197 HANDLE TargetProcessHandle;
1198 RTL_PROCESS_VERIFIER_OPTIONS VerifierOptions;
1199 HANDLE ProcessHeap;
1200 HANDLE CriticalSectionHandle;
1201 HANDLE CriticalSectionOwnerThread;
1202 PVOID Reserved[4];
1203 } RTL_DEBUG_INFORMATION, *PRTL_DEBUG_INFORMATION;
1204
1205 //
1206 // Unload Event Trace Structure for RtlGetUnloadEventTrace
1207 //
1208 typedef struct _RTL_UNLOAD_EVENT_TRACE
1209 {
1210 PVOID BaseAddress;
1211 ULONG SizeOfImage;
1212 ULONG Sequence;
1213 ULONG TimeDateStamp;
1214 ULONG CheckSum;
1215 WCHAR ImageName[32];
1216 } RTL_UNLOAD_EVENT_TRACE, *PRTL_UNLOAD_EVENT_TRACE;
1217
1218 //
1219 // RTL Handle Structures
1220 //
1221 typedef struct _RTL_HANDLE_TABLE_ENTRY
1222 {
1223 union
1224 {
1225 ULONG Flags;
1226 struct _RTL_HANDLE_TABLE_ENTRY *NextFree;
1227 };
1228 } RTL_HANDLE_TABLE_ENTRY, *PRTL_HANDLE_TABLE_ENTRY;
1229
1230 typedef struct _RTL_HANDLE_TABLE
1231 {
1232 ULONG MaximumNumberOfHandles;
1233 ULONG SizeOfHandleTableEntry;
1234 ULONG Reserved[2];
1235 PRTL_HANDLE_TABLE_ENTRY FreeHandles;
1236 PRTL_HANDLE_TABLE_ENTRY CommittedHandles;
1237 PRTL_HANDLE_TABLE_ENTRY UnCommittedHandles;
1238 PRTL_HANDLE_TABLE_ENTRY MaxReservedHandles;
1239 } RTL_HANDLE_TABLE, *PRTL_HANDLE_TABLE;
1240
1241 #ifdef NTOS_MODE_USER
1242 //
1243 // Exception Record
1244 //
1245 typedef struct _EXCEPTION_REGISTRATION_RECORD
1246 {
1247 struct _EXCEPTION_REGISTRATION_RECORD *Next;
1248 PEXCEPTION_ROUTINE Handler;
1249 } EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
1250 #endif /* NTOS_MODE_USER */
1251
1252 //
1253 // Current Directory Structures
1254 //
1255 typedef struct _CURDIR
1256 {
1257 UNICODE_STRING DosPath;
1258 HANDLE Handle;
1259 } CURDIR, *PCURDIR;
1260
1261 typedef struct _RTLP_CURDIR_REF
1262 {
1263 LONG RefCount;
1264 HANDLE Handle;
1265 } RTLP_CURDIR_REF, *PRTLP_CURDIR_REF;
1266
1267 typedef struct _RTL_RELATIVE_NAME_U
1268 {
1269 UNICODE_STRING RelativeName;
1270 HANDLE ContainingDirectory;
1271 PRTLP_CURDIR_REF CurDirRef;
1272 } RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U;
1273
1274 typedef struct _RTL_DRIVE_LETTER_CURDIR
1275 {
1276 USHORT Flags;
1277 USHORT Length;
1278 ULONG TimeStamp;
1279 UNICODE_STRING DosPath;
1280 } RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
1281
1282 typedef struct _RTL_PERTHREAD_CURDIR
1283 {
1284 PRTL_DRIVE_LETTER_CURDIR CurrentDirectories;
1285 PUNICODE_STRING ImageName;
1286 PVOID Environment;
1287 } RTL_PERTHREAD_CURDIR, *PRTL_PERTHREAD_CURDIR;
1288
1289 //
1290 // Private State structure for RtlAcquirePrivilege/RtlReleasePrivilege
1291 //
1292 typedef struct _RTL_ACQUIRE_STATE
1293 {
1294 HANDLE Token;
1295 HANDLE OldImpersonationToken;
1296 PTOKEN_PRIVILEGES OldPrivileges;
1297 PTOKEN_PRIVILEGES NewPrivileges;
1298 ULONG Flags;
1299 UCHAR OldPrivBuffer[1024];
1300 } RTL_ACQUIRE_STATE, *PRTL_ACQUIRE_STATE;
1301
1302 #ifndef NTOS_MODE_USER
1303
1304 //
1305 // RTL Critical Section Structures
1306 //
1307 typedef struct _RTL_CRITICAL_SECTION_DEBUG
1308 {
1309 USHORT Type;
1310 USHORT CreatorBackTraceIndex;
1311 struct _RTL_CRITICAL_SECTION *CriticalSection;
1312 LIST_ENTRY ProcessLocksList;
1313 ULONG EntryCount;
1314 ULONG ContentionCount;
1315 ULONG Spare[2];
1316 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
1317
1318 typedef struct _RTL_CRITICAL_SECTION
1319 {
1320 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
1321 LONG LockCount;
1322 LONG RecursionCount;
1323 HANDLE OwningThread;
1324 HANDLE LockSemaphore;
1325 ULONG_PTR SpinCount;
1326 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
1327
1328 #endif /* !NTOS_MODE_USER */
1329
1330 //
1331 // RTL Private Heap Structures
1332 //
1333 typedef struct _HEAP_LOCK
1334 {
1335 union
1336 {
1337 RTL_CRITICAL_SECTION CriticalSection;
1338 #ifndef NTOS_MODE_USER
1339 ERESOURCE Resource;
1340 #endif
1341 UCHAR Padding[0x68]; /* Max ERESOURCE size for x64 build. Needed because RTL is built only once */
1342 };
1343 } HEAP_LOCK, *PHEAP_LOCK;
1344
1345 //
1346 // RTL Range List Structures
1347 //
1348 typedef struct _RTL_RANGE_LIST
1349 {
1350 LIST_ENTRY ListHead;
1351 ULONG Flags;
1352 ULONG Count;
1353 ULONG Stamp;
1354 } RTL_RANGE_LIST, *PRTL_RANGE_LIST;
1355
1356 typedef struct _RTL_RANGE
1357 {
1358 ULONGLONG Start;
1359 ULONGLONG End;
1360 PVOID UserData;
1361 PVOID Owner;
1362 UCHAR Attributes;
1363 UCHAR Flags;
1364 } RTL_RANGE, *PRTL_RANGE;
1365
1366 typedef struct _RANGE_LIST_ITERATOR
1367 {
1368 PLIST_ENTRY RangeListHead;
1369 PLIST_ENTRY MergedHead;
1370 PVOID Current;
1371 ULONG Stamp;
1372 } RTL_RANGE_LIST_ITERATOR, *PRTL_RANGE_LIST_ITERATOR;
1373
1374 //
1375 // RTL Resource
1376 //
1377 #define RTL_RESOURCE_FLAG_LONG_TERM ((ULONG)0x00000001)
1378
1379 typedef struct _RTL_RESOURCE
1380 {
1381 RTL_CRITICAL_SECTION Lock;
1382 HANDLE SharedSemaphore;
1383 ULONG SharedWaiters;
1384 HANDLE ExclusiveSemaphore;
1385 ULONG ExclusiveWaiters;
1386 LONG NumberActive;
1387 HANDLE OwningThread;
1388 ULONG TimeoutBoost;
1389 PVOID DebugInfo;
1390 } RTL_RESOURCE, *PRTL_RESOURCE;
1391
1392 //
1393 // Structures for RtlCreateUserProcess
1394 //
1395 typedef struct _RTL_USER_PROCESS_PARAMETERS
1396 {
1397 ULONG MaximumLength;
1398 ULONG Length;
1399 ULONG Flags;
1400 ULONG DebugFlags;
1401 HANDLE ConsoleHandle;
1402 ULONG ConsoleFlags;
1403 HANDLE StandardInput;
1404 HANDLE StandardOutput;
1405 HANDLE StandardError;
1406 CURDIR CurrentDirectory;
1407 UNICODE_STRING DllPath;
1408 UNICODE_STRING ImagePathName;
1409 UNICODE_STRING CommandLine;
1410 PWSTR Environment;
1411 ULONG StartingX;
1412 ULONG StartingY;
1413 ULONG CountX;
1414 ULONG CountY;
1415 ULONG CountCharsX;
1416 ULONG CountCharsY;
1417 ULONG FillAttribute;
1418 ULONG WindowFlags;
1419 ULONG ShowWindowFlags;
1420 UNICODE_STRING WindowTitle;
1421 UNICODE_STRING DesktopInfo;
1422 UNICODE_STRING ShellInfo;
1423 UNICODE_STRING RuntimeData;
1424 RTL_DRIVE_LETTER_CURDIR CurrentDirectories[RTL_MAX_DRIVE_LETTERS];
1425 #if (NTDDI_VERSION >= NTDDI_LONGHORN)
1426 SIZE_T EnvironmentSize;
1427 #endif
1428 #if (NTDDI_VERSION >= NTDDI_WIN7)
1429 SIZE_T EnvironmentVersion;
1430 #endif
1431 } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
1432
1433 typedef struct _RTL_USER_PROCESS_INFORMATION
1434 {
1435 ULONG Size;
1436 HANDLE ProcessHandle;
1437 HANDLE ThreadHandle;
1438 CLIENT_ID ClientId;
1439 SECTION_IMAGE_INFORMATION ImageInformation;
1440 } RTL_USER_PROCESS_INFORMATION, *PRTL_USER_PROCESS_INFORMATION;
1441
1442 #if (NTDDI_VERSION >= NTDDI_WIN7)
1443
1444 typedef enum _RTL_UMS_SCHEDULER_REASON
1445 {
1446 UmsSchedulerStartup = 0,
1447 UmsSchedulerThreadBlocked = 1,
1448 UmsSchedulerThreadYield = 2,
1449 } RTL_UMS_SCHEDULER_REASON, *PRTL_UMS_SCHEDULER_REASON;
1450
1451 typedef enum _RTL_UMSCTX_FLAGS
1452 {
1453 UMSCTX_SCHEDULED_THREAD_BIT = 0,
1454 #if (NTDDI_VERSION < NTDDI_WIN8)
1455 UMSCTX_HAS_QUANTUM_REQ_BIT,
1456 UMSCTX_HAS_AFFINITY_REQ_BIT,
1457 UMSCTX_HAS_PRIORITY_REQ_BIT,
1458 #endif
1459 UMSCTX_SUSPENDED_BIT,
1460 UMSCTX_VOLATILE_CONTEXT_BIT,
1461 UMSCTX_TERMINATED_BIT,
1462 UMSCTX_DEBUG_ACTIVE_BIT,
1463 UMSCTX_RUNNING_ON_SELF_THREAD_BIT,
1464 UMSCTX_DENY_RUNNING_ON_SELF_THREAD_BIT
1465
1466 } RTL_UMSCTX_FLAGS, *PRTL_UMSCTX_FLAGS;
1467
1468 #define UMSCTX_SCHEDULED_THREAD_MASK (1 << UMSCTX_SCHEDULED_THREAD_BIT)
1469 #define UMSCTX_SUSPENDED_MASK (1 << UMSCTX_SUSPENDED_BIT)
1470 #define UMSCTX_VOLATILE_CONTEXT_MASK (1 << UMSCTX_VOLATILE_CONTEXT_BIT)
1471 #define UMSCTX_TERMINATED_MASK (1 << UMSCTX_TERMINATED_BIT)
1472 #define UMSCTX_DEBUG_ACTIVE_MASK (1 << UMSCTX_DEBUG_ACTIVE_BIT)
1473 #define UMSCTX_RUNNING_ON_SELF_THREAD_MASK (1 << UMSCTX_RUNNING_ON_SELF_THREAD_BIT)
1474 #define UMSCTX_DENY_RUNNING_ON_SELF_THREAD_MASK (1 << UMSCTX_DENY_RUNNING_ON_SELF_THREAD_BIT)
1475
1476 //
1477 // UMS Context
1478 //
1479 typedef struct DECLSPEC_ALIGN(16) _RTL_UMS_CONTEXT
1480 {
1481 SINGLE_LIST_ENTRY Link;
1482 CONTEXT Context;
1483 PVOID Teb;
1484 PVOID UserContext;
1485 union
1486 {
1487 struct
1488 {
1489 ULONG ScheduledThread : 1;
1490 #if (NTDDI_VERSION < NTDDI_WIN8)
1491 ULONG HasQuantumReq : 1;
1492 ULONG HasAffinityReq : 1;
1493 ULONG HasPriorityReq : 1;
1494 #endif
1495 ULONG Suspended : 1;
1496 ULONG VolatileContext : 1;
1497 ULONG Terminated : 1;
1498 ULONG DebugActive : 1;
1499 ULONG RunningOnSelfThread : 1;
1500 ULONG DenyRunningOnSelfThread : 1;
1501 #if (NTDDI_VERSION < NTDDI_WIN8)
1502 ULONG ReservedFlags : 22;
1503 #endif
1504 };
1505 LONG Flags;
1506 };
1507 union
1508 {
1509 struct
1510 {
1511 #if (NTDDI_VERSION >= NTDDI_WIN8)
1512 ULONG64 KernelUpdateLock : 2;
1513 #else
1514 ULONG64 KernelUpdateLock : 1;
1515 ULONG64 Reserved : 1;
1516 #endif
1517 ULONG64 PrimaryClientID : 62;
1518 };
1519 ULONG64 ContextLock;
1520 };
1521 #if (NTDDI_VERSION < NTDDI_WIN8)
1522 ULONG64 QuantumValue;
1523 GROUP_AFFINITY AffinityMask;
1524 LONG Priority;
1525 #endif
1526 struct _RTL_UMS_CONTEXT* PrimaryUmsContext;
1527 ULONG SwitchCount;
1528 ULONG KernelYieldCount;
1529 ULONG MixedYieldCount;
1530 ULONG YieldCount;
1531 } RTL_UMS_CONTEXT, *PRTL_UMS_CONTEXT;
1532 #endif // #if (NTDDI_VERSION >= NTDDI_WIN7)
1533
1534 //
1535 // RTL Atom Table Structures
1536 //
1537 typedef struct _RTL_ATOM_TABLE_ENTRY
1538 {
1539 struct _RTL_ATOM_TABLE_ENTRY *HashLink;
1540 USHORT HandleIndex;
1541 USHORT Atom;
1542 USHORT ReferenceCount;
1543 UCHAR Flags;
1544 UCHAR NameLength;
1545 WCHAR Name[1];
1546 } RTL_ATOM_TABLE_ENTRY, *PRTL_ATOM_TABLE_ENTRY;
1547
1548 typedef struct _RTL_ATOM_TABLE
1549 {
1550 ULONG Signature;
1551 union
1552 {
1553 #ifdef NTOS_MODE_USER
1554 RTL_CRITICAL_SECTION CriticalSection;
1555 #else
1556 FAST_MUTEX FastMutex;
1557 #endif
1558 };
1559 union
1560 {
1561 #ifdef NTOS_MODE_USER
1562 RTL_HANDLE_TABLE RtlHandleTable;
1563 #else
1564 PHANDLE_TABLE ExHandleTable;
1565 #endif
1566 };
1567 ULONG NumberOfBuckets;
1568 PRTL_ATOM_TABLE_ENTRY Buckets[1];
1569 } RTL_ATOM_TABLE, *PRTL_ATOM_TABLE;
1570
1571 #ifndef _WINBASE_
1572 //
1573 // System Time and Timezone Structures
1574 //
1575 typedef struct _SYSTEMTIME
1576 {
1577 USHORT wYear;
1578 USHORT wMonth;
1579 USHORT wDayOfWeek;
1580 USHORT wDay;
1581 USHORT wHour;
1582 USHORT wMinute;
1583 USHORT wSecond;
1584 USHORT wMilliseconds;
1585 } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
1586
1587 typedef struct _TIME_ZONE_INFORMATION
1588 {
1589 LONG Bias;
1590 WCHAR StandardName[32];
1591 SYSTEMTIME StandardDate;
1592 LONG StandardBias;
1593 WCHAR DaylightName[32];
1594 SYSTEMTIME DaylightDate;
1595 LONG DaylightBias;
1596 } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
1597 #endif /* !_WINBASE_ */
1598
1599 //
1600 // Native version of Timezone Structure
1601 //
1602 typedef LPTIME_ZONE_INFORMATION PRTL_TIME_ZONE_INFORMATION;
1603
1604 //
1605 // Hotpatch Header
1606 //
1607 typedef struct _RTL_PATCH_HEADER
1608 {
1609 LIST_ENTRY PatchList;
1610 PVOID PatchImageBase;
1611 struct _RTL_PATCH_HEADER *NextPath;
1612 ULONG PatchFlags;
1613 LONG PatchRefCount;
1614 struct _HOTPATCH_HEADER *HotpatchHeader;
1615 UNICODE_STRING TargetDllName;
1616 PVOID TargetDllBase;
1617 PLDR_DATA_TABLE_ENTRY TargetLdrDataTableEntry;
1618 PLDR_DATA_TABLE_ENTRY PatchLdrDataTableEntry;
1619 struct _SYSTEM_HOTPATCH_CODE_INFORMATION *CodeInfo;
1620 } RTL_PATCH_HEADER, *PRTL_PATCH_HEADER;
1621
1622 //
1623 // Header for NLS Files
1624 //
1625 typedef struct _NLS_FILE_HEADER
1626 {
1627 USHORT HeaderSize;
1628 USHORT CodePage;
1629 USHORT MaximumCharacterSize;
1630 USHORT DefaultChar;
1631 USHORT UniDefaultChar;
1632 USHORT TransDefaultChar;
1633 USHORT TransUniDefaultChar;
1634 UCHAR LeadByte[MAXIMUM_LEADBYTES];
1635 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
1636
1637 //
1638 // Stack Traces
1639 //
1640 typedef struct _RTL_STACK_TRACE_ENTRY
1641 {
1642 struct _RTL_STACK_TRACE_ENTRY *HashChain;
1643 ULONG TraceCount;
1644 USHORT Index;
1645 USHORT Depth;
1646 PVOID BackTrace[32];
1647 } RTL_STACK_TRACE_ENTRY, *PRTL_STACK_TRACE_ENTRY;
1648
1649 typedef struct _STACK_TRACE_DATABASE
1650 {
1651 RTL_CRITICAL_SECTION CriticalSection;
1652 } STACK_TRACE_DATABASE, *PSTACK_TRACE_DATABASE;
1653
1654 //
1655 // Trace Database
1656 //
1657
1658 typedef ULONG (NTAPI *RTL_TRACE_HASH_FUNCTION) (ULONG Count, PVOID *Trace);
1659
1660 typedef struct _RTL_TRACE_BLOCK
1661 {
1662 ULONG Magic;
1663 ULONG Count;
1664 ULONG Size;
1665 ULONG UserCount;
1666 ULONG UserSize;
1667 PVOID UserContext;
1668 struct _RTL_TRACE_BLOCK *Next;
1669 PVOID *Trace;
1670 } RTL_TRACE_BLOCK, *PRTL_TRACE_BLOCK;
1671
1672 typedef struct _RTL_TRACE_DATABASE
1673 {
1674 ULONG Magic;
1675 ULONG Flags;
1676 ULONG Tag;
1677 struct _RTL_TRACE_SEGMENT *SegmentList;
1678 SIZE_T MaximumSize;
1679 SIZE_T CurrentSize;
1680 PVOID Owner;
1681 #ifdef NTOS_MODE_USER
1682 RTL_CRITICAL_SECTION Lock;
1683 #else
1684 union
1685 {
1686 KSPIN_LOCK SpinLock;
1687 FAST_MUTEX FastMutex;
1688 } u;
1689 #endif
1690 ULONG NoOfBuckets;
1691 struct _RTL_TRACE_BLOCK **Buckets;
1692 RTL_TRACE_HASH_FUNCTION HashFunction;
1693 SIZE_T NoOfTraces;
1694 SIZE_T NoOfHits;
1695 ULONG HashCounter[16];
1696 } RTL_TRACE_DATABASE, *PRTL_TRACE_DATABASE;
1697
1698 typedef struct _RTL_TRACE_SEGMENT
1699 {
1700 ULONG Magic;
1701 struct _RTL_TRACE_DATABASE *Database;
1702 struct _RTL_TRACE_SEGMENT *NextSegment;
1703 SIZE_T TotalSize;
1704 PCHAR SegmentStart;
1705 PCHAR SegmentEnd;
1706 PCHAR SegmentFree;
1707 } RTL_TRACE_SEGMENT, *PRTL_TRACE_SEGMENT;
1708
1709 typedef struct _RTL_TRACE_ENUMERATE
1710 {
1711 struct _RTL_TRACE_DATABASE *Database;
1712 ULONG Index;
1713 struct _RTL_TRACE_BLOCK *Block;
1714 } RTL_TRACE_ENUMERATE, * PRTL_TRACE_ENUMERATE;
1715
1716 //
1717 // Auto-Managed Rtl* String Buffer
1718 //
1719 typedef struct _RTL_BUFFER
1720 {
1721 PUCHAR Buffer;
1722 PUCHAR StaticBuffer;
1723 SIZE_T Size;
1724 SIZE_T StaticSize;
1725 SIZE_T ReservedForAllocatedSize;
1726 PVOID ReservedForIMalloc;
1727 } RTL_BUFFER, *PRTL_BUFFER;
1728
1729 typedef struct _RTL_UNICODE_STRING_BUFFER
1730 {
1731 UNICODE_STRING String;
1732 RTL_BUFFER ByteBuffer;
1733 WCHAR MinimumStaticBufferForTerminalNul;
1734 } RTL_UNICODE_STRING_BUFFER, *PRTL_UNICODE_STRING_BUFFER;
1735
1736 #ifndef NTOS_MODE_USER
1737
1738 //
1739 // Message Resource Entry, Block and Data
1740 //
1741 typedef struct _MESSAGE_RESOURCE_ENTRY
1742 {
1743 USHORT Length;
1744 USHORT Flags;
1745 UCHAR Text[ANYSIZE_ARRAY];
1746 } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
1747
1748 typedef struct _MESSAGE_RESOURCE_BLOCK
1749 {
1750 ULONG LowId;
1751 ULONG HighId;
1752 ULONG OffsetToEntries;
1753 } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
1754
1755 typedef struct _MESSAGE_RESOURCE_DATA
1756 {
1757 ULONG NumberOfBlocks;
1758 MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY];
1759 } MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA;
1760
1761 #endif /* !NTOS_MODE_USER */
1762
1763 #ifdef NTOS_MODE_USER
1764
1765 //
1766 // Memory Stream
1767 //
1768 #ifndef CONST_VTBL
1769 #ifdef CONST_VTABLE
1770 #define CONST_VTBL const
1771 #else
1772 #define CONST_VTBL
1773 #endif
1774 #endif
1775
1776 struct IStreamVtbl;
1777 struct IStream;
1778 struct tagSTATSTG;
1779
1780 typedef struct _RTL_MEMORY_STREAM RTL_MEMORY_STREAM, *PRTL_MEMORY_STREAM;
1781
1782 typedef VOID
1783 (NTAPI *PRTL_MEMORY_STREAM_FINAL_RELEASE_ROUTINE)(
1784 _In_ PRTL_MEMORY_STREAM Stream
1785 );
1786
1787 struct _RTL_MEMORY_STREAM
1788 {
1789 CONST_VTBL struct IStreamVtbl *Vtbl;
1790 LONG RefCount;
1791 ULONG Unk1;
1792 PVOID Current;
1793 PVOID Start;
1794 PVOID End;
1795 PRTL_MEMORY_STREAM_FINAL_RELEASE_ROUTINE FinalRelease;
1796 HANDLE ProcessHandle;
1797 };
1798
1799 #endif /* NTOS_MODE_USER */
1800
1801 #ifdef __cplusplus
1802 }
1803 #endif
1804
1805 #endif /* !_RTLTYPES_H */