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