ReactOS  0.4.15-dev-5137-g826bd41
rtlfuncs.h
Go to the documentation of this file.
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 //
43 VOID
45  _Out_ PLIST_ENTRY ListHead
46 )
47 {
48  ListHead->Flink = ListHead->Blink = ListHead;
49 }
50 
52 VOID
54  _Inout_ PLIST_ENTRY ListHead,
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 
67 VOID
69  _Inout_ PLIST_ENTRY ListHead,
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 
83 BOOLEAN
85  _In_ const LIST_ENTRY * ListHead
86 )
87 {
88  return (BOOLEAN)(ListHead->Flink == ListHead);
89 }
90 
95 )
96 {
97  PSINGLE_LIST_ENTRY FirstEntry;
98  FirstEntry = ListHead->Next;
99  if (FirstEntry != NULL) {
100  ListHead->Next = FirstEntry->Next;
101  }
102 
103  return FirstEntry;
104 }
105 
107 VOID
109  _Inout_ PSINGLE_LIST_ENTRY ListHead,
111 )
112 {
113  Entry->Next = ListHead->Next;
114  ListHead->Next = Entry;
115 }
116 
118 BOOLEAN
121 {
122  PLIST_ENTRY OldFlink;
123  PLIST_ENTRY OldBlink;
124 
125  OldFlink = Entry->Flink;
126  OldBlink = Entry->Blink;
127  OldFlink->Blink = OldBlink;
128  OldBlink->Flink = OldFlink;
129  return (BOOLEAN)(OldFlink == OldBlink);
130 }
131 
135  _Inout_ PLIST_ENTRY ListHead)
136 {
137  PLIST_ENTRY Flink;
139 
140  Entry = ListHead->Flink;
141  Flink = Entry->Flink;
142  ListHead->Flink = Flink;
143  Flink->Blink = ListHead;
144  return Entry;
145 }
146 
150  _Inout_ PLIST_ENTRY ListHead)
151 {
152  PLIST_ENTRY Blink;
154 
155  Entry = ListHead->Blink;
156  Blink = Entry->Blink;
157  ListHead->Blink = Blink;
158  Blink->Flink = ListHead;
159  return Entry;
160 }
161 
162 //
163 // Unicode string macros
164 //
169 VOID
170 RtlInitEmptyUnicodeString(
174 {
175  UnicodeString->Length = 0;
176  UnicodeString->MaximumLength = BufferSize;
177  UnicodeString->Buffer = Buffer;
178 }
179 
181 _At_(AnsiString->Length, _Post_equal_to_(0))
184 VOID
185 RtlInitEmptyAnsiString(
189 {
190  AnsiString->Length = 0;
191  AnsiString->MaximumLength = BufferSize;
192  AnsiString->Buffer = Buffer;
193 }
194 
195 //
196 // LUID Macros
197 //
198 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
199  ((L1)->LowPart == (L2)->LowPart))
201 LUID
204  _In_ ULONG Ulong)
205 {
206  LUID TempLuid;
207 
208  TempLuid.LowPart = Ulong;
209  TempLuid.HighPart = 0;
210  return TempLuid;
211 }
212 
213 //
214 // ASSERT Macros
215 //
216 #ifndef ASSERT
217 #if DBG
218 
219 #define ASSERT( exp ) \
220  ((void)((!(exp)) ? \
221  (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ),FALSE) : \
222  TRUE))
223 
224 #define ASSERTMSG( msg, exp ) \
225  ((void)((!(exp)) ? \
226  (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, (PCHAR)msg ),FALSE) : \
227  TRUE))
228 
229 #else
230 
231 #define ASSERT( exp ) ((void) 0)
232 #define ASSERTMSG( msg, exp ) ((void) 0)
233 
234 #endif
235 #endif
236 
237 #ifdef NTOS_KERNEL_RUNTIME
238 
239 //
240 // Executing RTL functions at DISPATCH_LEVEL or higher will result in a
241 // bugcheck.
242 //
243 #define RTL_PAGED_CODE PAGED_CODE
244 
245 #else
246 
247 //
248 // This macro does nothing in user mode
249 //
250 #define RTL_PAGED_CODE()
251 
252 #endif
253 
254 //
255 // RTL Splay Tree Functions
256 //
257 #ifndef RTL_USE_AVL_TABLES
258 
259 NTSYSAPI
260 VOID
261 NTAPI
268 );
269 
270 NTSYSAPI
271 PVOID
272 NTAPI
277  _Out_opt_ PBOOLEAN NewElement
278 );
279 
280 NTSYSAPI
281 PVOID
282 NTAPI
287  _Out_opt_ PBOOLEAN NewElement,
288  _In_ PVOID NodeOrParent,
289  _In_ TABLE_SEARCH_RESULT SearchResult
290 );
291 
292 NTSYSAPI
293 BOOLEAN
294 NTAPI
298 );
299 
301 NTSYSAPI
302 PVOID
303 NTAPI
307 );
308 
309 NTSYSAPI
310 PVOID
311 NTAPI
314  _In_ PVOID Buffer,
315  _Out_ PVOID *NodeOrParent,
316  _Out_ TABLE_SEARCH_RESULT *SearchResult
317 );
318 
320 NTSYSAPI
321 PVOID
322 NTAPI
326 );
327 
329 NTSYSAPI
330 PVOID
331 NTAPI
334  _Inout_ PVOID *RestartKey
335 );
336 
338 NTSYSAPI
339 PVOID
340 NTAPI
343  _In_ ULONG I
344 );
345 
346 NTSYSAPI
347 ULONG
348 NTAPI
351 );
352 
354 NTSYSAPI
355 BOOLEAN
356 NTAPI
359 );
360 
361 #endif /* !RTL_USE_AVL_TABLES */
362 
363 NTSYSAPI
365 NTAPI
366 RtlSplay(
368 );
369 
370 NTSYSAPI
372 NTAPI
373 RtlDelete(
374  _In_ PRTL_SPLAY_LINKS Links
375 );
376 
377 NTSYSAPI
378 VOID
379 NTAPI
381  _In_ PRTL_SPLAY_LINKS Links,
383 );
384 
386 NTSYSAPI
388 NTAPI
390  _In_ PRTL_SPLAY_LINKS Links
391 );
392 
394 NTSYSAPI
396 NTAPI
398  _In_ PRTL_SPLAY_LINKS Links
399 );
400 
402 NTSYSAPI
404 NTAPI
406  _In_ PRTL_SPLAY_LINKS Links
407 );
408 
410 NTSYSAPI
412 NTAPI
414  _In_ PRTL_SPLAY_LINKS Links
415 );
416 
417 #define RtlIsLeftChild(Links) \
418  (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
419 
420 #define RtlIsRightChild(Links) \
421  (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
422 
423 #define RtlRightChild(Links) \
424  ((PRTL_SPLAY_LINKS)(Links))->RightChild
425 
426 #define RtlIsRoot(Links) \
427  (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
428 
429 #define RtlLeftChild(Links) \
430  ((PRTL_SPLAY_LINKS)(Links))->LeftChild
431 
432 #define RtlParent(Links) \
433  ((PRTL_SPLAY_LINKS)(Links))->Parent
434 
435 // FIXME: use inline function
436 
437 #define RtlInitializeSplayLinks(Links) \
438  { \
439  PRTL_SPLAY_LINKS _SplayLinks; \
440  _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
441  _SplayLinks->Parent = _SplayLinks; \
442  _SplayLinks->LeftChild = NULL; \
443  _SplayLinks->RightChild = NULL; \
444  }
445 
446 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
447  { \
448  PRTL_SPLAY_LINKS _SplayParent; \
449  PRTL_SPLAY_LINKS _SplayChild; \
450  _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
451  _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
452  _SplayParent->LeftChild = _SplayChild; \
453  _SplayChild->Parent = _SplayParent; \
454  }
455 
456 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
457  { \
458  PRTL_SPLAY_LINKS _SplayParent; \
459  PRTL_SPLAY_LINKS _SplayChild; \
460  _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
461  _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
462  _SplayParent->RightChild = _SplayChild; \
463  _SplayChild->Parent = _SplayParent; \
464  }
465 
466 //
467 // RTL AVL Tree Functions
468 //
469 NTSYSAPI
470 VOID
471 NTAPI
478 );
479 
480 NTSYSAPI
481 PVOID
482 NTAPI
487  _Out_opt_ PBOOLEAN NewElement
488 );
489 
490 NTSYSAPI
491 PVOID
492 NTAPI
497  _Out_opt_ PBOOLEAN NewElement,
498  _In_ PVOID NodeOrParent,
499  _In_ TABLE_SEARCH_RESULT SearchResult
500 );
501 
502 NTSYSAPI
503 BOOLEAN
504 NTAPI
508 );
509 
511 NTSYSAPI
512 PVOID
513 NTAPI
517 );
518 
519 NTSYSAPI
520 PVOID
521 NTAPI
524  _In_ PVOID Buffer,
525  _Out_ PVOID *NodeOrParent,
526  _Out_ TABLE_SEARCH_RESULT *SearchResult
527 );
528 
530 NTSYSAPI
531 PVOID
532 NTAPI
536 );
537 
539 NTSYSAPI
540 PVOID
541 NTAPI
544  _Inout_ PVOID *RestartKey
545 );
546 
548 NTSYSAPI
549 PVOID
550 NTAPI
553  _In_ PVOID Buffer,
554  _Out_ PVOID *RestartKey
555 );
556 
558 NTSYSAPI
559 PVOID
560 NTAPI
563  _In_opt_ PRTL_AVL_MATCH_FUNCTION MatchFunction,
565  _In_ ULONG NextFlag,
566  _Inout_ PVOID *RestartKey,
567  _Inout_ PULONG DeleteCount,
569 );
570 
572 NTSYSAPI
573 PVOID
574 NTAPI
577  _In_ ULONG I
578 );
579 
580 NTSYSAPI
581 ULONG
582 NTAPI
585 );
586 
588 NTSYSAPI
589 BOOLEAN
590 NTAPI
593 );
594 
595 #ifdef RTL_USE_AVL_TABLES
596 
597 #define RtlInitializeGenericTable RtlInitializeGenericTableAvl
598 #define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl
599 #define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl
600 #define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl
601 #define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl
602 #define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl
603 #define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl
604 #define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl
605 #define RtlGetElementGenericTable RtlGetElementGenericTableAvl
606 #define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl
607 #define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl
608 
609 #endif /* RTL_USE_AVL_TABLES */
610 
611 //
612 // Exception and Error Functions
613 //
614 NTSYSAPI
615 PVOID
616 NTAPI
618  _In_ ULONG FirstHandler,
619  _In_ PVECTORED_EXCEPTION_HANDLER VectoredHandler
620 );
621 
622 NTSYSAPI
623 ULONG
624 NTAPI
626  _In_ PVOID VectoredHandlerHandle
627 );
628 
629 NTSYSAPI
630 PVOID
631 NTAPI
633  _In_ ULONG FirstHandler,
634  _In_ PVECTORED_EXCEPTION_HANDLER VectoredHandler
635 );
636 
637 NTSYSAPI
638 ULONG
639 NTAPI
641  _In_ PVOID VectoredHandlerHandle
642 );
643 
644 NTSYSAPI
645 VOID
646 NTAPI
648  _In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
649 );
650 
651 NTSYSAPI
652 LONG
653 NTAPI
655  _In_ struct _EXCEPTION_POINTERS* ExceptionInfo
656 );
657 
659 NTSYSAPI
660 VOID
661 NTAPI
662 RtlAssert(
663  _In_ PVOID FailedAssertion,
667 );
668 
669 NTSYSAPI
670 PVOID
671 NTAPI
673  _In_ PVOID Pointer
674 );
675 
676 NTSYSAPI
677 PVOID
678 NTAPI
680  _In_ PVOID Pointer
681 );
682 
683 NTSYSAPI
684 PVOID
685 NTAPI
687  _In_ PVOID Pointer
688 );
689 
690 NTSYSAPI
691 PVOID
692 NTAPI
694  _In_ PVOID Pointer
695 );
696 
697 NTSYSAPI
698 NTSTATUS
699 NTAPI
701  VOID
702 );
703 
704 NTSYSAPI
705 ULONG
706 NTAPI
708  VOID
709 );
710 
711 NTSYSAPI
712 VOID
713 NTAPI
715  _In_ ULONG LastError
716 );
717 
718 NTSYSAPI
719 VOID
720 NTAPI
723 );
724 
725 NTSYSAPI
726 NTSTATUS
727 NTAPI
729  _In_ ULONG NewMode,
730  _Out_opt_ PULONG OldMode
731 );
732 
733 NTSYSAPI
734 ULONG
735 NTAPI
737  VOID
738 );
739 
740 #endif /* NTOS_MODE_USER */
741 
742 NTSYSAPI
743 VOID
744 NTAPI
747 );
748 
749 NTSYSAPI
750 BOOLEAN
751 NTAPI
753  _In_ PEXCEPTION_RECORD ExceptionRecord,
755 );
756 
758 _When_(Status < 0, _Out_range_(>, 0))
759 _When_(Status >= 0, _Out_range_(==, 0))
760 NTSYSAPI
761 ULONG
762 NTAPI
765 );
766 
767 _When_(Status < 0, _Out_range_(>, 0))
768 _When_(Status >= 0, _Out_range_(==, 0))
769 NTSYSAPI
770 ULONG
771 NTAPI
774 );
775 
776 NTSYSAPI
777 NTSTATUS
778 NTAPI
780  _In_ ULONG SecurityError
781 );
782 
783 NTSYSAPI
784 VOID
785 NTAPI
787  _In_ PEXCEPTION_RECORD ExceptionRecord
788 );
789 
791 NTSYSAPI
792 VOID
793 NTAPI
796 );
797 
798 NTSYSAPI
799 VOID
800 NTAPI
801 RtlUnwind(
802  _In_opt_ PVOID TargetFrame,
803  _In_opt_ PVOID TargetIp,
804  _In_opt_ PEXCEPTION_RECORD ExceptionRecord,
806 );
807 
808 #define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8
809 
810 #ifdef _M_AMD64
811 
812 NTSYSAPI
814 NTAPI
816  _In_ DWORD64 ControlPc,
817  _Out_ PDWORD64 ImageBase,
818  _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable
819 );
820 
821 NTSYSAPI
823 NTAPI
826  _In_ ULONG64 ImageBase,
827  _In_ ULONG64 ControlPc,
828  _In_ PRUNTIME_FUNCTION FunctionEntry,
830  _Outptr_ PVOID* HandlerData,
832  _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
833 );
834 
835 #endif // _M_AMD64
836 
837 //
838 // Tracing Functions
839 //
840 NTSYSAPI
841 ULONG
842 NTAPI
845  _In_ ULONG Count,
847 );
848 
849 NTSYSAPI
850 USHORT
851 NTAPI
853  VOID
854 );
855 
856 #ifdef NTOS_MODE_USER
857 //
858 // Heap Functions
859 //
863 NTSYSAPI
864 PVOID
865 NTAPI
867  _In_ PVOID HeapHandle,
870 );
871 
873 NTSYSAPI
874 PVOID
875 NTAPI
877  _In_ ULONG Flags,
879  _In_opt_ SIZE_T SizeToReserve,
880  _In_opt_ SIZE_T SizeToCommit,
883 );
884 
885 NTSYSAPI
886 ULONG
887 NTAPI
889  _In_ HANDLE HeapHandle,
890  _In_ ULONG Flags,
891  _In_opt_ PWSTR TagName,
892  _In_ PWSTR TagSubName
893 );
894 
895 ULONG
896 NTAPI
898  _In_ HANDLE Heap,
900 );
901 
903 NTSYSAPI
904 PVOID
905 NTAPI
907  _In_ ULONG Flags,
909  _In_opt_ SIZE_T SizeToReserve,
910  _In_opt_ SIZE_T SizeToCommit,
913 );
914 
915 NTSYSAPI
916 HANDLE
917 NTAPI
920 );
921 
922 NTSYSAPI
923 ULONG
924 NTAPI
926  _In_ HANDLE Heap,
927  _In_ ULONG Flags,
928  _In_ PVOID P,
930 );
931 
932 _Success_(return != 0)
933 NTSYSAPI
934 BOOLEAN
935 NTAPI
937  _In_ HANDLE HeapHandle,
940 );
941 
942 ULONG
943 NTAPI
945  _In_ ULONG HeapCount,
946  _Out_cap_(HeapCount) HANDLE *HeapArray
947 );
948 
949 _Success_(return != 0)
950 BOOLEAN
951 NTAPI
953  _In_ PVOID HeapHandle,
954  _In_ ULONG Flags,
956  _Inout_opt_ PVOID *UserValue,
957  _Out_opt_ PULONG UserFlags
958 );
959 
960 NTSYSAPI
961 PVOID
962 NTAPI
964  _In_ PVOID HeapHandle,
966 );
967 
968 NTSYSAPI
969 NTSTATUS
970 NTAPI
972  _In_ PVOID HeapHandle,
973  _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
974  _Out_ PVOID HeapInformation,
975  _In_ SIZE_T HeapInformationLength,
978 );
979 
981 NTSYSAPI
982 PWSTR
983 NTAPI
985  _In_ PVOID HeapHandle,
986  _In_ ULONG Flags,
987  _In_ USHORT TagIndex,
988  _In_ BOOLEAN ResetCounters,
989  _Out_ PRTL_HEAP_TAG_INFO HeapTagInfo
990 );
991 
995 NTSYSAPI
996 PVOID
997 NTAPI
999  _In_ HANDLE Heap,
1002  _In_ SIZE_T Size
1003 );
1004 
1005 NTSYSAPI
1006 NTSTATUS
1007 NTAPI
1009  _In_ PVOID HeapHandle,
1010  _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
1011  _When_(HeapInformationClass==HeapCompatibilityInformation,_In_) PVOID HeapInformation,
1012  _In_ SIZE_T HeapInformationLength
1013 );
1014 
1015 NTSYSAPI
1016 BOOLEAN
1017 NTAPI
1018 RtlLockHeap(
1019  _In_ HANDLE Heap
1020 );
1021 
1022 NTSYSAPI
1023 ULONG
1024 NTAPI
1026  _In_ HANDLE HeapHandle,
1027  _In_ ULONG Flags,
1028  _In_ SIZE_T Size,
1029  _In_ ULONG Count,
1031 );
1032 
1033 NTSYSAPI
1034 ULONG
1035 NTAPI
1037  _In_ HANDLE HeapHandle,
1038  _In_ ULONG Flags,
1039  _In_ ULONG Count,
1040  _In_count_(Count) /* _Deref_ _Post_invalid_ */ PVOID * Array
1041 );
1042 
1043 NTSYSAPI
1044 NTSTATUS
1045 NTAPI
1046 RtlUsageHeap(
1047  _In_ HANDLE Heap,
1048  _In_ ULONG Flags,
1050 );
1051 
1052 NTSYSAPI
1053 BOOLEAN
1054 NTAPI
1056  _In_ HANDLE Heap
1057 );
1058 
1059 BOOLEAN
1060 NTAPI
1062  _In_ PVOID HeapHandle,
1063  _In_ ULONG Flags,
1065  _In_ PVOID UserValue
1066 );
1067 
1068 BOOLEAN
1069 NTAPI
1071  _In_ PVOID HeapHandle,
1072  _In_ ULONG Flags,
1074  _In_ ULONG UserFlagsReset,
1075  _In_ ULONG UserFlagsSet
1076 );
1077 
1078 NTSYSAPI
1079 BOOLEAN
1080 NTAPI
1082  _In_ HANDLE Heap,
1083  _In_ ULONG Flags,
1084  _In_opt_ PVOID P
1085 );
1086 
1087 NTSYSAPI
1088 NTSTATUS
1089 NTAPI
1090 RtlWalkHeap(
1091  _In_ HANDLE HeapHandle,
1092  _In_ PVOID HeapEntry
1093 );
1094 
1095 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
1096 
1097 #endif // NTOS_MODE_USER
1098 
1099 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
1100 
1101 NTSYSAPI
1102 SIZE_T
1103 NTAPI
1104 RtlSizeHeap(
1105  _In_ PVOID HeapHandle,
1106  _In_ ULONG Flags,
1107  _In_ PVOID MemoryPointer
1108 );
1109 
1110 
1111 //
1112 // Security Functions
1113 //
1115 NTSYSAPI
1116 NTSTATUS
1117 NTAPI
1122 );
1123 
1125 NTSYSAPI
1126 NTSTATUS
1127 NTAPI
1129  _Inout_ PACL Acl,
1132  _In_ PSID Sid
1133 );
1134 
1136 NTSYSAPI
1137 NTSTATUS
1138 NTAPI
1140  _Inout_ PACL pAcl,
1144  _In_ PSID pSid
1145 );
1146 
1147 NTSYSAPI
1148 NTSTATUS
1149 NTAPI
1151  _Inout_ PACL pAcl,
1155  _In_opt_ GUID *ObjectTypeGuid,
1156  _In_opt_ GUID *InheritedObjectTypeGuid,
1157  _In_ PSID pSid
1158 );
1159 
1160 NTSYSAPI
1161 NTSTATUS
1162 NTAPI
1164  _Inout_ PACL Acl,
1167  _In_ PSID Sid
1168 );
1169 
1170 NTSYSAPI
1171 NTSTATUS
1172 NTAPI
1174  _Inout_ PACL Acl,
1176  _In_ ULONG Flags,
1178  _In_ PSID Sid
1179 );
1180 
1181 NTSYSAPI
1182 NTSTATUS
1183 NTAPI
1185  _Inout_ PACL pAcl,
1189  _In_opt_ GUID *ObjectTypeGuid,
1190  _In_opt_ GUID *InheritedObjectTypeGuid,
1191  _In_ PSID pSid
1192 );
1193 
1194 NTSYSAPI
1195 NTSTATUS
1196 NTAPI
1197 RtlAddAce(
1198  _Inout_ PACL Acl,
1203 );
1204 
1205 NTSYSAPI
1206 NTSTATUS
1207 NTAPI
1209  _Inout_ PACL Acl,
1212  _In_ PSID Sid,
1214  _In_ BOOLEAN Failure
1215 );
1216 
1217 NTSYSAPI
1218 NTSTATUS
1219 NTAPI
1222  _In_ ULONG NumPriv,
1223  _In_ ULONG Flags,
1224  _Out_ PVOID *ReturnedState
1225 );
1226 
1227 NTSYSAPI
1228 NTSTATUS
1229 NTAPI
1231  _Inout_ PACL Acl,
1233  _In_ ULONG Flags,
1235  _In_ PSID Sid,
1237  _In_ BOOLEAN Failure
1238 );
1239 
1240 NTSYSAPI
1241 NTSTATUS
1242 NTAPI
1244  _Inout_ PACL Acl,
1246  _In_ ULONG Flags,
1248  _In_opt_ GUID *ObjectTypeGuid,
1249  _In_opt_ GUID *InheritedObjectTypeGuid,
1250  _In_ PSID Sid,
1252  _In_ BOOLEAN Failure
1253 );
1254 
1255 NTSYSAPI
1256 NTSTATUS
1257 NTAPI
1259  _Inout_ PACL Acl,
1261  _In_ ULONG Flags,
1262  _In_ ULONG MandatoryFlags,
1263  _In_ UCHAR AceType,
1264  _In_ PSID LabelSid);
1265 
1266 NTSYSAPI
1267 NTSTATUS
1268 NTAPI
1271  _In_ BOOLEAN NewValue,
1272  _In_ BOOLEAN ForThread,
1273  _Out_ PBOOLEAN OldValue
1274 );
1275 
1277 NTSYSAPI
1278 NTSTATUS
1279 NTAPI
1283  _In_ ULONG SubAuthority0,
1284  _In_ ULONG SubAuthority1,
1285  _In_ ULONG SubAuthority2,
1286  _In_ ULONG SubAuthority3,
1287  _In_ ULONG SubAuthority4,
1288  _In_ ULONG SubAuthority5,
1289  _In_ ULONG SubAuthority6,
1290  _In_ ULONG SubAuthority7,
1291  _Outptr_ PSID *Sid
1292 );
1293 
1294 NTSYSAPI
1295 BOOLEAN
1296 NTAPI
1300 );
1301 
1302 NTSYSAPI
1303 BOOLEAN
1304 NTAPI
1308 );
1309 
1311 NTSYSAPI
1312 VOID
1313 NTAPI
1314 RtlCopyLuid (
1315  _Out_ PLUID DestinationLuid,
1317  );
1318 
1319 NTSYSAPI
1320 VOID
1321 NTAPI
1323  ULONG Count,
1326 );
1327 
1328 NTSYSAPI
1329 NTSTATUS
1330 NTAPI
1332  _In_ ULONG Count,
1334  _In_ ULONG SidAreaSize,
1336  _In_ PSID SidArea,
1337  _Out_ PSID* RemainingSidArea,
1338  _Out_ PULONG RemainingSidAreaSize
1339 );
1340 
1342 NTSYSAPI
1343 NTSTATUS
1344 NTAPI
1349 );
1350 
1352 NTSYSAPI
1353 NTSTATUS
1354 NTAPI
1355 RtlCopySid(
1356  _In_ ULONG DestinationSidLength,
1357  _Out_writes_bytes_(DestinationSidLength) PSID DestinationSid,
1359 );
1360 
1361 NTSYSAPI
1362 NTSTATUS
1363 NTAPI
1364 RtlCreateAcl(
1365  PACL Acl,
1366  ULONG AclSize,
1368 );
1369 
1370 NTSYSAPI
1371 NTSTATUS
1372 NTAPI
1376 );
1377 
1378 NTSYSAPI
1379 NTSTATUS
1380 NTAPI
1384 );
1385 
1386 NTSYSAPI
1387 NTSTATUS
1388 NTAPI
1390  _In_ PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
1391  _Out_ PSECURITY_DESCRIPTOR *pDestinationSecurityDescriptor
1392 );
1393 
1394 NTSYSAPI
1395 NTSTATUS
1396 NTAPI
1397 RtlDeleteAce(
1398  PACL Acl,
1399  ULONG AceIndex
1400 );
1401 
1402 NTSYSAPI
1403 BOOLEAN
1404 NTAPI
1406  PSID Sid1,
1407  PSID Sid2
1408 );
1409 
1410 NTSYSAPI
1411 BOOLEAN
1412 NTAPI
1413 RtlEqualSid (
1414  _In_ PSID Sid1,
1415  _In_ PSID Sid2
1416 );
1417 
1418 NTSYSAPI
1419 BOOLEAN
1420 NTAPI
1422  PACL Acl,
1423  PACE* Ace
1424 );
1425 
1426 NTSYSAPI
1427 PVOID
1428 NTAPI
1429 RtlFreeSid(
1431 );
1432 
1433 NTSYSAPI
1434 NTSTATUS
1435 NTAPI
1436 RtlGetAce(
1437  PACL Acl,
1438  ULONG AceIndex,
1439  PVOID *Ace
1440 );
1441 
1442 NTSYSAPI
1443 NTSTATUS
1444 NTAPI
1449 );
1450 
1451 NTSYSAPI
1452 NTSTATUS
1453 NTAPI
1457  _Out_ PACL *Dacl,
1459 );
1460 
1461 NTSYSAPI
1462 NTSTATUS
1463 NTAPI
1467  _Out_ PACL* Sacl,
1469 );
1470 
1471 NTSYSAPI
1472 NTSTATUS
1473 NTAPI
1476  _Out_ PSID *Group,
1478 );
1479 
1480 NTSYSAPI
1481 NTSTATUS
1482 NTAPI
1485  _Out_ PSID *Owner,
1487 );
1488 
1489 NTSYSAPI
1490 BOOLEAN
1491 NTAPI
1494  _Out_ PUCHAR RMControl
1495 );
1496 
1497 NTSYSAPI
1499 NTAPI
1501 
1502 NTSYSAPI
1503 NTSTATUS
1504 NTAPI
1506 
1508 NTSYSAPI
1509 NTSTATUS
1510 NTAPI
1512  _Out_ PSID Sid,
1515 );
1516 
1517 NTSYSAPI
1518 ULONG
1519 NTAPI
1521 
1523 NTSYSAPI
1524 ULONG
1525 NTAPI
1528 
1529 NTSYSAPI
1530 ULONG
1531 NTAPI
1533 
1534 NTSYSAPI
1535 NTSTATUS
1536 NTAPI
1538  _In_ PSECURITY_DESCRIPTOR AbsoluteSD,
1539  _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1541 
1542 NTSYSAPI
1543 VOID
1544 NTAPI
1548 );
1549 
1550 #ifdef NTOS_MODE_USER
1551 
1552 NTSYSAPI
1553 NTSTATUS
1554 NTAPI
1556  PACL Acl,
1558  ULONG InformationLength,
1560 );
1561 
1562 #endif
1563 
1564 NTSYSAPI
1565 VOID
1566 NTAPI
1568  _In_ PVOID ReturnedState
1569 );
1570 
1572 NTSYSAPI
1573 NTSTATUS
1574 NTAPI
1587 );
1588 
1589 NTSYSAPI
1590 NTSTATUS
1591 NTAPI
1593  _Inout_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1595 );
1596 
1597 NTSYSAPI
1598 NTSTATUS
1599 NTAPI
1604 );
1605 
1606 NTSYSAPI
1607 NTSTATUS
1608 NTAPI
1611  _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
1612  _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1613 );
1614 
1616 NTSYSAPI
1617 NTSTATUS
1618 NTAPI
1622  _In_opt_ PACL Dacl,
1624 );
1625 
1627 NTSYSAPI
1628 NTSTATUS
1629 NTAPI
1634 );
1635 
1636 #ifdef NTOS_MODE_USER
1637 
1638 NTSYSAPI
1639 NTSTATUS
1640 NTAPI
1642  PACL Acl,
1644  ULONG InformationLength,
1646 );
1647 
1648 #endif
1649 
1651 NTSYSAPI
1652 NTSTATUS
1653 NTAPI
1658 );
1659 
1660 NTSYSAPI
1661 NTSTATUS
1662 NTAPI
1666  _In_ PACL Sacl,
1668 );
1669 
1670 NTSYSAPI
1671 VOID
1672 NTAPI
1675  _In_ PUCHAR RMControl
1676 );
1677 
1678 NTSYSAPI
1679 PUCHAR
1680 NTAPI
1682  _In_ PSID Sid
1683 );
1684 
1685 NTSYSAPI
1686 PULONG
1687 NTAPI
1689  _In_ PSID Sid,
1690  _In_ ULONG SubAuthority
1691 );
1692 
1695 NTSYSAPI
1696 BOOLEAN
1697 NTAPI
1702 );
1703 
1704 NTSYSAPI
1705 BOOLEAN
1706 NTAPI
1708 
1709 NTSYSAPI
1710 BOOLEAN
1711 NTAPI
1713 
1714 NTSYSAPI
1715 BOOLEAN
1716 NTAPI
1717 RtlValidAcl(PACL Acl);
1718 
1719 NTSYSAPI
1720 NTSTATUS
1721 NTAPI
1723  _In_ PSECURITY_DESCRIPTOR *ObjectDescriptor
1724 );
1725 
1726 NTSYSAPI
1727 NTSTATUS
1728 NTAPI
1730  _In_ PSECURITY_DESCRIPTOR ParentDescriptor,
1731  _In_ PSECURITY_DESCRIPTOR CreatorDescriptor,
1734  _In_ HANDLE Token,
1736 );
1737 
1738 NTSYSAPI
1739 NTSTATUS
1740 NTAPI
1742  _In_ PSECURITY_DESCRIPTOR ObjectDescriptor,
1744  _Out_ PSECURITY_DESCRIPTOR ResultantDescriptor,
1745  _In_ ULONG DescriptorLength,
1747 );
1748 
1749 NTSYSAPI
1750 NTSTATUS
1751 NTAPI
1754  _In_ PSECURITY_DESCRIPTOR ModificationDescriptor,
1755  _Out_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
1757  _In_ HANDLE Token
1758 );
1759 
1760 //
1761 // Single-Character Functions
1762 //
1763 NTSYSAPI
1764 NTSTATUS
1765 NTAPI
1768  _In_ ULONG Base,
1769  _In_ ULONG Length,
1771 );
1772 
1773 NTSYSAPI
1774 CHAR
1775 NTAPI
1777 
1778 NTSYSAPI
1779 WCHAR
1780 NTAPI
1782 
1783 NTSYSAPI
1784 WCHAR
1785 NTAPI
1787 
1788 NTSYSAPI
1789 NTSTATUS
1790 NTAPI
1792  _In_ ULONG Value,
1793  _In_ ULONG Base,
1794  _In_ ULONG Length,
1796 );
1797 
1798 NTSYSAPI
1799 NTSTATUS
1800 NTAPI
1802  _In_ ULONG Value,
1806 );
1807 
1809 _At_(String->MaximumLength, _Const_)
1810 NTSYSAPI
1811 NTSTATUS
1812 NTAPI
1814  _In_ ULONG Value,
1817 );
1818 
1819 NTSYSAPI
1820 NTSTATUS
1821 NTAPI
1823  PCSZ String,
1824  ULONG Base,
1825  PULONG Value
1826 );
1827 
1828 //
1829 // Byte Swap Functions
1830 //
1831 #ifdef NTOS_MODE_USER
1832 
1833 unsigned short __cdecl _byteswap_ushort(unsigned short);
1834 unsigned long __cdecl _byteswap_ulong (unsigned long);
1835 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
1836 #ifdef _MSC_VER
1837 #pragma intrinsic(_byteswap_ushort)
1838 #pragma intrinsic(_byteswap_ulong)
1839 #pragma intrinsic(_byteswap_uint64)
1840 #endif // _MSC_VER
1841 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1842 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1843 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1844 
1845 #endif // NTOS_MODE_USER
1846 
1847 //
1848 // Unicode->Ansi String Functions
1849 //
1850 NTSYSAPI
1851 ULONG
1852 NTAPI
1854 
1855 #ifdef NTOS_MODE_USER
1856 
1857 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1858  NLS_MB_CODE_PAGE_TAG ? \
1859  RtlxUnicodeStringToAnsiSize(STRING) : \
1860  ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1861 )
1862 
1863 #endif
1864 
1865 NTSYSAPI
1866 NTSTATUS
1867 NTAPI
1872 );
1873 
1874 //
1875 // Unicode->OEM String Functions
1876 //
1877 NTSYSAPI
1878 NTSTATUS
1879 NTAPI
1884 );
1885 
1888 //_At_(DestinationString->Buffer, _Post_bytecount_(DestinationString->Length))
1889 NTSYSAPI
1890 NTSTATUS
1891 NTAPI
1898 );
1899 
1900 NTSYSAPI
1901 NTSTATUS
1902 NTAPI
1907 );
1908 
1911 NTSYSAPI
1912 NTSTATUS
1913 NTAPI
1914 RtlUnicodeStringToCountedOemString(
1920 );
1921 
1922 NTSYSAPI
1923 NTSTATUS
1924 NTAPI
1926  PCHAR OemString,
1927  ULONG OemSize,
1928  PULONG ResultSize,
1930  ULONG UnicodeSize
1931 );
1932 
1933 NTSYSAPI
1934 ULONG
1935 NTAPI
1937 
1938 #ifdef NTOS_MODE_USER
1939 
1940 #define RtlUnicodeStringToOemSize(STRING) ( \
1941  NLS_MB_OEM_CODE_PAGE_TAG ? \
1942  RtlxUnicodeStringToOemSize(STRING) : \
1943  ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1944 )
1945 
1946 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1947  (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1948 )
1949 
1950 #endif
1951 
1952 NTSYSAPI
1953 NTSTATUS
1954 NTAPI
1956  PCHAR OemString,
1957  ULONG OemSize,
1958  PULONG ResultSize,
1960  ULONG UnicodeSize
1961 );
1962 
1963 //
1964 // Unicode->MultiByte String Functions
1965 //
1966 NTSYSAPI
1967 NTSTATUS
1968 NTAPI
1970  PCHAR MbString,
1971  ULONG MbSize,
1972  PULONG ResultSize,
1974  ULONG UnicodeSize
1975 );
1976 
1977 NTSYSAPI
1978 NTSTATUS
1979 NTAPI
1981  PCHAR MbString,
1982  ULONG MbSize,
1983  PULONG ResultSize,
1985  ULONG UnicodeSize
1986 );
1987 
1988 NTSYSAPI
1989 NTSTATUS
1990 NTAPI
1992  PULONG MbSize,
1994  ULONG UnicodeSize
1995 );
1996 
1997 NTSYSAPI
1998 ULONG
1999 NTAPI
2001 
2002 //
2003 // OEM to Unicode Functions
2004 //
2005 NTSYSAPI
2006 NTSTATUS
2007 NTAPI
2012 );
2013 
2015 NTSYSAPI
2016 NTSTATUS
2017 NTAPI
2024 );
2025 
2026 #ifdef NTOS_MODE_USER
2027 
2028 #define RtlOemStringToUnicodeSize(STRING) ( \
2029  NLS_MB_OEM_CODE_PAGE_TAG ? \
2030  RtlxOemStringToUnicodeSize(STRING) : \
2031  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2032 )
2033 
2034 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
2035  (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
2036 )
2037 
2038 #endif
2039 
2040 //
2041 // Ansi->Unicode String Functions
2042 //
2044 NTSYSAPI
2045 WCHAR
2046 NTAPI
2048  _Inout_ PUCHAR *SourceCharacter);
2049 
2050 NTSYSAPI
2051 NTSTATUS
2052 NTAPI
2057 );
2058 
2059 NTSYSAPI
2060 ULONG
2061 NTAPI
2064 );
2065 
2066 #ifdef NTOS_MODE_USER
2067 
2068 #define RtlAnsiStringToUnicodeSize(STRING) ( \
2069  NLS_MB_CODE_PAGE_TAG ? \
2070  RtlxAnsiStringToUnicodeSize(STRING) : \
2071  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2072 )
2073 
2074 #endif
2075 
2076 NTSYSAPI
2077 BOOLEAN
2078 NTAPI
2081  _In_ PCSZ Source
2082 );
2083 
2084 //
2085 // Unicode String Functions
2086 //
2087 NTSYSAPI
2088 NTSTATUS
2089 NTAPI
2092  PCWSTR Source
2093 );
2094 
2095 NTSYSAPI
2096 NTSTATUS
2097 NTAPI
2101 );
2102 
2103 NTSYSAPI
2104 LONG
2105 NTAPI
2107  PCUNICODE_STRING String1,
2110 );
2111 
2112 NTSYSAPI
2113 VOID
2114 NTAPI
2118 );
2119 
2120 NTSYSAPI
2121 BOOLEAN
2122 NTAPI
2126 );
2127 
2128 #ifdef NTOS_MODE_USER
2129 
2130 NTSYSAPI
2131 NTSTATUS
2132 NTAPI
2134  _Inout_ PUNICODE_STRING UniDest,
2135  _In_ PCUNICODE_STRING UniSource,
2137 );
2138 
2139 NTSYSAPI
2140 NTSTATUS
2141 NTAPI
2143  _In_ ULONG Flags,
2146 );
2147 
2148 NTSYSAPI
2149 NTSTATUS
2150 NTAPI
2152  _In_ ULONG Flags,
2153  _In_ PCUNICODE_STRING SearchString,
2154  _In_ PCUNICODE_STRING MatchString,
2156 );
2157 
2158 //
2159 // Memory Functions
2160 //
2161 #if defined(_M_AMD64)
2162 
2164 VOID
2167  _In_ SIZE_T Length,
2168  _In_ ULONG Pattern)
2169 {
2171  if ((Length /= 4) != 0) {
2172  if (((ULONG64)Address & 4) != 0) {
2173  *Address = Pattern;
2174  if ((Length -= 1) == 0) {
2175  return;
2176  }
2177  Address += 1;
2178  }
2179  __stosq((PULONG64)(Address), Pattern | ((ULONG64)Pattern << 32), Length / 2);
2180  if ((Length & 1) != 0) Address[Length - 1] = Pattern;
2181  }
2182  return;
2183 }
2184 
2185 #define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
2186  __stosq((PULONG64)(Destination), Pattern, (Length) / 8)
2187 
2188 #else
2189 
2190 NTSYSAPI
2191 VOID
2192 NTAPI
2195  _In_ SIZE_T Length,
2196  _In_ ULONG Pattern
2197 );
2198 
2199 NTSYSAPI
2200 VOID
2201 NTAPI
2204  _In_ SIZE_T Length,
2205  _In_ ULONGLONG Pattern
2206 );
2207 
2208 #endif
2209 
2210 NTSYSAPI
2211 NTSTATUS
2212 NTAPI
2215  _In_reads_bytes_(Size) const VOID *Source,
2216  _In_ SIZE_T Size
2217 );
2218 
2219 NTSYSAPI
2220 SIZE_T
2221 NTAPI
2223  _In_ PVOID Source,
2224  _In_ SIZE_T Length,
2225  _In_ ULONG Pattern
2226 );
2227 
2228 #ifndef RtlEqualMemory
2229 #define RtlEqualMemory(Destination, Source, Length) \
2230  (!memcmp(Destination, Source, Length))
2231 #endif
2232 
2233 #define RtlCopyBytes RtlCopyMemory
2234 #define RtlFillBytes RtlFillMemory
2235 #define RtlZeroBytes RtlZeroMemory
2236 
2237 #endif
2238 
2239 NTSYSAPI
2240 BOOLEAN
2241 NTAPI
2243  PCUNICODE_STRING String1,
2246 );
2247 
2249 NTSYSAPI
2250 VOID
2251 NTAPI
2253  _Inout_ _At_(UnicodeString->Buffer, __drv_freesMem(Mem))
2255 );
2256 
2257 NTSYSAPI
2258 VOID
2259 NTAPI
2262 );
2263 
2264 NTSYSAPI
2265 NTSTATUS
2266 NTAPI
2272 );
2273 
2282 NTSYSAPI
2283 VOID
2284 NTAPI
2288 );
2289 
2298 NTSYSAPI
2299 VOID
2300 NTAPI
2304 );
2305 
2307 NTSYSAPI
2308 NTSTATUS
2309 NTAPI
2313 );
2314 
2315 NTSYSAPI
2316 BOOLEAN
2317 NTAPI
2319  _In_ CONST VOID* Buffer,
2320  _In_ INT Size,
2322 );
2323 
2326 NTSYSAPI
2327 BOOLEAN
2328 NTAPI
2330  _In_ const STRING *String1,
2333 );
2334 
2337 NTSYSAPI
2338 BOOLEAN
2339 NTAPI
2341  _In_ PCUNICODE_STRING String1,
2344 );
2345 
2347 NTSYSAPI
2348 VOID
2349 NTAPI
2353 );
2354 
2357 NTSYSAPI
2358 LONG
2359 NTAPI
2361  _In_ const STRING *String1,
2364 );
2365 
2366 NTSYSAPI
2367 VOID
2368 NTAPI
2372 );
2373 
2376 NTSYSAPI
2377 BOOLEAN
2378 NTAPI
2380  _In_ const STRING *String1,
2383 );
2384 
2386 NTSYSAPI
2387 NTSTATUS
2388 NTAPI
2392 );
2393 
2396 NTSYSAPI
2397 NTSTATUS
2398 NTAPI
2405 );
2406 
2408 NTSYSAPI
2409 NTSTATUS
2410 NTAPI
2415 );
2416 
2417 NTSYSAPI
2418 NTSTATUS
2419 NTAPI
2421  _In_ ULONG Flags,
2423 );
2424 
2425 #define RTL_SKIP_BUFFER_COPY 0x00000001
2426 
2427 NTSYSAPI
2428 NTSTATUS
2429 NTAPI
2431  _In_ ULONG Flags,
2434 );
2435 
2436 #ifdef NTOS_MODE_USER
2437 
2439 VOID
2440 RtlInitBuffer(
2442  _In_ PUCHAR Data,
2444 )
2445 {
2446  Buffer->Buffer = Buffer->StaticBuffer = Data;
2447  Buffer->Size = Buffer->StaticSize = DataSize;
2448  Buffer->ReservedForAllocatedSize = 0;
2449  Buffer->ReservedForIMalloc = NULL;
2450 }
2451 
2453 NTSTATUS
2454 RtlEnsureBufferSize(
2455  _In_ ULONG Flags,
2458 )
2459 {
2461  return STATUS_SUCCESS;
2463 }
2464 
2466 VOID
2467 RtlFreeBuffer(
2469 )
2470 {
2471  if (Buffer->Buffer != Buffer->StaticBuffer && Buffer->Buffer)
2472  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer->Buffer);
2473  Buffer->Buffer = Buffer->StaticBuffer;
2474  Buffer->Size = Buffer->StaticSize;
2475 }
2476 
2477 NTSYSAPI
2478 VOID
2479 NTAPI
2483 );
2484 
2485 NTSYSAPI
2486 VOID
2487 NTAPI
2489  _In_ UCHAR Hash,
2491 );
2492 
2493 #endif /* NTOS_MODE_USER */
2494 
2495 //
2496 // Ansi String Functions
2497 //
2499 NTSYSAPI
2500 VOID
2501 NTAPI
2503  _Inout_ _At_(AnsiString->Buffer, __drv_freesMem(Mem))
2505 );
2506 
2508 NTSYSAPI
2509 VOID
2510 NTAPI
2514 );
2515 
2517 NTSYSAPI
2518 NTSTATUS
2519 NTAPI
2523 );
2524 
2525 //
2526 // OEM String Functions
2527 //
2529 NTSYSAPI
2530 VOID
2531 NTAPI
2533  _Inout_ _At_(OemString->Buffer, __drv_freesMem(Mem))
2535 );
2536 
2537 //
2538 // MultiByte->Unicode String Functions
2539 //
2541 NTSYSAPI
2542 NTSTATUS
2543 NTAPI
2550 );
2551 
2553 NTSYSAPI
2554 NTSTATUS
2555 NTAPI
2560 );
2561 
2562 //
2563 // Atom Functions
2564 //
2565 NTSYSAPI
2566 NTSTATUS
2567 NTAPI
2569  _In_ PRTL_ATOM_TABLE AtomTable,
2570  _In_ PWSTR AtomName,
2572 );
2573 
2574 NTSYSAPI
2575 NTSTATUS
2576 NTAPI
2579  _Inout_ PRTL_ATOM_TABLE *AtomTable
2580 );
2581 
2582 NTSYSAPI
2583 NTSTATUS
2584 NTAPI
2586  _In_ PRTL_ATOM_TABLE AtomTable,
2588 );
2589 
2590 NTSYSAPI
2591 NTSTATUS
2592 NTAPI
2594 
2595 NTSYSAPI
2596 NTSTATUS
2597 NTAPI
2599  _In_ PRTL_ATOM_TABLE AtomTable,
2600  _In_ RTL_ATOM Atom,
2601  _Out_opt_ PULONG RefCount,
2603  _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName,
2604  _Inout_opt_ PULONG NameLength
2605 );
2606 
2607 NTSYSAPI
2608 NTSTATUS
2609 NTAPI
2611  _In_ PRTL_ATOM_TABLE AtomTable,
2613 );
2614 
2615 NTSYSAPI
2616 NTSTATUS
2617 NTAPI
2619  _In_ PRTL_ATOM_TABLE AtomTable,
2620  _In_ PWSTR AtomName,
2622 );
2623 
2624 //
2625 // Process Management Functions
2626 //
2627 NTSYSAPI
2628 PPEB
2629 NTAPI
2631  VOID
2632 );
2633 
2634 NTSYSAPI
2635 VOID
2636 NTAPI
2638 
2639 NTSYSAPI
2640 NTSTATUS
2641 NTAPI
2643  _Out_ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2644  _In_ PUNICODE_STRING ImagePathName,
2647  _In_opt_ PUNICODE_STRING CommandLine,
2649  _In_opt_ PUNICODE_STRING WindowTitle,
2650  _In_opt_ PUNICODE_STRING DesktopInfo,
2651  _In_opt_ PUNICODE_STRING ShellInfo,
2652  _In_opt_ PUNICODE_STRING RuntimeInfo
2653 );
2654 
2655 NTSYSAPI
2656 NTSTATUS
2657 NTAPI
2659  _In_ PUNICODE_STRING ImageFileName,
2661  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2662  _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor,
2663  _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor,
2664  _In_opt_ HANDLE ParentProcess,
2666  _In_opt_ HANDLE DebugPort,
2667  _In_opt_ HANDLE ExceptionPort,
2669 );
2670 
2671 #if (NTDDI_VERSION >= NTDDI_WIN7)
2672 NTSYSAPI
2673 NTSTATUS
2674 NTAPI
2676  _In_ PVOID ThreadContext,
2677  _Out_ HANDLE *OutThreadHandle,
2683  _Reserved_ PVOID Reserved6,
2685  _Reserved_ PVOID Reserved8
2686 );
2687 #else
2688 NTSYSAPI
2689 NTSTATUS
2690 NTAPI
2694  _In_ BOOLEAN CreateSuspended,
2695  _In_ ULONG StackZeroBits,
2696  _In_ SIZE_T StackReserve,
2697  _In_ SIZE_T StackCommit,
2698  _In_ PTHREAD_START_ROUTINE StartAddress,
2700  _Out_opt_ PHANDLE ThreadHandle,
2702 );
2703 #endif
2704 
2705 NTSYSAPI
2707 NTAPI
2709  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2710 
2711 NTSYSAPI
2712 NTSTATUS
2713 NTAPI
2715  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2716 
2717 NTSYSAPI
2718 VOID
2719 NTAPI
2721  _In_ NTSTATUS Status);
2722 
2723 NTSYSAPI
2724 VOID
2725 NTAPI
2728  _Out_ PCONTEXT ThreadContext,
2729  _In_opt_ PVOID ThreadStartParam,
2730  _In_ PTHREAD_START_ROUTINE ThreadStartAddress,
2731  _In_ PINITIAL_TEB InitialTeb
2732 );
2733 
2734 #ifdef _M_AMD64
2735 typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT;
2736 
2737 NTSYSAPI
2738 NTSTATUS
2739 NTAPI
2740 RtlWow64GetThreadContext(
2741  _In_ HANDLE ThreadHandle,
2742  _Inout_ PWOW64_CONTEXT ThreadContext
2743 );
2744 
2745 
2746 NTSYSAPI
2747 NTSTATUS
2748 NTAPI
2749 RtlWow64SetThreadContext(
2750  _In_ HANDLE ThreadHandle,
2751  _In_ PWOW64_CONTEXT ThreadContext
2752 );
2753 #endif
2754 
2755 NTSYSAPI
2756 BOOLEAN
2757 NTAPI
2759 
2760 NTSYSAPI
2762 NTAPI
2764  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2765 
2766 NTSYSAPI
2767 VOID
2768 NTAPI
2770 
2771 NTSYSAPI
2772 NTSTATUS
2773 NTAPI
2776  _In_ HANDLE Thread,
2777  _In_ PVOID CallSite,
2778  _In_ ULONG ArgumentCount,
2779  _In_ PULONG Arguments,
2780  _In_ BOOLEAN PassContext,
2781  _In_ BOOLEAN AlreadySuspended
2782 );
2783 
2784 NTSYSAPI
2785 NTSTATUS
2786 __cdecl
2788  _In_ BOOLEAN NewValue,
2789  _Out_opt_ PBOOLEAN OldValue,
2790  _In_ BOOLEAN NeedBreaks
2791 );
2792 
2793 NTSYSAPI
2794 NTSTATUS
2795 __cdecl
2797  _In_ BOOLEAN NewValue,
2798  _Out_opt_ PBOOLEAN OldValue,
2799  _In_ BOOLEAN NeedBreaks
2800 );
2801 
2802 NTSYSAPI
2803 ULONG
2804 NTAPI
2806  VOID
2807 );
2808 
2809 
2810 //
2811 // Thread Pool Functions
2812 //
2813 //
2814 NTSTATUS
2815 NTAPI
2817  _In_ PRTL_START_POOL_THREAD StartPoolThread,
2818  _In_ PRTL_EXIT_POOL_THREAD ExitPoolThread
2819 );
2820 
2821 NTSYSAPI
2822 NTSTATUS
2823 NTAPI
2825  _In_ HANDLE hWaitHandle,
2826  _In_opt_ HANDLE hCompletionEvent
2827 );
2828 
2829 NTSYSAPI
2830 NTSTATUS
2831 NTAPI
2833  _In_ HANDLE hWaitHandle
2834 );
2835 
2836 NTSYSAPI
2837 NTSTATUS
2838 NTAPI
2842  _In_ ULONG Flags
2843 );
2844 
2845 NTSYSAPI
2846 NTSTATUS
2847 NTAPI
2851  _In_ ULONG Flags
2852 );
2853 
2854 NTSYSAPI
2855 NTSTATUS
2856 NTAPI
2858  _In_ PHANDLE phNewWaitObject,
2859  _In_ HANDLE hObject,
2861  _In_ PVOID pvContext,
2862  _In_ ULONG ulMilliseconds,
2863  _In_ ULONG ulFlags
2864 );
2865 
2866 //
2867 // Environment/Path Functions
2868 //
2869 NTSYSAPI
2870 NTSTATUS
2871 NTAPI
2873  _In_ BOOLEAN Inherit,
2875 );
2876 
2877 NTSYSAPI
2878 NTSTATUS
2879 NTAPI
2881  _In_ PUNICODE_STRING DllName,
2882  _Inout_ PUNICODE_STRING RealName,
2883  _Inout_ PUNICODE_STRING LocalName
2884 );
2885 
2886 NTSYSAPI
2887 VOID
2888 NTAPI
2891 );
2892 
2893 NTSYSAPI
2894 BOOLEAN
2895 NTAPI
2898 );
2899 
2900 NTSYSAPI
2902 NTAPI
2904  _In_ PCWSTR Path
2905 );
2906 
2907 NTSYSAPI
2908 ULONG
2909 NTAPI
2911  _In_ PCWSTR Path,
2915  _Out_ PWSTR Buffer,
2916  _Out_ PWSTR *PartName
2917 );
2918 
2919 NTSYSAPI
2920 NTSTATUS
2921 NTAPI
2923  _In_ ULONG Flags,
2924  _In_ PUNICODE_STRING PathString,
2925  _In_ PUNICODE_STRING FileNameString,
2926  _In_ PUNICODE_STRING ExtensionString,
2927  _In_ PUNICODE_STRING CallerBuffer,
2929  _Out_opt_ PUNICODE_STRING* FullNameOut,
2930  _Out_opt_ PSIZE_T FilePartSize,
2932 );
2933 
2934 NTSYSAPI
2935 BOOLEAN
2936 NTAPI
2938  _In_opt_z_ PCWSTR DosPathName,
2939  _Out_ PUNICODE_STRING NtPathName,
2940  _Out_opt_ PCWSTR *NtFileNamePart,
2941  _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo
2942 );
2943 
2944 
2945 #define RTL_UNCHANGED_UNK_PATH 1
2946 #define RTL_CONVERTED_UNC_PATH 2
2947 #define RTL_CONVERTED_NT_PATH 3
2948 #define RTL_UNCHANGED_DOS_PATH 4
2949 
2950 NTSYSAPI
2951 NTSTATUS
2952 NTAPI
2954  _In_ ULONG Flags,
2958 );
2959 
2960 
2961 NTSYSAPI
2962 BOOLEAN
2963 NTAPI
2966  _Out_ PUNICODE_STRING NtName,
2967  _Out_ PCWSTR *PartName,
2968  _Out_ PRTL_RELATIVE_NAME_U RelativeName
2969 );
2970 
2972 NTSYSAPI
2973 NTSTATUS
2974 NTAPI
2980 );
2981 
2982 NTSYSAPI
2983 ULONG
2984 NTAPI
2988 );
2989 
2990 NTSYSAPI
2991 ULONG
2992 NTAPI
2995  _In_ ULONG Size,
2998 );
2999 
3000 #if (NTDDI_VERSION >= NTDDI_WIN7)
3001 NTSYSAPI
3002 NTSTATUS
3003 NTAPI
3007  _Out_ PWSTR Buffer,
3008  _Out_opt_ PWSTR *FilePart,
3009  _Out_opt_ RTL_PATH_TYPE *InputPathType
3010  );
3011 #endif
3012 
3013 NTSTATUS
3014 NTAPI
3020  _Out_opt_ PSIZE_T FilePartSize,
3024 );
3025 
3026 NTSYSAPI
3027 NTSTATUS
3028 NTAPI
3031  _In_ PCUNICODE_STRING PathString,
3033 );
3034 
3035 NTSYSAPI
3036 ULONG
3037 NTAPI
3039  VOID
3040 );
3041 
3042 NTSYSAPI
3043 ULONG
3044 NTAPI
3046  _In_ PCWSTR Name
3047 );
3048 
3049 NTSYSAPI
3050 ULONG
3051 NTAPI
3054 );
3055 
3058 NTSYSAPI
3059 BOOLEAN
3060 NTAPI
3065 );
3066 
3067 NTSYSAPI
3068 NTSTATUS
3069 NTAPI
3074 );
3075 
3076 VOID
3077 NTAPI
3079  _In_ PRTL_RELATIVE_NAME_U RelativeName
3080 );
3081 
3082 NTSYSAPI
3083 NTSTATUS
3084 NTAPI
3087 );
3088 
3089 NTSYSAPI
3090 NTSTATUS
3091 NTAPI
3096 );
3097 
3098 //
3099 // Critical Section/Resource Functions
3100 //
3101 NTSYSAPI
3102 NTSTATUS
3103 NTAPI
3106 );
3107 
3108 NTSYSAPI
3109 NTSTATUS
3110 NTAPI
3113 );
3114 
3115 NTSYSAPI
3116 NTSTATUS
3117 NTAPI
3120 );
3121 
3122 NTSYSAPI
3123 NTSTATUS
3124 NTAPI
3127  _In_ ULONG SpinCount
3128 );
3129 
3130 NTSYSAPI
3131 ULONG
3132 NTAPI
3135 );
3136 
3137 NTSYSAPI
3138 ULONG
3139 NTAPI
3142 );
3143 
3144 NTSYSAPI
3145 NTSTATUS
3146 NTAPI
3149 );
3150 
3151 NTSYSAPI
3152 BOOLEAN
3153 NTAPI
3156 );
3157 
3158 NTSYSAPI
3159 VOID
3160 NTAPI
3163 );
3164 
3165 NTSYSAPI
3166 NTSTATUS
3167 NTAPI
3170 );
3171 
3172 NTSYSAPI
3173 BOOLEAN
3174 NTAPI
3177  _In_ BOOLEAN Wait
3178 );
3179 
3180 NTSYSAPI
3181 BOOLEAN
3182 NTAPI
3185  _In_ BOOLEAN Wait
3186 );
3187 
3188 NTSYSAPI
3189 VOID
3190 NTAPI
3193 );
3194 
3195 NTSYSAPI
3196 VOID
3197 NTAPI
3200 );
3201 
3202 NTSYSAPI
3203 VOID
3204 NTAPI
3207 );
3208 
3209 NTSYSAPI
3210 VOID
3211 NTAPI
3214 );
3215 
3216 NTSYSAPI
3217 VOID
3218 NTAPI
3221 );
3222 
3223 NTSYSAPI
3224 VOID
3225 NTAPI
3228 );
3229 
3230 //
3231 // Compression Functions
3232 //
3233 NTSYSAPI //NT_RTL_COMPRESS_API
3234 NTSTATUS
3235 NTAPI
3237  _In_ USHORT CompressionFormatAndEngine,
3238  _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
3242  _In_ ULONG UncompressedChunkSize,
3243  _Out_ PULONG FinalCompressedSize,
3245 );
3246 
3248 NTSYSAPI //NT_RTL_COMPRESS_API
3249 NTSTATUS
3250 NTAPI
3252  _In_ USHORT CompressionFormat,
3258 );
3259 
3260 NTSYSAPI
3261 NTSTATUS
3262 NTAPI
3264  _In_ USHORT CompressionFormatAndEngine,
3265  _Out_ PULONG CompressBufferWorkSpaceSize,
3266  _Out_ PULONG CompressFragmentWorkSpaceSize
3267 );
3268 
3269 //
3270 // Frame Functions
3271 //
3272 NTSYSAPI
3273 VOID
3274 NTAPI
3275 RtlPopFrame(
3276  _In_ PTEB_ACTIVE_FRAME Frame
3277 );
3278 
3279 NTSYSAPI
3280 VOID
3281 NTAPI
3282 RtlPushFrame(
3283  _In_ PTEB_ACTIVE_FRAME Frame
3284 );
3285 
3286 NTSYSAPI
3288 NTAPI
3289 RtlGetFrame(
3290  VOID
3291 );
3292 
3293 //
3294 // Debug Info Functions
3295 //
3296 NTSYSAPI
3298 NTAPI
3300  _In_ ULONG Size,
3301  _In_ BOOLEAN EventPair
3302 );
3303 
3304 NTSYSAPI
3305 NTSTATUS
3306 NTAPI
3308 
3309 NTSYSAPI
3310 NTSTATUS
3311 NTAPI
3314  _In_ ULONG DebugInfoClassMask,
3315  _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer
3316 );
3317 
3318 //
3319 // Bitmap Functions
3320 //
3321 #ifdef NTOS_MODE_USER
3322 
3323 NTSYSAPI
3324 BOOLEAN
3325 NTAPI
3327  _In_ PRTL_BITMAP BitMapHeader,
3329  _In_ ULONG Length
3330 );
3331 
3332 NTSYSAPI
3333 BOOLEAN
3334 NTAPI
3336  _In_ PRTL_BITMAP BitMapHeader,
3338  _In_ ULONG Length
3339 );
3340 
3341 NTSYSAPI
3342 VOID
3343 NTAPI
3345  _In_ PRTL_BITMAP BitMapHeader
3346 );
3347 
3348 NTSYSAPI
3349 VOID
3350 NTAPI
3351 RtlClearBit(
3352  _In_ PRTL_BITMAP BitMapHeader,
3353  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3354 );
3355 
3356 NTSYSAPI
3357 VOID
3358 NTAPI
3359 RtlClearBits(
3360  _In_ PRTL_BITMAP BitMapHeader,
3361  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToClear) ULONG StartingIndex,
3362  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToClear
3363 );
3364 
3365 NTSYSAPI
3366 ULONG
3367 NTAPI
3369  _In_ PRTL_BITMAP BitMapHeader,
3372 );
3373 
3374 NTSYSAPI
3375 ULONG
3376 NTAPI
3378  _In_ PRTL_BITMAP BitMapHeader,
3381 );
3382 
3383 NTSYSAPI
3384 ULONG
3385 NTAPI
3387  _In_ PRTL_BITMAP BitMapHeader,
3389 );
3390 
3391 NTSYSAPI
3392 ULONG
3393 NTAPI
3395  _In_ PRTL_BITMAP BitMapHeader,
3396  _Out_writes_to_(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray,
3397  _In_range_(>, 0) ULONG SizeOfRunArray,
3398  _In_ BOOLEAN LocateLongestRuns
3399 );
3400 
3401 NTSYSAPI
3402 ULONG
3403 NTAPI
3405  _In_ PRTL_BITMAP BitMapHeader,
3406  _In_ ULONG FromIndex,
3407  _Out_ PULONG StartingRunIndex
3408 );
3409 
3410 NTSYSAPI
3411 CCHAR
3412 NTAPI
3415 );
3416 
3417 NTSYSAPI
3418 ULONG
3419 NTAPI
3421  _In_ PRTL_BITMAP BitMapHeader,
3423 );
3424 
3425 NTSYSAPI
3426 CCHAR
3427 NTAPI
3430 );
3431 
3432 NTSYSAPI
3433 ULONG
3434 NTAPI
3436  _In_ PRTL_BITMAP BitMapHeader,
3437  _In_ ULONG FromIndex,
3438  _Out_ PULONG StartingRunIndex
3439 );
3440 
3441 NTSYSAPI
3442 ULONG
3443 NTAPI
3445  _In_ PRTL_BITMAP BitMapHeader,
3446  _In_ ULONG FromIndex,
3447  _Out_ PULONG StartingRunIndex
3448 );
3449 
3450 NTSYSAPI
3451 ULONG
3452 NTAPI
3454  _In_ PRTL_BITMAP BitMapHeader,
3457 );
3458 
3459 NTSYSAPI
3460 ULONG
3461 NTAPI
3463  _In_ PRTL_BITMAP BitMapHeader,
3466 );
3467 
3468 #ifdef __REACTOS__ // ReactOS improvement
3469 _At_(BitMapHeader->SizeOfBitMap, _Post_equal_to_(SizeOfBitMap))
3470 _At_(BitMapHeader->Buffer, _Post_equal_to_(BitMapBuffer))
3471 #endif
3472 NTSYSAPI
3473 VOID
3474 NTAPI
3476  _Out_ PRTL_BITMAP BitMapHeader,
3477  _In_opt_ __drv_aliasesMem PULONG BitMapBuffer,
3478  _In_opt_ ULONG SizeOfBitMap
3479 );
3480 
3481 NTSYSAPI
3482 ULONG
3483 NTAPI
3485  _In_ PRTL_BITMAP BitMapHeader
3486 );
3487 
3488 NTSYSAPI
3489 ULONG
3490 NTAPI
3492  _In_ PRTL_BITMAP BitMapHeader
3493 );
3494 
3495 NTSYSAPI
3496 VOID
3497 NTAPI
3498 RtlSetBit(
3499  _In_ PRTL_BITMAP BitMapHeader,
3500  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3501 );
3502 
3503 NTSYSAPI
3504 VOID
3505 NTAPI
3506 RtlSetBits(
3507  _In_ PRTL_BITMAP BitMapHeader,
3508  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToSet) ULONG StartingIndex,
3509  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToSet
3510 );
3511 
3512 NTSYSAPI
3513 VOID
3514 NTAPI
3516  _In_ PRTL_BITMAP BitMapHeader
3517 );
3518 
3520 NTSYSAPI
3521 BOOLEAN
3522 NTAPI
3523 RtlTestBit(
3524  _In_ PRTL_BITMAP BitMapHeader,
3525  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3526 );
3527 
3528 #if defined(_M_AMD64)
3531 BOOLEAN
3532 RtlCheckBit(
3533  _In_ PRTL_BITMAP BitMapHeader,
3534  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitPosition)
3535 {
3536  return BitTest64((LONG64 CONST*)BitMapHeader->Buffer, (LONG64)BitPosition);
3537 }
3538 #else
3539 #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP)/32]) >> ((BP)%32)) & 0x1)
3540 #endif /* defined(_M_AMD64) */
3541 
3542 #endif // NTOS_MODE_USER
3543 
3544 
3545 //
3546 // Timer Functions
3547 //
3548 NTSYSAPI
3549 NTSTATUS
3550 NTAPI
3552  _In_ HANDLE TimerQueue,
3553  _In_ PHANDLE phNewTimer,
3556  _In_ ULONG DueTime,
3557  _In_ ULONG Period,
3558  _In_ ULONG Flags
3559 );
3560 
3561 NTSYSAPI
3562 NTSTATUS
3563 NTAPI
3564 RtlCreateTimerQueue(PHANDLE TimerQueue);
3565 
3566 NTSYSAPI
3567 NTSTATUS
3568 NTAPI
3570  _In_ HANDLE TimerQueue,
3571  _In_ HANDLE Timer,
3572  _In_ HANDLE CompletionEvent
3573 );
3574 
3575 NTSYSAPI
3576 NTSTATUS
3577 NTAPI
3579  _In_ HANDLE TimerQueue,
3580  _In_ HANDLE Timer,
3581  _In_ ULONG DueTime,
3582  _In_ ULONG Period
3583 );
3584 
3585 NTSYSAPI
3586 NTSTATUS
3587 NTAPI
3589  _In_ HANDLE TimerQueue,
3590  _In_opt_ HANDLE CompletionEvent
3591 );
3592 
3593 NTSYSAPI
3594 NTSTATUS
3595 NTAPI
3596 RtlDeleteTimerQueue(HANDLE TimerQueue);
3597 
3598 //
3599 // SList functions
3600 //
3602 FASTCALL
3604  _Inout_ PSLIST_HEADER ListHead,
3607  _In_ ULONG Count
3608 );
3609 
3610 //
3611 // Range List functions
3612 //
3613 NTSYSAPI
3614 VOID
3615 NTAPI
3617  _Out_ PRTL_RANGE_LIST RangeList
3618 );
3619 
3620 NTSYSAPI
3621 VOID
3622 NTAPI
3624  _In_ PRTL_RANGE_LIST RangeList
3625 );
3626 
3627 NTSYSAPI
3628 NTSTATUS
3629 NTAPI
3631  _Out_ PRTL_RANGE_LIST CopyRangeList,
3632  _In_ PRTL_RANGE_LIST RangeList
3633 );
3634 
3635 NTSYSAPI
3636 NTSTATUS
3637 NTAPI
3639  _Out_ PRTL_RANGE_LIST MergedRangeList,
3640  _In_ PRTL_RANGE_LIST RangeList1,
3641  _In_ PRTL_RANGE_LIST RangeList2,
3642  _In_ ULONG Flags
3643 );
3644 
3645 NTSYSAPI
3646 NTSTATUS
3647 NTAPI
3649  _Out_ PRTL_RANGE_LIST InvertedRangeList,
3650  _In_ PRTL_RANGE_LIST RangeList
3651 );
3652 
3653 NTSYSAPI
3654 NTSTATUS
3655 NTAPI
3656 RtlAddRange(
3657  _Inout_ PRTL_RANGE_LIST RangeList,
3659  _In_ ULONGLONG End,
3661  _In_ ULONG Flags,
3664 );
3665 
3666 NTSYSAPI
3667 NTSTATUS
3668 NTAPI
3670  _Inout_ PRTL_RANGE_LIST RangeList,
3672  _In_ ULONGLONG End,
3673  _In_ PVOID Owner
3674 );
3675 
3676 NTSYSAPI
3677 NTSTATUS
3678 NTAPI
3680  _Inout_ PRTL_RANGE_LIST RangeList,
3682 );
3683 
3684 NTSYSAPI
3685 NTSTATUS
3686 NTAPI
3687 RtlFindRange(
3688  _In_ PRTL_RANGE_LIST RangeList,
3689  _In_ ULONGLONG Minimum,
3690  _In_ ULONGLONG Maximum,
3691  _In_ ULONG Length,
3693  _In_ ULONG Flags,
3694  _In_ UCHAR AttributeAvailableMask,
3696  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3698 );
3699 
3700 NTSYSAPI
3701 NTSTATUS
3702 NTAPI
3704  _In_ PRTL_RANGE_LIST RangeList,
3706  _In_ ULONGLONG End,
3707  _In_ ULONG Flags,
3708  _In_ UCHAR AttributeAvailableMask,
3710  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3711  _Out_ PBOOLEAN Available
3712 );
3713 
3714 NTSYSAPI
3715 NTSTATUS
3716 NTAPI
3718  _In_ PRTL_RANGE_LIST RangeList,
3721 );
3722 
3723 NTSYSAPI
3724 NTSTATUS
3725 NTAPI
3729  _In_ BOOLEAN MoveForwards
3730 );
3731 
3732 //
3733 // Debug Functions
3734 //
3735 ULONG
3736 __cdecl
3737 DbgPrint(
3739  ...
3740 );
3741 
3742 NTSYSAPI
3743 ULONG
3744 __cdecl
3745 DbgPrintEx(
3747  _In_ ULONG Level,
3749  ...
3750 );
3751 
3752 NTSYSAPI
3753 ULONG
3754 NTAPI
3755 DbgPrompt(
3756  _In_z_ PCCH Prompt,
3759 );
3760 
3761 #undef DbgBreakPoint
3762 VOID
3763 NTAPI
3765  VOID
3766 );
3767 
3768 VOID
3769 NTAPI
3771  _In_ PSTRING Name,
3772  _In_ PVOID Base,
3774 );
3775 
3776 VOID
3777 NTAPI
3779  _In_ PSTRING Name,
3780  _In_ PVOID Base,
3782 );
3783 
3784 VOID
3785 NTAPI
3787  _In_ PCCH Name,
3788  _In_ PCCH Command
3789 );
3790 
3791 //
3792 // Generic Table Functions
3793 //
3794 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3795 NTSYSAPI
3796 PVOID
3797 NTAPI
3802  _Out_opt_ PBOOLEAN NewElement
3803 );
3804 
3805 NTSYSAPI
3806 PVOID
3807 NTAPI
3812  _Out_opt_ PBOOLEAN NewElement,
3813  _In_ PVOID NodeOrParent,
3814  _In_ TABLE_SEARCH_RESULT SearchResult
3815 );
3816 
3817 NTSYSAPI
3818 BOOLEAN
3819 NTAPI
3822 );
3823 
3824 NTSYSAPI
3825 PVOID
3826 NTAPI
3829  _In_ PVOID Buffer,
3830  _Out_ PVOID *NodeOrParent,
3831  _Out_ TABLE_SEARCH_RESULT *SearchResult
3832 );
3833 #endif
3834 
3835 //
3836 // Handle Table Functions
3837 //
3838 NTSYSAPI
3840 NTAPI
3844 );
3845 
3846 NTSYSAPI
3847 VOID
3848 NTAPI
3851 
3852 NTSYSAPI
3853 BOOLEAN
3854 NTAPI
3858 );
3859 
3860 NTSYSAPI
3861 VOID
3862 NTAPI
3865  _In_ ULONG HandleSize,
3867 );
3868 
3869 NTSYSAPI
3870 BOOLEAN
3871 NTAPI
3875 );
3876 
3877 _Success_(return!=FALSE)
3878 NTSYSAPI
3879 BOOLEAN
3880 NTAPI
3885 );
3886 
3887 //
3888 // PE Functions
3889 //
3890 NTSYSAPI
3891 NTSTATUS
3892 NTAPI
3895  _In_ ULONG Type,
3896  _In_ ULONG Language,
3897  _In_ ULONG MessageId,
3898  _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3899 );
3900 
3901 NTSYSAPI
3902 ULONG
3903 NTAPI
3905 
3906 _Success_(return!=NULL)
3907 NTSYSAPI
3908 PVOID
3909 NTAPI
3914  _Out_ PULONG Size
3915 );
3916 
3917 NTSYSAPI
3918 PVOID
3919 NTAPI
3921  _In_ PIMAGE_NT_HEADERS NtHeader,
3923  _In_ ULONG Rva,
3924  _Inout_opt_ PIMAGE_SECTION_HEADER *SectionHeader
3925 );
3926 
3927 NTSYSAPI
3929 NTAPI
3932 
3933 NTSYSAPI
3934 NTSTATUS
3935 NTAPI
3937  _In_ ULONG Flags,
3940  _Out_ PIMAGE_NT_HEADERS *NtHeader
3941 );
3942 
3943 NTSYSAPI
3945 NTAPI
3947  _In_ PIMAGE_NT_HEADERS NtHeader,
3949  _In_ ULONG Rva
3950 );
3951 
3952 NTSYSAPI
3953 ULONG
3954 NTAPI
3956  _In_ PVOID NewAddress,
3957  _In_ LONGLONG AdditionalBias,
3958  _In_ PCCH LoaderName,
3959  _In_ ULONG Success,
3960  _In_ ULONG Conflict,
3961  _In_ ULONG Invalid
3962 );
3963 
3964 //
3965 // Activation Context Functions
3966 //
3967 #ifdef NTOS_MODE_USER
3968 NTSYSAPI
3969 NTSTATUS
3970 NTAPI
3972  _In_ ULONG Flags,
3973  _In_ PTEB Teb,
3974  _In_ PVOID Context,
3976 );
3977 
3978 NTSYSAPI
3979 NTSTATUS
3980 NTAPI
3982  _In_ ULONG Flags,
3983  _In_ HANDLE Handle,
3985 );
3986 
3987 NTSYSAPI
3988 VOID
3989 NTAPI
3992 );
3993 
3994 NTSYSAPI
3996 FASTCALL
3998  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
4000 );
4001 
4002 NTSYSAPI
4003 NTSTATUS
4004 NTAPI
4007 );
4008 
4009 NTSYSAPI
4010 NTSTATUS
4011 NTAPI
4013  _In_ ULONG Flags,
4014  _In_ PACTIVATION_CONTEXT_DATA ActivationContextData,
4015  _In_ ULONG ExtraBytes,
4016  _In_ PVOID NotificationRoutine,
4019 );
4020 
4021 NTSYSAPI
4022 NTSTATUS
4023 NTAPI
4025  _In_ PVOID *Context
4026 );
4027 
4028 NTSYSAPI
4029 VOID
4030 NTAPI
4033 );
4034 
4035 NTSYSAPI
4036 NTSTATUS
4037 NTAPI
4039  _In_ ULONG dwFlags,
4040  _In_ ULONG_PTR ulCookie
4041 );
4042 
4043 NTSYSAPI
4044 VOID
4045 NTAPI
4048 );
4049 
4050 NTSYSAPI
4051 VOID
4052 NTAPI
4054 
4055 NTSYSAPI
4057 FASTCALL
4059  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
4060 );
4061 
4062 NTSYSAPI
4063 NTSTATUS
4064 NTAPI
4066  _In_ ULONG Flags,
4067  _In_ PUNICODE_STRING OriginalName,
4072  _In_ PULONG NewFlags,
4073  _In_ PSIZE_T FileNameSize,
4075 );
4076 
4077 NTSYSAPI
4078 NTSTATUS
4079 NTAPI
4081  _In_ ULONG dwFlags,
4082  _In_ const GUID *ExtensionGuid,
4083  _In_ ULONG SectionType,
4084  _In_ const UNICODE_STRING *SectionName,
4085  _Inout_ PVOID ReturnedData
4086 );
4087 
4088 NTSYSAPI
4089 NTSTATUS
4090 NTAPI
4092  _In_ DWORD dwFlags,
4094  _In_opt_ PVOID pvSubInstance,
4095  _In_ ULONG ulInfoClass,
4096  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4097  _In_opt_ SIZE_T cbBuffer,
4098  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4099 );
4100 
4101 NTSYSAPI
4102 NTSTATUS
4103 NTAPI
4105  _In_ ULONG ulInfoClass,
4106  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4107  _In_opt_ SIZE_T cbBuffer,
4108  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4109 );
4110 
4111 NTSYSAPI
4112 NTSTATUS
4113 NTAPI
4115  PVOID Context
4116 );
4117 
4118 //
4119 // WOW64 Functions
4120 //
4121 NTSYSAPI
4122 NTSTATUS
4123 NTAPI
4125  _In_ BOOLEAN Wow64FsEnableRedirection
4126 );
4127 
4128 NTSYSAPI
4129 NTSTATUS
4130 NTAPI
4132  _In_ PVOID Wow64FsEnableRedirection,
4133  _Out_ PVOID *OldFsRedirectionLevel
4134 );
4135 
4136 #endif
4137 
4138 //
4139 // Registry Functions
4140 //
4143 NTSYSAPI
4144 NTSTATUS
4145 NTAPI
4147  _In_ ULONG RelativeTo,
4148  _In_ PWSTR Path
4149 );
4150 
4151 NTSYSAPI
4152 NTSTATUS
4153 NTAPI
4155  _In_ ULONG RelativeTo,
4156  _In_ PWSTR Path
4157 );
4158 
4159 NTSYSAPI
4160 NTSTATUS
4161 NTAPI
4163  _Out_ _At_(KeyPath->Buffer, __drv_allocatesMem(Mem) _Post_bytecap_(KeyPath->MaximumLength) _Post_bytecount_(KeyPath->Length))
4164  PUNICODE_STRING KeyPath
4165 );
4166 
4167 NTSYSAPI
4168 NTSTATUS
4169 NTAPI
4173 );
4174 
4176 NTSYSAPI
4177 NTSTATUS
4178 NTAPI
4180  _In_ ULONG RelativeTo,
4181  _In_ PCWSTR Path,
4182  _Inout_ _At_(*(*QueryTable).EntryContext, _Pre_unknown_)
4186 );
4187 
4189 NTSYSAPI
4190 NTSTATUS
4191 NTAPI
4193  _In_ ULONG RelativeTo,
4199 );
4200 
4201 #ifdef NTOS_MODE_USER
4202 NTSYSAPI
4203 NTSTATUS
4204 NTAPI
4212 );
4213 
4214 NTSYSAPI
4215 NTSTATUS
4216 NTAPI
4220  _In_ ULONG Index,
4221  _In_ ULONG Unused
4222 );
4223 
4224 NTSYSAPI
4225 NTSTATUS
4226 NTAPI
4229 );
4230 
4231 NTSYSAPI
4232 NTSTATUS
4233 NTAPI
4238  _In_ ULONG Unused
4239 );
4240 
4241 NTSYSAPI
4242 NTSTATUS
4243 NTAPI
4249  _In_ ULONG Unused
4250 );
4251 
4252 NTSYSAPI
4253 NTSTATUS
4254 NTAPI
4257  _In_ ULONG Type,
4258  _In_ PVOID Data,
4260 );
4261 #endif
4262 
4263 //
4264 // NLS Functions
4265 //
4266 NTSYSAPI
4267 VOID
4268 NTAPI
4272 );
4273 
4274 NTSYSAPI
4275 VOID
4276 NTAPI
4278  _In_ PUSHORT AnsiTableBase,
4279  _In_ PUSHORT OemTableBase,
4280  _In_ PUSHORT CaseTableBase,
4281  _Out_ PNLSTABLEINFO NlsTable
4282 );
4283 
4285 NTSYSAPI
4286 VOID
4287 NTAPI
4289  _In_ PUSHORT TableBase,
4291 );
4292 
4293 NTSYSAPI
4294 VOID
4295 NTAPI
4297  _In_ PNLSTABLEINFO NlsTable);
4298 
4299 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
4300 
4301 //
4302 // Misc conversion functions
4303 //
4304 static __inline
4308  _In_ LONG SignedInteger
4309 )
4310 {
4312 
4313  Result.QuadPart = SignedInteger;
4314  return Result;
4315 }
4316 
4317 static __inline
4321  _In_ LONG Multiplicand,
4322  _In_ LONG Multiplier
4323 )
4324 {
4325  LARGE_INTEGER Product;
4326 
4327  Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4328  return Product;
4329 }
4330 
4331 static __inline
4332 ULONG
4335  _In_ ULARGE_INTEGER Dividend,
4336  _In_ ULONG Divisor,
4338 )
4339 {
4340  ULONG Quotient;
4341 
4342  Quotient = (ULONG)(Dividend.QuadPart / Divisor);
4343  if (Remainder) {
4344  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4345  }
4346 
4347  return Quotient;
4348 }
4349 
4350 static __inline
4354  _In_ ULONG Multiplicand,
4355  _In_ ULONG Multiplier
4356 )
4357 {
4358  LARGE_INTEGER Product;
4359 
4360  Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4361  return Product;
4362 }
4363 
4364 #if defined(_AMD64_) || defined(_IA64_)
4365 static __inline
4369  _In_ LARGE_INTEGER Dividend,
4370  _In_ ULONG Divisor,
4372 {
4374  ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
4375  if (Remainder)
4376  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4377  return ret;
4378 }
4379 
4380 #else
4381 NTSYSAPI
4383 NTAPI
4385  _In_ LARGE_INTEGER Dividend,
4386  _In_ ULONG Divisor,
4388 );
4389 
4390 #endif /* defined(_AMD64_) || defined(_IA64_) */
4391 
4392 #endif
4393 
4394 
4395 NTSYSAPI
4396 ULONG
4397 NTAPI
4398 RtlUniform(
4399  _In_ PULONG Seed
4400 );
4401 
4402 NTSYSAPI
4403 ULONG
4404 NTAPI
4405 RtlRandom(
4406  _Inout_ PULONG Seed
4407 );
4408 
4409 NTSYSAPI
4410 ULONG
4411 NTAPI
4413  _In_ ULONG InitialCrc,
4414  _In_ PUCHAR Buffer,
4415  _In_ ULONG Length
4416 );
4417 
4418 //
4419 // Network Functions
4420 //
4421 NTSYSAPI
4422 PSTR
4423 NTAPI
4425  _In_ const struct in_addr *Addr,
4426  _Out_writes_(16) PCHAR S
4427 );
4428 
4429 NTSYSAPI
4430 PWSTR
4431 NTAPI
4433  _In_ const struct in_addr *Addr,
4434  _Out_writes_(16) PWCHAR S
4435 );
4436 
4437 NTSYSAPI
4438 NTSTATUS
4439 NTAPI
4441  _In_ const struct in_addr *Address,
4442  _In_ USHORT Port,
4443  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PCHAR AddressString,
4444  _Inout_ PULONG AddressStringLength
4445 );
4446 
4447 NTSTATUS
4448 NTAPI
4450  _In_ const struct in_addr *Address,
4451  _In_ USHORT Port,
4452  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4453  _Inout_ PULONG AddressStringLength
4454 );
4455 
4456 NTSYSAPI
4457 NTSTATUS
4458 NTAPI
4460  _In_ PCSTR String,
4461  _In_ BOOLEAN Strict,
4462  _Out_ PCSTR *Terminator,
4463  _Out_ struct in_addr *Addr
4464 );
4465 
4466 NTSYSAPI
4467 NTSTATUS
4468 NTAPI
4470  _In_ PCWSTR String,
4471  _In_ BOOLEAN Strict,
4472  _Out_ PCWSTR *Terminator,
4473  _Out_ struct in_addr *Addr
4474 );
4475 
4476 NTSYSAPI
4477 NTSTATUS
4478 NTAPI
4480  _In_ PCSTR AddressString,
4481  _In_ BOOLEAN Strict,
4482  _Out_ struct in_addr *Address,
4484 );
4485 
4486 NTSYSAPI
4487 NTSTATUS
4488 NTAPI
4490  _In_ PCWSTR AddressString,
4491  _In_ BOOLEAN Strict,
4492  _Out_ struct in_addr *Address,
4494 );
4495 
4496 NTSYSAPI
4497 PSTR
4498 NTAPI
4500  _In_ const struct in6_addr *Addr,
4501  _Out_writes_(46) PSTR S
4502 );
4503 
4504 NTSYSAPI
4505 PWSTR
4506 NTAPI
4508  _In_ const struct in6_addr *Addr,
4509  _Out_writes_(46) PWSTR S
4510 );
4511 
4512 NTSYSAPI
4513 NTSTATUS
4514 NTAPI
4516  _In_ const struct in6_addr *Address,
4517  _In_ ULONG ScopeId,
4518  _In_ USHORT Port,
4519  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PSTR AddressString,
4520  _Inout_ PULONG AddressStringLength
4521 );
4522 
4523 NTSYSAPI
4524 NTSTATUS
4525 NTAPI
4527  _In_ const struct in6_addr *Address,
4528  _In_ ULONG ScopeId,
4529  _In_ USHORT Port,
4530  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4531  _Inout_ PULONG AddressStringLength
4532 );
4533 
4534 NTSYSAPI
4535 NTSTATUS
4536 NTAPI
4538  _In_ PCSTR String,
4539  _Out_ PCSTR *Terminator,
4540  _Out_ struct in6_addr *Addr
4541 );
4542 
4543 NTSYSAPI
4544 NTSTATUS
4545 NTAPI
4547  _In_ PCWSTR String,
4548  _Out_ PCWSTR *Terminator,
4549  _Out_ struct in6_addr *Addr
4550 );
4551 
4552 NTSYSAPI
4553 NTSTATUS
4554 NTAPI
4556  _In_ PCSTR AddressString,
4557  _Out_ struct in6_addr *Address,
4558  _Out_ PULONG ScopeId,
4560 );
4561 
4562 NTSYSAPI
4563 NTSTATUS
4564 NTAPI
4566  _In_ PCWSTR AddressString,
4567  _Out_ struct in6_addr *Address,
4568  _Out_ PULONG ScopeId,
4570 );
4571 
4572 
4573 //
4574 // Time Functions
4575 //
4576 NTSYSAPI
4577 BOOLEAN
4578 NTAPI
4580  _In_ PTIME_FIELDS CutoverTimeFields,
4581  _Out_ PLARGE_INTEGER SystemTime,
4582  _In_ PLARGE_INTEGER CurrentTime,
4583  _In_ BOOLEAN ThisYearsCutoverOnly);
4584 
4585 NTSYSAPI
4586 NTSTATUS
4587 NTAPI
4589  _Out_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4590 
4591 NTSYSAPI
4592 VOID
4593 NTAPI
4595  _In_ ULONG SecondsSince1970,
4597 );
4598 
4599 NTSYSAPI
4600 NTSTATUS
4601 NTAPI
4603  _In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4604 
4605 _Success_(return != FALSE)
4606 NTSYSAPI
4607 BOOLEAN
4608 NTAPI
4612 );
4613 
4614 _Success_(return != FALSE)
4615 NTSYSAPI
4616 BOOLEAN
4617 NTAPI
4621 );
4622 
4623 NTSYSAPI
4624 VOID
4625 NTAPI
4629 );
4630 
4631 NTSYSAPI
4632 NTSTATUS
4633 NTAPI
4635  _In_ PLARGE_INTEGER SystemTime,
4636  _Out_ PLARGE_INTEGER LocalTime
4637 );
4638 
4639 //
4640 // Version Functions
4641 //
4644 NTSYSAPI
4645 NTSTATUS
4646 NTAPI
4651 );
4652 
4654 NTSYSAPI
4655 NTSTATUS
4656 NTAPI
4658  _Out_
4659  _At_(lpVersionInformation->dwOSVersionInfoSize, _Pre_ _Valid_)
4660  _When_(lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW),
4661  _At_((PRTL_OSVERSIONINFOEXW)lpVersionInformation, _Out_))
4662  PRTL_OSVERSIONINFOW lpVersionInformation
4663 );
4664 
4666 NTSYSAPI
4667 BOOLEAN
4668 NTAPI
4670 
4671 //
4672 // Secure Memory Functions
4673 //
4674 #ifdef NTOS_MODE_USER
4675 NTSYSAPI
4676 NTSTATUS
4677 NTAPI
4679  _In_ PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
4680 
4681 NTSYSAPI
4682 BOOLEAN
4683 NTAPI
4685  _In_ PVOID MemoryCache,
4686  _In_opt_ SIZE_T MemoryLength
4687 );
4688 #endif
4689 
4690 //
4691 // Boot Status Data Functions
4692 //
4693 #ifdef NTOS_MODE_USER
4694 NTSYSAPI
4695 NTSTATUS
4696 NTAPI
4698  VOID
4699 );
4700 
4701 NTSYSAPI
4702 NTSTATUS
4703 NTAPI
4706  _In_ BOOLEAN WriteMode,
4707  _In_ RTL_BSD_ITEM_TYPE DataClass,
4708  _In_ PVOID Buffer,
4711 );
4712 
4713 NTSYSAPI
4714 NTSTATUS
4715 NTAPI
4718 );
4719 
4720 NTSYSAPI
4721 NTSTATUS
4722 NTAPI
4725 );
4726 #endif
4727 
4728 #ifdef NTOS_MODE_USER
4730 NTSYSAPI
4731 NTSTATUS
4732 NTAPI
4735  _Out_ GUID *Guid);
4736 
4738 NTSYSAPI
4739 NTSTATUS
4740 NTAPI
4742  _In_ REFGUID Guid,
4743  _Out_ _At_(GuidString->Buffer, __drv_allocatesMem(Mem))
4745 
4746 NTSYSAPI
4747 NTSTATUS
4748 NTAPI
4750  _In_ HANDLE hFile,
4751  _Out_ PCHAR Hash,
4752  _In_ ULONG ImportTableHashRevision
4753 );
4754 #endif
4755 
4756 //
4757 // MemoryStream functions
4758 //
4759 #ifdef NTOS_MODE_USER
4760 
4761 NTSYSAPI
4762 VOID
4763 NTAPI
4765  _Out_ PRTL_MEMORY_STREAM Stream
4766 );
4767 
4768 NTSYSAPI
4769 VOID
4770 NTAPI
4772  _Out_ PRTL_MEMORY_STREAM Stream
4773 );
4774 
4775 NTSYSAPI
4776 VOID
4777 NTAPI
4779  _In_ PRTL_MEMORY_STREAM Stream
4780 );
4781 
4782 NTSYSAPI
4783 HRESULT
4784 NTAPI
4786  _In_ struct IStream *This,
4787  _In_ REFIID RequestedIid,
4788  _Outptr_ PVOID *ResultObject
4789 );
4790 
4791 NTSYSAPI
4792 ULONG
4793 NTAPI
4795  _In_ struct IStream *This
4796 );
4797 
4798 NTSYSAPI
4799 ULONG
4800 NTAPI
4802  _In_ struct IStream *This
4803 );
4804 
4805 NTSYSAPI
4806 HRESULT
4807 NTAPI
4809  _In_ struct IStream *This,
4811  _In_ ULONG Length,
4813 );
4814 
4815 NTSYSAPI
4816 HRESULT
4817 NTAPI
4819  _In_ struct IStream *This,
4821  _In_ ULONG Length,
4823 );
4824 
4825 NTSYSAPI
4826 HRESULT
4827 NTAPI
4829  _In_ struct IStream *This,
4830  _In_ LARGE_INTEGER RelativeOffset,
4831  _In_ ULONG Origin,
4832  _Out_opt_ PULARGE_INTEGER ResultOffset
4833 );
4834 
4835 NTSYSAPI
4836 HRESULT
4837 NTAPI
4839  _In_ struct IStream *This,
4840  _In_ struct IStream *Target,
4844 );
4845 
4846 NTSYSAPI
4847 HRESULT
4848 NTAPI
4849 RtlCopyOutOfProcessMemoryStreamTo(
4850  _In_ struct IStream *This,
4851  _In_ struct IStream *Target,
4855 );
4856 
4857 NTSYSAPI
4858 HRESULT
4859 NTAPI
4861  _In_ struct IStream *This,
4862  _Out_ struct tagSTATSTG *Stats,
4863  _In_ ULONG Flags
4864 );
4865 
4866 // Dummy functions
4867 NTSYSAPI
4868 HRESULT
4869 NTAPI
4871  _In_ struct IStream *This,
4873  _In_