0f30638fe59416c7cda459f6a415b2af3cf41213
[reactos.git] / reactos / include / ndk / rtlfuncs.h
1 /*++ NDK Version: 0098
2
3 Copyright (c) Alex Ionescu. All rights reserved.
4
5 Header Name:
6
7 rtlfuncs.h
8
9 Abstract:
10
11 Function 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 _RTLFUNCS_H
20 #define _RTLFUNCS_H
21
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 #include <ntnls.h>
27 #include <rtltypes.h>
28 #include <pstypes.h>
29 #include <extypes.h>
30 #include "in6addr.h"
31 #include "inaddr.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #ifdef NTOS_MODE_USER
38
39 //
40 // List Functions
41 //
42 FORCEINLINE
43 VOID
44 InitializeListHead(
45 IN PLIST_ENTRY ListHead
46 )
47 {
48 ListHead->Flink = ListHead->Blink = ListHead;
49 }
50
51 FORCEINLINE
52 VOID
53 InsertHeadList(
54 IN PLIST_ENTRY ListHead,
55 IN PLIST_ENTRY Entry
56 )
57 {
58 PLIST_ENTRY OldFlink;
59 OldFlink = ListHead->Flink;
60 Entry->Flink = OldFlink;
61 Entry->Blink = ListHead;
62 OldFlink->Blink = Entry;
63 ListHead->Flink = Entry;
64 }
65
66 FORCEINLINE
67 VOID
68 InsertTailList(
69 IN PLIST_ENTRY ListHead,
70 IN PLIST_ENTRY Entry
71 )
72 {
73 PLIST_ENTRY OldBlink;
74 OldBlink = ListHead->Blink;
75 Entry->Flink = ListHead;
76 Entry->Blink = OldBlink;
77 OldBlink->Flink = Entry;
78 ListHead->Blink = Entry;
79 }
80
81 FORCEINLINE
82 BOOLEAN
83 IsListEmpty(
84 IN const LIST_ENTRY * ListHead
85 )
86 {
87 return (BOOLEAN)(ListHead->Flink == ListHead);
88 }
89
90 FORCEINLINE
91 PSINGLE_LIST_ENTRY
92 PopEntryList(
93 PSINGLE_LIST_ENTRY ListHead
94 )
95 {
96 PSINGLE_LIST_ENTRY FirstEntry;
97 FirstEntry = ListHead->Next;
98 if (FirstEntry != NULL) {
99 ListHead->Next = FirstEntry->Next;
100 }
101
102 return FirstEntry;
103 }
104
105 FORCEINLINE
106 VOID
107 PushEntryList(
108 PSINGLE_LIST_ENTRY ListHead,
109 PSINGLE_LIST_ENTRY Entry
110 )
111 {
112 Entry->Next = ListHead->Next;
113 ListHead->Next = Entry;
114 }
115
116 FORCEINLINE
117 BOOLEAN
118 RemoveEntryList(
119 IN PLIST_ENTRY Entry)
120 {
121 PLIST_ENTRY OldFlink;
122 PLIST_ENTRY OldBlink;
123
124 OldFlink = Entry->Flink;
125 OldBlink = Entry->Blink;
126 OldFlink->Blink = OldBlink;
127 OldBlink->Flink = OldFlink;
128 return (BOOLEAN)(OldFlink == OldBlink);
129 }
130
131 FORCEINLINE
132 PLIST_ENTRY
133 RemoveHeadList(
134 IN PLIST_ENTRY ListHead)
135 {
136 PLIST_ENTRY Flink;
137 PLIST_ENTRY Entry;
138
139 Entry = ListHead->Flink;
140 Flink = Entry->Flink;
141 ListHead->Flink = Flink;
142 Flink->Blink = ListHead;
143 return Entry;
144 }
145
146 FORCEINLINE
147 PLIST_ENTRY
148 RemoveTailList(
149 IN PLIST_ENTRY ListHead)
150 {
151 PLIST_ENTRY Blink;
152 PLIST_ENTRY Entry;
153
154 Entry = ListHead->Blink;
155 Blink = Entry->Blink;
156 ListHead->Blink = Blink;
157 Blink->Flink = ListHead;
158 return Entry;
159 }
160
161 //
162 // Unicode string macros
163 //
164 FORCEINLINE
165 VOID
166 RtlInitEmptyUnicodeString(OUT PUNICODE_STRING UnicodeString,
167 IN PWSTR Buffer,
168 IN USHORT BufferSize)
169 {
170 UnicodeString->Length = 0;
171 UnicodeString->MaximumLength = BufferSize;
172 UnicodeString->Buffer = Buffer;
173 }
174
175 FORCEINLINE
176 VOID
177 RtlInitEmptyAnsiString(OUT PANSI_STRING AnsiString,
178 IN PSTR Buffer,
179 IN USHORT BufferSize)
180 {
181 AnsiString->Length = 0;
182 AnsiString->MaximumLength = BufferSize;
183 AnsiString->Buffer = Buffer;
184 }
185
186 //
187 // LUID Macros
188 //
189 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
190 ((L1)->LowPart == (L2)->LowPart))
191 FORCEINLINE
192 LUID
193 NTAPI_INLINE
194 RtlConvertUlongToLuid(ULONG Ulong)
195 {
196 LUID TempLuid;
197
198 TempLuid.LowPart = Ulong;
199 TempLuid.HighPart = 0;
200 return TempLuid;
201 }
202
203 //
204 // ASSERT Macros
205 //
206 #ifndef ASSERT
207 #if DBG
208
209 #define ASSERT( exp ) \
210 ((void)((!(exp)) ? \
211 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ),FALSE) : \
212 TRUE))
213
214 #define ASSERTMSG( msg, exp ) \
215 ((void)((!(exp)) ? \
216 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, (PCHAR)msg ),FALSE) : \
217 TRUE))
218
219 #else
220
221 #define ASSERT( exp ) ((void) 0)
222 #define ASSERTMSG( msg, exp ) ((void) 0)
223
224 #endif
225 #endif
226
227 #ifdef NTOS_KERNEL_RUNTIME
228
229 //
230 // Executing RTL functions at DISPATCH_LEVEL or higher will result in a
231 // bugcheck.
232 //
233 #define RTL_PAGED_CODE PAGED_CODE
234
235 #else
236
237 //
238 // This macro does nothing in user mode
239 //
240 #define RTL_PAGED_CODE NOP_FUNCTION
241
242 #endif
243
244 //
245 // RTL Splay Tree Functions
246 //
247 #ifndef RTL_USE_AVL_TABLES
248
249 NTSYSAPI
250 VOID
251 NTAPI
252 RtlInitializeGenericTable(
253 OUT PRTL_GENERIC_TABLE Table,
254 IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine,
255 IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine,
256 IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine,
257 IN PVOID TableContext OPTIONAL
258 );
259
260 NTSYSAPI
261 PVOID
262 NTAPI
263 RtlInsertElementGenericTable(
264 IN PRTL_GENERIC_TABLE Table,
265 IN PVOID Buffer,
266 IN CLONG BufferSize,
267 OUT PBOOLEAN NewElement OPTIONAL
268 );
269
270 NTSYSAPI
271 PVOID
272 NTAPI
273 RtlInsertElementGenericTableFull(
274 IN PRTL_GENERIC_TABLE Table,
275 IN PVOID Buffer,
276 IN CLONG BufferSize,
277 OUT PBOOLEAN NewElement OPTIONAL,
278 IN PVOID NodeOrParent,
279 IN TABLE_SEARCH_RESULT SearchResult
280 );
281
282 NTSYSAPI
283 BOOLEAN
284 NTAPI
285 RtlDeleteElementGenericTable(
286 IN PRTL_GENERIC_TABLE Table,
287 IN PVOID Buffer
288 );
289
290 NTSYSAPI
291 PVOID
292 NTAPI
293 RtlLookupElementGenericTable(
294 IN PRTL_GENERIC_TABLE Table,
295 IN PVOID Buffer
296 );
297
298 NTSYSAPI
299 PVOID
300 NTAPI
301 RtlLookupElementGenericTableFull(
302 IN PRTL_GENERIC_TABLE Table,
303 IN PVOID Buffer,
304 OUT PVOID *NodeOrParent,
305 OUT TABLE_SEARCH_RESULT *SearchResult
306 );
307
308 NTSYSAPI
309 PVOID
310 NTAPI
311 RtlEnumerateGenericTable(
312 IN PRTL_GENERIC_TABLE Table,
313 IN BOOLEAN Restart
314 );
315
316 NTSYSAPI
317 PVOID
318 NTAPI
319 RtlEnumerateGenericTableWithoutSplaying(
320 IN PRTL_GENERIC_TABLE Table,
321 IN OUT PVOID *RestartKey
322 );
323
324 NTSYSAPI
325 PVOID
326 NTAPI
327 RtlGetElementGenericTable(
328 IN PRTL_GENERIC_TABLE Table,
329 IN ULONG I
330 );
331
332 NTSYSAPI
333 ULONG
334 NTAPI
335 RtlNumberGenericTableElements(
336 IN PRTL_GENERIC_TABLE Table
337 );
338
339 NTSYSAPI
340 BOOLEAN
341 NTAPI
342 RtlIsGenericTableEmpty(
343 IN PRTL_GENERIC_TABLE Table
344 );
345
346 #endif /* !RTL_USE_AVL_TABLES */
347
348 NTSYSAPI
349 PRTL_SPLAY_LINKS
350 NTAPI
351 RtlSplay(
352 IN PRTL_SPLAY_LINKS Links
353 );
354
355 NTSYSAPI
356 PRTL_SPLAY_LINKS
357 NTAPI
358 RtlDelete(
359 IN PRTL_SPLAY_LINKS Links
360 );
361
362 NTSYSAPI
363 VOID
364 NTAPI
365 RtlDeleteNoSplay(
366 IN PRTL_SPLAY_LINKS Links,
367 OUT PRTL_SPLAY_LINKS *Root
368 );
369
370 NTSYSAPI
371 PRTL_SPLAY_LINKS
372 NTAPI
373 RtlSubtreeSuccessor(
374 IN PRTL_SPLAY_LINKS Links
375 );
376
377 NTSYSAPI
378 PRTL_SPLAY_LINKS
379 NTAPI
380 RtlSubtreePredecessor(
381 IN PRTL_SPLAY_LINKS Links
382 );
383
384 NTSYSAPI
385 PRTL_SPLAY_LINKS
386 NTAPI
387 RtlRealSuccessor(
388 IN PRTL_SPLAY_LINKS Links
389 );
390
391 NTSYSAPI
392 PRTL_SPLAY_LINKS
393 NTAPI
394 RtlRealPredecessor(
395 IN PRTL_SPLAY_LINKS Links
396 );
397
398 #define RtlIsLeftChild(Links) \
399 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
400
401 #define RtlIsRightChild(Links) \
402 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
403
404 #define RtlRightChild(Links) \
405 ((PRTL_SPLAY_LINKS)(Links))->RightChild
406
407 #define RtlIsRoot(Links) \
408 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
409
410 #define RtlLeftChild(Links) \
411 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
412
413 #define RtlParent(Links) \
414 ((PRTL_SPLAY_LINKS)(Links))->Parent
415
416 #define RtlInitializeSplayLinks(Links) \
417 { \
418 PRTL_SPLAY_LINKS _SplayLinks; \
419 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
420 _SplayLinks->Parent = _SplayLinks; \
421 _SplayLinks->LeftChild = NULL; \
422 _SplayLinks->RightChild = NULL; \
423 }
424
425 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
426 { \
427 PRTL_SPLAY_LINKS _SplayParent; \
428 PRTL_SPLAY_LINKS _SplayChild; \
429 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
430 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
431 _SplayParent->LeftChild = _SplayChild; \
432 _SplayChild->Parent = _SplayParent; \
433 }
434
435 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
436 { \
437 PRTL_SPLAY_LINKS _SplayParent; \
438 PRTL_SPLAY_LINKS _SplayChild; \
439 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
440 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
441 _SplayParent->RightChild = _SplayChild; \
442 _SplayChild->Parent = _SplayParent; \
443 }
444
445 //
446 // RTL AVL Tree Functions
447 //
448 NTSYSAPI
449 VOID
450 NTAPI
451 RtlInitializeGenericTableAvl(
452 OUT PRTL_AVL_TABLE Table,
453 IN PRTL_AVL_COMPARE_ROUTINE CompareRoutine,
454 IN PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine,
455 IN PRTL_AVL_FREE_ROUTINE FreeRoutine,
456 IN PVOID TableContext OPTIONAL
457 );
458
459 NTSYSAPI
460 PVOID
461 NTAPI
462 RtlInsertElementGenericTableAvl(
463 IN PRTL_AVL_TABLE Table,
464 IN PVOID Buffer,
465 IN CLONG BufferSize,
466 OUT PBOOLEAN NewElement OPTIONAL
467 );
468
469 NTSYSAPI
470 PVOID
471 NTAPI
472 RtlInsertElementGenericTableFullAvl(
473 IN PRTL_AVL_TABLE Table,
474 IN PVOID Buffer,
475 IN CLONG BufferSize,
476 OUT PBOOLEAN NewElement OPTIONAL,
477 IN PVOID NodeOrParent,
478 IN TABLE_SEARCH_RESULT SearchResult
479 );
480
481 NTSYSAPI
482 BOOLEAN
483 NTAPI
484 RtlDeleteElementGenericTableAvl(
485 IN PRTL_AVL_TABLE Table,
486 IN PVOID Buffer
487 );
488
489 NTSYSAPI
490 PVOID
491 NTAPI
492 RtlLookupElementGenericTableAvl(
493 IN PRTL_AVL_TABLE Table,
494 IN PVOID Buffer
495 );
496
497 NTSYSAPI
498 PVOID
499 NTAPI
500 RtlLookupElementGenericTableFullAvl(
501 IN PRTL_AVL_TABLE Table,
502 IN PVOID Buffer,
503 OUT PVOID *NodeOrParent,
504 OUT TABLE_SEARCH_RESULT *SearchResult
505 );
506
507 NTSYSAPI
508 PVOID
509 NTAPI
510 RtlEnumerateGenericTableAvl(
511 IN PRTL_AVL_TABLE Table,
512 IN BOOLEAN Restart
513 );
514
515 NTSYSAPI
516 PVOID
517 NTAPI
518 RtlEnumerateGenericTableWithoutSplayingAvl(
519 IN PRTL_AVL_TABLE Table,
520 IN OUT PVOID *RestartKey
521 );
522
523 NTSYSAPI
524 PVOID
525 NTAPI
526 RtlLookupFirstMatchingElementGenericTableAvl(
527 IN PRTL_AVL_TABLE Table,
528 IN PVOID Buffer,
529 OUT PVOID *RestartKey
530 );
531
532 NTSYSAPI
533 PVOID
534 NTAPI
535 RtlEnumerateGenericTableLikeADirectory(
536 IN PRTL_AVL_TABLE Table,
537 IN PRTL_AVL_MATCH_FUNCTION MatchFunction OPTIONAL,
538 IN PVOID MatchData OPTIONAL,
539 IN ULONG NextFlag,
540 IN OUT PVOID *RestartKey,
541 IN OUT PULONG DeleteCount,
542 IN PVOID Buffer
543 );
544
545 NTSYSAPI
546 PVOID
547 NTAPI
548 RtlGetElementGenericTableAvl(
549 IN PRTL_AVL_TABLE Table,
550 IN ULONG I
551 );
552
553 NTSYSAPI
554 ULONG
555 NTAPI
556 RtlNumberGenericTableElementsAvl(
557 IN PRTL_AVL_TABLE Table
558 );
559
560 NTSYSAPI
561 BOOLEAN
562 NTAPI
563 RtlIsGenericTableEmptyAvl(
564 IN PRTL_AVL_TABLE Table
565 );
566
567 #ifdef RTL_USE_AVL_TABLES
568
569 #define RtlInitializeGenericTable RtlInitializeGenericTableAvl
570 #define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl
571 #define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl
572 #define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl
573 #define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl
574 #define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl
575 #define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl
576 #define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl
577 #define RtlGetElementGenericTable RtlGetElementGenericTableAvl
578 #define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl
579 #define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl
580
581 #endif /* RTL_USE_AVL_TABLES */
582
583 #endif /* NTOS_MODE_USER */
584
585 //
586 // Error and Exception Functions
587 //
588 NTSYSAPI
589 PVOID
590 NTAPI
591 RtlAddVectoredExceptionHandler(
592 IN ULONG FirstHandler,
593 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
594 );
595
596 NTSYSAPI
597 VOID
598 NTAPI
599 RtlAssert(
600 IN PVOID FailedAssertion,
601 IN PVOID FileName,
602 IN ULONG LineNumber,
603 IN PCHAR Message
604 );
605
606 NTSYSAPI
607 VOID
608 NTAPI
609 RtlSetUnhandledExceptionFilter(
610 IN PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
611 );
612
613 NTSYSAPI
614 VOID
615 NTAPI
616 RtlCaptureContext(
617 OUT PCONTEXT ContextRecord
618 );
619
620 NTSYSAPI
621 PVOID
622 NTAPI
623 RtlEncodePointer(
624 IN PVOID Pointer
625 );
626
627 NTSYSAPI
628 PVOID
629 NTAPI
630 RtlDecodePointer(
631 IN PVOID Pointer
632 );
633
634 NTSYSAPI
635 PVOID
636 NTAPI
637 RtlEncodeSystemPointer(
638 IN PVOID Pointer
639 );
640
641 NTSYSAPI
642 PVOID
643 NTAPI
644 RtlDecodeSystemPointer(
645 IN PVOID Pointer
646 );
647
648 NTSYSAPI
649 BOOLEAN
650 NTAPI
651 RtlDispatchException(
652 IN PEXCEPTION_RECORD ExceptionRecord,
653 IN PCONTEXT Context
654 );
655
656 NTSYSAPI
657 ULONG
658 NTAPI
659 RtlNtStatusToDosError(
660 IN NTSTATUS Status
661 );
662
663 NTSYSAPI
664 ULONG
665 NTAPI
666 RtlNtStatusToDosErrorNoTeb(
667 IN NTSTATUS Status
668 );
669
670 NTSYSAPI
671 VOID
672 NTAPI
673 RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
674 IN NTSTATUS Status
675 );
676
677 NTSYSAPI
678 VOID
679 NTAPI
680 RtlRaiseException(
681 IN PEXCEPTION_RECORD ExceptionRecord
682 );
683
684 DECLSPEC_NORETURN
685 NTSYSAPI
686 VOID
687 NTAPI
688 RtlRaiseStatus(
689 IN NTSTATUS Status
690 );
691
692 NTSYSAPI
693 LONG
694 NTAPI
695 RtlUnhandledExceptionFilter(
696 IN struct _EXCEPTION_POINTERS* ExceptionInfo
697 );
698
699 NTSYSAPI
700 VOID
701 NTAPI
702 RtlUnwind(
703 IN PVOID TargetFrame OPTIONAL,
704 IN PVOID TargetIp OPTIONAL,
705 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
706 IN PVOID ReturnValue
707 );
708
709 //
710 // Tracing Functions
711 //
712 NTSYSAPI
713 ULONG
714 NTAPI
715 RtlWalkFrameChain(
716 OUT PVOID *Callers,
717 IN ULONG Count,
718 IN ULONG Flags
719 );
720
721 NTSYSAPI
722 USHORT
723 NTAPI
724 RtlLogStackBackTrace(
725 VOID
726 );
727
728 //
729 // Heap Functions
730 //
731 NTSYSAPI
732 PVOID
733 NTAPI
734 RtlAllocateHeap(
735 IN HANDLE HeapHandle,
736 IN ULONG Flags,
737 IN SIZE_T Size
738 );
739
740 NTSYSAPI
741 PVOID
742 NTAPI
743 RtlCreateHeap(
744 IN ULONG Flags,
745 IN PVOID BaseAddress OPTIONAL,
746 IN SIZE_T SizeToReserve OPTIONAL,
747 IN SIZE_T SizeToCommit OPTIONAL,
748 IN PVOID Lock OPTIONAL,
749 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
750 );
751
752 NTSYSAPI
753 ULONG
754 NTAPI
755 RtlCreateTagHeap(
756 IN HANDLE HeapHandle,
757 IN ULONG Flags,
758 IN PWSTR TagName,
759 IN PWSTR TagSubName
760 );
761
762 ULONG
763 NTAPI
764 RtlCompactHeap(
765 HANDLE Heap,
766 ULONG Flags
767 );
768
769 NTSYSAPI
770 PVOID
771 NTAPI
772 RtlDebugCreateHeap(
773 IN ULONG Flags,
774 IN PVOID BaseAddress OPTIONAL,
775 IN SIZE_T SizeToReserve OPTIONAL,
776 IN SIZE_T SizeToCommit OPTIONAL,
777 IN PVOID Lock OPTIONAL,
778 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
779 );
780
781 NTSYSAPI
782 HANDLE
783 NTAPI
784 RtlDestroyHeap(
785 IN HANDLE Heap
786 );
787
788 NTSYSAPI
789 ULONG
790 NTAPI
791 RtlExtendHeap(
792 IN HANDLE Heap,
793 IN ULONG Flags,
794 IN PVOID P,
795 IN SIZE_T Size
796 );
797
798 NTSYSAPI
799 BOOLEAN
800 NTAPI
801 RtlFreeHeap(
802 IN HANDLE HeapHandle,
803 IN ULONG Flags,
804 IN PVOID P
805 );
806
807 NTSYSAPI
808 ULONG
809 NTAPI
810 RtlGetNtGlobalFlags(
811 VOID
812 );
813
814 ULONG
815 NTAPI
816 RtlGetProcessHeaps(
817 ULONG HeapCount,
818 HANDLE *HeapArray
819 );
820
821 BOOLEAN
822 NTAPI
823 RtlGetUserInfoHeap(
824 IN PVOID HeapHandle,
825 IN ULONG Flags,
826 IN PVOID BaseAddress,
827 OUT PVOID *UserValue,
828 OUT PULONG UserFlags
829 );
830
831 NTSYSAPI
832 PVOID
833 NTAPI
834 RtlProtectHeap(
835 IN PVOID HeapHandle,
836 IN BOOLEAN Protect
837 );
838
839 NTSYSAPI
840 NTSTATUS
841 NTAPI
842 RtlQueryHeapInformation (
843 IN PVOID HeapHandle,
844 IN HEAP_INFORMATION_CLASS HeapInformationClass,
845 OUT PVOID HeapInformation OPTIONAL,
846 IN SIZE_T HeapInformationLength OPTIONAL,
847 OUT PSIZE_T ReturnLength OPTIONAL
848 );
849
850 NTSYSAPI
851 PWSTR
852 NTAPI
853 RtlQueryTagHeap(
854 IN PVOID HeapHandle,
855 IN ULONG Flags,
856 IN USHORT TagIndex,
857 IN BOOLEAN ResetCounters,
858 OUT PRTL_HEAP_TAG_INFO HeapTagInfo
859 );
860
861 NTSYSAPI
862 PVOID
863 NTAPI
864 RtlReAllocateHeap(
865 HANDLE Heap,
866 ULONG Flags,
867 PVOID Ptr,
868 SIZE_T Size
869 );
870
871 NTSYSAPI
872 NTSTATUS
873 NTAPI
874 RtlSetHeapInformation (
875 IN PVOID HeapHandle,
876 IN HEAP_INFORMATION_CLASS HeapInformationClass,
877 IN PVOID HeapInformation OPTIONAL,
878 IN SIZE_T HeapInformationLength OPTIONAL
879 );
880
881 NTSYSAPI
882 BOOLEAN
883 NTAPI
884 RtlLockHeap(
885 IN HANDLE Heap
886 );
887
888 NTSYSAPI
889 NTSTATUS
890 NTAPI
891 RtlMultipleAllocateHeap (
892 IN PVOID HeapHandle,
893 IN ULONG Flags,
894 IN SIZE_T Size,
895 IN ULONG Count,
896 OUT PVOID * Array
897 );
898
899 NTSYSAPI
900 NTSTATUS
901 NTAPI
902 RtlMultipleFreeHeap (
903 IN PVOID HeapHandle,
904 IN ULONG Flags,
905 IN ULONG Count,
906 OUT PVOID * Array
907 );
908
909 NTSYSAPI
910 NTSTATUS
911 NTAPI
912 RtlUsageHeap(
913 IN HANDLE Heap,
914 IN ULONG Flags,
915 OUT PRTL_HEAP_USAGE Usage
916 );
917
918 NTSYSAPI
919 BOOLEAN
920 NTAPI
921 RtlUnlockHeap(
922 IN HANDLE Heap
923 );
924
925 BOOLEAN
926 NTAPI
927 RtlSetUserValueHeap(
928 IN PVOID HeapHandle,
929 IN ULONG Flags,
930 IN PVOID BaseAddress,
931 IN PVOID UserValue
932 );
933
934 BOOLEAN
935 NTAPI
936 RtlSetUserFlagsHeap(
937 IN PVOID HeapHandle,
938 IN ULONG Flags,
939 IN PVOID BaseAddress,
940 IN ULONG UserFlagsReset,
941 IN ULONG UserFlagsSet
942 );
943
944 NTSYSAPI
945 SIZE_T
946 NTAPI
947 RtlSizeHeap(
948 IN PVOID HeapHandle,
949 IN ULONG Flags,
950 IN PVOID MemoryPointer
951 );
952
953 NTSYSAPI
954 BOOLEAN
955 NTAPI
956 RtlValidateHeap(
957 HANDLE Heap,
958 ULONG Flags,
959 PVOID P
960 );
961
962 NTSYSAPI
963 NTSTATUS
964 NTAPI
965 RtlWalkHeap(
966 IN HANDLE HeapHandle,
967 IN PVOID HeapEntry
968 );
969
970 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
971
972 //
973 // Security Functions
974 //
975 NTSYSAPI
976 NTSTATUS
977 NTAPI
978 RtlAbsoluteToSelfRelativeSD(
979 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor,
980 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor,
981 IN PULONG BufferLength
982 );
983
984 NTSYSAPI
985 NTSTATUS
986 NTAPI
987 RtlAddAccessAllowedAce(
988 PACL Acl,
989 ULONG Revision,
990 ACCESS_MASK AccessMask,
991 PSID Sid
992 );
993
994 NTSYSAPI
995 NTSTATUS
996 NTAPI
997 RtlAddAccessAllowedAceEx(
998 IN OUT PACL pAcl,
999 IN ULONG dwAceRevision,
1000 IN ULONG AceFlags,
1001 IN ACCESS_MASK AccessMask,
1002 IN PSID pSid
1003 );
1004
1005 NTSYSAPI
1006 NTSTATUS
1007 NTAPI
1008 RtlAddAccessAllowedObjectAce(
1009 IN OUT PACL pAcl,
1010 IN ULONG dwAceRevision,
1011 IN ULONG AceFlags,
1012 IN ACCESS_MASK AccessMask,
1013 IN GUID *ObjectTypeGuid OPTIONAL,
1014 IN GUID *InheritedObjectTypeGuid OPTIONAL,
1015 IN PSID pSid
1016 );
1017
1018 NTSYSAPI
1019 NTSTATUS
1020 NTAPI
1021 RtlAddAccessDeniedAce(
1022 PACL Acl,
1023 ULONG Revision,
1024 ACCESS_MASK AccessMask,
1025 PSID Sid
1026 );
1027
1028 NTSYSAPI
1029 NTSTATUS
1030 NTAPI
1031 RtlAddAccessDeniedAceEx(
1032 IN OUT PACL Acl,
1033 IN ULONG Revision,
1034 IN ULONG Flags,
1035 IN ACCESS_MASK AccessMask,
1036 IN PSID Sid
1037 );
1038
1039 NTSYSAPI
1040 NTSTATUS
1041 NTAPI
1042 RtlAddAccessDeniedObjectAce(
1043 IN OUT PACL pAcl,
1044 IN ULONG dwAceRevision,
1045 IN ULONG AceFlags,
1046 IN ACCESS_MASK AccessMask,
1047 IN GUID *ObjectTypeGuid OPTIONAL,
1048 IN GUID *InheritedObjectTypeGuid OPTIONAL,
1049 IN PSID pSid
1050 );
1051
1052 NTSYSAPI
1053 NTSTATUS
1054 NTAPI
1055 RtlAddAce(
1056 PACL Acl,
1057 ULONG AceRevision,
1058 ULONG StartingAceIndex,
1059 PVOID AceList,
1060 ULONG AceListLength
1061 );
1062
1063 NTSYSAPI
1064 NTSTATUS
1065 NTAPI
1066 RtlAddAuditAccessAce(
1067 PACL Acl,
1068 ULONG Revision,
1069 ACCESS_MASK AccessMask,
1070 PSID Sid,
1071 BOOLEAN Success,
1072 BOOLEAN Failure
1073 );
1074
1075 NTSYSAPI
1076 NTSTATUS
1077 NTAPI
1078 RtlAcquirePrivilege(
1079 IN PULONG Privilege,
1080 IN ULONG NumPriv,
1081 IN ULONG Flags,
1082 OUT PVOID *ReturnedState
1083 );
1084
1085 NTSYSAPI
1086 NTSTATUS
1087 NTAPI
1088 RtlAddAuditAccessAceEx(
1089 IN OUT PACL Acl,
1090 IN ULONG Revision,
1091 IN ULONG Flags,
1092 IN ACCESS_MASK AccessMask,
1093 IN PSID Sid,
1094 IN BOOLEAN Success,
1095 IN BOOLEAN Failure
1096 );
1097
1098 NTSYSAPI
1099 NTSTATUS
1100 NTAPI
1101 RtlAddAuditAccessObjectAce(
1102 IN OUT PACL Acl,
1103 IN ULONG Revision,
1104 IN ULONG Flags,
1105 IN ACCESS_MASK AccessMask,
1106 IN GUID *ObjectTypeGuid OPTIONAL,
1107 IN GUID *InheritedObjectTypeGuid OPTIONAL,
1108 IN PSID Sid,
1109 IN BOOLEAN Success,
1110 IN BOOLEAN Failure
1111 );
1112
1113 NTSYSAPI
1114 NTSTATUS
1115 NTAPI
1116 RtlAddMandatoryAce(
1117 IN OUT PACL Acl,
1118 IN ULONG Revision,
1119 IN ULONG Flags,
1120 IN ULONG MandatoryFlags,
1121 IN UCHAR AceType,
1122 IN PSID LabelSid);
1123
1124 NTSYSAPI
1125 NTSTATUS
1126 NTAPI
1127 RtlAdjustPrivilege(
1128 IN ULONG Privilege,
1129 IN BOOLEAN NewValue,
1130 IN BOOLEAN ForThread,
1131 OUT PBOOLEAN OldValue
1132 );
1133
1134 NTSYSAPI
1135 NTSTATUS
1136 NTAPI
1137 RtlAllocateAndInitializeSid(
1138 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1139 IN UCHAR SubAuthorityCount,
1140 IN ULONG SubAuthority0,
1141 IN ULONG SubAuthority1,
1142 IN ULONG SubAuthority2,
1143 IN ULONG SubAuthority3,
1144 IN ULONG SubAuthority4,
1145 IN ULONG SubAuthority5,
1146 IN ULONG SubAuthority6,
1147 IN ULONG SubAuthority7,
1148 OUT PSID *Sid
1149 );
1150
1151 NTSYSAPI
1152 BOOLEAN
1153 NTAPI
1154 RtlAreAllAccessesGranted(
1155 ACCESS_MASK GrantedAccess,
1156 ACCESS_MASK DesiredAccess
1157 );
1158
1159 NTSYSAPI
1160 BOOLEAN
1161 NTAPI
1162 RtlAreAnyAccessesGranted(
1163 ACCESS_MASK GrantedAccess,
1164 ACCESS_MASK DesiredAccess
1165 );
1166
1167 NTSYSAPI
1168 VOID
1169 NTAPI
1170 RtlCopyLuid(
1171 IN PLUID LuidDest,
1172 IN PLUID LuidSrc
1173 );
1174
1175 NTSYSAPI
1176 VOID
1177 NTAPI
1178 RtlCopyLuidAndAttributesArray(
1179 ULONG Count,
1180 PLUID_AND_ATTRIBUTES Src,
1181 PLUID_AND_ATTRIBUTES Dest
1182 );
1183
1184 NTSYSAPI
1185 NTSTATUS
1186 NTAPI
1187 RtlCopySidAndAttributesArray(
1188 ULONG Count,
1189 PSID_AND_ATTRIBUTES Src,
1190 ULONG SidAreaSize,
1191 PSID_AND_ATTRIBUTES Dest,
1192 PVOID SidArea,
1193 PVOID* RemainingSidArea,
1194 PULONG RemainingSidAreaSize
1195 );
1196
1197 NTSYSAPI
1198 NTSTATUS
1199 NTAPI
1200 RtlConvertSidToUnicodeString(
1201 OUT PUNICODE_STRING DestinationString,
1202 IN PSID Sid,
1203 IN BOOLEAN AllocateDestinationString
1204 );
1205
1206 NTSYSAPI
1207 NTSTATUS
1208 NTAPI
1209 RtlCopySid(
1210 IN ULONG Length,
1211 IN PSID Destination,
1212 IN PSID Source
1213 );
1214
1215 NTSYSAPI
1216 NTSTATUS
1217 NTAPI
1218 RtlCreateAcl(
1219 PACL Acl,
1220 ULONG AclSize,
1221 ULONG AclRevision
1222 );
1223
1224 NTSYSAPI
1225 NTSTATUS
1226 NTAPI
1227 RtlCreateSecurityDescriptor(
1228 OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1229 IN ULONG Revision
1230 );
1231
1232 NTSYSAPI
1233 NTSTATUS
1234 NTAPI
1235 RtlCreateSecurityDescriptorRelative(
1236 OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
1237 IN ULONG Revision
1238 );
1239
1240 NTSYSAPI
1241 NTSTATUS
1242 NTAPI
1243 RtlCopySecurityDescriptor(
1244 IN PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
1245 OUT PSECURITY_DESCRIPTOR pDestinationSecurityDescriptor
1246 );
1247
1248 NTSYSAPI
1249 NTSTATUS
1250 NTAPI
1251 RtlDeleteAce(
1252 PACL Acl,
1253 ULONG AceIndex
1254 );
1255
1256 NTSYSAPI
1257 BOOLEAN
1258 NTAPI
1259 RtlEqualPrefixSid(
1260 PSID Sid1,
1261 PSID Sid2
1262 );
1263
1264 NTSYSAPI
1265 BOOLEAN
1266 NTAPI
1267 RtlEqualSid (
1268 IN PSID Sid1,
1269 IN PSID Sid2
1270 );
1271
1272 NTSYSAPI
1273 BOOLEAN
1274 NTAPI
1275 RtlFirstFreeAce(
1276 PACL Acl,
1277 PACE* Ace
1278 );
1279
1280 NTSYSAPI
1281 PVOID
1282 NTAPI
1283 RtlFreeSid (
1284 IN PSID Sid
1285 );
1286
1287 NTSYSAPI
1288 NTSTATUS
1289 NTAPI
1290 RtlGetAce(
1291 PACL Acl,
1292 ULONG AceIndex,
1293 PVOID *Ace
1294 );
1295
1296 NTSYSAPI
1297 NTSTATUS
1298 NTAPI
1299 RtlGetControlSecurityDescriptor(
1300 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1301 OUT PSECURITY_DESCRIPTOR_CONTROL Control,
1302 OUT PULONG Revision
1303 );
1304
1305 NTSYSAPI
1306 NTSTATUS
1307 NTAPI
1308 RtlGetDaclSecurityDescriptor(
1309 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1310 OUT PBOOLEAN DaclPresent,
1311 OUT PACL *Dacl,
1312 OUT PBOOLEAN DaclDefaulted
1313 );
1314
1315 NTSYSAPI
1316 NTSTATUS
1317 NTAPI
1318 RtlGetSaclSecurityDescriptor(
1319 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1320 OUT PBOOLEAN SaclPresent,
1321 OUT PACL* Sacl,
1322 OUT PBOOLEAN SaclDefaulted
1323 );
1324
1325 NTSYSAPI
1326 NTSTATUS
1327 NTAPI
1328 RtlGetGroupSecurityDescriptor(
1329 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1330 OUT PSID *Group,
1331 OUT PBOOLEAN GroupDefaulted
1332 );
1333
1334 NTSYSAPI
1335 NTSTATUS
1336 NTAPI
1337 RtlGetOwnerSecurityDescriptor(
1338 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1339 OUT PSID *Owner,
1340 OUT PBOOLEAN OwnerDefaulted
1341 );
1342
1343 NTSYSAPI
1344 BOOLEAN
1345 NTAPI
1346 RtlGetSecurityDescriptorRMControl(
1347 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1348 OUT PUCHAR RMControl
1349 );
1350
1351 NTSYSAPI
1352 PSID_IDENTIFIER_AUTHORITY
1353 NTAPI
1354 RtlIdentifierAuthoritySid(PSID Sid);
1355
1356 NTSYSAPI
1357 NTSTATUS
1358 NTAPI
1359 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
1360
1361 NTSYSAPI
1362 NTSTATUS
1363 NTAPI
1364 RtlInitializeSid(
1365 IN OUT PSID Sid,
1366 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
1367 IN UCHAR SubAuthorityCount
1368 );
1369
1370 NTSYSAPI
1371 ULONG
1372 NTAPI
1373 RtlLengthRequiredSid(IN ULONG SubAuthorityCount);
1374
1375 NTSYSAPI
1376 ULONG
1377 NTAPI
1378 RtlLengthSid(IN PSID Sid);
1379
1380 NTSYSAPI
1381 NTSTATUS
1382 NTAPI
1383 RtlMakeSelfRelativeSD(
1384 IN PSECURITY_DESCRIPTOR AbsoluteSD,
1385 OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
1386 IN OUT PULONG BufferLength);
1387
1388 NTSYSAPI
1389 VOID
1390 NTAPI
1391 RtlMapGenericMask(
1392 PACCESS_MASK AccessMask,
1393 PGENERIC_MAPPING GenericMapping
1394 );
1395
1396 #ifdef NTOS_MODE_USER
1397
1398 NTSYSAPI
1399 NTSTATUS
1400 NTAPI
1401 RtlQueryInformationAcl(
1402 PACL Acl,
1403 PVOID Information,
1404 ULONG InformationLength,
1405 ACL_INFORMATION_CLASS InformationClass
1406 );
1407
1408 #endif
1409
1410 NTSYSAPI
1411 VOID
1412 NTAPI
1413 RtlReleasePrivilege(
1414 IN PVOID ReturnedState
1415 );
1416
1417 NTSYSAPI
1418 NTSTATUS
1419 NTAPI
1420 RtlSelfRelativeToAbsoluteSD(
1421 IN PSECURITY_DESCRIPTOR SelfRelativeSD,
1422 OUT PSECURITY_DESCRIPTOR AbsoluteSD,
1423 IN PULONG AbsoluteSDSize,
1424 IN PACL Dacl,
1425 IN PULONG DaclSize,
1426 IN PACL Sacl,
1427 IN PULONG SaclSize,
1428 IN PSID Owner,
1429 IN PULONG OwnerSize,
1430 IN PSID PrimaryGroup,
1431 IN PULONG PrimaryGroupSize
1432 );
1433
1434 NTSYSAPI
1435 NTSTATUS
1436 NTAPI
1437 RtlSelfRelativeToAbsoluteSD2(
1438 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD,
1439 OUT PULONG BufferSize
1440 );
1441
1442 NTSYSAPI
1443 NTSTATUS
1444 NTAPI
1445 RtlSetAttributesSecurityDescriptor(
1446 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1447 IN SECURITY_DESCRIPTOR_CONTROL Control,
1448 OUT PULONG Revision
1449 );
1450
1451 NTSYSAPI
1452 NTSTATUS
1453 NTAPI
1454 RtlSetControlSecurityDescriptor(
1455 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
1456 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
1457 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1458 );
1459
1460 NTSYSAPI
1461 NTSTATUS
1462 NTAPI
1463 RtlSetDaclSecurityDescriptor (
1464 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1465 IN BOOLEAN DaclPresent,
1466 IN PACL Dacl,
1467 IN BOOLEAN DaclDefaulted
1468 );
1469
1470 NTSYSAPI
1471 NTSTATUS
1472 NTAPI
1473 RtlSetGroupSecurityDescriptor(
1474 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1475 IN PSID Group,
1476 IN BOOLEAN GroupDefaulted
1477 );
1478
1479 #ifdef NTOS_MODE_USER
1480
1481 NTSYSAPI
1482 NTSTATUS
1483 NTAPI
1484 RtlSetInformationAcl(
1485 PACL Acl,
1486 PVOID Information,
1487 ULONG InformationLength,
1488 ACL_INFORMATION_CLASS InformationClass
1489 );
1490
1491 #endif
1492
1493 NTSYSAPI
1494 NTSTATUS
1495 NTAPI
1496 RtlSetOwnerSecurityDescriptor(
1497 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1498 IN PSID Owner,
1499 IN BOOLEAN OwnerDefaulted
1500 );
1501
1502 NTSYSAPI
1503 NTSTATUS
1504 NTAPI
1505 RtlSetSaclSecurityDescriptor(
1506 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1507 IN BOOLEAN SaclPresent,
1508 IN PACL Sacl,
1509 IN BOOLEAN SaclDefaulted
1510 );
1511
1512 NTSYSAPI
1513 VOID
1514 NTAPI
1515 RtlSetSecurityDescriptorRMControl(
1516 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor,
1517 IN PUCHAR RMControl
1518 );
1519
1520 NTSYSAPI
1521 PUCHAR
1522 NTAPI
1523 RtlSubAuthorityCountSid(
1524 IN PSID Sid
1525 );
1526
1527 NTSYSAPI
1528 PULONG
1529 NTAPI
1530 RtlSubAuthoritySid(
1531 IN PSID Sid,
1532 IN ULONG SubAuthority
1533 );
1534
1535 NTSYSAPI
1536 BOOLEAN
1537 NTAPI
1538 RtlValidRelativeSecurityDescriptor(
1539 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput,
1540 IN ULONG SecurityDescriptorLength,
1541 IN SECURITY_INFORMATION RequiredInformation
1542 );
1543
1544 NTSYSAPI
1545 BOOLEAN
1546 NTAPI
1547 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor);
1548
1549 NTSYSAPI
1550 BOOLEAN
1551 NTAPI
1552 RtlValidSid(IN PSID Sid);
1553
1554 NTSYSAPI
1555 BOOLEAN
1556 NTAPI
1557 RtlValidAcl(PACL Acl);
1558
1559 NTSYSAPI
1560 NTSTATUS
1561 NTAPI
1562 RtlDeleteSecurityObject(
1563 IN PSECURITY_DESCRIPTOR *ObjectDescriptor
1564 );
1565
1566 NTSYSAPI
1567 NTSTATUS
1568 NTAPI
1569 RtlNewSecurityObject(
1570 IN PSECURITY_DESCRIPTOR ParentDescriptor,
1571 IN PSECURITY_DESCRIPTOR CreatorDescriptor,
1572 OUT PSECURITY_DESCRIPTOR *NewDescriptor,
1573 IN BOOLEAN IsDirectoryObject,
1574 IN HANDLE Token,
1575 IN PGENERIC_MAPPING GenericMapping
1576 );
1577
1578 NTSYSAPI
1579 NTSTATUS
1580 NTAPI
1581 RtlQuerySecurityObject(
1582 IN PSECURITY_DESCRIPTOR ObjectDescriptor,
1583 IN SECURITY_INFORMATION SecurityInformation,
1584 OUT PSECURITY_DESCRIPTOR ResultantDescriptor,
1585 IN ULONG DescriptorLength,
1586 OUT PULONG ReturnLength
1587 );
1588
1589 NTSYSAPI
1590 NTSTATUS
1591 NTAPI
1592 RtlSetSecurityObject(
1593 IN SECURITY_INFORMATION SecurityInformation,
1594 IN PSECURITY_DESCRIPTOR ModificationDescriptor,
1595 OUT PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
1596 IN PGENERIC_MAPPING GenericMapping,
1597 IN HANDLE Token
1598 );
1599
1600 //
1601 // Single-Character Functions
1602 //
1603 NTSYSAPI
1604 NTSTATUS
1605 NTAPI
1606 RtlLargeIntegerToChar(
1607 IN PLARGE_INTEGER Value,
1608 IN ULONG Base,
1609 IN ULONG Length,
1610 IN OUT PCHAR String
1611 );
1612
1613 NTSYSAPI
1614 CHAR
1615 NTAPI
1616 RtlUpperChar(CHAR Source);
1617
1618 NTSYSAPI
1619 WCHAR
1620 NTAPI
1621 RtlUpcaseUnicodeChar(WCHAR Source);
1622
1623 NTSYSAPI
1624 WCHAR
1625 NTAPI
1626 RtlDowncaseUnicodeChar(IN WCHAR Source);
1627
1628 NTSYSAPI
1629 NTSTATUS
1630 NTAPI
1631 RtlIntegerToChar(
1632 IN ULONG Value,
1633 IN ULONG Base,
1634 IN ULONG Length,
1635 IN OUT PCHAR String
1636 );
1637
1638 NTSYSAPI
1639 NTSTATUS
1640 NTAPI
1641 RtlIntegerToUnicode(
1642 IN ULONG Value,
1643 IN ULONG Base OPTIONAL,
1644 IN ULONG Length OPTIONAL,
1645 IN OUT LPWSTR String
1646 );
1647
1648 NTSYSAPI
1649 NTSTATUS
1650 NTAPI
1651 RtlIntegerToUnicodeString(
1652 IN ULONG Value,
1653 IN ULONG Base,
1654 IN OUT PUNICODE_STRING String
1655 );
1656
1657 NTSYSAPI
1658 NTSTATUS
1659 NTAPI
1660 RtlCharToInteger(
1661 PCSZ String,
1662 ULONG Base,
1663 PULONG Value
1664 );
1665
1666 //
1667 // Byte Swap Functions
1668 //
1669 #ifdef NTOS_MODE_USER
1670
1671 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
1672 ((defined(_M_AMD64) || \
1673 defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
1674
1675 unsigned short __cdecl _byteswap_ushort(unsigned short);
1676 unsigned long __cdecl _byteswap_ulong (unsigned long);
1677 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
1678 #pragma intrinsic(_byteswap_ushort)
1679 #pragma intrinsic(_byteswap_ulong)
1680 #pragma intrinsic(_byteswap_uint64)
1681 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1682 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1683 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1684
1685 #elif defined (__GNUC__)
1686
1687 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1688 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1689 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1690
1691 #else
1692
1693 #if (NTDDI_VERSION >= NTDDI_WIN2K)
1694 NTSYSAPI
1695 USHORT
1696 FASTCALL
1697 RtlUshortByteSwap(IN USHORT Source);
1698
1699 NTSYSAPI
1700 ULONG
1701 FASTCALL
1702 RtlUlongByteSwap(IN ULONG Source);
1703
1704 NTSYSAPI
1705 ULONGLONG
1706 FASTCALL
1707 RtlUlonglongByteSwap(IN ULONGLONG Source);
1708 #endif
1709
1710 #endif
1711 #endif // NTOS_MODE_USER
1712
1713 //
1714 // Unicode->Ansi String Functions
1715 //
1716 NTSYSAPI
1717 ULONG
1718 NTAPI
1719 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString);
1720
1721 #ifdef NTOS_MODE_USER
1722
1723 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1724 NLS_MB_CODE_PAGE_TAG ? \
1725 RtlxUnicodeStringToAnsiSize(STRING) : \
1726 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1727 )
1728
1729 #endif
1730
1731 NTSYSAPI
1732 NTSTATUS
1733 NTAPI
1734 RtlUnicodeStringToAnsiString(
1735 PANSI_STRING DestinationString,
1736 PCUNICODE_STRING SourceString,
1737 BOOLEAN AllocateDestinationString
1738 );
1739
1740 //
1741 // Unicode->OEM String Functions
1742 //
1743 NTSYSAPI
1744 NTSTATUS
1745 NTAPI
1746 RtlUpcaseUnicodeStringToOemString(
1747 POEM_STRING DestinationString,
1748 PCUNICODE_STRING SourceString,
1749 BOOLEAN AllocateDestinationString
1750 );
1751
1752 NTSYSAPI
1753 NTSTATUS
1754 NTAPI
1755 RtlUpcaseUnicodeStringToCountedOemString(
1756 IN OUT POEM_STRING DestinationString,
1757 IN PCUNICODE_STRING SourceString,
1758 IN BOOLEAN AllocateDestinationString
1759 );
1760
1761 NTSYSAPI
1762 NTSTATUS
1763 NTAPI
1764 RtlUnicodeStringToOemString(
1765 POEM_STRING DestinationString,
1766 PCUNICODE_STRING SourceString,
1767 BOOLEAN AllocateDestinationString
1768 );
1769
1770 NTSYSAPI
1771 NTSTATUS
1772 NTAPI
1773 RtlUpcaseUnicodeToOemN(
1774 PCHAR OemString,
1775 ULONG OemSize,
1776 PULONG ResultSize,
1777 PCWCH UnicodeString,
1778 ULONG UnicodeSize
1779 );
1780
1781 NTSYSAPI
1782 ULONG
1783 NTAPI
1784 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString);
1785
1786 #ifdef NTOS_MODE_USER
1787
1788 #define RtlUnicodeStringToOemSize(STRING) ( \
1789 NLS_MB_OEM_CODE_PAGE_TAG ? \
1790 RtlxUnicodeStringToOemSize(STRING) : \
1791 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1792 )
1793
1794 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1795 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1796 )
1797
1798 #endif
1799
1800 NTSYSAPI
1801 NTSTATUS
1802 NTAPI
1803 RtlUnicodeToOemN(
1804 PCHAR OemString,
1805 ULONG OemSize,
1806 PULONG ResultSize,
1807 PCWCH UnicodeString,
1808 ULONG UnicodeSize
1809 );
1810
1811 //
1812 // Unicode->MultiByte String Functions
1813 //
1814 NTSYSAPI
1815 NTSTATUS
1816 NTAPI
1817 RtlUnicodeToMultiByteN(
1818 PCHAR MbString,
1819 ULONG MbSize,
1820 PULONG ResultSize,
1821 PCWCH UnicodeString,
1822 ULONG UnicodeSize
1823 );
1824
1825 NTSYSAPI
1826 NTSTATUS
1827 NTAPI
1828 RtlUpcaseUnicodeToMultiByteN(
1829 PCHAR MbString,
1830 ULONG MbSize,
1831 PULONG ResultSize,
1832 PCWCH UnicodeString,
1833 ULONG UnicodeSize
1834 );
1835
1836 NTSYSAPI
1837 NTSTATUS
1838 NTAPI
1839 RtlUnicodeToMultiByteSize(
1840 PULONG MbSize,
1841 PCWCH UnicodeString,
1842 ULONG UnicodeSize
1843 );
1844
1845 NTSYSAPI
1846 ULONG
1847 NTAPI
1848 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString);
1849
1850 //
1851 // OEM to Unicode Functions
1852 //
1853 NTSYSAPI
1854 NTSTATUS
1855 NTAPI
1856 RtlOemStringToUnicodeString(
1857 PUNICODE_STRING DestinationString,
1858 PCOEM_STRING SourceString,
1859 BOOLEAN AllocateDestinationString
1860 );
1861
1862 NTSYSAPI
1863 NTSTATUS
1864 NTAPI
1865 RtlOemToUnicodeN(
1866 PWSTR UnicodeString,
1867 ULONG MaxBytesInUnicodeString,
1868 PULONG BytesInUnicodeString,
1869 IN PCCH OemString,
1870 ULONG BytesInOemString
1871 );
1872
1873 #ifdef NTOS_MODE_USER
1874
1875 #define RtlOemStringToUnicodeSize(STRING) ( \
1876 NLS_MB_OEM_CODE_PAGE_TAG ? \
1877 RtlxOemStringToUnicodeSize(STRING) : \
1878 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1879 )
1880
1881 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1882 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1883 )
1884
1885 #endif
1886
1887 //
1888 // Ansi->Unicode String Functions
1889 //
1890 NTSYSAPI
1891 ULONG
1892 NTAPI
1893 RtlxAnsiStringToUnicodeSize(
1894 PCANSI_STRING AnsiString
1895 );
1896
1897 NTSYSAPI
1898 NTSTATUS
1899 NTAPI
1900 RtlAnsiStringToUnicodeString(
1901 PUNICODE_STRING DestinationString,
1902 PCANSI_STRING SourceString,
1903 BOOLEAN AllocateDestinationString
1904 );
1905
1906 #ifdef NTOS_MODE_USER
1907
1908 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1909 NLS_MB_CODE_PAGE_TAG ? \
1910 RtlxAnsiStringToUnicodeSize(STRING) : \
1911 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1912 )
1913
1914 #endif
1915
1916 NTSYSAPI
1917 BOOLEAN
1918 NTAPI
1919 RtlCreateUnicodeStringFromAsciiz(
1920 OUT PUNICODE_STRING Destination,
1921 IN PCSZ Source
1922 );
1923
1924 //
1925 // Unicode String Functions
1926 //
1927 NTSYSAPI
1928 NTSTATUS
1929 NTAPI
1930 RtlAppendUnicodeToString(
1931 PUNICODE_STRING Destination,
1932 PCWSTR Source
1933 );
1934
1935 NTSYSAPI
1936 NTSTATUS
1937 NTAPI
1938 RtlAppendUnicodeStringToString(
1939 PUNICODE_STRING Destination,
1940 PCUNICODE_STRING Source
1941 );
1942
1943 NTSYSAPI
1944 LONG
1945 NTAPI
1946 RtlCompareUnicodeString(
1947 PCUNICODE_STRING String1,
1948 PCUNICODE_STRING String2,
1949 BOOLEAN CaseInsensitive
1950 );
1951
1952 NTSYSAPI
1953 VOID
1954 NTAPI
1955 RtlCopyUnicodeString(
1956 PUNICODE_STRING DestinationString,
1957 PCUNICODE_STRING SourceString
1958 );
1959
1960 NTSYSAPI
1961 BOOLEAN
1962 NTAPI
1963 RtlCreateUnicodeString(
1964 PUNICODE_STRING DestinationString,
1965 PCWSTR SourceString
1966 );
1967
1968 #ifdef NTOS_MODE_USER
1969
1970 NTSYSAPI
1971 NTSTATUS
1972 NTAPI
1973 RtlDowncaseUnicodeString(
1974 IN OUT PUNICODE_STRING UniDest,
1975 IN PCUNICODE_STRING UniSource,
1976 IN BOOLEAN AllocateDestinationString
1977 );
1978
1979 NTSYSAPI
1980 NTSTATUS
1981 NTAPI
1982 RtlDuplicateUnicodeString(
1983 IN ULONG Flags,
1984 IN PCUNICODE_STRING SourceString,
1985 OUT PUNICODE_STRING DestinationString
1986 );
1987
1988 //
1989 // Memory Functions
1990 //
1991 NTSYSAPI
1992 VOID
1993 NTAPI
1994 RtlFillMemoryUlong(
1995 IN PVOID Destination,
1996 IN SIZE_T Length,
1997 IN ULONG Fill
1998 );
1999
2000 NTSYSAPI
2001 VOID
2002 NTAPI
2003 RtlFillMemoryUlonglong(
2004 OUT PVOID Destination,
2005 IN SIZE_T Length,
2006 IN ULONGLONG Pattern
2007 );
2008
2009
2010 NTSYSAPI
2011 SIZE_T
2012 NTAPI
2013 RtlCompareMemoryUlong(
2014 IN PVOID Source,
2015 IN SIZE_T Length,
2016 IN ULONG Pattern
2017 );
2018
2019 #define RtlCopyBytes RtlCopyMemory
2020 #define RtlFillBytes RtlFillMemory
2021 #define RtlZeroBytes RtlZeroMemory
2022
2023 #endif
2024
2025 NTSYSAPI
2026 BOOLEAN
2027 NTAPI
2028 RtlEqualUnicodeString(
2029 PCUNICODE_STRING String1,
2030 PCUNICODE_STRING String2,
2031 BOOLEAN CaseInsensitive
2032 );
2033
2034 NTSYSAPI
2035 NTSTATUS
2036 NTAPI
2037 RtlFindCharInUnicodeString(
2038 IN ULONG Flags,
2039 IN PCUNICODE_STRING SearchString,
2040 IN PCUNICODE_STRING MatchString,
2041 OUT PUSHORT Position
2042 );
2043
2044 NTSYSAPI
2045 VOID
2046 NTAPI
2047 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
2048
2049 NTSYSAPI
2050 NTSTATUS
2051 NTAPI
2052 RtlHashUnicodeString(
2053 IN CONST UNICODE_STRING *String,
2054 IN BOOLEAN CaseInSensitive,
2055 IN ULONG HashAlgorithm,
2056 OUT PULONG HashValue
2057 );
2058
2059 NTSYSAPI
2060 VOID
2061 NTAPI
2062 RtlInitUnicodeString(
2063 IN OUT PUNICODE_STRING DestinationString,
2064 IN PCWSTR SourceString
2065 );
2066
2067 NTSYSAPI
2068 NTSTATUS
2069 NTAPI
2070 RtlInitUnicodeStringEx(
2071 OUT PUNICODE_STRING DestinationString,
2072 IN PCWSTR SourceString OPTIONAL
2073 );
2074
2075 NTSYSAPI
2076 BOOLEAN
2077 NTAPI
2078 RtlIsTextUnicode(
2079 PVOID Buffer,
2080 INT Length,
2081 INT *Flags
2082 );
2083
2084 NTSYSAPI
2085 BOOLEAN
2086 NTAPI
2087 RtlPrefixString(
2088 PCANSI_STRING String1,
2089 PCANSI_STRING String2,
2090 BOOLEAN CaseInsensitive
2091 );
2092
2093 NTSYSAPI
2094 BOOLEAN
2095 NTAPI
2096 RtlPrefixUnicodeString(
2097 PCUNICODE_STRING String1,
2098 PCUNICODE_STRING String2,
2099 BOOLEAN CaseInsensitive
2100 );
2101
2102 NTSYSAPI
2103 NTSTATUS
2104 NTAPI
2105 RtlUpcaseUnicodeString(
2106 PUNICODE_STRING DestinationString,
2107 PCUNICODE_STRING SourceString,
2108 BOOLEAN AllocateDestinationString
2109 );
2110
2111 NTSYSAPI
2112 NTSTATUS
2113 NTAPI
2114 RtlUnicodeStringToInteger(
2115 PCUNICODE_STRING String,
2116 ULONG Base,
2117 PULONG Value
2118 );
2119
2120 NTSYSAPI
2121 NTSTATUS
2122 NTAPI
2123 RtlValidateUnicodeString(
2124 IN ULONG Flags,
2125 IN PCUNICODE_STRING String
2126 );
2127
2128 //
2129 // Ansi String Functions
2130 //
2131 NTSYSAPI
2132 VOID
2133 NTAPI
2134 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
2135
2136 NTSYSAPI
2137 VOID
2138 NTAPI
2139 RtlInitAnsiString(
2140 PANSI_STRING DestinationString,
2141 PCSZ SourceString
2142 );
2143
2144 NTSYSAPI
2145 NTSTATUS
2146 NTAPI
2147 RtlInitAnsiStringEx(
2148 PANSI_STRING DestinationString,
2149 PCSZ SourceString
2150 );
2151
2152 //
2153 // OEM String Functions
2154 //
2155 NTSYSAPI
2156 VOID
2157 NTAPI
2158 RtlFreeOemString(IN POEM_STRING OemString);
2159
2160 //
2161 // MultiByte->Unicode String Functions
2162 //
2163 NTSYSAPI
2164 NTSTATUS
2165 NTAPI
2166 RtlMultiByteToUnicodeN(
2167 PWCHAR UnicodeString,
2168 ULONG UnicodeSize,
2169 PULONG ResultSize,
2170 PCSTR MbString,
2171 ULONG MbSize
2172 );
2173
2174 NTSYSAPI
2175 NTSTATUS
2176 NTAPI
2177 RtlMultiByteToUnicodeSize(
2178 PULONG UnicodeSize,
2179 PCSTR MbString,
2180 ULONG MbSize
2181 );
2182
2183 //
2184 // Atom Functions
2185 //
2186 NTSYSAPI
2187 NTSTATUS
2188 NTAPI
2189 RtlAddAtomToAtomTable(
2190 IN PRTL_ATOM_TABLE AtomTable,
2191 IN PWSTR AtomName,
2192 OUT PRTL_ATOM Atom
2193 );
2194
2195 NTSYSAPI
2196 NTSTATUS
2197 NTAPI
2198 RtlCreateAtomTable(
2199 IN ULONG TableSize,
2200 IN OUT PRTL_ATOM_TABLE *AtomTable
2201 );
2202
2203 NTSYSAPI
2204 NTSTATUS
2205 NTAPI
2206 RtlDeleteAtomFromAtomTable(
2207 IN PRTL_ATOM_TABLE AtomTable,
2208 IN RTL_ATOM Atom
2209 );
2210
2211 NTSYSAPI
2212 NTSTATUS
2213 NTAPI
2214 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
2215
2216 NTSYSAPI
2217 NTSTATUS
2218 NTAPI
2219 RtlQueryAtomInAtomTable(
2220 IN PRTL_ATOM_TABLE AtomTable,
2221 IN RTL_ATOM Atom,
2222 IN OUT PULONG RefCount OPTIONAL,
2223 IN OUT PULONG PinCount OPTIONAL,
2224 IN OUT PWSTR AtomName OPTIONAL,
2225 IN OUT PULONG NameLength OPTIONAL
2226 );
2227
2228 NTSYSAPI
2229 NTSTATUS
2230 NTAPI
2231 RtlPinAtomInAtomTable(
2232 IN PRTL_ATOM_TABLE AtomTable,
2233 IN RTL_ATOM Atom
2234 );
2235
2236 NTSYSAPI
2237 NTSTATUS
2238 NTAPI
2239 RtlLookupAtomInAtomTable(
2240 IN PRTL_ATOM_TABLE AtomTable,
2241 IN PWSTR AtomName,
2242 OUT PRTL_ATOM Atom
2243 );
2244
2245 //
2246 // Process Management Functions
2247 //
2248 NTSYSAPI
2249 PPEB
2250 NTAPI
2251 RtlGetCurrentPeb(
2252 VOID
2253 );
2254
2255 NTSYSAPI
2256 VOID
2257 NTAPI
2258 RtlAcquirePebLock(VOID);
2259
2260 NTSYSAPI
2261 NTSTATUS
2262 NTAPI
2263 RtlCreateProcessParameters (
2264 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2265 IN PUNICODE_STRING ImagePathName OPTIONAL,
2266 IN PUNICODE_STRING DllPath OPTIONAL,
2267 IN PUNICODE_STRING CurrentDirectory OPTIONAL,
2268 IN PUNICODE_STRING CommandLine OPTIONAL,
2269 IN PWSTR Environment OPTIONAL,
2270 IN PUNICODE_STRING WindowTitle OPTIONAL,
2271 IN PUNICODE_STRING DesktopInfo OPTIONAL,
2272 IN PUNICODE_STRING ShellInfo OPTIONAL,
2273 IN PUNICODE_STRING RuntimeInfo OPTIONAL
2274 );
2275
2276 NTSYSAPI
2277 NTSTATUS
2278 NTAPI
2279 RtlCreateUserProcess(
2280 IN PUNICODE_STRING ImageFileName,
2281 IN ULONG Attributes,
2282 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2283 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL,
2284 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL,
2285 IN HANDLE ParentProcess OPTIONAL,
2286 IN BOOLEAN CurrentDirectory,
2287 IN HANDLE DebugPort OPTIONAL,
2288 IN HANDLE ExceptionPort OPTIONAL,
2289 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
2290 );
2291
2292 NTSYSAPI
2293 NTSTATUS
2294 NTAPI
2295 RtlCreateUserThread(
2296 IN HANDLE ProcessHandle,
2297 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
2298 IN BOOLEAN CreateSuspended,
2299 IN ULONG StackZeroBits,
2300 IN SIZE_T StackReserve,
2301 IN SIZE_T StackCommit,
2302 IN PTHREAD_START_ROUTINE StartAddress,
2303 IN PVOID Parameter,
2304 IN OUT PHANDLE ThreadHandle,
2305 IN OUT PCLIENT_ID ClientId
2306 );
2307
2308 NTSYSAPI
2309 PRTL_USER_PROCESS_PARAMETERS
2310 NTAPI
2311 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2312
2313 NTSYSAPI
2314 NTSTATUS
2315 NTAPI
2316 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2317
2318 NTSYSAPI
2319 VOID
2320 NTAPI
2321 RtlExitUserThread(NTSTATUS Status);
2322
2323 NTSYSAPI
2324 VOID
2325 NTAPI
2326 RtlInitializeContext(
2327 IN HANDLE ProcessHandle,
2328 OUT PCONTEXT ThreadContext,
2329 IN PVOID ThreadStartParam OPTIONAL,
2330 IN PTHREAD_START_ROUTINE ThreadStartAddress,
2331 IN PINITIAL_TEB InitialTeb
2332 );
2333
2334 #ifdef _M_AMD64
2335 typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT;
2336
2337 NTSYSAPI
2338 NTSTATUS
2339 NTAPI
2340 RtlWow64GetThreadContext(
2341 IN HANDLE ThreadHandle,
2342 IN OUT PWOW64_CONTEXT ThreadContext
2343 );
2344
2345
2346 NTSYSAPI
2347 NTSTATUS
2348 NTAPI
2349 RtlWow64SetThreadContext(
2350 IN HANDLE ThreadHandle,
2351 IN PWOW64_CONTEXT ThreadContext
2352 );
2353 #endif
2354
2355 NTSYSAPI
2356 BOOLEAN
2357 NTAPI
2358 RtlIsThreadWithinLoaderCallout(VOID);
2359
2360 NTSYSAPI
2361 PRTL_USER_PROCESS_PARAMETERS
2362 NTAPI
2363 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2364
2365 NTSYSAPI
2366 VOID
2367 NTAPI
2368 RtlReleasePebLock(VOID);
2369
2370 NTSYSAPI
2371 NTSTATUS
2372 NTAPI
2373 RtlRemoteCall(
2374 IN HANDLE Process,
2375 IN HANDLE Thread,
2376 IN PVOID CallSite,
2377 IN ULONG ArgumentCount,
2378 IN PULONG Arguments,
2379 IN BOOLEAN PassContext,
2380 IN BOOLEAN AlreadySuspended
2381 );
2382
2383 NTSYSAPI
2384 NTSTATUS
2385 NTAPI
2386 RtlSetProcessIsCritical(
2387 IN BOOLEAN NewValue,
2388 OUT PBOOLEAN OldValue OPTIONAL,
2389 IN BOOLEAN NeedBreaks
2390 );
2391
2392 NTSYSAPI
2393 NTSTATUS
2394 NTAPI
2395 RtlSetThreadIsCritical(
2396 IN BOOLEAN NewValue,
2397 OUT PBOOLEAN OldValue OPTIONAL,
2398 IN BOOLEAN NeedBreaks
2399 );
2400
2401 NTSYSAPI
2402 ULONG
2403 NTAPI
2404 RtlGetCurrentProcessorNumber(
2405 VOID
2406 );
2407
2408 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
2409
2410 //
2411 // Thread Pool Functions
2412 //
2413 //
2414 NTSTATUS
2415 NTAPI
2416 RtlSetThreadPoolStartFunc(
2417 IN PRTL_START_POOL_THREAD StartPoolThread,
2418 IN PRTL_EXIT_POOL_THREAD ExitPoolThread
2419 );
2420
2421 NTSYSAPI
2422 NTSTATUS
2423 NTAPI
2424 RtlDeregisterWaitEx(
2425 IN HANDLE hWaitHandle,
2426 IN HANDLE hCompletionEvent
2427 );
2428
2429 NTSYSAPI
2430 NTSTATUS
2431 NTAPI
2432 RtlDeregisterWait(
2433 IN HANDLE hWaitHandle
2434 );
2435
2436 NTSYSAPI
2437 NTSTATUS
2438 NTAPI
2439 RtlQueueWorkItem(
2440 IN WORKERCALLBACKFUNC Function,
2441 IN PVOID Context OPTIONAL,
2442 IN ULONG Flags
2443 );
2444
2445 NTSYSAPI
2446 NTSTATUS
2447 NTAPI
2448 RtlSetIoCompletionCallback(
2449 IN HANDLE FileHandle,
2450 IN PIO_APC_ROUTINE Callback,
2451 IN ULONG Flags
2452 );
2453
2454 NTSYSAPI
2455 NTSTATUS
2456 NTAPI
2457 RtlRegisterWait(
2458 IN PHANDLE phNewWaitObject,
2459 IN HANDLE hObject,
2460 IN WAITORTIMERCALLBACKFUNC Callback,
2461 IN PVOID pvContext,
2462 IN ULONG ulMilliseconds,
2463 IN ULONG ulFlags
2464 );
2465
2466 //
2467 // Environment/Path Functions
2468 //
2469 NTSYSAPI
2470 NTSTATUS
2471 NTAPI
2472 RtlCreateEnvironment(
2473 BOOLEAN Inherit,
2474 PWSTR *Environment
2475 );
2476
2477 NTSYSAPI
2478 NTSTATUS
2479 NTAPI
2480 RtlComputePrivatizedDllName_U(
2481 IN PUNICODE_STRING DllName,
2482 OUT PUNICODE_STRING RealName,
2483 OUT PUNICODE_STRING LocalName
2484 );
2485
2486 NTSYSAPI
2487 VOID
2488 NTAPI
2489 RtlDestroyEnvironment(
2490 IN PWSTR Environment
2491 );
2492
2493 NTSYSAPI
2494 BOOLEAN
2495 NTAPI
2496 RtlDoesFileExists_U(
2497 IN PCWSTR FileName
2498 );
2499
2500 NTSYSAPI
2501 ULONG
2502 NTAPI
2503 RtlDetermineDosPathNameType_U(
2504 IN PCWSTR Path
2505 );
2506
2507 NTSYSAPI
2508 ULONG
2509 NTAPI
2510 RtlDosSearchPath_U(
2511 IN PCWSTR Path,
2512 IN PCWSTR FileName,
2513 IN PCWSTR Extension,
2514 IN ULONG BufferSize,
2515 OUT PWSTR Buffer,
2516 OUT PWSTR *PartName
2517 );
2518
2519 ULONG
2520 NTAPI
2521 RtlDosSearchPath_Ustr(
2522 IN ULONG Flags,
2523 IN PUNICODE_STRING PathString,
2524 IN PUNICODE_STRING FileNameString,
2525 IN PUNICODE_STRING ExtensionString,
2526 IN PUNICODE_STRING CallerBuffer,
2527 IN OUT PUNICODE_STRING DynamicString OPTIONAL,
2528 OUT PUNICODE_STRING* FullNameOut OPTIONAL,
2529 OUT PSIZE_T FilePartSize OPTIONAL,
2530 OUT PSIZE_T LengthNeeded OPTIONAL
2531 );
2532
2533 NTSYSAPI
2534 BOOLEAN
2535 NTAPI
2536 RtlDosPathNameToNtPathName_U(
2537 IN PCWSTR DosPathName,
2538 OUT PUNICODE_STRING NtPathName,
2539 OUT PCWSTR *NtFileNamePart,
2540 OUT PRTL_RELATIVE_NAME_U DirectoryInfo
2541 );
2542
2543 NTSYSAPI
2544 BOOLEAN
2545 NTAPI
2546 RtlDosPathNameToRelativeNtPathName_U(
2547 IN PCWSTR DosName,
2548 OUT PUNICODE_STRING NtName,
2549 OUT PCWSTR *PartName,
2550 OUT PRTL_RELATIVE_NAME_U RelativeName
2551 );
2552
2553 NTSYSAPI
2554 NTSTATUS
2555 NTAPI
2556 RtlExpandEnvironmentStrings_U(
2557 PWSTR Environment,
2558 PUNICODE_STRING Source,
2559 PUNICODE_STRING Destination,
2560 PULONG Length
2561 );
2562
2563 NTSYSAPI
2564 ULONG
2565 NTAPI
2566 RtlGetCurrentDirectory_U(
2567 ULONG MaximumLength,
2568 PWSTR Buffer
2569 );
2570
2571 NTSYSAPI
2572 ULONG
2573 NTAPI
2574 RtlGetFullPathName_U(
2575 IN PCWSTR FileName,
2576 IN ULONG Size,
2577 IN PWSTR Buffer,
2578 OUT PWSTR *ShortName
2579 );
2580
2581 #if (NTDDI_VERSION >= NTDDI_WIN7)
2582 NTSYSAPI
2583 NTSTATUS
2584 NTAPI
2585 RtlGetFullPathName_UEx(
2586 IN PWSTR FileName,
2587 IN ULONG BufferLength,
2588 OUT PWSTR Buffer,
2589 OUT OPTIONAL PWSTR *FilePart,
2590 OUT OPTIONAL RTL_PATH_TYPE *InputPathType
2591 );
2592 #endif
2593
2594 NTSTATUS
2595 NTAPI
2596 RtlGetFullPathName_UstrEx(
2597 IN PUNICODE_STRING FileName,
2598 IN PUNICODE_STRING StaticString,
2599 IN PUNICODE_STRING DynamicString,
2600 IN PUNICODE_STRING *StringUsed,
2601 IN PSIZE_T FilePartSize,
2602 OUT PBOOLEAN NameInvalid,
2603 OUT RTL_PATH_TYPE* PathType,
2604 OUT PSIZE_T LengthNeeded
2605 );
2606
2607 NTSYSAPI
2608 ULONG
2609 NTAPI
2610 RtlGetLongestNtPathLength(
2611 VOID
2612 );
2613
2614 NTSYSAPI
2615 ULONG
2616 NTAPI
2617 RtlIsDosDeviceName_U(
2618 IN PCWSTR Name
2619 );
2620
2621 NTSYSAPI
2622 ULONG
2623 NTAPI
2624 RtlIsDosDeviceName_Ustr(
2625 IN PCUNICODE_STRING Name
2626 );
2627
2628
2629 NTSYSAPI
2630 BOOLEAN
2631 NTAPI
2632 RtlIsNameLegalDOS8Dot3(
2633 IN PCUNICODE_STRING Name,
2634 IN OUT POEM_STRING OemName OPTIONAL,
2635 IN OUT PBOOLEAN NameContainsSpaces OPTIONAL
2636 );
2637
2638 NTSYSAPI
2639 NTSTATUS
2640 NTAPI
2641 RtlQueryEnvironmentVariable_U(
2642 IN OPTIONAL PWSTR Environment,
2643 IN PUNICODE_STRING Name,
2644 OUT PUNICODE_STRING Value
2645 );
2646
2647 VOID
2648 NTAPI
2649 RtlReleaseRelativeName(
2650 IN PRTL_RELATIVE_NAME_U RelativeName
2651 );
2652
2653 NTSYSAPI
2654 NTSTATUS
2655 NTAPI
2656 RtlSetCurrentDirectory_U(
2657 IN PUNICODE_STRING name
2658 );
2659
2660 NTSYSAPI
2661 NTSTATUS
2662 NTAPI
2663 RtlSetEnvironmentVariable(
2664 PWSTR *Environment,
2665 PUNICODE_STRING Name,
2666 PUNICODE_STRING Value
2667 );
2668
2669 //
2670 // Critical Section/Resource Functions
2671 //
2672 NTSYSAPI
2673 NTSTATUS
2674 NTAPI
2675 RtlDeleteCriticalSection (
2676 IN PRTL_CRITICAL_SECTION CriticalSection
2677 );
2678
2679 NTSYSAPI
2680 NTSTATUS
2681 NTAPI
2682 RtlEnterCriticalSection(
2683 IN PRTL_CRITICAL_SECTION CriticalSection
2684 );
2685
2686 NTSYSAPI
2687 NTSTATUS
2688 NTAPI
2689 RtlInitializeCriticalSection(
2690 IN PRTL_CRITICAL_SECTION CriticalSection
2691 );
2692
2693 NTSYSAPI
2694 NTSTATUS
2695 NTAPI
2696 RtlInitializeCriticalSectionAndSpinCount(
2697 IN PRTL_CRITICAL_SECTION CriticalSection,
2698 IN ULONG SpinCount
2699 );
2700
2701 NTSYSAPI
2702 NTSTATUS
2703 NTAPI
2704 RtlLeaveCriticalSection(
2705 IN PRTL_CRITICAL_SECTION CriticalSection
2706 );
2707
2708 NTSYSAPI
2709 BOOLEAN
2710 NTAPI
2711 RtlTryEnterCriticalSection(
2712 IN PRTL_CRITICAL_SECTION CriticalSection
2713 );
2714
2715 NTSYSAPI
2716 VOID
2717 NTAPI
2718 RtlpUnWaitCriticalSection(
2719 IN PRTL_CRITICAL_SECTION CriticalSection
2720 );
2721
2722 NTSYSAPI
2723 NTSTATUS
2724 NTAPI
2725 RtlpWaitForCriticalSection(
2726 IN PRTL_CRITICAL_SECTION CriticalSection
2727 );
2728
2729 NTSYSAPI
2730 BOOLEAN
2731 NTAPI
2732 RtlAcquireResourceExclusive(
2733 IN PRTL_RESOURCE Resource,
2734 IN BOOLEAN Wait
2735 );
2736
2737 NTSYSAPI
2738 BOOLEAN
2739 NTAPI
2740 RtlAcquireResourceShared(
2741 IN PRTL_RESOURCE Resource,
2742 IN BOOLEAN Wait
2743 );
2744
2745 NTSYSAPI
2746 VOID
2747 NTAPI
2748 RtlConvertExclusiveToShared(
2749 IN PRTL_RESOURCE Resource
2750 );
2751
2752 NTSYSAPI
2753 VOID
2754 NTAPI
2755 RtlConvertSharedToExclusive(
2756 IN PRTL_RESOURCE Resource
2757 );
2758
2759 NTSYSAPI
2760 VOID
2761 NTAPI
2762 RtlDeleteResource(
2763 IN PRTL_RESOURCE Resource
2764 );
2765
2766 NTSYSAPI
2767 VOID
2768 NTAPI
2769 RtlDumpResource(
2770 IN PRTL_RESOURCE Resource
2771 );
2772
2773 NTSYSAPI
2774 VOID
2775 NTAPI
2776 RtlInitializeResource(
2777 IN PRTL_RESOURCE Resource
2778 );
2779
2780 NTSYSAPI
2781 VOID
2782 NTAPI
2783 RtlReleaseResource(
2784 IN PRTL_RESOURCE Resource
2785 );
2786
2787 //
2788 // Compression Functions
2789 //
2790 NTSYSAPI
2791 NTSTATUS
2792 NTAPI
2793 RtlCompressBuffer(
2794 IN USHORT CompressionFormatAndEngine,
2795 IN PUCHAR UncompressedBuffer,
2796 IN ULONG UncompressedBufferSize,
2797 OUT PUCHAR CompressedBuffer,
2798 IN ULONG CompressedBufferSize,
2799 IN ULONG UncompressedChunkSize,
2800 OUT PULONG FinalCompressedSize,
2801 IN PVOID WorkSpace
2802 );
2803
2804 NTSYSAPI
2805 NTSTATUS
2806 NTAPI
2807 RtlDecompressBuffer(
2808 IN USHORT CompressionFormat,
2809 OUT PUCHAR UncompressedBuffer,
2810 IN ULONG UncompressedBufferSize,
2811 IN PUCHAR CompressedBuffer,
2812 IN ULONG CompressedBufferSize,
2813 OUT PULONG FinalUncompressedSize
2814 );
2815
2816 NTSYSAPI
2817 NTSTATUS
2818 NTAPI
2819 RtlGetCompressionWorkSpaceSize(
2820 IN USHORT CompressionFormatAndEngine,
2821 OUT PULONG CompressBufferWorkSpaceSize,
2822 OUT PULONG CompressFragmentWorkSpaceSize
2823 );
2824
2825 //
2826 // Debug Info Functions
2827 //
2828 NTSYSAPI
2829 PRTL_DEBUG_INFORMATION
2830 NTAPI
2831 RtlCreateQueryDebugBuffer(
2832 IN ULONG Size,
2833 IN BOOLEAN EventPair
2834 );
2835
2836 NTSYSAPI
2837 NTSTATUS
2838 NTAPI
2839 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
2840
2841 NTSYSAPI
2842 NTSTATUS
2843 NTAPI
2844 RtlQueryProcessDebugInformation(
2845 IN ULONG ProcessId,
2846 IN ULONG DebugInfoClassMask,
2847 IN OUT PRTL_DEBUG_INFORMATION DebugBuffer
2848 );
2849
2850 //
2851 // Bitmap Functions
2852 //
2853 NTSYSAPI
2854 BOOLEAN
2855 NTAPI
2856 RtlAreBitsClear(
2857 IN PRTL_BITMAP BitMapHeader,
2858 IN ULONG StartingIndex,
2859 IN ULONG Length
2860 );
2861
2862 NTSYSAPI
2863 BOOLEAN
2864 NTAPI
2865 RtlAreBitsSet(
2866 IN PRTL_BITMAP BitMapHeader,
2867 IN ULONG StartingIndex,
2868 IN ULONG Length
2869 );
2870
2871 NTSYSAPI
2872 VOID
2873 NTAPI
2874 RtlClearBits(
2875 IN PRTL_BITMAP BitMapHeader,
2876 IN ULONG StartingIndex,
2877 IN ULONG NumberToClear
2878 );
2879
2880 NTSYSAPI
2881 ULONG
2882 NTAPI
2883 RtlFindClearBits(
2884 IN PRTL_BITMAP BitMapHeader,
2885 IN ULONG NumberToFind,
2886 IN ULONG HintIndex
2887 );
2888
2889 NTSYSAPI
2890 ULONG
2891 NTAPI
2892 RtlFindClearBitsAndSet(
2893 IN PRTL_BITMAP BitMapHeader,
2894 IN ULONG NumberToFind,
2895 IN ULONG HintIndex
2896 );
2897
2898 NTSYSAPI
2899 ULONG
2900 NTAPI
2901 RtlFindNextForwardRunClear(
2902 IN PRTL_BITMAP BitMapHeader,
2903 IN ULONG FromIndex,
2904 IN PULONG StartingRunIndex
2905 );
2906
2907 NTSYSAPI
2908 VOID
2909 NTAPI
2910 RtlInitializeBitMap(
2911 IN PRTL_BITMAP BitMapHeader,
2912 IN PULONG BitMapBuffer,
2913 IN ULONG SizeOfBitMap
2914 );
2915
2916 NTSYSAPI
2917 ULONG
2918 NTAPI
2919 RtlNumberOfSetBits(
2920 IN PRTL_BITMAP BitMapHeader
2921 );
2922
2923 NTSYSAPI
2924 VOID
2925 NTAPI
2926 RtlSetBit(
2927 PRTL_BITMAP BitMapHeader,
2928 ULONG BitNumber
2929 );
2930
2931 NTSYSAPI
2932 VOID
2933 NTAPI
2934 RtlSetBits(
2935 IN PRTL_BITMAP BitMapHeader,
2936 IN ULONG StartingIndex,
2937 IN ULONG NumberToSet
2938 );
2939
2940 NTSYSAPI
2941 VOID
2942 NTAPI
2943 RtlSetAllBits(
2944 PRTL_BITMAP BitMapHeader
2945 );
2946
2947 NTSYSAPI
2948 BOOLEAN
2949 NTAPI
2950 RtlTestBit(
2951 PRTL_BITMAP BitMapHeader,
2952 ULONG BitNumber
2953 );
2954
2955 //
2956 // Timer Functions
2957 //
2958 NTSYSAPI
2959 NTSTATUS
2960 NTAPI
2961 RtlCreateTimer(
2962 HANDLE TimerQueue,
2963 PHANDLE phNewTimer,
2964 WAITORTIMERCALLBACKFUNC Callback,
2965 PVOID Parameter,
2966 ULONG DueTime,
2967 ULONG Period,
2968 ULONG Flags
2969 );
2970
2971 NTSYSAPI
2972 NTSTATUS
2973 NTAPI
2974 RtlCreateTimerQueue(PHANDLE TimerQueue);
2975
2976 NTSYSAPI
2977 NTSTATUS
2978 NTAPI
2979 RtlDeleteTimer(
2980 HANDLE TimerQueue,
2981 HANDLE Timer,
2982 HANDLE CompletionEvent
2983 );
2984
2985 NTSYSAPI
2986 NTSTATUS
2987 NTAPI
2988 RtlUpdateTimer(
2989 HANDLE TimerQueue,
2990 HANDLE Timer,
2991 ULONG DueTime,
2992 ULONG Period
2993 );
2994
2995 NTSYSAPI
2996 NTSTATUS
2997 NTAPI
2998 RtlDeleteTimerQueueEx(
2999 HANDLE TimerQueue,
3000 HANDLE CompletionEvent
3001 );
3002
3003 NTSYSAPI
3004 NTSTATUS
3005 NTAPI
3006 RtlDeleteTimerQueue(HANDLE TimerQueue);
3007
3008 //
3009 // SList functions
3010 //
3011 PSLIST_ENTRY
3012 FASTCALL
3013 InterlockedPushListSList(
3014 IN PSLIST_HEADER ListHead,
3015 IN PSLIST_ENTRY List,
3016 IN PSLIST_ENTRY ListEnd,
3017 IN ULONG Count
3018 );
3019
3020 //
3021 // Range List functions
3022 //
3023 NTSYSAPI
3024 VOID
3025 NTAPI
3026 RtlInitializeRangeList(
3027 IN OUT PRTL_RANGE_LIST RangeList
3028 );
3029
3030 NTSYSAPI
3031 VOID
3032 NTAPI
3033 RtlFreeRangeList(
3034 IN PRTL_RANGE_LIST RangeList
3035 );
3036
3037 NTSYSAPI
3038 NTSTATUS
3039 NTAPI
3040 RtlAddRange(
3041 IN OUT PRTL_RANGE_LIST RangeList,
3042 IN ULONGLONG Start,
3043 IN ULONGLONG End,
3044 IN UCHAR Attributes,
3045 IN ULONG Flags,
3046 IN PVOID UserData OPTIONAL,
3047 IN PVOID Owner OPTIONAL
3048 );
3049
3050 //
3051 // Debug Functions
3052 //
3053 ULONG
3054 __cdecl
3055 DbgPrint(
3056 IN PCCH Format,
3057 IN ...
3058 );
3059
3060 NTSYSAPI
3061 ULONG
3062 __cdecl
3063 DbgPrintEx(
3064 IN ULONG ComponentId,
3065 IN ULONG Level,
3066 IN PCCH Format,
3067 IN ...
3068 );
3069
3070 NTSYSAPI
3071 ULONG
3072 NTAPI
3073 DbgPrompt(
3074 IN PCCH Prompt,
3075 OUT PCH Response,
3076 IN ULONG MaximumResponseLength
3077 );
3078
3079 VOID
3080 NTAPI
3081 DbgBreakPoint(
3082 VOID
3083 );
3084
3085 VOID
3086 NTAPI
3087 DbgLoadImageSymbols(
3088 IN PSTRING Name,
3089 IN PVOID Base,
3090 IN ULONG_PTR ProcessId
3091 );
3092
3093 VOID
3094 NTAPI
3095 DbgUnLoadImageSymbols(
3096 IN PSTRING Name,
3097 IN PVOID Base,
3098 IN ULONG_PTR ProcessId
3099 );
3100
3101 VOID
3102 NTAPI
3103 DbgCommandString(
3104 IN PCCH Name,
3105 IN PCCH Command
3106 );
3107
3108 //
3109 // Generic Table Functions
3110 //
3111 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3112 NTSYSAPI
3113 PVOID
3114 NTAPI
3115 RtlInsertElementGenericTable(
3116 IN PRTL_GENERIC_TABLE Table,
3117 IN PVOID Buffer,
3118 IN ULONG BufferSize,
3119 OUT PBOOLEAN NewElement OPTIONAL
3120 );
3121
3122 NTSYSAPI
3123 PVOID
3124 NTAPI
3125 RtlInsertElementGenericTableFull(
3126 IN PRTL_GENERIC_TABLE Table,
3127 IN PVOID Buffer,
3128 IN ULONG BufferSize,
3129 OUT PBOOLEAN NewElement OPTIONAL,
3130 IN PVOID NodeOrParent,
3131 IN TABLE_SEARCH_RESULT SearchResult
3132 );
3133
3134 NTSYSAPI
3135 BOOLEAN
3136 NTAPI
3137 RtlIsGenericTableEmpty(
3138 IN PRTL_GENERIC_TABLE Table
3139 );
3140
3141 NTSYSAPI
3142 PVOID
3143 NTAPI
3144 RtlLookupElementGenericTableFull(
3145 IN PRTL_GENERIC_TABLE Table,
3146 IN PVOID Buffer,
3147 OUT PVOID *NodeOrParent,
3148 OUT TABLE_SEARCH_RESULT *SearchResult
3149 );
3150 #endif
3151
3152 //
3153 // Handle Table Functions
3154 //
3155 NTSYSAPI
3156 PRTL_HANDLE_TABLE_ENTRY
3157 NTAPI
3158 RtlAllocateHandle(
3159 IN PRTL_HANDLE_TABLE HandleTable,
3160 IN OUT PULONG Index
3161 );
3162
3163 NTSYSAPI
3164 VOID
3165 NTAPI
3166 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
3167
3168 NTSYSAPI
3169 BOOLEAN
3170 NTAPI
3171 RtlFreeHandle(
3172 IN PRTL_HANDLE_TABLE HandleTable,
3173 IN PRTL_HANDLE_TABLE_ENTRY Handle
3174 );
3175
3176 NTSYSAPI
3177 VOID
3178 NTAPI
3179 RtlInitializeHandleTable(
3180 IN ULONG TableSize,
3181 IN ULONG HandleSize,
3182 IN PRTL_HANDLE_TABLE HandleTable
3183 );
3184
3185 NTSYSAPI
3186 BOOLEAN
3187 NTAPI
3188 RtlIsValidHandle(
3189 IN PRTL_HANDLE_TABLE HandleTable,
3190 IN PRTL_HANDLE_TABLE_ENTRY Handle
3191 );
3192
3193 NTSYSAPI
3194 BOOLEAN
3195 NTAPI
3196 RtlIsValidIndexHandle(
3197 IN PRTL_HANDLE_TABLE HandleTable,
3198 IN ULONG Index,
3199 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
3200 );
3201
3202 //
3203 // PE Functions
3204 //
3205 NTSYSAPI
3206 NTSTATUS
3207 NTAPI
3208 RtlFindMessage(
3209 IN PVOID BaseAddress,
3210 IN ULONG Type,
3211 IN ULONG Language,
3212 IN ULONG MessageId,
3213 OUT PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3214 );
3215
3216 NTSYSAPI
3217 ULONG
3218 NTAPI
3219 RtlGetNtGlobalFlags(VOID);
3220
3221 NTSYSAPI
3222 PVOID
3223 NTAPI
3224 RtlImageDirectoryEntryToData(
3225 PVOID BaseAddress,
3226 BOOLEAN MappedAsImage,
3227 USHORT Directory,
3228 PULONG Size
3229 );
3230
3231 NTSYSAPI
3232 PVOID
3233 NTAPI
3234 RtlImageRvaToVa(
3235 PIMAGE_NT_HEADERS NtHeader,
3236 PVOID BaseAddress,
3237 ULONG Rva,
3238 PIMAGE_SECTION_HEADER *SectionHeader
3239 );
3240
3241 NTSYSAPI
3242 PIMAGE_NT_HEADERS
3243 NTAPI
3244 RtlImageNtHeader(IN PVOID BaseAddress);
3245
3246 NTSYSAPI
3247 NTSTATUS
3248 NTAPI
3249 RtlImageNtHeaderEx(
3250 IN ULONG Flags,
3251 IN PVOID BaseAddress,
3252 IN ULONGLONG Size,
3253 IN PIMAGE_NT_HEADERS *NtHeader
3254 );
3255
3256 NTSYSAPI
3257 PIMAGE_SECTION_HEADER
3258 NTAPI
3259 RtlImageRvaToSection(
3260 PIMAGE_NT_HEADERS NtHeader,
3261 PVOID BaseAddress,
3262 ULONG Rva
3263 );
3264
3265 NTSYSAPI
3266 ULONG
3267 NTAPI
3268 LdrRelocateImageWithBias(
3269 IN PVOID NewAddress,
3270 IN LONGLONG AdditionalBias,
3271 IN PCCH LoaderName,
3272 IN ULONG Success,
3273 IN ULONG Conflict,
3274 IN ULONG Invalid
3275 );
3276
3277 //
3278 // Activation Context Functions
3279 //
3280 #ifdef NTOS_MODE_USER
3281 NTSYSAPI
3282 NTSTATUS
3283 NTAPI
3284 RtlActivateActivationContextEx(
3285 IN ULONG Flags,
3286 IN PTEB Teb,
3287 IN PVOID Context,
3288 IN PULONG_PTR Cookie
3289 );
3290
3291 NTSYSAPI
3292 NTSTATUS
3293 NTAPI
3294 RtlActivateActivationContext(
3295 IN ULONG Flags,
3296 IN HANDLE Handle,
3297 OUT PULONG_PTR Cookie
3298 );
3299
3300 NTSYSAPI
3301 VOID
3302 NTAPI
3303 RtlAddRefActivationContext(
3304 PVOID Context
3305 );
3306
3307 NTSYSAPI
3308 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3309 FASTCALL
3310 RtlActivateActivationContextUnsafeFast(
3311 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3312 IN PVOID Context
3313 );
3314
3315 NTSYSAPI
3316 NTSTATUS
3317 NTAPI
3318 RtlAllocateActivationContextStack(
3319 IN PVOID *Context
3320 );
3321
3322 NTSYSAPI
3323 NTSTATUS
3324 NTAPI
3325 RtlCreateActivationContext(
3326 OUT PHANDLE Handle,
3327 IN OUT PVOID ReturnedData
3328 );
3329
3330 NTSYSAPI
3331 NTSTATUS
3332 NTAPI
3333 RtlGetActiveActivationContext(
3334 IN PVOID *Context
3335 );
3336
3337 NTSYSAPI
3338 VOID
3339 NTAPI
3340 RtlReleaseActivationContext(
3341 IN HANDLE handle
3342 );
3343
3344 NTSYSAPI
3345 NTSTATUS
3346 NTAPI
3347 RtlDeactivateActivationContext(
3348 ULONG dwFlags,
3349 ULONG_PTR ulCookie
3350 );
3351
3352 NTSYSAPI
3353 VOID
3354 NTAPI
3355 RtlFreeThreadActivationContextStack(void);
3356
3357 NTSYSAPI
3358 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3359 FASTCALL
3360 RtlDeactivateActivationContextUnsafeFast(
3361 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3362 );
3363
3364 NTSYSAPI
3365 NTSTATUS
3366 NTAPI
3367 RtlDosApplyFileIsolationRedirection_Ustr(
3368 IN ULONG Flags,
3369 IN PUNICODE_STRING OriginalName,
3370 IN PUNICODE_STRING Extension,
3371 IN OUT PUNICODE_STRING StaticString,
3372 IN OUT PUNICODE_STRING DynamicString,
3373 IN OUT PUNICODE_STRING *NewName,
3374 IN PULONG NewFlags,
3375 IN PSIZE_T FileNameSize,
3376 IN PSIZE_T RequiredLength
3377 );
3378
3379 NTSYSAPI
3380 NTSTATUS
3381 NTAPI
3382 RtlFindActivationContextSectionString(
3383 IN ULONG dwFlags,
3384 IN const GUID *ExtensionGuid,
3385 IN ULONG SectionType,
3386 IN PUNICODE_STRING SectionName,
3387 IN OUT PVOID ReturnedData
3388 );
3389
3390 NTSYSAPI
3391 NTSTATUS
3392 NTAPI
3393 RtlQueryInformationActivationContext(
3394 DWORD dwFlags,
3395 PVOID Context,
3396 PVOID pvSubInstance,
3397 ULONG ulInfoClass,
3398 PVOID pvBuffer,
3399 SIZE_T cbBuffer OPTIONAL,
3400 SIZE_T *pcbWrittenOrRequired OPTIONAL
3401 );
3402
3403 NTSYSAPI
3404 NTSTATUS
3405 NTAPI
3406 RtlZombifyActivationContext(
3407 PVOID Context
3408 );
3409
3410 //
3411 // WOW64 Functions
3412 //
3413 NTSYSAPI
3414 NTSTATUS
3415 NTAPI
3416 RtlWow64EnableFsRedirection(
3417 IN BOOLEAN Wow64FsEnableRedirection
3418 );
3419
3420 NTSYSAPI
3421 NTSTATUS
3422 NTAPI
3423 RtlWow64EnableFsRedirectionEx(
3424 IN PVOID Wow64FsEnableRedirection,
3425 OUT PVOID *OldFsRedirectionLevel
3426 );
3427
3428 #endif
3429
3430 //
3431 // Registry Functions
3432 //
3433 NTSYSAPI
3434 NTSTATUS
3435 NTAPI
3436 RtlCheckRegistryKey(
3437 ULONG RelativeTo,
3438 PWSTR Path
3439 );
3440
3441 NTSYSAPI
3442 NTSTATUS
3443 NTAPI
3444 RtlCreateRegistryKey(
3445 IN ULONG RelativeTo,
3446 IN PWSTR Path
3447 );
3448
3449 NTSYSAPI
3450 NTSTATUS
3451 NTAPI
3452 RtlFormatCurrentUserKeyPath(
3453 IN OUT PUNICODE_STRING KeyPath
3454 );
3455
3456 NTSYSAPI
3457 NTSTATUS
3458 NTAPI
3459 RtlOpenCurrentUser(
3460 IN ACCESS_MASK DesiredAccess,
3461 OUT PHANDLE KeyHandle
3462 );
3463
3464 NTSYSAPI
3465 NTSTATUS
3466 NTAPI
3467 RtlQueryRegistryValues(
3468 IN ULONG RelativeTo,
3469 IN PCWSTR Path,
3470 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
3471 IN PVOID Context,
3472 IN PVOID Environment
3473 );
3474
3475 NTSYSAPI
3476 NTSTATUS
3477 NTAPI
3478 RtlWriteRegistryValue(
3479 ULONG RelativeTo,
3480 PCWSTR Path,
3481 PCWSTR ValueName,
3482 ULONG ValueType,
3483 PVOID ValueData,
3484 ULONG ValueLength
3485 );
3486
3487 #ifdef NTOS_MODE_USER
3488 NTSYSAPI
3489 NTSTATUS
3490 NTAPI
3491 RtlpNtCreateKey(
3492 OUT HANDLE KeyHandle,
3493 IN ACCESS_MASK DesiredAccess,
3494 IN POBJECT_ATTRIBUTES ObjectAttributes,
3495 IN ULONG TitleIndex,
3496 IN PUNICODE_STRING Class,
3497 OUT PULONG Disposition
3498 );
3499
3500 NTSYSAPI
3501 NTSTATUS
3502 NTAPI
3503 RtlpNtEnumerateSubKey(
3504 IN HANDLE KeyHandle,
3505 OUT PUNICODE_STRING SubKeyName,
3506 IN ULONG Index,
3507 IN ULONG Unused
3508 );
3509
3510 NTSYSAPI
3511 NTSTATUS
3512 NTAPI
3513 RtlpNtMakeTemporaryKey(
3514 IN HANDLE KeyHandle
3515 );
3516
3517 NTSYSAPI
3518 NTSTATUS
3519 NTAPI
3520 RtlpNtOpenKey(
3521 OUT HANDLE KeyHandle,
3522 IN ACCESS_MASK DesiredAccess,
3523 IN POBJECT_ATTRIBUTES ObjectAttributes,
3524 IN ULONG Unused
3525 );
3526
3527 NTSYSAPI
3528 NTSTATUS
3529 NTAPI
3530 RtlpNtQueryValueKey(
3531 IN HANDLE KeyHandle,
3532 OUT PULONG Type OPTIONAL,
3533 OUT PVOID Data OPTIONAL,
3534 IN OUT PULONG DataLength OPTIONAL,
3535 IN ULONG Unused
3536 );
3537
3538 NTSYSAPI
3539 NTSTATUS
3540 NTAPI
3541 RtlpNtSetValueKey(
3542 IN HANDLE KeyHandle,
3543 IN ULONG Type,
3544 IN PVOID Data,
3545 IN ULONG DataLength
3546 );
3547 #endif
3548
3549 //
3550 // NLS Functions
3551 //
3552 NTSYSAPI
3553 VOID
3554 NTAPI
3555 RtlGetDefaultCodePage(
3556 OUT PUSHORT AnsiCodePage,
3557 OUT PUSHORT OemCodePage
3558 );
3559
3560 NTSYSAPI
3561 VOID
3562 NTAPI
3563 RtlInitNlsTables(
3564 IN PUSHORT AnsiTableBase,
3565 IN PUSHORT OemTableBase,
3566 IN PUSHORT CaseTableBase,
3567 OUT PNLSTABLEINFO NlsTable
3568 );
3569
3570 NTSYSAPI
3571 VOID
3572 NTAPI
3573 RtlInitCodePageTable(
3574 IN PUSHORT TableBase,
3575 OUT PCPTABLEINFO CodePageTable
3576 );
3577
3578 NTSYSAPI
3579 VOID
3580 NTAPI
3581 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
3582
3583 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
3584
3585 //
3586 // Misc conversion functions
3587 //
3588 static __inline
3589 LARGE_INTEGER
3590 NTAPI_INLINE
3591 RtlConvertLongToLargeInteger(
3592 LONG SignedInteger
3593 )
3594 {
3595 LARGE_INTEGER Result;
3596
3597 Result.QuadPart = SignedInteger;
3598 return Result;
3599 }
3600
3601 static __inline
3602 LARGE_INTEGER
3603 NTAPI_INLINE
3604 RtlEnlargedIntegerMultiply(
3605 LONG Multiplicand,
3606 LONG Multiplier
3607 )
3608 {
3609 LARGE_INTEGER Product;
3610
3611 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3612 return Product;
3613 }
3614
3615 static __inline
3616 ULONG
3617 NTAPI_INLINE
3618 RtlEnlargedUnsignedDivide(
3619 IN ULARGE_INTEGER Dividend,
3620 IN ULONG Divisor,
3621 IN PULONG Remainder OPTIONAL
3622 )
3623 {
3624 ULONG Quotient;
3625
3626 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
3627 if (Remainder) {
3628 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3629 }
3630
3631 return Quotient;
3632 }
3633
3634 static __inline
3635 LARGE_INTEGER
3636 NTAPI_INLINE
3637 RtlEnlargedUnsignedMultiply(
3638 ULONG Multiplicand,
3639 ULONG Multiplier
3640 )
3641 {
3642 LARGE_INTEGER Product;
3643
3644 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3645 return Product;
3646 }
3647
3648 #if defined(_AMD64_) || defined(_IA64_)
3649 static __inline
3650 LARGE_INTEGER
3651 NTAPI_INLINE
3652 RtlExtendedLargeIntegerDivide(
3653 IN LARGE_INTEGER Dividend,
3654 IN ULONG Divisor,
3655 OUT PULONG Remainder OPTIONAL)
3656 {
3657 LARGE_INTEGER ret;
3658 ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
3659 if (Remainder)
3660 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3661 return ret;
3662 }
3663
3664 #else
3665 NTSYSAPI
3666 LARGE_INTEGER
3667 NTAPI
3668 RtlExtendedLargeIntegerDivide(
3669 IN LARGE_INTEGER Dividend,
3670 IN ULONG Divisor,
3671 OUT PULONG Remainder OPTIONAL
3672 );
3673
3674 #endif /* defined(_AMD64_) || defined(_IA64_) */
3675
3676 #endif
3677
3678
3679 NTSYSAPI
3680 ULONG
3681 NTAPI
3682 RtlUniform(
3683 IN PULONG Seed
3684 );
3685
3686 NTSYSAPI
3687 ULONG
3688 NTAPI
3689 RtlRandom(
3690 IN OUT PULONG Seed
3691 );
3692
3693 NTSYSAPI
3694 ULONG
3695 NTAPI
3696 RtlComputeCrc32(
3697 IN ULONG InitialCrc,
3698 IN PUCHAR Buffer,
3699 IN ULONG Length
3700 );
3701
3702 //
3703 // Network Functions
3704 //
3705 NTSYSAPI
3706 NTSTATUS
3707 NTAPI
3708 RtlIpv4StringToAddressW(
3709 IN PCWSTR String,
3710 IN BOOLEAN Strict,
3711 OUT LPWSTR *Terminator,
3712 OUT struct in_addr *Addr
3713 );
3714
3715 NTSYSAPI
3716 NTSTATUS
3717 NTAPI
3718 RtlIpv6StringToAddressA(
3719 IN PCHAR Name,
3720 OUT PCHAR *Terminator,
3721 OUT struct in6_addr *Addr
3722 );
3723
3724 NTSYSAPI
3725 NTSTATUS
3726 NTAPI
3727 RtlIpv6StringToAddressW(
3728 IN PWCHAR Name,
3729 OUT PCHAR *Terminator,
3730 OUT struct in6_addr *Addr
3731 );
3732
3733 NTSYSAPI
3734 NTSTATUS
3735 NTAPI
3736 RtlIpv6StringToAddressExA(
3737 IN PCHAR AddressString,
3738 IN struct in6_addr *Address,
3739 IN PULONG ScopeId,
3740 IN PUSHORT Port
3741 );
3742
3743 NTSYSAPI
3744 NTSTATUS
3745 NTAPI
3746 RtlIpv6StringToAddressExW(
3747 IN PWCHAR AddressName,
3748 IN struct in6_addr *Address,
3749 IN PULONG ScopeId,
3750 IN PUSHORT Port
3751 );
3752
3753
3754 //
3755 // Time Functions
3756 //
3757 NTSYSAPI
3758 NTSTATUS
3759 NTAPI
3760 RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3761
3762 NTSYSAPI
3763 VOID
3764 NTAPI
3765 RtlSecondsSince1970ToTime(
3766 IN ULONG SecondsSince1970,
3767 OUT PLARGE_INTEGER Time
3768 );
3769
3770 NTSYSAPI
3771 NTSTATUS
3772 NTAPI
3773 RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3774
3775 NTSYSAPI
3776 BOOLEAN
3777 NTAPI
3778 RtlTimeFieldsToTime(
3779 PTIME_FIELDS TimeFields,
3780 PLARGE_INTEGER Time
3781 );
3782
3783 NTSYSAPI
3784 BOOLEAN
3785 NTAPI
3786 RtlTimeToSecondsSince1970(
3787 PLARGE_INTEGER Time,
3788 OUT PULONG SecondsSince1970
3789 );
3790
3791 NTSYSAPI
3792 VOID
3793 NTAPI
3794 RtlTimeToTimeFields(
3795 PLARGE_INTEGER Time,
3796 PTIME_FIELDS TimeFields
3797 );
3798
3799 NTSYSAPI
3800 NTSTATUS
3801 NTAPI
3802 RtlSystemTimeToLocalTime(
3803 IN PLARGE_INTEGER SystemTime,
3804 OUT PLARGE_INTEGER LocalTime
3805 );
3806
3807 //
3808 // Version Functions
3809 //
3810 NTSYSAPI
3811 NTSTATUS
3812 NTAPI
3813 RtlVerifyVersionInfo(
3814 IN PRTL_OSVERSIONINFOEXW VersionInfo,
3815 IN ULONG TypeMask,
3816 IN ULONGLONG ConditionMask
3817 );
3818
3819 NTSYSAPI
3820 NTSTATUS
3821 NTAPI
3822 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
3823
3824 NTSYSAPI
3825 BOOLEAN
3826 NTAPI
3827 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
3828
3829 //
3830 // Secure Memory Functions
3831 //
3832 #ifdef NTOS_MODE_USER
3833 NTSYSAPI
3834 NTSTATUS
3835 NTAPI
3836 RtlRegisterSecureMemoryCacheCallback(
3837 IN PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
3838
3839 NTSYSAPI
3840 BOOLEAN
3841 NTAPI
3842 RtlFlushSecureMemoryCache(
3843 IN PVOID MemoryCache,
3844 IN OPTIONAL SIZE_T MemoryLength
3845 );
3846 #endif
3847
3848 //
3849 // Boot Status Data Functions
3850 //
3851 #ifdef NTOS_MODE_USER
3852 NTSYSAPI
3853 NTSTATUS
3854 NTAPI
3855 RtlCreateBootStatusDataFile(
3856 VOID
3857 );
3858
3859 NTSYSAPI
3860 NTSTATUS
3861 NTAPI
3862 RtlGetSetBootStatusData(
3863 IN HANDLE FileHandle,
3864 IN BOOLEAN WriteMode,
3865 IN RTL_BSD_ITEM_TYPE DataClass,
3866 IN PVOID Buffer,
3867 IN ULONG BufferSize,
3868 OUT PULONG ReturnLength OPTIONAL
3869 );
3870
3871 NTSYSAPI
3872 NTSTATUS
3873 NTAPI
3874 RtlLockBootStatusData(
3875 OUT PHANDLE FileHandle
3876 );
3877
3878 NTSYSAPI
3879 NTSTATUS
3880 NTAPI
3881 RtlUnlockBootStatusData(
3882 IN HANDLE FileHandle
3883 );
3884 #endif
3885
3886 #ifdef NTOS_MODE_USER
3887 NTSYSAPI
3888 NTSTATUS
3889 NTAPI
3890 RtlGUIDFromString(
3891 IN PUNICODE_STRING GuidString,
3892 OUT GUID *Guid);
3893
3894 NTSYSAPI
3895 NTSTATUS
3896 NTAPI
3897 RtlComputeImportTableHash(
3898 IN HANDLE hFile,
3899 OUT PCHAR Hash,
3900 IN ULONG ImportTableHashRevision
3901 );
3902 #endif
3903
3904 #ifdef __cplusplus
3905 }
3906 #endif
3907
3908 #endif