6b185beae0f1276d37746f9de42412f40e95b776
[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( #exp, __FILE__, __LINE__, NULL ),FALSE) : \
212 TRUE))
213
214 #define ASSERTMSG( msg, exp ) \
215 ((void)((!(exp)) ? \
216 (RtlAssert( #exp, __FILE__, __LINE__, 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 PVOID
608 NTAPI
609 RtlSetUnhandledExceptionFilter(
610 IN PVOID 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 ULONG 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 PWCHAR 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 ULONG Length,
1997 IN ULONG Fill
1998 );
1999
2000 NTSYSAPI
2001 SIZE_T
2002 NTAPI
2003 RtlCompareMemoryUlong(
2004 IN PVOID Source,
2005 IN SIZE_T Length,
2006 IN ULONG Pattern
2007 );
2008
2009 #define RtlCopyBytes RtlCopyMemory
2010 #define RtlFillBytes RtlFillMemory
2011 #define RtlZeroBytes RtlZeroMemory
2012
2013 #endif
2014
2015 NTSYSAPI
2016 BOOLEAN
2017 NTAPI
2018 RtlEqualUnicodeString(
2019 PCUNICODE_STRING String1,
2020 PCUNICODE_STRING String2,
2021 BOOLEAN CaseInsensitive
2022 );
2023
2024 NTSYSAPI
2025 NTSTATUS
2026 NTAPI
2027 RtlFindCharInUnicodeString(
2028 IN ULONG Flags,
2029 IN PUNICODE_STRING SearchString,
2030 IN PCUNICODE_STRING MatchString,
2031 OUT PUSHORT Position
2032 );
2033
2034 NTSYSAPI
2035 VOID
2036 NTAPI
2037 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString);
2038
2039 NTSYSAPI
2040 NTSTATUS
2041 NTAPI
2042 RtlHashUnicodeString(
2043 IN CONST UNICODE_STRING *String,
2044 IN BOOLEAN CaseInSensitive,
2045 IN ULONG HashAlgorithm,
2046 OUT PULONG HashValue
2047 );
2048
2049 NTSYSAPI
2050 VOID
2051 NTAPI
2052 RtlInitUnicodeString(
2053 IN OUT PUNICODE_STRING DestinationString,
2054 IN PCWSTR SourceString
2055 );
2056
2057 NTSYSAPI
2058 NTSTATUS
2059 NTAPI
2060 RtlInitUnicodeStringEx(
2061 OUT PUNICODE_STRING DestinationString,
2062 IN PCWSTR SourceString OPTIONAL
2063 );
2064
2065 NTSYSAPI
2066 BOOLEAN
2067 NTAPI
2068 RtlIsTextUnicode(
2069 PVOID Buffer,
2070 INT Length,
2071 INT *Flags
2072 );
2073
2074 NTSYSAPI
2075 BOOLEAN
2076 NTAPI
2077 RtlPrefixString(
2078 PCANSI_STRING String1,
2079 PCANSI_STRING String2,
2080 BOOLEAN CaseInsensitive
2081 );
2082
2083 NTSYSAPI
2084 BOOLEAN
2085 NTAPI
2086 RtlPrefixUnicodeString(
2087 PCUNICODE_STRING String1,
2088 PCUNICODE_STRING String2,
2089 BOOLEAN CaseInsensitive
2090 );
2091
2092 NTSYSAPI
2093 NTSTATUS
2094 NTAPI
2095 RtlUpcaseUnicodeString(
2096 PUNICODE_STRING DestinationString,
2097 PCUNICODE_STRING SourceString,
2098 BOOLEAN AllocateDestinationString
2099 );
2100
2101 NTSYSAPI
2102 NTSTATUS
2103 NTAPI
2104 RtlUnicodeStringToInteger(
2105 PCUNICODE_STRING String,
2106 ULONG Base,
2107 PULONG Value
2108 );
2109
2110 NTSYSAPI
2111 NTSTATUS
2112 NTAPI
2113 RtlValidateUnicodeString(
2114 IN ULONG Flags,
2115 IN PCUNICODE_STRING String
2116 );
2117
2118 //
2119 // Ansi String Functions
2120 //
2121 NTSYSAPI
2122 VOID
2123 NTAPI
2124 RtlFreeAnsiString(IN PANSI_STRING AnsiString);
2125
2126 NTSYSAPI
2127 VOID
2128 NTAPI
2129 RtlInitAnsiString(
2130 PANSI_STRING DestinationString,
2131 PCSZ SourceString
2132 );
2133
2134 NTSYSAPI
2135 NTSTATUS
2136 NTAPI
2137 RtlInitAnsiStringEx(
2138 PANSI_STRING DestinationString,
2139 PCSZ SourceString
2140 );
2141
2142 //
2143 // OEM String Functions
2144 //
2145 NTSYSAPI
2146 VOID
2147 NTAPI
2148 RtlFreeOemString(IN POEM_STRING OemString);
2149
2150 //
2151 // MultiByte->Unicode String Functions
2152 //
2153 NTSYSAPI
2154 NTSTATUS
2155 NTAPI
2156 RtlMultiByteToUnicodeN(
2157 PWCHAR UnicodeString,
2158 ULONG UnicodeSize,
2159 PULONG ResultSize,
2160 PCSTR MbString,
2161 ULONG MbSize
2162 );
2163
2164 NTSYSAPI
2165 NTSTATUS
2166 NTAPI
2167 RtlMultiByteToUnicodeSize(
2168 PULONG UnicodeSize,
2169 PCSTR MbString,
2170 ULONG MbSize
2171 );
2172
2173 //
2174 // Atom Functions
2175 //
2176 NTSYSAPI
2177 NTSTATUS
2178 NTAPI
2179 RtlAddAtomToAtomTable(
2180 IN PRTL_ATOM_TABLE AtomTable,
2181 IN PWSTR AtomName,
2182 OUT PRTL_ATOM Atom
2183 );
2184
2185 NTSYSAPI
2186 NTSTATUS
2187 NTAPI
2188 RtlCreateAtomTable(
2189 IN ULONG TableSize,
2190 IN OUT PRTL_ATOM_TABLE *AtomTable
2191 );
2192
2193 NTSYSAPI
2194 NTSTATUS
2195 NTAPI
2196 RtlDeleteAtomFromAtomTable(
2197 IN PRTL_ATOM_TABLE AtomTable,
2198 IN RTL_ATOM Atom
2199 );
2200
2201 NTSYSAPI
2202 NTSTATUS
2203 NTAPI
2204 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
2205
2206 NTSYSAPI
2207 NTSTATUS
2208 NTAPI
2209 RtlQueryAtomInAtomTable(
2210 IN PRTL_ATOM_TABLE AtomTable,
2211 IN RTL_ATOM Atom,
2212 IN OUT PULONG RefCount OPTIONAL,
2213 IN OUT PULONG PinCount OPTIONAL,
2214 IN OUT PWSTR AtomName OPTIONAL,
2215 IN OUT PULONG NameLength OPTIONAL
2216 );
2217
2218 NTSYSAPI
2219 NTSTATUS
2220 NTAPI
2221 RtlPinAtomInAtomTable(
2222 IN PRTL_ATOM_TABLE AtomTable,
2223 IN RTL_ATOM Atom
2224 );
2225
2226 NTSYSAPI
2227 NTSTATUS
2228 NTAPI
2229 RtlLookupAtomInAtomTable(
2230 IN PRTL_ATOM_TABLE AtomTable,
2231 IN PWSTR AtomName,
2232 OUT PRTL_ATOM Atom
2233 );
2234
2235 //
2236 // Process Management Functions
2237 //
2238 NTSYSAPI
2239 PPEB
2240 NTAPI
2241 RtlGetCurrentPeb(
2242 VOID
2243 );
2244
2245 NTSYSAPI
2246 VOID
2247 NTAPI
2248 RtlAcquirePebLock(VOID);
2249
2250 NTSYSAPI
2251 NTSTATUS
2252 NTAPI
2253 RtlCreateProcessParameters (
2254 OUT PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2255 IN PUNICODE_STRING ImagePathName OPTIONAL,
2256 IN PUNICODE_STRING DllPath OPTIONAL,
2257 IN PUNICODE_STRING CurrentDirectory OPTIONAL,
2258 IN PUNICODE_STRING CommandLine OPTIONAL,
2259 IN PWSTR Environment OPTIONAL,
2260 IN PUNICODE_STRING WindowTitle OPTIONAL,
2261 IN PUNICODE_STRING DesktopInfo OPTIONAL,
2262 IN PUNICODE_STRING ShellInfo OPTIONAL,
2263 IN PUNICODE_STRING RuntimeInfo OPTIONAL
2264 );
2265
2266 NTSYSAPI
2267 NTSTATUS
2268 NTAPI
2269 RtlCreateUserProcess(
2270 IN PUNICODE_STRING ImageFileName,
2271 IN ULONG Attributes,
2272 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2273 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL,
2274 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL,
2275 IN HANDLE ParentProcess OPTIONAL,
2276 IN BOOLEAN CurrentDirectory,
2277 IN HANDLE DebugPort OPTIONAL,
2278 IN HANDLE ExceptionPort OPTIONAL,
2279 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
2280 );
2281
2282 NTSYSAPI
2283 NTSTATUS
2284 NTAPI
2285 RtlCreateUserThread(
2286 IN HANDLE ProcessHandle,
2287 IN PSECURITY_DESCRIPTOR SecurityDescriptor,
2288 IN BOOLEAN CreateSuspended,
2289 IN ULONG StackZeroBits,
2290 IN SIZE_T StackReserve,
2291 IN SIZE_T StackCommit,
2292 IN PTHREAD_START_ROUTINE StartAddress,
2293 IN PVOID Parameter,
2294 IN OUT PHANDLE ThreadHandle,
2295 IN OUT PCLIENT_ID ClientId
2296 );
2297
2298 NTSYSAPI
2299 PRTL_USER_PROCESS_PARAMETERS
2300 NTAPI
2301 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2302
2303 NTSYSAPI
2304 NTSTATUS
2305 NTAPI
2306 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2307
2308 NTSYSAPI
2309 VOID
2310 NTAPI
2311 RtlExitUserThread(NTSTATUS Status);
2312
2313 NTSYSAPI
2314 VOID
2315 NTAPI
2316 RtlInitializeContext(
2317 IN HANDLE ProcessHandle,
2318 OUT PCONTEXT ThreadContext,
2319 IN PVOID ThreadStartParam OPTIONAL,
2320 IN PTHREAD_START_ROUTINE ThreadStartAddress,
2321 IN PINITIAL_TEB InitialTeb
2322 );
2323
2324 NTSYSAPI
2325 BOOLEAN
2326 NTAPI
2327 RtlIsThreadWithinLoaderCallout(VOID);
2328
2329 NTSYSAPI
2330 PRTL_USER_PROCESS_PARAMETERS
2331 NTAPI
2332 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2333
2334 NTSYSAPI
2335 VOID
2336 NTAPI
2337 RtlReleasePebLock(VOID);
2338
2339 NTSYSAPI
2340 NTSTATUS
2341 NTAPI
2342 RtlRemoteCall(
2343 IN HANDLE Process,
2344 IN HANDLE Thread,
2345 IN PVOID CallSite,
2346 IN ULONG ArgumentCount,
2347 IN PULONG Arguments,
2348 IN BOOLEAN PassContext,
2349 IN BOOLEAN AlreadySuspended
2350 );
2351
2352 NTSYSAPI
2353 NTSTATUS
2354 NTAPI
2355 RtlSetProcessIsCritical(
2356 IN BOOLEAN NewValue,
2357 OUT PBOOLEAN OldValue OPTIONAL,
2358 IN BOOLEAN NeedBreaks
2359 );
2360
2361 NTSYSAPI
2362 ULONG
2363 NTAPI
2364 RtlGetCurrentProcessorNumber(
2365 VOID
2366 );
2367
2368 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
2369
2370 //
2371 // Thread Pool Functions
2372 //
2373 NTSYSAPI
2374 NTSTATUS
2375 NTAPI
2376 RtlDeregisterWaitEx(
2377 IN HANDLE hWaitHandle,
2378 IN HANDLE hCompletionEvent
2379 );
2380
2381 NTSYSAPI
2382 NTSTATUS
2383 NTAPI
2384 RtlDeregisterWait(
2385 IN HANDLE hWaitHandle
2386 );
2387
2388 NTSYSAPI
2389 NTSTATUS
2390 NTAPI
2391 RtlQueueWorkItem(
2392 IN WORKERCALLBACKFUNC Function,
2393 IN PVOID Context OPTIONAL,
2394 IN ULONG Flags
2395 );
2396
2397 NTSYSAPI
2398 NTSTATUS
2399 NTAPI
2400 RtlSetIoCompletionCallback(
2401 IN HANDLE FileHandle,
2402 IN PIO_APC_ROUTINE Callback,
2403 IN ULONG Flags
2404 );
2405
2406 NTSYSAPI
2407 NTSTATUS
2408 NTAPI
2409 RtlRegisterWait(
2410 IN PHANDLE phNewWaitObject,
2411 IN HANDLE hObject,
2412 IN WAITORTIMERCALLBACKFUNC Callback,
2413 IN PVOID pvContext,
2414 IN ULONG ulMilliseconds,
2415 IN ULONG ulFlags
2416 );
2417
2418 //
2419 // Environment/Path Functions
2420 //
2421 NTSYSAPI
2422 NTSTATUS
2423 NTAPI
2424 RtlCreateEnvironment(
2425 BOOLEAN Inherit,
2426 PWSTR *Environment
2427 );
2428
2429 NTSYSAPI
2430 NTSTATUS
2431 NTAPI
2432 RtlComputePrivatizedDllName_U(
2433 IN PUNICODE_STRING DllName,
2434 OUT PUNICODE_STRING RealName,
2435 OUT PUNICODE_STRING LocalName
2436 );
2437
2438 NTSYSAPI
2439 VOID
2440 NTAPI
2441 RtlDestroyEnvironment(
2442 IN PWSTR Environment
2443 );
2444
2445 NTSYSAPI
2446 BOOLEAN
2447 NTAPI
2448 RtlDoesFileExists_U(
2449 IN PCWSTR FileName
2450 );
2451
2452 NTSYSAPI
2453 BOOLEAN
2454 NTAPI
2455 RtlDoesFileExists_UstrEx(
2456 IN PCUNICODE_STRING FileName,
2457 IN BOOLEAN SucceedIfBusy
2458 );
2459
2460 NTSYSAPI
2461 ULONG
2462 NTAPI
2463 RtlDetermineDosPathNameType_U(
2464 IN PCWSTR Path
2465 );
2466
2467 NTSYSAPI
2468 RTL_PATH_TYPE
2469 NTAPI
2470 RtlDetermineDosPathNameType_Ustr(
2471 IN PCUNICODE_STRING Path
2472 );
2473
2474 NTSYSAPI
2475 ULONG
2476 NTAPI
2477 RtlDosSearchPath_U(
2478 IN PCWSTR Path,
2479 IN PCWSTR FileName,
2480 IN PCWSTR Extension,
2481 IN ULONG BufferSize,
2482 OUT PWSTR Buffer,
2483 OUT PWSTR *PartName
2484 );
2485
2486 NTSYSAPI
2487 BOOLEAN
2488 NTAPI
2489 RtlDosPathNameToNtPathName_U(
2490 IN PCWSTR DosPathName,
2491 OUT PUNICODE_STRING NtPathName,
2492 OUT PCWSTR *NtFileNamePart,
2493 OUT PRTL_RELATIVE_NAME_U DirectoryInfo
2494 );
2495
2496 NTSYSAPI
2497 NTSTATUS
2498 NTAPI
2499 RtlExpandEnvironmentStrings_U(
2500 PWSTR Environment,
2501 PUNICODE_STRING Source,
2502 PUNICODE_STRING Destination,
2503 PULONG Length
2504 );
2505
2506 NTSYSAPI
2507 ULONG
2508 NTAPI
2509 RtlGetCurrentDirectory_U(
2510 ULONG MaximumLength,
2511 PWSTR Buffer
2512 );
2513
2514 NTSYSAPI
2515 ULONG
2516 NTAPI
2517 RtlGetFullPathName_U(
2518 IN PCWSTR FileName,
2519 IN ULONG Size,
2520 IN PWSTR Buffer,
2521 OUT PWSTR *ShortName
2522 );
2523
2524 NTSYSAPI
2525 ULONG
2526 NTAPI
2527 RtlIsDosDeviceName_U(
2528 IN PWSTR Name
2529 );
2530
2531 NTSYSAPI
2532 ULONG
2533 NTAPI
2534 RtlIsDosDeviceName_Ustr(
2535 IN PUNICODE_STRING Name
2536 );
2537
2538
2539 NTSYSAPI
2540 BOOLEAN
2541 NTAPI
2542 RtlIsNameLegalDOS8Dot3(
2543 IN PCUNICODE_STRING Name,
2544 IN OUT POEM_STRING OemName OPTIONAL,
2545 IN OUT PBOOLEAN NameContainsSpaces OPTIONAL
2546 );
2547
2548 NTSYSAPI
2549 NTSTATUS
2550 NTAPI
2551 RtlQueryEnvironmentVariable_U(
2552 PWSTR Environment,
2553 PUNICODE_STRING Name,
2554 PUNICODE_STRING Value
2555 );
2556
2557 VOID
2558 NTAPI
2559 RtlReleaseRelativeName(
2560 IN PRTL_RELATIVE_NAME_U RelativeName
2561 );
2562
2563 NTSYSAPI
2564 NTSTATUS
2565 NTAPI
2566 RtlSetCurrentDirectory_U(
2567 IN PUNICODE_STRING name
2568 );
2569
2570 NTSYSAPI
2571 NTSTATUS
2572 NTAPI
2573 RtlSetEnvironmentVariable(
2574 PWSTR *Environment,
2575 PUNICODE_STRING Name,
2576 PUNICODE_STRING Value
2577 );
2578
2579 //
2580 // Critical Section/Resource Functions
2581 //
2582 NTSYSAPI
2583 NTSTATUS
2584 NTAPI
2585 RtlDeleteCriticalSection (
2586 IN PRTL_CRITICAL_SECTION CriticalSection
2587 );
2588
2589 NTSYSAPI
2590 NTSTATUS
2591 NTAPI
2592 RtlEnterCriticalSection(
2593 IN PRTL_CRITICAL_SECTION CriticalSection
2594 );
2595
2596 NTSYSAPI
2597 NTSTATUS
2598 NTAPI
2599 RtlInitializeCriticalSection(
2600 IN PRTL_CRITICAL_SECTION CriticalSection
2601 );
2602
2603 NTSYSAPI
2604 NTSTATUS
2605 NTAPI
2606 RtlInitializeCriticalSectionAndSpinCount(
2607 IN PRTL_CRITICAL_SECTION CriticalSection,
2608 IN ULONG SpinCount
2609 );
2610
2611 NTSYSAPI
2612 NTSTATUS
2613 NTAPI
2614 RtlLeaveCriticalSection(
2615 IN PRTL_CRITICAL_SECTION CriticalSection
2616 );
2617
2618 NTSYSAPI
2619 BOOLEAN
2620 NTAPI
2621 RtlTryEnterCriticalSection(
2622 IN PRTL_CRITICAL_SECTION CriticalSection
2623 );
2624
2625 NTSYSAPI
2626 VOID
2627 NTAPI
2628 RtlpUnWaitCriticalSection(
2629 IN PRTL_CRITICAL_SECTION CriticalSection
2630 );
2631
2632 NTSYSAPI
2633 NTSTATUS
2634 NTAPI
2635 RtlpWaitForCriticalSection(
2636 IN PRTL_CRITICAL_SECTION CriticalSection
2637 );
2638
2639 NTSYSAPI
2640 BOOLEAN
2641 NTAPI
2642 RtlAcquireResourceExclusive(
2643 IN PRTL_RESOURCE Resource,
2644 IN BOOLEAN Wait
2645 );
2646
2647 NTSYSAPI
2648 BOOLEAN
2649 NTAPI
2650 RtlAcquireResourceShared(
2651 IN PRTL_RESOURCE Resource,
2652 IN BOOLEAN Wait
2653 );
2654
2655 NTSYSAPI
2656 VOID
2657 NTAPI
2658 RtlConvertExclusiveToShared(
2659 IN PRTL_RESOURCE Resource
2660 );
2661
2662 NTSYSAPI
2663 VOID
2664 NTAPI
2665 RtlConvertSharedToExclusive(
2666 IN PRTL_RESOURCE Resource
2667 );
2668
2669 NTSYSAPI
2670 VOID
2671 NTAPI
2672 RtlDeleteResource(
2673 IN PRTL_RESOURCE Resource
2674 );
2675
2676 NTSYSAPI
2677 VOID
2678 NTAPI
2679 RtlDumpResource(
2680 IN PRTL_RESOURCE Resource
2681 );
2682
2683 NTSYSAPI
2684 VOID
2685 NTAPI
2686 RtlInitializeResource(
2687 IN PRTL_RESOURCE Resource
2688 );
2689
2690 NTSYSAPI
2691 VOID
2692 NTAPI
2693 RtlReleaseResource(
2694 IN PRTL_RESOURCE Resource
2695 );
2696
2697 //
2698 // Compression Functions
2699 //
2700 NTSYSAPI
2701 NTSTATUS
2702 NTAPI
2703 RtlCompressBuffer(
2704 IN USHORT CompressionFormatAndEngine,
2705 IN PUCHAR UncompressedBuffer,
2706 IN ULONG UncompressedBufferSize,
2707 OUT PUCHAR CompressedBuffer,
2708 IN ULONG CompressedBufferSize,
2709 IN ULONG UncompressedChunkSize,
2710 OUT PULONG FinalCompressedSize,
2711 IN PVOID WorkSpace
2712 );
2713
2714 NTSYSAPI
2715 NTSTATUS
2716 NTAPI
2717 RtlDecompressBuffer(
2718 IN USHORT CompressionFormat,
2719 OUT PUCHAR UncompressedBuffer,
2720 IN ULONG UncompressedBufferSize,
2721 IN PUCHAR CompressedBuffer,
2722 IN ULONG CompressedBufferSize,
2723 OUT PULONG FinalUncompressedSize
2724 );
2725
2726 NTSYSAPI
2727 NTSTATUS
2728 NTAPI
2729 RtlGetCompressionWorkSpaceSize(
2730 IN USHORT CompressionFormatAndEngine,
2731 OUT PULONG CompressBufferWorkSpaceSize,
2732 OUT PULONG CompressFragmentWorkSpaceSize
2733 );
2734
2735 //
2736 // Debug Info Functions
2737 //
2738 NTSYSAPI
2739 PRTL_DEBUG_INFORMATION
2740 NTAPI
2741 RtlCreateQueryDebugBuffer(
2742 IN ULONG Size,
2743 IN BOOLEAN EventPair
2744 );
2745
2746 NTSYSAPI
2747 NTSTATUS
2748 NTAPI
2749 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
2750
2751 NTSYSAPI
2752 NTSTATUS
2753 NTAPI
2754 RtlQueryProcessDebugInformation(
2755 IN ULONG ProcessId,
2756 IN ULONG DebugInfoClassMask,
2757 IN OUT PRTL_DEBUG_INFORMATION DebugBuffer
2758 );
2759
2760 //
2761 // Bitmap Functions
2762 //
2763 NTSYSAPI
2764 BOOLEAN
2765 NTAPI
2766 RtlAreBitsClear(
2767 IN PRTL_BITMAP BitMapHeader,
2768 IN ULONG StartingIndex,
2769 IN ULONG Length
2770 );
2771
2772 NTSYSAPI
2773 BOOLEAN
2774 NTAPI
2775 RtlAreBitsSet(
2776 IN PRTL_BITMAP BitMapHeader,
2777 IN ULONG StartingIndex,
2778 IN ULONG Length
2779 );
2780
2781 NTSYSAPI
2782 VOID
2783 NTAPI
2784 RtlClearBits(
2785 IN PRTL_BITMAP BitMapHeader,
2786 IN ULONG StartingIndex,
2787 IN ULONG NumberToClear
2788 );
2789
2790 NTSYSAPI
2791 ULONG
2792 NTAPI
2793 RtlFindClearBits(
2794 IN PRTL_BITMAP BitMapHeader,
2795 IN ULONG NumberToFind,
2796 IN ULONG HintIndex
2797 );
2798
2799 NTSYSAPI
2800 ULONG
2801 NTAPI
2802 RtlFindClearBitsAndSet(
2803 IN PRTL_BITMAP BitMapHeader,
2804 IN ULONG NumberToFind,
2805 IN ULONG HintIndex
2806 );
2807
2808 NTSYSAPI
2809 ULONG
2810 NTAPI
2811 RtlFindNextForwardRunClear(
2812 IN PRTL_BITMAP BitMapHeader,
2813 IN ULONG FromIndex,
2814 IN PULONG StartingRunIndex
2815 );
2816
2817 NTSYSAPI
2818 VOID
2819 NTAPI
2820 RtlInitializeBitMap(
2821 IN PRTL_BITMAP BitMapHeader,
2822 IN PULONG BitMapBuffer,
2823 IN ULONG SizeOfBitMap
2824 );
2825
2826 NTSYSAPI
2827 ULONG
2828 NTAPI
2829 RtlNumberOfSetBits(
2830 IN PRTL_BITMAP BitMapHeader
2831 );
2832
2833 NTSYSAPI
2834 VOID
2835 NTAPI
2836 RtlSetBit(
2837 PRTL_BITMAP BitMapHeader,
2838 ULONG BitNumber
2839 );
2840
2841 NTSYSAPI
2842 VOID
2843 NTAPI
2844 RtlSetBits(
2845 IN PRTL_BITMAP BitMapHeader,
2846 IN ULONG StartingIndex,
2847 IN ULONG NumberToSet
2848 );
2849
2850 NTSYSAPI
2851 VOID
2852 NTAPI
2853 RtlSetAllBits(
2854 PRTL_BITMAP BitMapHeader
2855 );
2856
2857 NTSYSAPI
2858 BOOLEAN
2859 NTAPI
2860 RtlTestBit(
2861 PRTL_BITMAP BitMapHeader,
2862 ULONG BitNumber
2863 );
2864
2865 //
2866 // Timer Functions
2867 //
2868 NTSYSAPI
2869 NTSTATUS
2870 NTAPI
2871 RtlCreateTimer(
2872 HANDLE TimerQueue,
2873 PHANDLE phNewTimer,
2874 WAITORTIMERCALLBACKFUNC Callback,
2875 PVOID Parameter,
2876 ULONG DueTime,
2877 ULONG Period,
2878 ULONG Flags
2879 );
2880
2881 NTSYSAPI
2882 NTSTATUS
2883 NTAPI
2884 RtlCreateTimerQueue(PHANDLE TimerQueue);
2885
2886 NTSYSAPI
2887 NTSTATUS
2888 NTAPI
2889 RtlDeleteTimer(
2890 HANDLE TimerQueue,
2891 HANDLE Timer,
2892 HANDLE CompletionEvent
2893 );
2894
2895 NTSYSAPI
2896 NTSTATUS
2897 NTAPI
2898 RtlUpdateTimer(
2899 HANDLE TimerQueue,
2900 HANDLE Timer,
2901 ULONG DueTime,
2902 ULONG Period
2903 );
2904
2905 NTSYSAPI
2906 NTSTATUS
2907 NTAPI
2908 RtlDeleteTimerQueueEx(
2909 HANDLE TimerQueue,
2910 HANDLE CompletionEvent
2911 );
2912
2913 NTSYSAPI
2914 NTSTATUS
2915 NTAPI
2916 RtlDeleteTimerQueue(HANDLE TimerQueue);
2917
2918 //
2919 // SList functions
2920 //
2921 PSLIST_ENTRY
2922 FASTCALL
2923 InterlockedPushListSList(
2924 IN PSLIST_HEADER ListHead,
2925 IN PSLIST_ENTRY List,
2926 IN PSLIST_ENTRY ListEnd,
2927 IN ULONG Count
2928 );
2929
2930 //
2931 // Range List functions
2932 //
2933 NTSYSAPI
2934 VOID
2935 NTAPI
2936 RtlInitializeRangeList(
2937 IN OUT PRTL_RANGE_LIST RangeList
2938 );
2939
2940 NTSYSAPI
2941 VOID
2942 NTAPI
2943 RtlFreeRangeList(
2944 IN PRTL_RANGE_LIST RangeList
2945 );
2946
2947 NTSYSAPI
2948 NTSTATUS
2949 NTAPI
2950 RtlAddRange(
2951 IN OUT PRTL_RANGE_LIST RangeList,
2952 IN ULONGLONG Start,
2953 IN ULONGLONG End,
2954 IN UCHAR Attributes,
2955 IN ULONG Flags,
2956 IN PVOID UserData OPTIONAL,
2957 IN PVOID Owner OPTIONAL
2958 );
2959
2960 //
2961 // Debug Functions
2962 //
2963 ULONG
2964 __cdecl
2965 DbgPrint(
2966 IN PCCH Format,
2967 IN ...
2968 );
2969
2970 NTSYSAPI
2971 ULONG
2972 __cdecl
2973 DbgPrintEx(
2974 IN ULONG ComponentId,
2975 IN ULONG Level,
2976 IN PCCH Format,
2977 IN ...
2978 );
2979
2980 NTSYSAPI
2981 ULONG
2982 NTAPI
2983 DbgPrompt(
2984 IN PCCH Prompt,
2985 OUT PCH Response,
2986 IN ULONG MaximumResponseLength
2987 );
2988
2989 VOID
2990 NTAPI
2991 DbgBreakPoint(
2992 VOID
2993 );
2994
2995 VOID
2996 NTAPI
2997 DbgLoadImageSymbols(
2998 IN PSTRING Name,
2999 IN PVOID Base,
3000 IN ULONG_PTR ProcessId
3001 );
3002
3003 VOID
3004 NTAPI
3005 DbgUnLoadImageSymbols(
3006 IN PSTRING Name,
3007 IN PVOID Base,
3008 IN ULONG_PTR ProcessId
3009 );
3010
3011 VOID
3012 NTAPI
3013 DbgCommandString(
3014 IN PCCH Name,
3015 IN PCCH Command
3016 );
3017
3018 //
3019 // Generic Table Functions
3020 //
3021 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3022 NTSYSAPI
3023 PVOID
3024 NTAPI
3025 RtlInsertElementGenericTable(
3026 IN PRTL_GENERIC_TABLE Table,
3027 IN PVOID Buffer,
3028 IN ULONG BufferSize,
3029 OUT PBOOLEAN NewElement OPTIONAL
3030 );
3031
3032 NTSYSAPI
3033 PVOID
3034 NTAPI
3035 RtlInsertElementGenericTableFull(
3036 IN PRTL_GENERIC_TABLE Table,
3037 IN PVOID Buffer,
3038 IN ULONG BufferSize,
3039 OUT PBOOLEAN NewElement OPTIONAL,
3040 IN PVOID NodeOrParent,
3041 IN TABLE_SEARCH_RESULT SearchResult
3042 );
3043
3044 NTSYSAPI
3045 BOOLEAN
3046 NTAPI
3047 RtlIsGenericTableEmpty(
3048 IN PRTL_GENERIC_TABLE Table
3049 );
3050
3051 NTSYSAPI
3052 PVOID
3053 NTAPI
3054 RtlLookupElementGenericTableFull(
3055 IN PRTL_GENERIC_TABLE Table,
3056 IN PVOID Buffer,
3057 OUT PVOID *NodeOrParent,
3058 OUT TABLE_SEARCH_RESULT *SearchResult
3059 );
3060 #endif
3061
3062 //
3063 // Handle Table Functions
3064 //
3065 NTSYSAPI
3066 PRTL_HANDLE_TABLE_ENTRY
3067 NTAPI
3068 RtlAllocateHandle(
3069 IN PRTL_HANDLE_TABLE HandleTable,
3070 IN OUT PULONG Index
3071 );
3072
3073 NTSYSAPI
3074 VOID
3075 NTAPI
3076 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
3077
3078 NTSYSAPI
3079 BOOLEAN
3080 NTAPI
3081 RtlFreeHandle(
3082 IN PRTL_HANDLE_TABLE HandleTable,
3083 IN PRTL_HANDLE_TABLE_ENTRY Handle
3084 );
3085
3086 NTSYSAPI
3087 VOID
3088 NTAPI
3089 RtlInitializeHandleTable(
3090 IN ULONG TableSize,
3091 IN ULONG HandleSize,
3092 IN PRTL_HANDLE_TABLE HandleTable
3093 );
3094
3095 NTSYSAPI
3096 BOOLEAN
3097 NTAPI
3098 RtlIsValidHandle(
3099 IN PRTL_HANDLE_TABLE HandleTable,
3100 IN PRTL_HANDLE_TABLE_ENTRY Handle
3101 );
3102
3103 NTSYSAPI
3104 BOOLEAN
3105 NTAPI
3106 RtlIsValidIndexHandle(
3107 IN PRTL_HANDLE_TABLE HandleTable,
3108 IN ULONG Index,
3109 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
3110 );
3111
3112 //
3113 // PE Functions
3114 //
3115 NTSYSAPI
3116 NTSTATUS
3117 NTAPI
3118 RtlFindMessage(
3119 IN PVOID BaseAddress,
3120 IN ULONG Type,
3121 IN ULONG Language,
3122 IN ULONG MessageId,
3123 OUT PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3124 );
3125
3126 NTSYSAPI
3127 ULONG
3128 NTAPI
3129 RtlGetNtGlobalFlags(VOID);
3130
3131 NTSYSAPI
3132 PVOID
3133 NTAPI
3134 RtlImageDirectoryEntryToData(
3135 PVOID BaseAddress,
3136 BOOLEAN MappedAsImage,
3137 USHORT Directory,
3138 PULONG Size
3139 );
3140
3141 NTSYSAPI
3142 PVOID
3143 NTAPI
3144 RtlImageRvaToVa(
3145 PIMAGE_NT_HEADERS NtHeader,
3146 PVOID BaseAddress,
3147 ULONG Rva,
3148 PIMAGE_SECTION_HEADER *SectionHeader
3149 );
3150
3151 NTSYSAPI
3152 PIMAGE_NT_HEADERS
3153 NTAPI
3154 RtlImageNtHeader(IN PVOID BaseAddress);
3155
3156 NTSYSAPI
3157 NTSTATUS
3158 NTAPI
3159 RtlImageNtHeaderEx(
3160 IN ULONG Flags,
3161 IN PVOID BaseAddress,
3162 IN ULONGLONG Size,
3163 IN PIMAGE_NT_HEADERS *NtHeader
3164 );
3165
3166 NTSYSAPI
3167 PIMAGE_SECTION_HEADER
3168 NTAPI
3169 RtlImageRvaToSection(
3170 PIMAGE_NT_HEADERS NtHeader,
3171 PVOID BaseAddress,
3172 ULONG Rva
3173 );
3174
3175 NTSYSAPI
3176 ULONG
3177 NTAPI
3178 LdrRelocateImageWithBias(
3179 IN PVOID NewAddress,
3180 IN LONGLONG AdditionalBias,
3181 IN PCCH LoaderName,
3182 IN ULONG Success,
3183 IN ULONG Conflict,
3184 IN ULONG Invalid
3185 );
3186
3187 //
3188 // Activation Context Functions
3189 //
3190 #ifdef NTOS_MODE_USER
3191 NTSYSAPI
3192 NTSTATUS
3193 NTAPI
3194 RtlActivateActivationContextEx(
3195 IN ULONG Flags,
3196 IN PTEB Teb,
3197 IN PVOID Context,
3198 IN PULONG_PTR Cookie
3199 );
3200
3201 NTSYSAPI
3202 NTSTATUS
3203 NTAPI
3204 RtlActivateActivationContext(
3205 IN ULONG Flags,
3206 IN HANDLE Handle,
3207 OUT PULONG_PTR Cookie
3208 );
3209
3210 NTSYSAPI
3211 VOID
3212 NTAPI
3213 RtlAddRefActivationContext(
3214 PVOID Context
3215 );
3216
3217 NTSYSAPI
3218 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3219 FASTCALL
3220 RtlActivateActivationContextUnsafeFast(
3221 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3222 IN PVOID Context
3223 );
3224
3225 NTSYSAPI
3226 NTSTATUS
3227 NTAPI
3228 RtlAllocateActivationContextStack(
3229 IN PVOID *Context
3230 );
3231
3232 NTSYSAPI
3233 NTSTATUS
3234 NTAPI
3235 RtlCreateActivationContext(
3236 OUT PHANDLE Handle,
3237 IN OUT PVOID ReturnedData
3238 );
3239
3240 NTSYSAPI
3241 NTSTATUS
3242 NTAPI
3243 RtlGetActiveActivationContext(
3244 IN PVOID *Context
3245 );
3246
3247 NTSYSAPI
3248 VOID
3249 NTAPI
3250 RtlReleaseActivationContext(
3251 IN HANDLE handle
3252 );
3253
3254 NTSYSAPI
3255 NTSTATUS
3256 NTAPI
3257 RtlDeactivateActivationContext(
3258 ULONG dwFlags,
3259 ULONG_PTR ulCookie
3260 );
3261
3262 NTSYSAPI
3263 VOID
3264 NTAPI
3265 RtlFreeThreadActivationContextStack(void);
3266
3267 NTSYSAPI
3268 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3269 FASTCALL
3270 RtlDeactivateActivationContextUnsafeFast(
3271 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3272 );
3273
3274 NTSYSAPI
3275 NTSTATUS
3276 NTAPI
3277 RtlDosApplyFileIsolationRedirection_Ustr(
3278 IN BOOLEAN Unknown,
3279 IN PUNICODE_STRING OriginalName,
3280 IN PUNICODE_STRING Extension,
3281 IN OUT PUNICODE_STRING RedirectedName,
3282 IN OUT PUNICODE_STRING RedirectedName2,
3283 IN OUT PUNICODE_STRING *OriginalName2,
3284 IN PVOID Unknown1,
3285 IN PVOID Unknown2,
3286 IN PVOID Unknown3
3287 );
3288
3289 NTSYSAPI
3290 NTSTATUS
3291 NTAPI
3292 RtlFindActivationContextSectionString(
3293 IN ULONG dwFlags,
3294 IN const GUID *ExtensionGuid,
3295 IN ULONG SectionType,
3296 IN PUNICODE_STRING SectionName,
3297 IN OUT PVOID ReturnedData
3298 );
3299
3300 NTSYSAPI
3301 NTSTATUS
3302 NTAPI
3303 RtlQueryInformationActivationContext(
3304 DWORD dwFlags,
3305 PVOID Context,
3306 PVOID pvSubInstance,
3307 ULONG ulInfoClass,
3308 PVOID pvBuffer,
3309 SIZE_T cbBuffer OPTIONAL,
3310 SIZE_T *pcbWrittenOrRequired OPTIONAL
3311 );
3312
3313 NTSYSAPI
3314 NTSTATUS
3315 NTAPI
3316 RtlZombifyActivationContext(
3317 PVOID Context
3318 );
3319
3320
3321 #endif
3322
3323 //
3324 // Registry Functions
3325 //
3326 NTSYSAPI
3327 NTSTATUS
3328 NTAPI
3329 RtlCheckRegistryKey(
3330 ULONG RelativeTo,
3331 PWSTR Path
3332 );
3333
3334 NTSYSAPI
3335 NTSTATUS
3336 NTAPI
3337 RtlCreateRegistryKey(
3338 IN ULONG RelativeTo,
3339 IN PWSTR Path
3340 );
3341
3342 NTSYSAPI
3343 NTSTATUS
3344 NTAPI
3345 RtlFormatCurrentUserKeyPath(
3346 IN OUT PUNICODE_STRING KeyPath
3347 );
3348
3349 NTSYSAPI
3350 NTSTATUS
3351 NTAPI
3352 RtlpNtOpenKey(
3353 OUT HANDLE KeyHandle,
3354 IN ACCESS_MASK DesiredAccess,
3355 IN POBJECT_ATTRIBUTES ObjectAttributes,
3356 IN ULONG Unused
3357 );
3358
3359 NTSYSAPI
3360 NTSTATUS
3361 NTAPI
3362 RtlOpenCurrentUser(
3363 IN ACCESS_MASK DesiredAccess,
3364 OUT PHANDLE KeyHandle
3365 );
3366
3367 NTSYSAPI
3368 NTSTATUS
3369 NTAPI
3370 RtlQueryRegistryValues(
3371 IN ULONG RelativeTo,
3372 IN PCWSTR Path,
3373 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
3374 IN PVOID Context,
3375 IN PVOID Environment
3376 );
3377
3378 NTSYSAPI
3379 NTSTATUS
3380 NTAPI
3381 RtlWriteRegistryValue(
3382 ULONG RelativeTo,
3383 PCWSTR Path,
3384 PCWSTR ValueName,
3385 ULONG ValueType,
3386 PVOID ValueData,
3387 ULONG ValueLength
3388 );
3389
3390 //
3391 // NLS Functions
3392 //
3393 NTSYSAPI
3394 VOID
3395 NTAPI
3396 RtlGetDefaultCodePage(
3397 OUT PUSHORT AnsiCodePage,
3398 OUT PUSHORT OemCodePage
3399 );
3400
3401 NTSYSAPI
3402 VOID
3403 NTAPI
3404 RtlInitNlsTables(
3405 IN PUSHORT AnsiTableBase,
3406 IN PUSHORT OemTableBase,
3407 IN PUSHORT CaseTableBase,
3408 OUT PNLSTABLEINFO NlsTable
3409 );
3410
3411 NTSYSAPI
3412 VOID
3413 NTAPI
3414 RtlInitCodePageTable(
3415 IN PUSHORT TableBase,
3416 OUT PCPTABLEINFO CodePageTable
3417 );
3418
3419 NTSYSAPI
3420 VOID
3421 NTAPI
3422 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
3423
3424 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
3425
3426 //
3427 // Misc conversion functions
3428 //
3429 static __inline
3430 LARGE_INTEGER
3431 NTAPI_INLINE
3432 RtlConvertLongToLargeInteger(
3433 LONG SignedInteger
3434 )
3435 {
3436 LARGE_INTEGER Result;
3437
3438 Result.QuadPart = SignedInteger;
3439 return Result;
3440 }
3441
3442 static __inline
3443 LARGE_INTEGER
3444 NTAPI_INLINE
3445 RtlEnlargedIntegerMultiply(
3446 LONG Multiplicand,
3447 LONG Multiplier
3448 )
3449 {
3450 LARGE_INTEGER Product;
3451
3452 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3453 return Product;
3454 }
3455
3456 static __inline
3457 ULONG
3458 NTAPI_INLINE
3459 RtlEnlargedUnsignedDivide(
3460 IN ULARGE_INTEGER Dividend,
3461 IN ULONG Divisor,
3462 IN PULONG Remainder OPTIONAL
3463 )
3464 {
3465 ULONG Quotient;
3466
3467 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
3468 if (Remainder) {
3469 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3470 }
3471
3472 return Quotient;
3473 }
3474
3475 static __inline
3476 LARGE_INTEGER
3477 NTAPI_INLINE
3478 RtlEnlargedUnsignedMultiply(
3479 ULONG Multiplicand,
3480 ULONG Multiplier
3481 )
3482 {
3483 LARGE_INTEGER Product;
3484
3485 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3486 return Product;
3487 }
3488 #endif
3489
3490 NTSYSAPI
3491 ULONG
3492 NTAPI
3493 RtlUniform(
3494 IN PULONG Seed
3495 );
3496
3497 NTSYSAPI
3498 ULONG
3499 NTAPI
3500 RtlRandom(
3501 IN OUT PULONG Seed
3502 );
3503
3504 NTSYSAPI
3505 ULONG
3506 NTAPI
3507 RtlComputeCrc32(
3508 IN ULONG InitialCrc,
3509 IN PUCHAR Buffer,
3510 IN ULONG Length
3511 );
3512
3513 //
3514 // Network Functions
3515 //
3516 NTSYSAPI
3517 NTSTATUS
3518 NTAPI
3519 RtlIpv4StringToAddressW(
3520 IN PCWSTR String,
3521 IN BOOLEAN Strict,
3522 OUT LPWSTR *Terminator,
3523 OUT struct in_addr *Addr
3524 );
3525
3526 NTSYSAPI
3527 NTSTATUS
3528 NTAPI
3529 RtlIpv6StringToAddressA(
3530 IN PCHAR Name,
3531 OUT PCHAR *Terminator,
3532 OUT struct in6_addr *Addr
3533 );
3534
3535 NTSYSAPI
3536 NTSTATUS
3537 NTAPI
3538 RtlIpv6StringToAddressW(
3539 IN PWCHAR Name,
3540 OUT PCHAR *Terminator,
3541 OUT struct in6_addr *Addr
3542 );
3543
3544 NTSYSAPI
3545 NTSTATUS
3546 NTAPI
3547 RtlIpv6StringToAddressExA(
3548 IN PCHAR AddressString,
3549 IN struct in6_addr *Address,
3550 IN PULONG ScopeId,
3551 IN PUSHORT Port
3552 );
3553
3554 NTSYSAPI
3555 NTSTATUS
3556 NTAPI
3557 RtlIpv6StringToAddressExW(
3558 IN PWCHAR AddressName,
3559 IN struct in6_addr *Address,
3560 IN PULONG ScopeId,
3561 IN PUSHORT Port
3562 );
3563
3564
3565 //
3566 // Time Functions
3567 //
3568 NTSYSAPI
3569 NTSTATUS
3570 NTAPI
3571 RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3572
3573 NTSYSAPI
3574 VOID
3575 NTAPI
3576 RtlSecondsSince1970ToTime(
3577 IN ULONG SecondsSince1970,
3578 OUT PLARGE_INTEGER Time
3579 );
3580
3581 NTSYSAPI
3582 NTSTATUS
3583 NTAPI
3584 RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3585
3586 NTSYSAPI
3587 BOOLEAN
3588 NTAPI
3589 RtlTimeFieldsToTime(
3590 PTIME_FIELDS TimeFields,
3591 PLARGE_INTEGER Time
3592 );
3593
3594 NTSYSAPI
3595 BOOLEAN
3596 NTAPI
3597 RtlTimeToSecondsSince1970(
3598 PLARGE_INTEGER Time,
3599 OUT PULONG SecondsSince1970
3600 );
3601
3602 NTSYSAPI
3603 VOID
3604 NTAPI
3605 RtlTimeToTimeFields(
3606 PLARGE_INTEGER Time,
3607 PTIME_FIELDS TimeFields
3608 );
3609
3610 NTSYSAPI
3611 NTSTATUS
3612 NTAPI
3613 RtlSystemTimeToLocalTime(
3614 IN PLARGE_INTEGER SystemTime,
3615 OUT PLARGE_INTEGER LocalTime
3616 );
3617
3618 //
3619 // Version Functions
3620 //
3621 NTSYSAPI
3622 NTSTATUS
3623 NTAPI
3624 RtlVerifyVersionInfo(
3625 IN PRTL_OSVERSIONINFOEXW VersionInfo,
3626 IN ULONG TypeMask,
3627 IN ULONGLONG ConditionMask
3628 );
3629
3630 NTSYSAPI
3631 NTSTATUS
3632 NTAPI
3633 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
3634
3635 NTSYSAPI
3636 BOOLEAN
3637 NTAPI
3638 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
3639
3640 //
3641 // Secure Memory Functions
3642 //
3643 #ifdef NTOS_MODE_USER
3644 NTSYSAPI
3645 NTSTATUS
3646 NTAPI
3647 RtlRegisterSecureMemoryCacheCallback(
3648 IN PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
3649
3650 NTSYSAPI
3651 BOOLEAN
3652 NTAPI
3653 RtlFlushSecureMemoryCache(
3654 IN PVOID MemoryCache,
3655 IN OPTIONAL SIZE_T MemoryLength
3656 );
3657 #endif
3658
3659 //
3660 // Boot Status Data Functions
3661 //
3662 #ifdef NTOS_MODE_USER
3663 NTSYSAPI
3664 NTSTATUS
3665 NTAPI
3666 RtlCreateBootStatusDataFile(
3667 VOID
3668 );
3669
3670 NTSYSAPI
3671 NTSTATUS
3672 NTAPI
3673 RtlGetSetBootStatusData(
3674 HANDLE FileHandle,
3675 BOOLEAN WriteMode,
3676 DWORD DataClass,
3677 PVOID Buffer,
3678 ULONG BufferSize,
3679 DWORD DataClass2
3680 );
3681
3682 NTSYSAPI
3683 NTSTATUS
3684 NTAPI
3685 RtlLockBootStatusData(
3686 OUT PHANDLE FileHandle
3687 );
3688
3689 NTSYSAPI
3690 NTSTATUS
3691 NTAPI
3692 RtlUnlockBootStatusData(
3693 IN HANDLE FileHandle
3694 );
3695 #endif
3696
3697 #ifdef NTOS_MODE_USER
3698 NTSYSAPI
3699 NTSTATUS
3700 NTAPI
3701 RtlGUIDFromString(
3702 IN PUNICODE_STRING GuidString,
3703 OUT GUID *Guid);
3704 #endif
3705
3706 #ifdef __cplusplus
3707 }
3708 #endif
3709
3710 #endif