594a7aaf4a1028efbca66e0beb11cf36ac2a37aa
[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 BOOLEAN
2502 NTAPI
2503 RtlDoesFileExists_UstrEx(
2504 IN PCUNICODE_STRING FileName,
2505 IN BOOLEAN SucceedIfBusy
2506 );
2507
2508 NTSYSAPI
2509 ULONG
2510 NTAPI
2511 RtlDetermineDosPathNameType_U(
2512 IN PCWSTR Path
2513 );
2514
2515 NTSYSAPI
2516 ULONG
2517 NTAPI
2518 RtlDosSearchPath_U(
2519 IN PCWSTR Path,
2520 IN PCWSTR FileName,
2521 IN PCWSTR Extension,
2522 IN ULONG BufferSize,
2523 OUT PWSTR Buffer,
2524 OUT PWSTR *PartName
2525 );
2526
2527 ULONG
2528 NTAPI
2529 RtlDosSearchPath_Ustr(
2530 IN ULONG Flags,
2531 IN PUNICODE_STRING PathString,
2532 IN PUNICODE_STRING FileNameString,
2533 IN PUNICODE_STRING ExtensionString,
2534 IN PUNICODE_STRING CallerBuffer,
2535 IN OUT PUNICODE_STRING DynamicString OPTIONAL,
2536 OUT PUNICODE_STRING* FullNameOut OPTIONAL,
2537 OUT PSIZE_T FilePartSize OPTIONAL,
2538 OUT PSIZE_T LengthNeeded OPTIONAL
2539 );
2540
2541 NTSYSAPI
2542 BOOLEAN
2543 NTAPI
2544 RtlDosPathNameToNtPathName_U(
2545 IN PCWSTR DosPathName,
2546 OUT PUNICODE_STRING NtPathName,
2547 OUT PCWSTR *NtFileNamePart,
2548 OUT PRTL_RELATIVE_NAME_U DirectoryInfo
2549 );
2550
2551 NTSYSAPI
2552 BOOLEAN
2553 NTAPI
2554 RtlDosPathNameToRelativeNtPathName_U(
2555 IN PCWSTR DosName,
2556 OUT PUNICODE_STRING NtName,
2557 OUT PCWSTR *PartName,
2558 OUT PRTL_RELATIVE_NAME_U RelativeName
2559 );
2560
2561 NTSYSAPI
2562 NTSTATUS
2563 NTAPI
2564 RtlExpandEnvironmentStrings_U(
2565 PWSTR Environment,
2566 PUNICODE_STRING Source,
2567 PUNICODE_STRING Destination,
2568 PULONG Length
2569 );
2570
2571 NTSYSAPI
2572 ULONG
2573 NTAPI
2574 RtlGetCurrentDirectory_U(
2575 ULONG MaximumLength,
2576 PWSTR Buffer
2577 );
2578
2579 NTSYSAPI
2580 ULONG
2581 NTAPI
2582 RtlGetFullPathName_U(
2583 IN PCWSTR FileName,
2584 IN ULONG Size,
2585 IN PWSTR Buffer,
2586 OUT PWSTR *ShortName
2587 );
2588
2589 #if (NTDDI_VERSION >= NTDDI_WIN7)
2590 NTSYSAPI
2591 NTSTATUS
2592 NTAPI
2593 RtlGetFullPathName_UEx(
2594 IN PWSTR FileName,
2595 IN ULONG BufferLength,
2596 OUT PWSTR Buffer,
2597 OUT OPTIONAL PWSTR *FilePart,
2598 OUT OPTIONAL RTL_PATH_TYPE *InputPathType
2599 );
2600 #endif
2601
2602 NTSTATUS
2603 NTAPI
2604 RtlGetFullPathName_UstrEx(
2605 IN PUNICODE_STRING FileName,
2606 IN PUNICODE_STRING StaticString,
2607 IN PUNICODE_STRING DynamicString,
2608 IN PUNICODE_STRING *StringUsed,
2609 IN PSIZE_T FilePartSize,
2610 OUT PBOOLEAN NameInvalid,
2611 OUT RTL_PATH_TYPE* PathType,
2612 OUT PSIZE_T LengthNeeded
2613 );
2614
2615 NTSYSAPI
2616 ULONG
2617 NTAPI
2618 RtlGetLongestNtPathLength(
2619 VOID
2620 );
2621
2622 NTSYSAPI
2623 ULONG
2624 NTAPI
2625 RtlIsDosDeviceName_U(
2626 IN PCWSTR Name
2627 );
2628
2629 NTSYSAPI
2630 ULONG
2631 NTAPI
2632 RtlIsDosDeviceName_Ustr(
2633 IN PCUNICODE_STRING Name
2634 );
2635
2636
2637 NTSYSAPI
2638 BOOLEAN
2639 NTAPI
2640 RtlIsNameLegalDOS8Dot3(
2641 IN PCUNICODE_STRING Name,
2642 IN OUT POEM_STRING OemName OPTIONAL,
2643 IN OUT PBOOLEAN NameContainsSpaces OPTIONAL
2644 );
2645
2646 NTSYSAPI
2647 NTSTATUS
2648 NTAPI
2649 RtlQueryEnvironmentVariable_U(
2650 IN OPTIONAL PWSTR Environment,
2651 IN PUNICODE_STRING Name,
2652 OUT PUNICODE_STRING Value
2653 );
2654
2655 VOID
2656 NTAPI
2657 RtlReleaseRelativeName(
2658 IN PRTL_RELATIVE_NAME_U RelativeName
2659 );
2660
2661 NTSYSAPI
2662 NTSTATUS
2663 NTAPI
2664 RtlSetCurrentDirectory_U(
2665 IN PUNICODE_STRING name
2666 );
2667
2668 NTSYSAPI
2669 NTSTATUS
2670 NTAPI
2671 RtlSetEnvironmentVariable(
2672 PWSTR *Environment,
2673 PUNICODE_STRING Name,
2674 PUNICODE_STRING Value
2675 );
2676
2677 //
2678 // Critical Section/Resource Functions
2679 //
2680 NTSYSAPI
2681 NTSTATUS
2682 NTAPI
2683 RtlDeleteCriticalSection (
2684 IN PRTL_CRITICAL_SECTION CriticalSection
2685 );
2686
2687 NTSYSAPI
2688 NTSTATUS
2689 NTAPI
2690 RtlEnterCriticalSection(
2691 IN PRTL_CRITICAL_SECTION CriticalSection
2692 );
2693
2694 NTSYSAPI
2695 NTSTATUS
2696 NTAPI
2697 RtlInitializeCriticalSection(
2698 IN PRTL_CRITICAL_SECTION CriticalSection
2699 );
2700
2701 NTSYSAPI
2702 NTSTATUS
2703 NTAPI
2704 RtlInitializeCriticalSectionAndSpinCount(
2705 IN PRTL_CRITICAL_SECTION CriticalSection,
2706 IN ULONG SpinCount
2707 );
2708
2709 NTSYSAPI
2710 NTSTATUS
2711 NTAPI
2712 RtlLeaveCriticalSection(
2713 IN PRTL_CRITICAL_SECTION CriticalSection
2714 );
2715
2716 NTSYSAPI
2717 BOOLEAN
2718 NTAPI
2719 RtlTryEnterCriticalSection(
2720 IN PRTL_CRITICAL_SECTION CriticalSection
2721 );
2722
2723 NTSYSAPI
2724 VOID
2725 NTAPI
2726 RtlpUnWaitCriticalSection(
2727 IN PRTL_CRITICAL_SECTION CriticalSection
2728 );
2729
2730 NTSYSAPI
2731 NTSTATUS
2732 NTAPI
2733 RtlpWaitForCriticalSection(
2734 IN PRTL_CRITICAL_SECTION CriticalSection
2735 );
2736
2737 NTSYSAPI
2738 BOOLEAN
2739 NTAPI
2740 RtlAcquireResourceExclusive(
2741 IN PRTL_RESOURCE Resource,
2742 IN BOOLEAN Wait
2743 );
2744
2745 NTSYSAPI
2746 BOOLEAN
2747 NTAPI
2748 RtlAcquireResourceShared(
2749 IN PRTL_RESOURCE Resource,
2750 IN BOOLEAN Wait
2751 );
2752
2753 NTSYSAPI
2754 VOID
2755 NTAPI
2756 RtlConvertExclusiveToShared(
2757 IN PRTL_RESOURCE Resource
2758 );
2759
2760 NTSYSAPI
2761 VOID
2762 NTAPI
2763 RtlConvertSharedToExclusive(
2764 IN PRTL_RESOURCE Resource
2765 );
2766
2767 NTSYSAPI
2768 VOID
2769 NTAPI
2770 RtlDeleteResource(
2771 IN PRTL_RESOURCE Resource
2772 );
2773
2774 NTSYSAPI
2775 VOID
2776 NTAPI
2777 RtlDumpResource(
2778 IN PRTL_RESOURCE Resource
2779 );
2780
2781 NTSYSAPI
2782 VOID
2783 NTAPI
2784 RtlInitializeResource(
2785 IN PRTL_RESOURCE Resource
2786 );
2787
2788 NTSYSAPI
2789 VOID
2790 NTAPI
2791 RtlReleaseResource(
2792 IN PRTL_RESOURCE Resource
2793 );
2794
2795 //
2796 // Compression Functions
2797 //
2798 NTSYSAPI
2799 NTSTATUS
2800 NTAPI
2801 RtlCompressBuffer(
2802 IN USHORT CompressionFormatAndEngine,
2803 IN PUCHAR UncompressedBuffer,
2804 IN ULONG UncompressedBufferSize,
2805 OUT PUCHAR CompressedBuffer,
2806 IN ULONG CompressedBufferSize,
2807 IN ULONG UncompressedChunkSize,
2808 OUT PULONG FinalCompressedSize,
2809 IN PVOID WorkSpace
2810 );
2811
2812 NTSYSAPI
2813 NTSTATUS
2814 NTAPI
2815 RtlDecompressBuffer(
2816 IN USHORT CompressionFormat,
2817 OUT PUCHAR UncompressedBuffer,
2818 IN ULONG UncompressedBufferSize,
2819 IN PUCHAR CompressedBuffer,
2820 IN ULONG CompressedBufferSize,
2821 OUT PULONG FinalUncompressedSize
2822 );
2823
2824 NTSYSAPI
2825 NTSTATUS
2826 NTAPI
2827 RtlGetCompressionWorkSpaceSize(
2828 IN USHORT CompressionFormatAndEngine,
2829 OUT PULONG CompressBufferWorkSpaceSize,
2830 OUT PULONG CompressFragmentWorkSpaceSize
2831 );
2832
2833 //
2834 // Debug Info Functions
2835 //
2836 NTSYSAPI
2837 PRTL_DEBUG_INFORMATION
2838 NTAPI
2839 RtlCreateQueryDebugBuffer(
2840 IN ULONG Size,
2841 IN BOOLEAN EventPair
2842 );
2843
2844 NTSYSAPI
2845 NTSTATUS
2846 NTAPI
2847 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer);
2848
2849 NTSYSAPI
2850 NTSTATUS
2851 NTAPI
2852 RtlQueryProcessDebugInformation(
2853 IN ULONG ProcessId,
2854 IN ULONG DebugInfoClassMask,
2855 IN OUT PRTL_DEBUG_INFORMATION DebugBuffer
2856 );
2857
2858 //
2859 // Bitmap Functions
2860 //
2861 NTSYSAPI
2862 BOOLEAN
2863 NTAPI
2864 RtlAreBitsClear(
2865 IN PRTL_BITMAP BitMapHeader,
2866 IN ULONG StartingIndex,
2867 IN ULONG Length
2868 );
2869
2870 NTSYSAPI
2871 BOOLEAN
2872 NTAPI
2873 RtlAreBitsSet(
2874 IN PRTL_BITMAP BitMapHeader,
2875 IN ULONG StartingIndex,
2876 IN ULONG Length
2877 );
2878
2879 NTSYSAPI
2880 VOID
2881 NTAPI
2882 RtlClearBits(
2883 IN PRTL_BITMAP BitMapHeader,
2884 IN ULONG StartingIndex,
2885 IN ULONG NumberToClear
2886 );
2887
2888 NTSYSAPI
2889 ULONG
2890 NTAPI
2891 RtlFindClearBits(
2892 IN PRTL_BITMAP BitMapHeader,
2893 IN ULONG NumberToFind,
2894 IN ULONG HintIndex
2895 );
2896
2897 NTSYSAPI
2898 ULONG
2899 NTAPI
2900 RtlFindClearBitsAndSet(
2901 IN PRTL_BITMAP BitMapHeader,
2902 IN ULONG NumberToFind,
2903 IN ULONG HintIndex
2904 );
2905
2906 NTSYSAPI
2907 ULONG
2908 NTAPI
2909 RtlFindNextForwardRunClear(
2910 IN PRTL_BITMAP BitMapHeader,
2911 IN ULONG FromIndex,
2912 IN PULONG StartingRunIndex
2913 );
2914
2915 NTSYSAPI
2916 VOID
2917 NTAPI
2918 RtlInitializeBitMap(
2919 IN PRTL_BITMAP BitMapHeader,
2920 IN PULONG BitMapBuffer,
2921 IN ULONG SizeOfBitMap
2922 );
2923
2924 NTSYSAPI
2925 ULONG
2926 NTAPI
2927 RtlNumberOfSetBits(
2928 IN PRTL_BITMAP BitMapHeader
2929 );
2930
2931 NTSYSAPI
2932 VOID
2933 NTAPI
2934 RtlSetBit(
2935 PRTL_BITMAP BitMapHeader,
2936 ULONG BitNumber
2937 );
2938
2939 NTSYSAPI
2940 VOID
2941 NTAPI
2942 RtlSetBits(
2943 IN PRTL_BITMAP BitMapHeader,
2944 IN ULONG StartingIndex,
2945 IN ULONG NumberToSet
2946 );
2947
2948 NTSYSAPI
2949 VOID
2950 NTAPI
2951 RtlSetAllBits(
2952 PRTL_BITMAP BitMapHeader
2953 );
2954
2955 NTSYSAPI
2956 BOOLEAN
2957 NTAPI
2958 RtlTestBit(
2959 PRTL_BITMAP BitMapHeader,
2960 ULONG BitNumber
2961 );
2962
2963 //
2964 // Timer Functions
2965 //
2966 NTSYSAPI
2967 NTSTATUS
2968 NTAPI
2969 RtlCreateTimer(
2970 HANDLE TimerQueue,
2971 PHANDLE phNewTimer,
2972 WAITORTIMERCALLBACKFUNC Callback,
2973 PVOID Parameter,
2974 ULONG DueTime,
2975 ULONG Period,
2976 ULONG Flags
2977 );
2978
2979 NTSYSAPI
2980 NTSTATUS
2981 NTAPI
2982 RtlCreateTimerQueue(PHANDLE TimerQueue);
2983
2984 NTSYSAPI
2985 NTSTATUS
2986 NTAPI
2987 RtlDeleteTimer(
2988 HANDLE TimerQueue,
2989 HANDLE Timer,
2990 HANDLE CompletionEvent
2991 );
2992
2993 NTSYSAPI
2994 NTSTATUS
2995 NTAPI
2996 RtlUpdateTimer(
2997 HANDLE TimerQueue,
2998 HANDLE Timer,
2999 ULONG DueTime,
3000 ULONG Period
3001 );
3002
3003 NTSYSAPI
3004 NTSTATUS
3005 NTAPI
3006 RtlDeleteTimerQueueEx(
3007 HANDLE TimerQueue,
3008 HANDLE CompletionEvent
3009 );
3010
3011 NTSYSAPI
3012 NTSTATUS
3013 NTAPI
3014 RtlDeleteTimerQueue(HANDLE TimerQueue);
3015
3016 //
3017 // SList functions
3018 //
3019 PSLIST_ENTRY
3020 FASTCALL
3021 InterlockedPushListSList(
3022 IN PSLIST_HEADER ListHead,
3023 IN PSLIST_ENTRY List,
3024 IN PSLIST_ENTRY ListEnd,
3025 IN ULONG Count
3026 );
3027
3028 //
3029 // Range List functions
3030 //
3031 NTSYSAPI
3032 VOID
3033 NTAPI
3034 RtlInitializeRangeList(
3035 IN OUT PRTL_RANGE_LIST RangeList
3036 );
3037
3038 NTSYSAPI
3039 VOID
3040 NTAPI
3041 RtlFreeRangeList(
3042 IN PRTL_RANGE_LIST RangeList
3043 );
3044
3045 NTSYSAPI
3046 NTSTATUS
3047 NTAPI
3048 RtlAddRange(
3049 IN OUT PRTL_RANGE_LIST RangeList,
3050 IN ULONGLONG Start,
3051 IN ULONGLONG End,
3052 IN UCHAR Attributes,
3053 IN ULONG Flags,
3054 IN PVOID UserData OPTIONAL,
3055 IN PVOID Owner OPTIONAL
3056 );
3057
3058 //
3059 // Debug Functions
3060 //
3061 ULONG
3062 __cdecl
3063 DbgPrint(
3064 IN PCCH Format,
3065 IN ...
3066 );
3067
3068 NTSYSAPI
3069 ULONG
3070 __cdecl
3071 DbgPrintEx(
3072 IN ULONG ComponentId,
3073 IN ULONG Level,
3074 IN PCCH Format,
3075 IN ...
3076 );
3077
3078 NTSYSAPI
3079 ULONG
3080 NTAPI
3081 DbgPrompt(
3082 IN PCCH Prompt,
3083 OUT PCH Response,
3084 IN ULONG MaximumResponseLength
3085 );
3086
3087 VOID
3088 NTAPI
3089 DbgBreakPoint(
3090 VOID
3091 );
3092
3093 VOID
3094 NTAPI
3095 DbgLoadImageSymbols(
3096 IN PSTRING Name,
3097 IN PVOID Base,
3098 IN ULONG_PTR ProcessId
3099 );
3100
3101 VOID
3102 NTAPI
3103 DbgUnLoadImageSymbols(
3104 IN PSTRING Name,
3105 IN PVOID Base,
3106 IN ULONG_PTR ProcessId
3107 );
3108
3109 VOID
3110 NTAPI
3111 DbgCommandString(
3112 IN PCCH Name,
3113 IN PCCH Command
3114 );
3115
3116 //
3117 // Generic Table Functions
3118 //
3119 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3120 NTSYSAPI
3121 PVOID
3122 NTAPI
3123 RtlInsertElementGenericTable(
3124 IN PRTL_GENERIC_TABLE Table,
3125 IN PVOID Buffer,
3126 IN ULONG BufferSize,
3127 OUT PBOOLEAN NewElement OPTIONAL
3128 );
3129
3130 NTSYSAPI
3131 PVOID
3132 NTAPI
3133 RtlInsertElementGenericTableFull(
3134 IN PRTL_GENERIC_TABLE Table,
3135 IN PVOID Buffer,
3136 IN ULONG BufferSize,
3137 OUT PBOOLEAN NewElement OPTIONAL,
3138 IN PVOID NodeOrParent,
3139 IN TABLE_SEARCH_RESULT SearchResult
3140 );
3141
3142 NTSYSAPI
3143 BOOLEAN
3144 NTAPI
3145 RtlIsGenericTableEmpty(
3146 IN PRTL_GENERIC_TABLE Table
3147 );
3148
3149 NTSYSAPI
3150 PVOID
3151 NTAPI
3152 RtlLookupElementGenericTableFull(
3153 IN PRTL_GENERIC_TABLE Table,
3154 IN PVOID Buffer,
3155 OUT PVOID *NodeOrParent,
3156 OUT TABLE_SEARCH_RESULT *SearchResult
3157 );
3158 #endif
3159
3160 //
3161 // Handle Table Functions
3162 //
3163 NTSYSAPI
3164 PRTL_HANDLE_TABLE_ENTRY
3165 NTAPI
3166 RtlAllocateHandle(
3167 IN PRTL_HANDLE_TABLE HandleTable,
3168 IN OUT PULONG Index
3169 );
3170
3171 NTSYSAPI
3172 VOID
3173 NTAPI
3174 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable);
3175
3176 NTSYSAPI
3177 BOOLEAN
3178 NTAPI
3179 RtlFreeHandle(
3180 IN PRTL_HANDLE_TABLE HandleTable,
3181 IN PRTL_HANDLE_TABLE_ENTRY Handle
3182 );
3183
3184 NTSYSAPI
3185 VOID
3186 NTAPI
3187 RtlInitializeHandleTable(
3188 IN ULONG TableSize,
3189 IN ULONG HandleSize,
3190 IN PRTL_HANDLE_TABLE HandleTable
3191 );
3192
3193 NTSYSAPI
3194 BOOLEAN
3195 NTAPI
3196 RtlIsValidHandle(
3197 IN PRTL_HANDLE_TABLE HandleTable,
3198 IN PRTL_HANDLE_TABLE_ENTRY Handle
3199 );
3200
3201 NTSYSAPI
3202 BOOLEAN
3203 NTAPI
3204 RtlIsValidIndexHandle(
3205 IN PRTL_HANDLE_TABLE HandleTable,
3206 IN ULONG Index,
3207 OUT PRTL_HANDLE_TABLE_ENTRY *Handle
3208 );
3209
3210 //
3211 // PE Functions
3212 //
3213 NTSYSAPI
3214 NTSTATUS
3215 NTAPI
3216 RtlFindMessage(
3217 IN PVOID BaseAddress,
3218 IN ULONG Type,
3219 IN ULONG Language,
3220 IN ULONG MessageId,
3221 OUT PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3222 );
3223
3224 NTSYSAPI
3225 ULONG
3226 NTAPI
3227 RtlGetNtGlobalFlags(VOID);
3228
3229 NTSYSAPI
3230 PVOID
3231 NTAPI
3232 RtlImageDirectoryEntryToData(
3233 PVOID BaseAddress,
3234 BOOLEAN MappedAsImage,
3235 USHORT Directory,
3236 PULONG Size
3237 );
3238
3239 NTSYSAPI
3240 PVOID
3241 NTAPI
3242 RtlImageRvaToVa(
3243 PIMAGE_NT_HEADERS NtHeader,
3244 PVOID BaseAddress,
3245 ULONG Rva,
3246 PIMAGE_SECTION_HEADER *SectionHeader
3247 );
3248
3249 NTSYSAPI
3250 PIMAGE_NT_HEADERS
3251 NTAPI
3252 RtlImageNtHeader(IN PVOID BaseAddress);
3253
3254 NTSYSAPI
3255 NTSTATUS
3256 NTAPI
3257 RtlImageNtHeaderEx(
3258 IN ULONG Flags,
3259 IN PVOID BaseAddress,
3260 IN ULONGLONG Size,
3261 IN PIMAGE_NT_HEADERS *NtHeader
3262 );
3263
3264 NTSYSAPI
3265 PIMAGE_SECTION_HEADER
3266 NTAPI
3267 RtlImageRvaToSection(
3268 PIMAGE_NT_HEADERS NtHeader,
3269 PVOID BaseAddress,
3270 ULONG Rva
3271 );
3272
3273 NTSYSAPI
3274 ULONG
3275 NTAPI
3276 LdrRelocateImageWithBias(
3277 IN PVOID NewAddress,
3278 IN LONGLONG AdditionalBias,
3279 IN PCCH LoaderName,
3280 IN ULONG Success,
3281 IN ULONG Conflict,
3282 IN ULONG Invalid
3283 );
3284
3285 //
3286 // Activation Context Functions
3287 //
3288 #ifdef NTOS_MODE_USER
3289 NTSYSAPI
3290 NTSTATUS
3291 NTAPI
3292 RtlActivateActivationContextEx(
3293 IN ULONG Flags,
3294 IN PTEB Teb,
3295 IN PVOID Context,
3296 IN PULONG_PTR Cookie
3297 );
3298
3299 NTSYSAPI
3300 NTSTATUS
3301 NTAPI
3302 RtlActivateActivationContext(
3303 IN ULONG Flags,
3304 IN HANDLE Handle,
3305 OUT PULONG_PTR Cookie
3306 );
3307
3308 NTSYSAPI
3309 VOID
3310 NTAPI
3311 RtlAddRefActivationContext(
3312 PVOID Context
3313 );
3314
3315 NTSYSAPI
3316 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3317 FASTCALL
3318 RtlActivateActivationContextUnsafeFast(
3319 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3320 IN PVOID Context
3321 );
3322
3323 NTSYSAPI
3324 NTSTATUS
3325 NTAPI
3326 RtlAllocateActivationContextStack(
3327 IN PVOID *Context
3328 );
3329
3330 NTSYSAPI
3331 NTSTATUS
3332 NTAPI
3333 RtlCreateActivationContext(
3334 OUT PHANDLE Handle,
3335 IN OUT PVOID ReturnedData
3336 );
3337
3338 NTSYSAPI
3339 NTSTATUS
3340 NTAPI
3341 RtlGetActiveActivationContext(
3342 IN PVOID *Context
3343 );
3344
3345 NTSYSAPI
3346 VOID
3347 NTAPI
3348 RtlReleaseActivationContext(
3349 IN HANDLE handle
3350 );
3351
3352 NTSYSAPI
3353 NTSTATUS
3354 NTAPI
3355 RtlDeactivateActivationContext(
3356 ULONG dwFlags,
3357 ULONG_PTR ulCookie
3358 );
3359
3360 NTSYSAPI
3361 VOID
3362 NTAPI
3363 RtlFreeThreadActivationContextStack(void);
3364
3365 NTSYSAPI
3366 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3367 FASTCALL
3368 RtlDeactivateActivationContextUnsafeFast(
3369 IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3370 );
3371
3372 NTSYSAPI
3373 NTSTATUS
3374 NTAPI
3375 RtlDosApplyFileIsolationRedirection_Ustr(
3376 IN ULONG Flags,
3377 IN PUNICODE_STRING OriginalName,
3378 IN PUNICODE_STRING Extension,
3379 IN OUT PUNICODE_STRING StaticString,
3380 IN OUT PUNICODE_STRING DynamicString,
3381 IN OUT PUNICODE_STRING *NewName,
3382 IN PULONG NewFlags,
3383 IN PSIZE_T FileNameSize,
3384 IN PSIZE_T RequiredLength
3385 );
3386
3387 NTSYSAPI
3388 NTSTATUS
3389 NTAPI
3390 RtlFindActivationContextSectionString(
3391 IN ULONG dwFlags,
3392 IN const GUID *ExtensionGuid,
3393 IN ULONG SectionType,
3394 IN PUNICODE_STRING SectionName,
3395 IN OUT PVOID ReturnedData
3396 );
3397
3398 NTSYSAPI
3399 NTSTATUS
3400 NTAPI
3401 RtlQueryInformationActivationContext(
3402 DWORD dwFlags,
3403 PVOID Context,
3404 PVOID pvSubInstance,
3405 ULONG ulInfoClass,
3406 PVOID pvBuffer,
3407 SIZE_T cbBuffer OPTIONAL,
3408 SIZE_T *pcbWrittenOrRequired OPTIONAL
3409 );
3410
3411 NTSYSAPI
3412 NTSTATUS
3413 NTAPI
3414 RtlZombifyActivationContext(
3415 PVOID Context
3416 );
3417
3418 //
3419 // WOW64 Functions
3420 //
3421 NTSYSAPI
3422 NTSTATUS
3423 NTAPI
3424 RtlWow64EnableFsRedirection(
3425 IN BOOLEAN Wow64FsEnableRedirection
3426 );
3427
3428 NTSYSAPI
3429 NTSTATUS
3430 NTAPI
3431 RtlWow64EnableFsRedirectionEx(
3432 IN PVOID Wow64FsEnableRedirection,
3433 OUT PVOID *OldFsRedirectionLevel
3434 );
3435
3436 #endif
3437
3438 //
3439 // Registry Functions
3440 //
3441 NTSYSAPI
3442 NTSTATUS
3443 NTAPI
3444 RtlCheckRegistryKey(
3445 ULONG RelativeTo,
3446 PWSTR Path
3447 );
3448
3449 NTSYSAPI
3450 NTSTATUS
3451 NTAPI
3452 RtlCreateRegistryKey(
3453 IN ULONG RelativeTo,
3454 IN PWSTR Path
3455 );
3456
3457 NTSYSAPI
3458 NTSTATUS
3459 NTAPI
3460 RtlFormatCurrentUserKeyPath(
3461 IN OUT PUNICODE_STRING KeyPath
3462 );
3463
3464 NTSYSAPI
3465 NTSTATUS
3466 NTAPI
3467 RtlOpenCurrentUser(
3468 IN ACCESS_MASK DesiredAccess,
3469 OUT PHANDLE KeyHandle
3470 );
3471
3472 NTSYSAPI
3473 NTSTATUS
3474 NTAPI
3475 RtlQueryRegistryValues(
3476 IN ULONG RelativeTo,
3477 IN PCWSTR Path,
3478 IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
3479 IN PVOID Context,
3480 IN PVOID Environment
3481 );
3482
3483 NTSYSAPI
3484 NTSTATUS
3485 NTAPI
3486 RtlWriteRegistryValue(
3487 ULONG RelativeTo,
3488 PCWSTR Path,
3489 PCWSTR ValueName,
3490 ULONG ValueType,
3491 PVOID ValueData,
3492 ULONG ValueLength
3493 );
3494
3495 #ifdef NTOS_MODE_USER
3496 NTSYSAPI
3497 NTSTATUS
3498 NTAPI
3499 RtlpNtCreateKey(
3500 OUT HANDLE KeyHandle,
3501 IN ACCESS_MASK DesiredAccess,
3502 IN POBJECT_ATTRIBUTES ObjectAttributes,
3503 IN ULONG TitleIndex,
3504 IN PUNICODE_STRING Class,
3505 OUT PULONG Disposition
3506 );
3507
3508 NTSYSAPI
3509 NTSTATUS
3510 NTAPI
3511 RtlpNtEnumerateSubKey(
3512 IN HANDLE KeyHandle,
3513 OUT PUNICODE_STRING SubKeyName,
3514 IN ULONG Index,
3515 IN ULONG Unused
3516 );
3517
3518 NTSYSAPI
3519 NTSTATUS
3520 NTAPI
3521 RtlpNtMakeTemporaryKey(
3522 IN HANDLE KeyHandle
3523 );
3524
3525 NTSYSAPI
3526 NTSTATUS
3527 NTAPI
3528 RtlpNtOpenKey(
3529 OUT HANDLE KeyHandle,
3530 IN ACCESS_MASK DesiredAccess,
3531 IN POBJECT_ATTRIBUTES ObjectAttributes,
3532 IN ULONG Unused
3533 );
3534
3535 NTSYSAPI
3536 NTSTATUS
3537 NTAPI
3538 RtlpNtQueryValueKey(
3539 IN HANDLE KeyHandle,
3540 OUT PULONG Type OPTIONAL,
3541 OUT PVOID Data OPTIONAL,
3542 IN OUT PULONG DataLength OPTIONAL,
3543 IN ULONG Unused
3544 );
3545
3546 NTSYSAPI
3547 NTSTATUS
3548 NTAPI
3549 RtlpNtSetValueKey(
3550 IN HANDLE KeyHandle,
3551 IN ULONG Type,
3552 IN PVOID Data,
3553 IN ULONG DataLength
3554 );
3555 #endif
3556
3557 //
3558 // NLS Functions
3559 //
3560 NTSYSAPI
3561 VOID
3562 NTAPI
3563 RtlGetDefaultCodePage(
3564 OUT PUSHORT AnsiCodePage,
3565 OUT PUSHORT OemCodePage
3566 );
3567
3568 NTSYSAPI
3569 VOID
3570 NTAPI
3571 RtlInitNlsTables(
3572 IN PUSHORT AnsiTableBase,
3573 IN PUSHORT OemTableBase,
3574 IN PUSHORT CaseTableBase,
3575 OUT PNLSTABLEINFO NlsTable
3576 );
3577
3578 NTSYSAPI
3579 VOID
3580 NTAPI
3581 RtlInitCodePageTable(
3582 IN PUSHORT TableBase,
3583 OUT PCPTABLEINFO CodePageTable
3584 );
3585
3586 NTSYSAPI
3587 VOID
3588 NTAPI
3589 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable);
3590
3591 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
3592
3593 //
3594 // Misc conversion functions
3595 //
3596 static __inline
3597 LARGE_INTEGER
3598 NTAPI_INLINE
3599 RtlConvertLongToLargeInteger(
3600 LONG SignedInteger
3601 )
3602 {
3603 LARGE_INTEGER Result;
3604
3605 Result.QuadPart = SignedInteger;
3606 return Result;
3607 }
3608
3609 static __inline
3610 LARGE_INTEGER
3611 NTAPI_INLINE
3612 RtlEnlargedIntegerMultiply(
3613 LONG Multiplicand,
3614 LONG Multiplier
3615 )
3616 {
3617 LARGE_INTEGER Product;
3618
3619 Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3620 return Product;
3621 }
3622
3623 static __inline
3624 ULONG
3625 NTAPI_INLINE
3626 RtlEnlargedUnsignedDivide(
3627 IN ULARGE_INTEGER Dividend,
3628 IN ULONG Divisor,
3629 IN PULONG Remainder OPTIONAL
3630 )
3631 {
3632 ULONG Quotient;
3633
3634 Quotient = (ULONG)(Dividend.QuadPart / Divisor);
3635 if (Remainder) {
3636 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3637 }
3638
3639 return Quotient;
3640 }
3641
3642 static __inline
3643 LARGE_INTEGER
3644 NTAPI_INLINE
3645 RtlEnlargedUnsignedMultiply(
3646 ULONG Multiplicand,
3647 ULONG Multiplier
3648 )
3649 {
3650 LARGE_INTEGER Product;
3651
3652 Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
3653 return Product;
3654 }
3655
3656 #if defined(_AMD64_) || defined(_IA64_)
3657 static __inline
3658 LARGE_INTEGER
3659 NTAPI_INLINE
3660 RtlExtendedLargeIntegerDivide(
3661 IN LARGE_INTEGER Dividend,
3662 IN ULONG Divisor,
3663 OUT PULONG Remainder OPTIONAL)
3664 {
3665 LARGE_INTEGER ret;
3666 ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
3667 if (Remainder)
3668 *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
3669 return ret;
3670 }
3671
3672 #else
3673 NTSYSAPI
3674 LARGE_INTEGER
3675 NTAPI
3676 RtlExtendedLargeIntegerDivide(
3677 IN LARGE_INTEGER Dividend,
3678 IN ULONG Divisor,
3679 OUT PULONG Remainder OPTIONAL
3680 );
3681
3682 #endif /* defined(_AMD64_) || defined(_IA64_) */
3683
3684 #endif
3685
3686
3687 NTSYSAPI
3688 ULONG
3689 NTAPI
3690 RtlUniform(
3691 IN PULONG Seed
3692 );
3693
3694 NTSYSAPI
3695 ULONG
3696 NTAPI
3697 RtlRandom(
3698 IN OUT PULONG Seed
3699 );
3700
3701 NTSYSAPI
3702 ULONG
3703 NTAPI
3704 RtlComputeCrc32(
3705 IN ULONG InitialCrc,
3706 IN PUCHAR Buffer,
3707 IN ULONG Length
3708 );
3709
3710 //
3711 // Network Functions
3712 //
3713 NTSYSAPI
3714 NTSTATUS
3715 NTAPI
3716 RtlIpv4StringToAddressW(
3717 IN PCWSTR String,
3718 IN BOOLEAN Strict,
3719 OUT LPWSTR *Terminator,
3720 OUT struct in_addr *Addr
3721 );
3722
3723 NTSYSAPI
3724 NTSTATUS
3725 NTAPI
3726 RtlIpv6StringToAddressA(
3727 IN PCHAR Name,
3728 OUT PCHAR *Terminator,
3729 OUT struct in6_addr *Addr
3730 );
3731
3732 NTSYSAPI
3733 NTSTATUS
3734 NTAPI
3735 RtlIpv6StringToAddressW(
3736 IN PWCHAR Name,
3737 OUT PCHAR *Terminator,
3738 OUT struct in6_addr *Addr
3739 );
3740
3741 NTSYSAPI
3742 NTSTATUS
3743 NTAPI
3744 RtlIpv6StringToAddressExA(
3745 IN PCHAR AddressString,
3746 IN struct in6_addr *Address,
3747 IN PULONG ScopeId,
3748 IN PUSHORT Port
3749 );
3750
3751 NTSYSAPI
3752 NTSTATUS
3753 NTAPI
3754 RtlIpv6StringToAddressExW(
3755 IN PWCHAR AddressName,
3756 IN struct in6_addr *Address,
3757 IN PULONG ScopeId,
3758 IN PUSHORT Port
3759 );
3760
3761
3762 //
3763 // Time Functions
3764 //
3765 NTSYSAPI
3766 NTSTATUS
3767 NTAPI
3768 RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3769
3770 NTSYSAPI
3771 VOID
3772 NTAPI
3773 RtlSecondsSince1970ToTime(
3774 IN ULONG SecondsSince1970,
3775 OUT PLARGE_INTEGER Time
3776 );
3777
3778 NTSYSAPI
3779 NTSTATUS
3780 NTAPI
3781 RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
3782
3783 NTSYSAPI
3784 BOOLEAN
3785 NTAPI
3786 RtlTimeFieldsToTime(
3787 PTIME_FIELDS TimeFields,
3788 PLARGE_INTEGER Time
3789 );
3790
3791 NTSYSAPI
3792 BOOLEAN
3793 NTAPI
3794 RtlTimeToSecondsSince1970(
3795 PLARGE_INTEGER Time,
3796 OUT PULONG SecondsSince1970
3797 );
3798
3799 NTSYSAPI
3800 VOID
3801 NTAPI
3802 RtlTimeToTimeFields(
3803 PLARGE_INTEGER Time,
3804 PTIME_FIELDS TimeFields
3805 );
3806
3807 NTSYSAPI
3808 NTSTATUS
3809 NTAPI
3810 RtlSystemTimeToLocalTime(
3811 IN PLARGE_INTEGER SystemTime,
3812 OUT PLARGE_INTEGER LocalTime
3813 );
3814
3815 //
3816 // Version Functions
3817 //
3818 NTSYSAPI
3819 NTSTATUS
3820 NTAPI
3821 RtlVerifyVersionInfo(
3822 IN PRTL_OSVERSIONINFOEXW VersionInfo,
3823 IN ULONG TypeMask,
3824 IN ULONGLONG ConditionMask
3825 );
3826
3827 NTSYSAPI
3828 NTSTATUS
3829 NTAPI
3830 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation);
3831
3832 NTSYSAPI
3833 BOOLEAN
3834 NTAPI
3835 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType);
3836
3837 //
3838 // Secure Memory Functions
3839 //
3840 #ifdef NTOS_MODE_USER
3841 NTSYSAPI
3842 NTSTATUS
3843 NTAPI
3844 RtlRegisterSecureMemoryCacheCallback(
3845 IN PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
3846
3847 NTSYSAPI
3848 BOOLEAN
3849 NTAPI
3850 RtlFlushSecureMemoryCache(
3851 IN PVOID MemoryCache,
3852 IN OPTIONAL SIZE_T MemoryLength
3853 );
3854 #endif
3855
3856 //
3857 // Boot Status Data Functions
3858 //
3859 #ifdef NTOS_MODE_USER
3860 NTSYSAPI
3861 NTSTATUS
3862 NTAPI
3863 RtlCreateBootStatusDataFile(
3864 VOID
3865 );
3866
3867 NTSYSAPI
3868 NTSTATUS
3869 NTAPI
3870 RtlGetSetBootStatusData(
3871 IN HANDLE FileHandle,
3872 IN BOOLEAN WriteMode,
3873 IN RTL_BSD_ITEM_TYPE DataClass,
3874 IN PVOID Buffer,
3875 IN ULONG BufferSize,
3876 OUT PULONG ReturnLength OPTIONAL
3877 );
3878
3879 NTSYSAPI
3880 NTSTATUS
3881 NTAPI
3882 RtlLockBootStatusData(
3883 OUT PHANDLE FileHandle
3884 );
3885
3886 NTSYSAPI
3887 NTSTATUS
3888 NTAPI
3889 RtlUnlockBootStatusData(
3890 IN HANDLE FileHandle
3891 );
3892 #endif
3893
3894 #ifdef NTOS_MODE_USER
3895 NTSYSAPI
3896 NTSTATUS
3897 NTAPI
3898 RtlGUIDFromString(
3899 IN PUNICODE_STRING GuidString,
3900 OUT GUID *Guid);
3901
3902 NTSYSAPI
3903 NTSTATUS
3904 NTAPI
3905 RtlComputeImportTableHash(
3906 IN HANDLE hFile,
3907 OUT PCHAR Hash,
3908 IN ULONG ImportTableHashRevision
3909 );
3910 #endif
3911
3912 #ifdef __cplusplus
3913 }
3914 #endif
3915
3916 #endif