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