xref: /reactos/sdk/include/xdk/rtltypes.h (revision 682f85ad)
1 /******************************************************************************
2  *                           Runtime Library Types                            *
3  ******************************************************************************/
4 
5 $if (_WDMDDK_)
6 #define RTL_REGISTRY_ABSOLUTE             0
7 #define RTL_REGISTRY_SERVICES             1
8 #define RTL_REGISTRY_CONTROL              2
9 #define RTL_REGISTRY_WINDOWS_NT           3
10 #define RTL_REGISTRY_DEVICEMAP            4
11 #define RTL_REGISTRY_USER                 5
12 #define RTL_REGISTRY_MAXIMUM              6
13 #define RTL_REGISTRY_HANDLE               0x40000000
14 #define RTL_REGISTRY_OPTIONAL             0x80000000
15 
16 /* RTL_QUERY_REGISTRY_TABLE.Flags */
17 #define RTL_QUERY_REGISTRY_SUBKEY         0x00000001
18 #define RTL_QUERY_REGISTRY_TOPKEY         0x00000002
19 #define RTL_QUERY_REGISTRY_REQUIRED       0x00000004
20 #define RTL_QUERY_REGISTRY_NOVALUE        0x00000008
21 #define RTL_QUERY_REGISTRY_NOEXPAND       0x00000010
22 #define RTL_QUERY_REGISTRY_DIRECT         0x00000020
23 #define RTL_QUERY_REGISTRY_DELETE         0x00000040
24 #define RTL_QUERY_REGISTRY_TYPECHECK      0x00000100
25 
26 #define RTL_QUERY_REGISTRY_TYPECHECK_SHIFT 24
27 
28 #define HASH_STRING_ALGORITHM_DEFAULT     0
29 #define HASH_STRING_ALGORITHM_X65599      1
30 #define HASH_STRING_ALGORITHM_INVALID     0xffffffff
31 
32 typedef struct _RTL_BITMAP {
33   ULONG SizeOfBitMap;
34   PULONG Buffer;
35 } RTL_BITMAP, *PRTL_BITMAP;
36 
37 typedef struct _RTL_BITMAP_RUN {
38   ULONG StartingIndex;
39   ULONG NumberOfBits;
40 } RTL_BITMAP_RUN, *PRTL_BITMAP_RUN;
41 
42 _Function_class_(RTL_QUERY_REGISTRY_ROUTINE)
43 _IRQL_requires_max_(PASSIVE_LEVEL)
44 _IRQL_requires_same_
45 typedef NTSTATUS
46 (NTAPI RTL_QUERY_REGISTRY_ROUTINE)(
47   _In_z_ PWSTR ValueName,
48   _In_ ULONG ValueType,
49   _In_reads_bytes_opt_(ValueLength) PVOID ValueData,
50   _In_ ULONG ValueLength,
51   _In_opt_ PVOID Context,
52   _In_opt_ PVOID EntryContext);
53 typedef RTL_QUERY_REGISTRY_ROUTINE *PRTL_QUERY_REGISTRY_ROUTINE;
54 
55 typedef struct _RTL_QUERY_REGISTRY_TABLE {
56   PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
57   ULONG Flags;
58   PCWSTR Name;
59   PVOID EntryContext;
60   ULONG DefaultType;
61   PVOID DefaultData;
62   ULONG DefaultLength;
63 } RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
64 
65 typedef struct _TIME_FIELDS {
66   CSHORT Year;
67   CSHORT Month;
68   CSHORT Day;
69   CSHORT Hour;
70   CSHORT Minute;
71   CSHORT Second;
72   CSHORT Milliseconds;
73   CSHORT Weekday;
74 } TIME_FIELDS, *PTIME_FIELDS;
75 
76 /* Slist Header */
77 #ifndef _SLIST_HEADER_
78 #define _SLIST_HEADER_
79 
80 #if defined(_WIN64)
81 
82 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
83   struct _SLIST_ENTRY *Next;
84 } SLIST_ENTRY, *PSLIST_ENTRY;
85 
86 typedef struct _SLIST_ENTRY32 {
87   ULONG Next;
88 } SLIST_ENTRY32, *PSLIST_ENTRY32;
89 
90 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
91   _ANONYMOUS_STRUCT struct {
92     ULONGLONG Alignment;
93     ULONGLONG Region;
94   } DUMMYSTRUCTNAME;
95   struct {
96     ULONGLONG Depth:16;
97     ULONGLONG Sequence:9;
98     ULONGLONG NextEntry:39;
99     ULONGLONG HeaderType:1;
100     ULONGLONG Init:1;
101     ULONGLONG Reserved:59;
102     ULONGLONG Region:3;
103   } Header8;
104   struct {
105     ULONGLONG Depth:16;
106     ULONGLONG Sequence:48;
107     ULONGLONG HeaderType:1;
108     ULONGLONG Init:1;
109     ULONGLONG Reserved:2;
110     ULONGLONG NextEntry:60;
111   } Header16;
112   struct {
113     ULONGLONG Depth:16;
114     ULONGLONG Sequence:48;
115     ULONGLONG HeaderType:1;
116     ULONGLONG Reserved:3;
117     ULONGLONG NextEntry:60;
118   } HeaderX64;
119 } SLIST_HEADER, *PSLIST_HEADER;
120 
121 typedef union _SLIST_HEADER32 {
122   ULONGLONG Alignment;
123   _ANONYMOUS_STRUCT struct {
124     SLIST_ENTRY32 Next;
125     USHORT Depth;
126     USHORT Sequence;
127   } DUMMYSTRUCTNAME;
128 } SLIST_HEADER32, *PSLIST_HEADER32;
129 
130 #else
131 
132 #define SLIST_ENTRY SINGLE_LIST_ENTRY
133 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
134 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
135 
136 typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32;
137 
138 typedef union _SLIST_HEADER {
139   ULONGLONG Alignment;
140   _ANONYMOUS_STRUCT struct {
141     SLIST_ENTRY Next;
142     USHORT Depth;
143     USHORT Sequence;
144   } DUMMYSTRUCTNAME;
145 } SLIST_HEADER, *PSLIST_HEADER;
146 
147 typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32;
148 
149 #endif /* defined(_WIN64) */
150 
151 #endif /* _SLIST_HEADER_ */
152 
153 /* Exception record flags */
154 #define EXCEPTION_NONCONTINUABLE  0x01
155 #define EXCEPTION_UNWINDING       0x02
156 #define EXCEPTION_EXIT_UNWIND     0x04
157 #define EXCEPTION_STACK_INVALID   0x08
158 #define EXCEPTION_NESTED_CALL     0x10
159 #define EXCEPTION_TARGET_UNWIND   0x20
160 #define EXCEPTION_COLLIDED_UNWIND 0x40
161 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
162                           EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
163 
164 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
165 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
166 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
167 
168 #define EXCEPTION_MAXIMUM_PARAMETERS 15
169 
170 /* Exception records */
171 typedef struct _EXCEPTION_RECORD {
172   NTSTATUS ExceptionCode;
173   ULONG ExceptionFlags;
174   struct _EXCEPTION_RECORD *ExceptionRecord;
175   PVOID ExceptionAddress;
176   ULONG NumberParameters;
177   ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
178 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
179 
180 typedef struct _EXCEPTION_RECORD32 {
181   NTSTATUS ExceptionCode;
182   ULONG ExceptionFlags;
183   ULONG ExceptionRecord;
184   ULONG ExceptionAddress;
185   ULONG NumberParameters;
186   ULONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
187 } EXCEPTION_RECORD32, *PEXCEPTION_RECORD32;
188 
189 typedef struct _EXCEPTION_RECORD64 {
190   NTSTATUS ExceptionCode;
191   ULONG ExceptionFlags;
192   ULONG64 ExceptionRecord;
193   ULONG64 ExceptionAddress;
194   ULONG NumberParameters;
195   ULONG __unusedAlignment;
196   ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
197 } EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
198 
199 typedef struct _EXCEPTION_POINTERS {
200   PEXCEPTION_RECORD ExceptionRecord;
201   PCONTEXT ContextRecord;
202 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
203 
204 #ifdef _NTSYSTEM_
205 extern BOOLEAN NlsMbCodePageTag;
206 #define NLS_MB_CODE_PAGE_TAG NlsMbCodePageTag
207 extern BOOLEAN NlsMbOemCodePageTag;
208 #define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag
209 #else
210 __CREATE_NTOS_DATA_IMPORT_ALIAS(NlsMbCodePageTag)
211 extern BOOLEAN *NlsMbCodePageTag;
212 #define NLS_MB_CODE_PAGE_TAG (*NlsMbCodePageTag)
213 __CREATE_NTOS_DATA_IMPORT_ALIAS(NlsMbOemCodePageTag)
214 extern BOOLEAN *NlsMbOemCodePageTag;
215 #define NLS_MB_OEM_CODE_PAGE_TAG (*NlsMbOemCodePageTag)
216 #endif
217 
218 #define SHORT_LEAST_SIGNIFICANT_BIT       0
219 #define SHORT_MOST_SIGNIFICANT_BIT        1
220 
221 #define LONG_LEAST_SIGNIFICANT_BIT        0
222 #define LONG_3RD_MOST_SIGNIFICANT_BIT     1
223 #define LONG_2ND_MOST_SIGNIFICANT_BIT     2
224 #define LONG_MOST_SIGNIFICANT_BIT         3
225 
226 #define RTLVERLIB_DDI(x) Wdmlib##x
227 
228 typedef BOOLEAN
229 (*PFN_RTL_IS_NTDDI_VERSION_AVAILABLE)(
230   _In_ ULONG Version);
231 
232 typedef BOOLEAN
233 (*PFN_RTL_IS_SERVICE_PACK_VERSION_INSTALLED)(
234   _In_ ULONG Version);
235 
236 typedef struct _OSVERSIONINFOA {
237   ULONG dwOSVersionInfoSize;
238   ULONG dwMajorVersion;
239   ULONG dwMinorVersion;
240   ULONG dwBuildNumber;
241   ULONG dwPlatformId;
242   CHAR szCSDVersion[128];
243 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
244 
245 typedef struct _OSVERSIONINFOW {
246   ULONG dwOSVersionInfoSize;
247   ULONG dwMajorVersion;
248   ULONG dwMinorVersion;
249   ULONG dwBuildNumber;
250   ULONG dwPlatformId;
251   WCHAR szCSDVersion[128];
252 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
253 
254 typedef struct _OSVERSIONINFOEXA {
255   ULONG dwOSVersionInfoSize;
256   ULONG dwMajorVersion;
257   ULONG dwMinorVersion;
258   ULONG dwBuildNumber;
259   ULONG dwPlatformId;
260   CHAR szCSDVersion[128];
261   USHORT wServicePackMajor;
262   USHORT wServicePackMinor;
263   USHORT wSuiteMask;
264   UCHAR wProductType;
265   UCHAR wReserved;
266 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
267 
268 typedef struct _OSVERSIONINFOEXW {
269   ULONG dwOSVersionInfoSize;
270   ULONG dwMajorVersion;
271   ULONG dwMinorVersion;
272   ULONG dwBuildNumber;
273   ULONG dwPlatformId;
274   WCHAR szCSDVersion[128];
275   USHORT wServicePackMajor;
276   USHORT wServicePackMinor;
277   USHORT wSuiteMask;
278   UCHAR wProductType;
279   UCHAR wReserved;
280 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
281 
282 #ifdef UNICODE
283 typedef OSVERSIONINFOEXW OSVERSIONINFOEX;
284 typedef POSVERSIONINFOEXW POSVERSIONINFOEX;
285 typedef LPOSVERSIONINFOEXW LPOSVERSIONINFOEX;
286 typedef OSVERSIONINFOW OSVERSIONINFO;
287 typedef POSVERSIONINFOW POSVERSIONINFO;
288 typedef LPOSVERSIONINFOW LPOSVERSIONINFO;
289 #else
290 typedef OSVERSIONINFOEXA OSVERSIONINFOEX;
291 typedef POSVERSIONINFOEXA POSVERSIONINFOEX;
292 typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX;
293 typedef OSVERSIONINFOA OSVERSIONINFO;
294 typedef POSVERSIONINFOA POSVERSIONINFO;
295 typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
296 #endif /* UNICODE */
297 
298 $endif (_WDMDDK_)
299 $if (_NTDDK_)
300 
301 #ifndef _RTL_RUN_ONCE_DEF
302 #define _RTL_RUN_ONCE_DEF
303 
304 #define RTL_RUN_ONCE_INIT {0}
305 
306 #define RTL_RUN_ONCE_CHECK_ONLY     0x00000001UL
307 #define RTL_RUN_ONCE_ASYNC          0x00000002UL
308 #define RTL_RUN_ONCE_INIT_FAILED    0x00000004UL
309 
310 #define RTL_RUN_ONCE_CTX_RESERVED_BITS 2
311 
312 #define RTL_HASH_ALLOCATED_HEADER            0x00000001
313 
314 #define RTL_HASH_RESERVED_SIGNATURE 0
315 
316 /* RtlVerifyVersionInfo() ComparisonType */
317 
318 #define VER_EQUAL                       1
319 #define VER_GREATER                     2
320 #define VER_GREATER_EQUAL               3
321 #define VER_LESS                        4
322 #define VER_LESS_EQUAL                  5
323 #define VER_AND                         6
324 #define VER_OR                          7
325 
326 #define VER_CONDITION_MASK              7
327 #define VER_NUM_BITS_PER_CONDITION_MASK 3
328 
329 /* RtlVerifyVersionInfo() TypeMask */
330 
331 #define VER_MINORVERSION                  0x0000001
332 #define VER_MAJORVERSION                  0x0000002
333 #define VER_BUILDNUMBER                   0x0000004
334 #define VER_PLATFORMID                    0x0000008
335 #define VER_SERVICEPACKMINOR              0x0000010
336 #define VER_SERVICEPACKMAJOR              0x0000020
337 #define VER_SUITENAME                     0x0000040
338 #define VER_PRODUCT_TYPE                  0x0000080
339 
340 #define VER_NT_WORKSTATION              0x0000001
341 #define VER_NT_DOMAIN_CONTROLLER        0x0000002
342 #define VER_NT_SERVER                   0x0000003
343 
344 #define VER_PLATFORM_WIN32s             0
345 #define VER_PLATFORM_WIN32_WINDOWS      1
346 #define VER_PLATFORM_WIN32_NT           2
347 
348 typedef union _RTL_RUN_ONCE {
349   PVOID Ptr;
350 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
351 
352 _Function_class_(RTL_RUN_ONCE_INIT_FN)
353 _IRQL_requires_same_
354 typedef ULONG /* LOGICAL */
355 (NTAPI *PRTL_RUN_ONCE_INIT_FN) (
356   _Inout_ PRTL_RUN_ONCE RunOnce,
357   _Inout_opt_ PVOID Parameter,
358   _Inout_opt_ PVOID *Context);
359 
360 #endif /* _RTL_RUN_ONCE_DEF */
361 
362 typedef enum _TABLE_SEARCH_RESULT {
363   TableEmptyTree,
364   TableFoundNode,
365   TableInsertAsLeft,
366   TableInsertAsRight
367 } TABLE_SEARCH_RESULT;
368 
369 typedef enum _RTL_GENERIC_COMPARE_RESULTS {
370   GenericLessThan,
371   GenericGreaterThan,
372   GenericEqual
373 } RTL_GENERIC_COMPARE_RESULTS;
374 
375 // Forwarder
376 struct _RTL_AVL_TABLE;
377 
378 _IRQL_requires_same_
379 _Function_class_(RTL_AVL_COMPARE_ROUTINE)
380 typedef RTL_GENERIC_COMPARE_RESULTS
381 (NTAPI RTL_AVL_COMPARE_ROUTINE) (
382   _In_ struct _RTL_AVL_TABLE *Table,
383   _In_ PVOID FirstStruct,
384   _In_ PVOID SecondStruct);
385 typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE;
386 
387 _IRQL_requires_same_
388 _Function_class_(RTL_AVL_ALLOCATE_ROUTINE)
389 __drv_allocatesMem(Mem)
390 typedef PVOID
391 (NTAPI RTL_AVL_ALLOCATE_ROUTINE) (
392   _In_ struct _RTL_AVL_TABLE *Table,
393   _In_ CLONG ByteSize);
394 typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE;
395 
396 _IRQL_requires_same_
397 _Function_class_(RTL_AVL_FREE_ROUTINE)
398 typedef VOID
399 (NTAPI RTL_AVL_FREE_ROUTINE) (
400   _In_ struct _RTL_AVL_TABLE *Table,
401   _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer);
402 typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE;
403 
404 _IRQL_requires_same_
405 _Function_class_(RTL_AVL_MATCH_FUNCTION)
406 typedef NTSTATUS
407 (NTAPI RTL_AVL_MATCH_FUNCTION) (
408   _In_ struct _RTL_AVL_TABLE *Table,
409   _In_ PVOID UserData,
410   _In_ PVOID MatchData);
411 typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION;
412 
413 typedef struct _RTL_BALANCED_LINKS {
414   struct _RTL_BALANCED_LINKS *Parent;
415   struct _RTL_BALANCED_LINKS *LeftChild;
416   struct _RTL_BALANCED_LINKS *RightChild;
417   CHAR Balance;
418   UCHAR Reserved[3];
419 } RTL_BALANCED_LINKS, *PRTL_BALANCED_LINKS;
420 
421 typedef struct _RTL_AVL_TABLE {
422   RTL_BALANCED_LINKS BalancedRoot;
423   PVOID OrderedPointer;
424   ULONG WhichOrderedElement;
425   ULONG NumberGenericTableElements;
426   ULONG DepthOfTree;
427   PRTL_BALANCED_LINKS RestartKey;
428   ULONG DeleteCount;
429   PRTL_AVL_COMPARE_ROUTINE CompareRoutine;
430   PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine;
431   PRTL_AVL_FREE_ROUTINE FreeRoutine;
432   PVOID TableContext;
433 } RTL_AVL_TABLE, *PRTL_AVL_TABLE;
434 
435 typedef struct _RTL_SPLAY_LINKS {
436   struct _RTL_SPLAY_LINKS *Parent;
437   struct _RTL_SPLAY_LINKS *LeftChild;
438   struct _RTL_SPLAY_LINKS *RightChild;
439 } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS;
440 
441 #ifndef RTL_USE_AVL_TABLES
442 
443 struct _RTL_GENERIC_TABLE;
444 
445 _IRQL_requires_same_
446 _Function_class_(RTL_GENERIC_COMPARE_ROUTINE)
447 typedef RTL_GENERIC_COMPARE_RESULTS
448 (NTAPI RTL_GENERIC_COMPARE_ROUTINE) (
449   _In_ struct _RTL_GENERIC_TABLE *Table,
450   _In_ PVOID FirstStruct,
451   _In_ PVOID SecondStruct);
452 typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE;
453 
454 _IRQL_requires_same_
455 _Function_class_(RTL_GENERIC_ALLOCATE_ROUTINE)
456 __drv_allocatesMem(Mem)
457 typedef PVOID
458 (NTAPI RTL_GENERIC_ALLOCATE_ROUTINE) (
459   _In_ struct _RTL_GENERIC_TABLE *Table,
460   _In_ CLONG ByteSize);
461 typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE;
462 
463 _IRQL_requires_same_
464 _Function_class_(RTL_GENERIC_FREE_ROUTINE)
465 typedef VOID
466 (NTAPI RTL_GENERIC_FREE_ROUTINE) (
467   _In_ struct _RTL_GENERIC_TABLE *Table,
468   _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer);
469 typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE;
470 
471 typedef struct _RTL_GENERIC_TABLE {
472   PRTL_SPLAY_LINKS TableRoot;
473   LIST_ENTRY InsertOrderList;
474   PLIST_ENTRY OrderedPointer;
475   ULONG WhichOrderedElement;
476   ULONG NumberGenericTableElements;
477   PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine;
478   PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine;
479   PRTL_GENERIC_FREE_ROUTINE FreeRoutine;
480   PVOID TableContext;
481 } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE;
482 
483 #endif /* !RTL_USE_AVL_TABLES */
484 
485 #ifdef RTL_USE_AVL_TABLES
486 
487 #undef  RTL_GENERIC_COMPARE_ROUTINE
488 #undef PRTL_GENERIC_COMPARE_ROUTINE
489 #undef  RTL_GENERIC_ALLOCATE_ROUTINE
490 #undef PRTL_GENERIC_ALLOCATE_ROUTINE
491 #undef  RTL_GENERIC_FREE_ROUTINE
492 #undef PRTL_GENERIC_FREE_ROUTINE
493 #undef  RTL_GENERIC_TABLE
494 #undef PRTL_GENERIC_TABLE
495 
496 #define  RTL_GENERIC_COMPARE_ROUTINE     RTL_AVL_COMPARE_ROUTINE
497 #define PRTL_GENERIC_COMPARE_ROUTINE    PRTL_AVL_COMPARE_ROUTINE
498 #define  RTL_GENERIC_ALLOCATE_ROUTINE    RTL_AVL_ALLOCATE_ROUTINE
499 #define PRTL_GENERIC_ALLOCATE_ROUTINE   PRTL_AVL_ALLOCATE_ROUTINE
500 #define  RTL_GENERIC_FREE_ROUTINE        RTL_AVL_FREE_ROUTINE
501 #define PRTL_GENERIC_FREE_ROUTINE       PRTL_AVL_FREE_ROUTINE
502 #define  RTL_GENERIC_TABLE               RTL_AVL_TABLE
503 #define PRTL_GENERIC_TABLE              PRTL_AVL_TABLE
504 
505 #endif /* RTL_USE_AVL_TABLES */
506 
507 #define RTL_HASH_ALLOCATED_HEADER 0x00000001
508 
509 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENTRY {
510   LIST_ENTRY Linkage;
511   ULONG_PTR Signature;
512 } RTL_DYNAMIC_HASH_TABLE_ENTRY, *PRTL_DYNAMIC_HASH_TABLE_ENTRY;
513 
514 typedef struct _RTL_DYNAMIC_HASH_TABLE_CONTEXT {
515   PLIST_ENTRY ChainHead;
516   PLIST_ENTRY PrevLinkage;
517   ULONG_PTR Signature;
518 } RTL_DYNAMIC_HASH_TABLE_CONTEXT, *PRTL_DYNAMIC_HASH_TABLE_CONTEXT;
519 
520 typedef struct _RTL_DYNAMIC_HASH_TABLE_ENUMERATOR {
521   RTL_DYNAMIC_HASH_TABLE_ENTRY HashEntry;
522   PLIST_ENTRY ChainHead;
523   ULONG BucketIndex;
524 } RTL_DYNAMIC_HASH_TABLE_ENUMERATOR, *PRTL_DYNAMIC_HASH_TABLE_ENUMERATOR;
525 
526 typedef struct _RTL_DYNAMIC_HASH_TABLE {
527   ULONG Flags;
528   ULONG Shift;
529   ULONG TableSize;
530   ULONG Pivot;
531   ULONG DivisorMask;
532   ULONG NumEntries;
533   ULONG NonEmptyBuckets;
534   ULONG NumEnumerators;
535   PVOID Directory;
536 } RTL_DYNAMIC_HASH_TABLE, *PRTL_DYNAMIC_HASH_TABLE;
537 
538 #define HASH_ENTRY_KEY(x)    ((x)->Signature)
539 
540 $endif (_NTDDK_)
541 $if (_NTIFS_)
542 
543 #define RTL_SYSTEM_VOLUME_INFORMATION_FOLDER    L"System Volume Information"
544 
545 _Function_class_(RTL_ALLOCATE_STRING_ROUTINE)
546 _IRQL_requires_max_(PASSIVE_LEVEL)
547 __drv_allocatesMem(Mem)
548 typedef PVOID
549 (NTAPI *PRTL_ALLOCATE_STRING_ROUTINE)(
550   _In_ SIZE_T NumberOfBytes);
551 
552 #if _WIN32_WINNT >= 0x0600
553 _Function_class_(RTL_REALLOCATE_STRING_ROUTINE)
554 _IRQL_requires_max_(PASSIVE_LEVEL)
555 __drv_allocatesMem(Mem)
556 typedef PVOID
557 (NTAPI *PRTL_REALLOCATE_STRING_ROUTINE)(
558   _In_ SIZE_T NumberOfBytes,
559   IN PVOID Buffer);
560 #endif
561 
562 typedef VOID
563 (NTAPI *PRTL_FREE_STRING_ROUTINE)(
564   _In_ __drv_freesMem(Mem) _Post_invalid_ PVOID Buffer);
565 
566 extern NTKERNELAPI const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine;
567 extern NTKERNELAPI const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine;
568 
569 #if _WIN32_WINNT >= 0x0600
570 extern NTKERNELAPI const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine;
571 #endif
572 
573 _Function_class_(RTL_HEAP_COMMIT_ROUTINE)
574 _IRQL_requires_same_
575 typedef NTSTATUS
576 (NTAPI *PRTL_HEAP_COMMIT_ROUTINE) (
577   _In_ PVOID Base,
578   _Inout_ PVOID *CommitAddress,
579   _Inout_ PSIZE_T CommitSize);
580 
581 typedef struct _RTL_HEAP_PARAMETERS {
582   ULONG Length;
583   SIZE_T SegmentReserve;
584   SIZE_T SegmentCommit;
585   SIZE_T DeCommitFreeBlockThreshold;
586   SIZE_T DeCommitTotalFreeThreshold;
587   SIZE_T MaximumAllocationSize;
588   SIZE_T VirtualMemoryThreshold;
589   SIZE_T InitialCommit;
590   SIZE_T InitialReserve;
591   PRTL_HEAP_COMMIT_ROUTINE CommitRoutine;
592   SIZE_T Reserved[2];
593 } RTL_HEAP_PARAMETERS, *PRTL_HEAP_PARAMETERS;
594 
595 #if (NTDDI_VERSION >= NTDDI_WIN2K)
596 
597 typedef struct _GENERATE_NAME_CONTEXT {
598   USHORT Checksum;
599   BOOLEAN CheckSumInserted;
600   _Field_range_(<=, 8) UCHAR NameLength;
601   WCHAR NameBuffer[8];
602   _Field_range_(<=, 4) ULONG ExtensionLength;
603   WCHAR ExtensionBuffer[4];
604   ULONG LastIndexValue;
605 } GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
606 
607 typedef struct _PREFIX_TABLE_ENTRY {
608   CSHORT NodeTypeCode;
609   CSHORT NameLength;
610   struct _PREFIX_TABLE_ENTRY *NextPrefixTree;
611   RTL_SPLAY_LINKS Links;
612   PSTRING Prefix;
613 } PREFIX_TABLE_ENTRY, *PPREFIX_TABLE_ENTRY;
614 
615 typedef struct _PREFIX_TABLE {
616   CSHORT NodeTypeCode;
617   CSHORT NameLength;
618   PPREFIX_TABLE_ENTRY NextPrefixTree;
619 } PREFIX_TABLE, *PPREFIX_TABLE;
620 
621 typedef struct _UNICODE_PREFIX_TABLE_ENTRY {
622   CSHORT NodeTypeCode;
623   CSHORT NameLength;
624   struct _UNICODE_PREFIX_TABLE_ENTRY *NextPrefixTree;
625   struct _UNICODE_PREFIX_TABLE_ENTRY *CaseMatch;
626   RTL_SPLAY_LINKS Links;
627   PUNICODE_STRING Prefix;
628 } UNICODE_PREFIX_TABLE_ENTRY, *PUNICODE_PREFIX_TABLE_ENTRY;
629 
630 typedef struct _UNICODE_PREFIX_TABLE {
631   CSHORT NodeTypeCode;
632   CSHORT NameLength;
633   PUNICODE_PREFIX_TABLE_ENTRY NextPrefixTree;
634   PUNICODE_PREFIX_TABLE_ENTRY LastNextEntry;
635 } UNICODE_PREFIX_TABLE, *PUNICODE_PREFIX_TABLE;
636 
637 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
638 
639 #if (NTDDI_VERSION >= NTDDI_WINXP)
640 typedef struct _COMPRESSED_DATA_INFO {
641   USHORT CompressionFormatAndEngine;
642   UCHAR CompressionUnitShift;
643   UCHAR ChunkShift;
644   UCHAR ClusterShift;
645   UCHAR Reserved;
646   USHORT NumberOfChunks;
647   ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
648 } COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
649 #endif
650 $endif (_NTIFS_)
651