ReactOS  0.4.15-dev-1039-gb9754fa
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 //
811 // Tracing Functions
812 //
813 NTSYSAPI
814 ULONG
815 NTAPI
818  _In_ ULONG Count,
820 );
821 
822 NTSYSAPI
823 USHORT
824 NTAPI
826  VOID
827 );
828 
829 #ifdef NTOS_MODE_USER
830 //
831 // Heap Functions
832 //
836 NTSYSAPI
837 PVOID
838 NTAPI
840  _In_ PVOID HeapHandle,
843 );
844 
846 NTSYSAPI
847 PVOID
848 NTAPI
850  _In_ ULONG Flags,
852  _In_opt_ SIZE_T SizeToReserve,
853  _In_opt_ SIZE_T SizeToCommit,
856 );
857 
858 NTSYSAPI
859 ULONG
860 NTAPI
862  _In_ HANDLE HeapHandle,
863  _In_ ULONG Flags,
864  _In_ PWSTR TagName,
865  _In_ PWSTR TagSubName
866 );
867 
868 ULONG
869 NTAPI
871  _In_ HANDLE Heap,
873 );
874 
876 NTSYSAPI
877 PVOID
878 NTAPI
880  _In_ ULONG Flags,
882  _In_opt_ SIZE_T SizeToReserve,
883  _In_opt_ SIZE_T SizeToCommit,
886 );
887 
888 NTSYSAPI
889 HANDLE
890 NTAPI
893 );
894 
895 NTSYSAPI
896 ULONG
897 NTAPI
899  _In_ HANDLE Heap,
900  _In_ ULONG Flags,
901  _In_ PVOID P,
903 );
904 
905 _Success_(return != 0)
906 NTSYSAPI
907 BOOLEAN
908 NTAPI
910  _In_ HANDLE HeapHandle,
913 );
914 
915 ULONG
916 NTAPI
918  _In_ ULONG HeapCount,
919  _Out_cap_(HeapCount) HANDLE *HeapArray
920 );
921 
922 _Success_(return != 0)
923 BOOLEAN
924 NTAPI
926  _In_ PVOID HeapHandle,
927  _In_ ULONG Flags,
929  _Inout_opt_ PVOID *UserValue,
930  _Out_opt_ PULONG UserFlags
931 );
932 
933 NTSYSAPI
934 PVOID
935 NTAPI
937  _In_ PVOID HeapHandle,
939 );
940 
941 NTSYSAPI
942 NTSTATUS
943 NTAPI
945  _In_ PVOID HeapHandle,
946  _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
947  _Out_ PVOID HeapInformation,
948  _In_ SIZE_T HeapInformationLength,
951 );
952 
954 NTSYSAPI
955 PWSTR
956 NTAPI
958  _In_ PVOID HeapHandle,
959  _In_ ULONG Flags,
960  _In_ USHORT TagIndex,
961  _In_ BOOLEAN ResetCounters,
962  _Out_ PRTL_HEAP_TAG_INFO HeapTagInfo
963 );
964 
968 NTSYSAPI
969 PVOID
970 NTAPI
972  _In_ HANDLE Heap,
976 );
977 
978 NTSYSAPI
979 NTSTATUS
980 NTAPI
982  _In_ PVOID HeapHandle,
983  _In_ HEAP_INFORMATION_CLASS HeapInformationClass,
984  _When_(HeapInformationClass==HeapCompatibilityInformation,_In_) PVOID HeapInformation,
985  _In_ SIZE_T HeapInformationLength
986 );
987 
988 NTSYSAPI
989 BOOLEAN
990 NTAPI
992  _In_ HANDLE Heap
993 );
994 
995 NTSYSAPI
996 ULONG
997 NTAPI
999  _In_ HANDLE HeapHandle,
1000  _In_ ULONG Flags,
1001  _In_ SIZE_T Size,
1002  _In_ ULONG Count,
1004 );
1005 
1006 NTSYSAPI
1007 ULONG
1008 NTAPI
1010  _In_ HANDLE HeapHandle,
1011  _In_ ULONG Flags,
1012  _In_ ULONG Count,
1013  _In_count_(Count) /* _Deref_ _Post_invalid_ */ PVOID * Array
1014 );
1015 
1016 NTSYSAPI
1017 NTSTATUS
1018 NTAPI
1019 RtlUsageHeap(
1020  _In_ HANDLE Heap,
1021  _In_ ULONG Flags,
1023 );
1024 
1025 NTSYSAPI
1026 BOOLEAN
1027 NTAPI
1029  _In_ HANDLE Heap
1030 );
1031 
1032 BOOLEAN
1033 NTAPI
1035  _In_ PVOID HeapHandle,
1036  _In_ ULONG Flags,
1038  _In_ PVOID UserValue
1039 );
1040 
1041 BOOLEAN
1042 NTAPI
1044  _In_ PVOID HeapHandle,
1045  _In_ ULONG Flags,
1047  _In_ ULONG UserFlagsReset,
1048  _In_ ULONG UserFlagsSet
1049 );
1050 
1051 NTSYSAPI
1052 BOOLEAN
1053 NTAPI
1055  _In_ HANDLE Heap,
1056  _In_ ULONG Flags,
1057  _In_opt_ PVOID P
1058 );
1059 
1060 NTSYSAPI
1061 NTSTATUS
1062 NTAPI
1063 RtlWalkHeap(
1064  _In_ HANDLE HeapHandle,
1065  _In_ PVOID HeapEntry
1066 );
1067 
1068 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
1069 
1070 #endif // NTOS_MODE_USER
1071 
1072 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
1073 
1074 NTSYSAPI
1075 SIZE_T
1076 NTAPI
1077 RtlSizeHeap(
1078  _In_ PVOID HeapHandle,
1079  _In_ ULONG Flags,
1080  _In_ PVOID MemoryPointer
1081 );
1082 
1083 
1084 //
1085 // Security Functions
1086 //
1088 NTSYSAPI
1089 NTSTATUS
1090 NTAPI
1095 );
1096 
1098 NTSYSAPI
1099 NTSTATUS
1100 NTAPI
1102  _Inout_ PACL Acl,
1105  _In_ PSID Sid
1106 );
1107 
1109 NTSYSAPI
1110 NTSTATUS
1111 NTAPI
1113  _Inout_ PACL pAcl,
1117  _In_ PSID pSid
1118 );
1119 
1120 NTSYSAPI
1121 NTSTATUS
1122 NTAPI
1124  _Inout_ PACL pAcl,
1128  _In_opt_ GUID *ObjectTypeGuid,
1129  _In_opt_ GUID *InheritedObjectTypeGuid,
1130  _In_ PSID pSid
1131 );
1132 
1133 NTSYSAPI
1134 NTSTATUS
1135 NTAPI
1137  _Inout_ PACL Acl,
1140  _In_ PSID Sid
1141 );
1142 
1143 NTSYSAPI
1144 NTSTATUS
1145 NTAPI
1147  _Inout_ PACL Acl,
1149  _In_ ULONG Flags,
1151  _In_ PSID Sid
1152 );
1153 
1154 NTSYSAPI
1155 NTSTATUS
1156 NTAPI
1158  _Inout_ PACL pAcl,
1162  _In_opt_ GUID *ObjectTypeGuid,
1163  _In_opt_ GUID *InheritedObjectTypeGuid,
1164  _In_ PSID pSid
1165 );
1166 
1167 NTSYSAPI
1168 NTSTATUS
1169 NTAPI
1170 RtlAddAce(
1171  _Inout_ PACL Acl,
1176 );
1177 
1178 NTSYSAPI
1179 NTSTATUS
1180 NTAPI
1182  _Inout_ PACL Acl,
1185  _In_ PSID Sid,
1187  _In_ BOOLEAN Failure
1188 );
1189 
1190 NTSYSAPI
1191 NTSTATUS
1192 NTAPI
1195  _In_ ULONG NumPriv,
1196  _In_ ULONG Flags,
1197  _Out_ PVOID *ReturnedState
1198 );
1199 
1200 NTSYSAPI
1201 NTSTATUS
1202 NTAPI
1204  _Inout_ PACL Acl,
1206  _In_ ULONG Flags,
1208  _In_ PSID Sid,
1210  _In_ BOOLEAN Failure
1211 );
1212 
1213 NTSYSAPI
1214 NTSTATUS
1215 NTAPI
1217  _Inout_ PACL Acl,
1219  _In_ ULONG Flags,
1221  _In_opt_ GUID *ObjectTypeGuid,
1222  _In_opt_ GUID *InheritedObjectTypeGuid,
1223  _In_ PSID Sid,
1225  _In_ BOOLEAN Failure
1226 );
1227 
1228 NTSYSAPI
1229 NTSTATUS
1230 NTAPI
1232  _Inout_ PACL Acl,
1234  _In_ ULONG Flags,
1235  _In_ ULONG MandatoryFlags,
1236  _In_ UCHAR AceType,
1237  _In_ PSID LabelSid);
1238 
1239 NTSYSAPI
1240 NTSTATUS
1241 NTAPI
1244  _In_ BOOLEAN NewValue,
1245  _In_ BOOLEAN ForThread,
1246  _Out_ PBOOLEAN OldValue
1247 );
1248 
1250 NTSYSAPI
1251 NTSTATUS
1252 NTAPI
1256  _In_ ULONG SubAuthority0,
1257  _In_ ULONG SubAuthority1,
1258  _In_ ULONG SubAuthority2,
1259  _In_ ULONG SubAuthority3,
1260  _In_ ULONG SubAuthority4,
1261  _In_ ULONG SubAuthority5,
1262  _In_ ULONG SubAuthority6,
1263  _In_ ULONG SubAuthority7,
1264  _Outptr_ PSID *Sid
1265 );
1266 
1267 NTSYSAPI
1268 BOOLEAN
1269 NTAPI
1273 );
1274 
1275 NTSYSAPI
1276 BOOLEAN
1277 NTAPI
1281 );
1282 
1284 NTSYSAPI
1285 VOID
1286 NTAPI
1287 RtlCopyLuid (
1288  _Out_ PLUID DestinationLuid,
1290  );
1291 
1292 NTSYSAPI
1293 VOID
1294 NTAPI
1296  ULONG Count,
1299 );
1300 
1301 NTSYSAPI
1302 NTSTATUS
1303 NTAPI
1305  _In_ ULONG Count,
1307  _In_ ULONG SidAreaSize,
1309  _In_ PSID SidArea,
1310  _Out_ PSID* RemainingSidArea,
1311  _Out_ PULONG RemainingSidAreaSize
1312 );
1313 
1315 NTSYSAPI
1316 NTSTATUS
1317 NTAPI
1322 );
1323 
1325 NTSYSAPI
1326 NTSTATUS
1327 NTAPI
1328 RtlCopySid(
1329  _In_ ULONG DestinationSidLength,
1330  _Out_writes_bytes_(DestinationSidLength) PSID DestinationSid,
1332 );
1333 
1334 NTSYSAPI
1335 NTSTATUS
1336 NTAPI
1337 RtlCreateAcl(
1338  PACL Acl,
1339  ULONG AclSize,
1341 );
1342 
1343 NTSYSAPI
1344 NTSTATUS
1345 NTAPI
1349 );
1350 
1351 NTSYSAPI
1352 NTSTATUS
1353 NTAPI
1357 );
1358 
1359 NTSYSAPI
1360 NTSTATUS
1361 NTAPI
1363  _In_ PSECURITY_DESCRIPTOR pSourceSecurityDescriptor,
1364  _Out_ PSECURITY_DESCRIPTOR *pDestinationSecurityDescriptor
1365 );
1366 
1367 NTSYSAPI
1368 NTSTATUS
1369 NTAPI
1370 RtlDeleteAce(
1371  PACL Acl,
1372  ULONG AceIndex
1373 );
1374 
1375 NTSYSAPI
1376 BOOLEAN
1377 NTAPI
1379  PSID Sid1,
1380  PSID Sid2
1381 );
1382 
1383 NTSYSAPI
1384 BOOLEAN
1385 NTAPI
1386 RtlEqualSid (
1387  _In_ PSID Sid1,
1388  _In_ PSID Sid2
1389 );
1390 
1391 NTSYSAPI
1392 BOOLEAN
1393 NTAPI
1395  PACL Acl,
1396  PACE* Ace
1397 );
1398 
1399 NTSYSAPI
1400 PVOID
1401 NTAPI
1402 RtlFreeSid(
1404 );
1405 
1406 NTSYSAPI
1407 NTSTATUS
1408 NTAPI
1409 RtlGetAce(
1410  PACL Acl,
1411  ULONG AceIndex,
1412  PVOID *Ace
1413 );
1414 
1415 NTSYSAPI
1416 NTSTATUS
1417 NTAPI
1422 );
1423 
1424 NTSYSAPI
1425 NTSTATUS
1426 NTAPI
1430  _Out_ PACL *Dacl,
1432 );
1433 
1434 NTSYSAPI
1435 NTSTATUS
1436 NTAPI
1440  _Out_ PACL* Sacl,
1442 );
1443 
1444 NTSYSAPI
1445 NTSTATUS
1446 NTAPI
1449  _Out_ PSID *Group,
1451 );
1452 
1453 NTSYSAPI
1454 NTSTATUS
1455 NTAPI
1458  _Out_ PSID *Owner,
1460 );
1461 
1462 NTSYSAPI
1463 BOOLEAN
1464 NTAPI
1467  _Out_ PUCHAR RMControl
1468 );
1469 
1470 NTSYSAPI
1472 NTAPI
1474 
1475 NTSYSAPI
1476 NTSTATUS
1477 NTAPI
1479 
1481 NTSYSAPI
1482 NTSTATUS
1483 NTAPI
1485  _Out_ PSID Sid,
1488 );
1489 
1490 NTSYSAPI
1491 ULONG
1492 NTAPI
1494 
1496 NTSYSAPI
1497 ULONG
1498 NTAPI
1501 
1502 NTSYSAPI
1503 ULONG
1504 NTAPI
1506 
1507 NTSYSAPI
1508 NTSTATUS
1509 NTAPI
1511  _In_ PSECURITY_DESCRIPTOR AbsoluteSD,
1512  _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1514 
1515 NTSYSAPI
1516 VOID
1517 NTAPI
1521 );
1522 
1523 #ifdef NTOS_MODE_USER
1524 
1525 NTSYSAPI
1526 NTSTATUS
1527 NTAPI
1529  PACL Acl,
1531  ULONG InformationLength,
1533 );
1534 
1535 #endif
1536 
1537 NTSYSAPI
1538 VOID
1539 NTAPI
1541  _In_ PVOID ReturnedState
1542 );
1543 
1545 NTSYSAPI
1546 NTSTATUS
1547 NTAPI
1560 );
1561 
1562 NTSYSAPI
1563 NTSTATUS
1564 NTAPI
1566  _Inout_ PSECURITY_DESCRIPTOR SelfRelativeSD,
1568 );
1569 
1570 NTSYSAPI
1571 NTSTATUS
1572 NTAPI
1577 );
1578 
1579 NTSYSAPI
1580 NTSTATUS
1581 NTAPI
1584  _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
1585  _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1586 );
1587 
1589 NTSYSAPI
1590 NTSTATUS
1591 NTAPI
1595  _In_opt_ PACL Dacl,
1597 );
1598 
1600 NTSYSAPI
1601 NTSTATUS
1602 NTAPI
1607 );
1608 
1609 #ifdef NTOS_MODE_USER
1610 
1611 NTSYSAPI
1612 NTSTATUS
1613 NTAPI
1615  PACL Acl,
1617  ULONG InformationLength,
1619 );
1620 
1621 #endif
1622 
1624 NTSYSAPI
1625 NTSTATUS
1626 NTAPI
1631 );
1632 
1633 NTSYSAPI
1634 NTSTATUS
1635 NTAPI
1639  _In_ PACL Sacl,
1641 );
1642 
1643 NTSYSAPI
1644 VOID
1645 NTAPI
1648  _In_ PUCHAR RMControl
1649 );
1650 
1651 NTSYSAPI
1652 PUCHAR
1653 NTAPI
1655  _In_ PSID Sid
1656 );
1657 
1658 NTSYSAPI
1659 PULONG
1660 NTAPI
1662  _In_ PSID Sid,
1663  _In_ ULONG SubAuthority
1664 );
1665 
1668 NTSYSAPI
1669 BOOLEAN
1670 NTAPI
1675 );
1676 
1677 NTSYSAPI
1678 BOOLEAN
1679 NTAPI
1681 
1682 NTSYSAPI
1683 BOOLEAN
1684 NTAPI
1686 
1687 NTSYSAPI
1688 BOOLEAN
1689 NTAPI
1690 RtlValidAcl(PACL Acl);
1691 
1692 NTSYSAPI
1693 NTSTATUS
1694 NTAPI
1696  _In_ PSECURITY_DESCRIPTOR *ObjectDescriptor
1697 );
1698 
1699 NTSYSAPI
1700 NTSTATUS
1701 NTAPI
1703  _In_ PSECURITY_DESCRIPTOR ParentDescriptor,
1704  _In_ PSECURITY_DESCRIPTOR CreatorDescriptor,
1707  _In_ HANDLE Token,
1709 );
1710 
1711 NTSYSAPI
1712 NTSTATUS
1713 NTAPI
1715  _In_ PSECURITY_DESCRIPTOR ObjectDescriptor,
1717  _Out_ PSECURITY_DESCRIPTOR ResultantDescriptor,
1718  _In_ ULONG DescriptorLength,
1720 );
1721 
1722 NTSYSAPI
1723 NTSTATUS
1724 NTAPI
1727  _In_ PSECURITY_DESCRIPTOR ModificationDescriptor,
1728  _Out_ PSECURITY_DESCRIPTOR *ObjectsSecurityDescriptor,
1730  _In_ HANDLE Token
1731 );
1732 
1733 //
1734 // Single-Character Functions
1735 //
1736 NTSYSAPI
1737 NTSTATUS
1738 NTAPI
1741  _In_ ULONG Base,
1742  _In_ ULONG Length,
1744 );
1745 
1746 NTSYSAPI
1747 CHAR
1748 NTAPI
1750 
1751 NTSYSAPI
1752 WCHAR
1753 NTAPI
1755 
1756 NTSYSAPI
1757 WCHAR
1758 NTAPI
1760 
1761 NTSYSAPI
1762 NTSTATUS
1763 NTAPI
1765  _In_ ULONG Value,
1766  _In_ ULONG Base,
1767  _In_ ULONG Length,
1769 );
1770 
1771 NTSYSAPI
1772 NTSTATUS
1773 NTAPI
1775  _In_ ULONG Value,
1779 );
1780 
1782 _At_(String->MaximumLength, _Const_)
1783 NTSYSAPI
1784 NTSTATUS
1785 NTAPI
1787  _In_ ULONG Value,
1790 );
1791 
1792 NTSYSAPI
1793 NTSTATUS
1794 NTAPI
1796  PCSZ String,
1797  ULONG Base,
1798  PULONG Value
1799 );
1800 
1801 //
1802 // Byte Swap Functions
1803 //
1804 #ifdef NTOS_MODE_USER
1805 
1806 unsigned short __cdecl _byteswap_ushort(unsigned short);
1807 unsigned long __cdecl _byteswap_ulong (unsigned long);
1808 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
1809 #ifdef _MSC_VER
1810 #pragma intrinsic(_byteswap_ushort)
1811 #pragma intrinsic(_byteswap_ulong)
1812 #pragma intrinsic(_byteswap_uint64)
1813 #endif // _MSC_VER
1814 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1815 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1816 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1817 
1818 #endif // NTOS_MODE_USER
1819 
1820 //
1821 // Unicode->Ansi String Functions
1822 //
1823 NTSYSAPI
1824 ULONG
1825 NTAPI
1827 
1828 #ifdef NTOS_MODE_USER
1829 
1830 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1831  NLS_MB_CODE_PAGE_TAG ? \
1832  RtlxUnicodeStringToAnsiSize(STRING) : \
1833  ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1834 )
1835 
1836 #endif
1837 
1838 NTSYSAPI
1839 NTSTATUS
1840 NTAPI
1845 );
1846 
1847 //
1848 // Unicode->OEM String Functions
1849 //
1850 NTSYSAPI
1851 NTSTATUS
1852 NTAPI
1857 );
1858 
1861 //_At_(DestinationString->Buffer, _Post_bytecount_(DestinationString->Length))
1862 NTSYSAPI
1863 NTSTATUS
1864 NTAPI
1871 );
1872 
1873 NTSYSAPI
1874 NTSTATUS
1875 NTAPI
1880 );
1881 
1882 NTSYSAPI
1883 NTSTATUS
1884 NTAPI
1886  PCHAR OemString,
1887  ULONG OemSize,
1888  PULONG ResultSize,
1890  ULONG UnicodeSize
1891 );
1892 
1893 NTSYSAPI
1894 ULONG
1895 NTAPI
1897 
1898 #ifdef NTOS_MODE_USER
1899 
1900 #define RtlUnicodeStringToOemSize(STRING) ( \
1901  NLS_MB_OEM_CODE_PAGE_TAG ? \
1902  RtlxUnicodeStringToOemSize(STRING) : \
1903  ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1904 )
1905 
1906 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1907  (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1908 )
1909 
1910 #endif
1911 
1912 NTSYSAPI
1913 NTSTATUS
1914 NTAPI
1916  PCHAR OemString,
1917  ULONG OemSize,
1918  PULONG ResultSize,
1920  ULONG UnicodeSize
1921 );
1922 
1923 //
1924 // Unicode->MultiByte String Functions
1925 //
1926 NTSYSAPI
1927 NTSTATUS
1928 NTAPI
1930  PCHAR MbString,
1931  ULONG MbSize,
1932  PULONG ResultSize,
1934  ULONG UnicodeSize
1935 );
1936 
1937 NTSYSAPI
1938 NTSTATUS
1939 NTAPI
1941  PCHAR MbString,
1942  ULONG MbSize,
1943  PULONG ResultSize,
1945  ULONG UnicodeSize
1946 );
1947 
1948 NTSYSAPI
1949 NTSTATUS
1950 NTAPI
1952  PULONG MbSize,
1954  ULONG UnicodeSize
1955 );
1956 
1957 NTSYSAPI
1958 ULONG
1959 NTAPI
1961 
1962 //
1963 // OEM to Unicode Functions
1964 //
1965 NTSYSAPI
1966 NTSTATUS
1967 NTAPI
1972 );
1973 
1975 NTSYSAPI
1976 NTSTATUS
1977 NTAPI
1984 );
1985 
1986 #ifdef NTOS_MODE_USER
1987 
1988 #define RtlOemStringToUnicodeSize(STRING) ( \
1989  NLS_MB_OEM_CODE_PAGE_TAG ? \
1990  RtlxOemStringToUnicodeSize(STRING) : \
1991  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1992 )
1993 
1994 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1995  (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1996 )
1997 
1998 #endif
1999 
2000 //
2001 // Ansi->Unicode String Functions
2002 //
2004 NTSYSAPI
2005 WCHAR
2006 NTAPI
2008  _Inout_ PUCHAR *SourceCharacter);
2009 
2010 NTSYSAPI
2011 NTSTATUS
2012 NTAPI
2017 );
2018 
2019 NTSYSAPI
2020 ULONG
2021 NTAPI
2024 );
2025 
2026 #ifdef NTOS_MODE_USER
2027 
2028 #define RtlAnsiStringToUnicodeSize(STRING) ( \
2029  NLS_MB_CODE_PAGE_TAG ? \
2030  RtlxAnsiStringToUnicodeSize(STRING) : \
2031  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2032 )
2033 
2034 #endif
2035 
2036 NTSYSAPI
2037 BOOLEAN
2038 NTAPI
2041  _In_ PCSZ Source
2042 );
2043 
2044 //
2045 // Unicode String Functions
2046 //
2047 NTSYSAPI
2048 NTSTATUS
2049 NTAPI
2052  PCWSTR Source
2053 );
2054 
2055 NTSYSAPI
2056 NTSTATUS
2057 NTAPI
2061 );
2062 
2063 NTSYSAPI
2064 LONG
2065 NTAPI
2067  PCUNICODE_STRING String1,
2070 );
2071 
2072 NTSYSAPI
2073 VOID
2074 NTAPI
2078 );
2079 
2080 NTSYSAPI
2081 BOOLEAN
2082 NTAPI
2086 );
2087 
2088 #ifdef NTOS_MODE_USER
2089 
2090 NTSYSAPI
2091 NTSTATUS
2092 NTAPI
2094  _Inout_ PUNICODE_STRING UniDest,
2095  _In_ PCUNICODE_STRING UniSource,
2097 );
2098 
2099 NTSYSAPI
2100 NTSTATUS
2101 NTAPI
2103  _In_ ULONG Flags,
2106 );
2107 
2108 NTSYSAPI
2109 NTSTATUS
2110 NTAPI
2112  _In_ ULONG Flags,
2113  _In_ PCUNICODE_STRING SearchString,
2114  _In_ PCUNICODE_STRING MatchString,
2116 );
2117 
2118 //
2119 // Memory Functions
2120 //
2121 #if defined(_M_AMD64)
2122 
2124 VOID
2127  _In_ SIZE_T Length,
2128  _In_ ULONG Pattern)
2129 {
2131  if ((Length /= 4) != 0) {
2132  if (((ULONG64)Address & 4) != 0) {
2133  *Address = Pattern;
2134  if ((Length -= 1) == 0) {
2135  return;
2136  }
2137  Address += 1;
2138  }
2139  __stosq((PULONG64)(Address), Pattern | ((ULONG64)Pattern << 32), Length / 2);
2140  if ((Length & 1) != 0) Address[Length - 1] = Pattern;
2141  }
2142  return;
2143 }
2144 
2145 #define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
2146  __stosq((PULONG64)(Destination), Pattern, (Length) / 8)
2147 
2148 #else
2149 
2150 NTSYSAPI
2151 VOID
2152 NTAPI
2155  _In_ SIZE_T Length,
2156  _In_ ULONG Pattern
2157 );
2158 
2159 NTSYSAPI
2160 VOID
2161 NTAPI
2164  _In_ SIZE_T Length,
2165  _In_ ULONGLONG Pattern
2166 );
2167 
2168 #endif
2169 
2170 NTSYSAPI
2171 NTSTATUS
2172 NTAPI
2175  _In_reads_bytes_(Size) const VOID *Source,
2176  _In_ SIZE_T Size
2177 );
2178 
2179 NTSYSAPI
2180 SIZE_T
2181 NTAPI
2183  _In_ PVOID Source,
2184  _In_ SIZE_T Length,
2185  _In_ ULONG Pattern
2186 );
2187 
2188 #ifndef RtlEqualMemory
2189 #define RtlEqualMemory(Destination, Source, Length) \
2190  (!memcmp(Destination, Source, Length))
2191 #endif
2192 
2193 #define RtlCopyBytes RtlCopyMemory
2194 #define RtlFillBytes RtlFillMemory
2195 #define RtlZeroBytes RtlZeroMemory
2196 
2197 #endif
2198 
2199 NTSYSAPI
2200 BOOLEAN
2201 NTAPI
2203  PCUNICODE_STRING String1,
2206 );
2207 
2209 NTSYSAPI
2210 VOID
2211 NTAPI
2213  _Inout_ _At_(UnicodeString->Buffer, __drv_freesMem(Mem))
2215 );
2216 
2217 NTSYSAPI
2218 VOID
2219 NTAPI
2222 );
2223 
2224 NTSYSAPI
2225 NTSTATUS
2226 NTAPI
2232 );
2233 
2242 NTSYSAPI
2243 VOID
2244 NTAPI
2248 );
2249 
2258 NTSYSAPI
2259 VOID
2260 NTAPI
2264 );
2265 
2267 NTSYSAPI
2268 NTSTATUS
2269 NTAPI
2273 );
2274 
2275 NTSYSAPI
2276 BOOLEAN
2277 NTAPI
2279  _In_ CONST VOID* Buffer,
2280  _In_ INT Size,
2282 );
2283 
2286 NTSYSAPI
2287 BOOLEAN
2288 NTAPI
2290  _In_ const STRING *String1,
2293 );
2294 
2297 NTSYSAPI
2298 BOOLEAN
2299 NTAPI
2301  _In_ PCUNICODE_STRING String1,
2304 );
2305 
2307 NTSYSAPI
2308 VOID
2309 NTAPI
2313 );
2314 
2317 NTSYSAPI
2318 LONG
2319 NTAPI
2321  _In_ const STRING *String1,
2324 );
2325 
2326 NTSYSAPI
2327 VOID
2328 NTAPI
2332 );
2333 
2336 NTSYSAPI
2337 BOOLEAN
2338 NTAPI
2340  _In_ const STRING *String1,
2343 );
2344 
2346 NTSYSAPI
2347 NTSTATUS
2348 NTAPI
2352 );
2353 
2356 NTSYSAPI
2357 NTSTATUS
2358 NTAPI
2365 );
2366 
2368 NTSYSAPI
2369 NTSTATUS
2370 NTAPI
2375 );
2376 
2377 NTSYSAPI
2378 NTSTATUS
2379 NTAPI
2381  _In_ ULONG Flags,
2383 );
2384 
2385 #define RTL_SKIP_BUFFER_COPY 0x00000001
2386 
2387 NTSYSAPI
2388 NTSTATUS
2389 NTAPI
2391  _In_ ULONG Flags,
2394 );
2395 
2396 #ifdef NTOS_MODE_USER
2397 
2399 VOID
2400 RtlInitBuffer(
2402  _In_ PUCHAR Data,
2404 )
2405 {
2406  Buffer->Buffer = Buffer->StaticBuffer = Data;
2407  Buffer->Size = Buffer->StaticSize = DataSize;
2408  Buffer->ReservedForAllocatedSize = 0;
2409  Buffer->ReservedForIMalloc = NULL;
2410 }
2411 
2413 NTSTATUS
2414 RtlEnsureBufferSize(
2415  _In_ ULONG Flags,
2418 )
2419 {
2420  if (Buffer && RequiredSize <= Buffer->Size)
2421  return STATUS_SUCCESS;
2423 }
2424 
2426 VOID
2427 RtlFreeBuffer(
2429 )
2430 {
2431  if (Buffer->Buffer != Buffer->StaticBuffer && Buffer->Buffer)
2432  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer->Buffer);
2433  Buffer->Buffer = Buffer->StaticBuffer;
2434  Buffer->Size = Buffer->StaticSize;
2435 }
2436 
2437 NTSYSAPI
2438 VOID
2439 NTAPI
2443 );
2444 
2445 NTSYSAPI
2446 VOID
2447 NTAPI
2449  _In_ UCHAR Hash,
2451 );
2452 
2453 #endif /* NTOS_MODE_USER */
2454 
2455 //
2456 // Ansi String Functions
2457 //
2459 NTSYSAPI
2460 VOID
2461 NTAPI
2463  _Inout_ _At_(AnsiString->Buffer, __drv_freesMem(Mem))
2465 );
2466 
2468 NTSYSAPI
2469 VOID
2470 NTAPI
2474 );
2475 
2477 NTSYSAPI
2478 NTSTATUS
2479 NTAPI
2483 );
2484 
2485 //
2486 // OEM String Functions
2487 //
2489 NTSYSAPI
2490 VOID
2491 NTAPI
2493  _Inout_ _At_(OemString->Buffer, __drv_freesMem(Mem))
2495 );
2496 
2497 //
2498 // MultiByte->Unicode String Functions
2499 //
2501 NTSYSAPI
2502 NTSTATUS
2503 NTAPI
2510 );
2511 
2513 NTSYSAPI
2514 NTSTATUS
2515 NTAPI
2520 );
2521 
2522 //
2523 // Atom Functions
2524 //
2525 NTSYSAPI
2526 NTSTATUS
2527 NTAPI
2529  _In_ PRTL_ATOM_TABLE AtomTable,
2530  _In_ PWSTR AtomName,
2532 );
2533 
2534 NTSYSAPI
2535 NTSTATUS
2536 NTAPI
2539  _Inout_ PRTL_ATOM_TABLE *AtomTable
2540 );
2541 
2542 NTSYSAPI
2543 NTSTATUS
2544 NTAPI
2546  _In_ PRTL_ATOM_TABLE AtomTable,
2548 );
2549 
2550 NTSYSAPI
2551 NTSTATUS
2552 NTAPI
2554 
2555 NTSYSAPI
2556 NTSTATUS
2557 NTAPI
2559  _In_ PRTL_ATOM_TABLE AtomTable,
2560  _In_ RTL_ATOM Atom,
2561  _Out_opt_ PULONG RefCount,
2563  _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName,
2564  _Inout_opt_ PULONG NameLength
2565 );
2566 
2567 NTSYSAPI
2568 NTSTATUS
2569 NTAPI
2571  _In_ PRTL_ATOM_TABLE AtomTable,
2573 );
2574 
2575 NTSYSAPI
2576 NTSTATUS
2577 NTAPI
2579  _In_ PRTL_ATOM_TABLE AtomTable,
2580  _In_ PWSTR AtomName,
2582 );
2583 
2584 //
2585 // Process Management Functions
2586 //
2587 NTSYSAPI
2588 PPEB
2589 NTAPI
2591  VOID
2592 );
2593 
2594 NTSYSAPI
2595 VOID
2596 NTAPI
2598 
2599 NTSYSAPI
2600 NTSTATUS
2601 NTAPI
2603  _Out_ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2604  _In_ PUNICODE_STRING ImagePathName,
2607  _In_opt_ PUNICODE_STRING CommandLine,
2609  _In_opt_ PUNICODE_STRING WindowTitle,
2610  _In_opt_ PUNICODE_STRING DesktopInfo,
2611  _In_opt_ PUNICODE_STRING ShellInfo,
2612  _In_opt_ PUNICODE_STRING RuntimeInfo
2613 );
2614 
2615 NTSYSAPI
2616 NTSTATUS
2617 NTAPI
2619  _In_ PUNICODE_STRING ImageFileName,
2621  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2622  _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor,
2623  _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor,
2624  _In_opt_ HANDLE ParentProcess,
2626  _In_opt_ HANDLE DebugPort,
2627  _In_opt_ HANDLE ExceptionPort,
2629 );
2630 
2631 #if (NTDDI_VERSION >= NTDDI_WIN7)
2632 NTSYSAPI
2633 NTSTATUS
2634 NTAPI
2636  _In_ PVOID ThreadContext,
2637  _Out_ HANDLE *OutThreadHandle,
2643  _Reserved_ PVOID Reserved6,
2645  _Reserved_ PVOID Reserved8
2646 );
2647 #else
2648 NTSYSAPI
2649 NTSTATUS
2650 NTAPI
2654  _In_ BOOLEAN CreateSuspended,
2655  _In_ ULONG StackZeroBits,
2656  _In_ SIZE_T StackReserve,
2657  _In_ SIZE_T StackCommit,
2658  _In_ PTHREAD_START_ROUTINE StartAddress,
2660  _Out_opt_ PHANDLE ThreadHandle,
2662 );
2663 #endif
2664 
2665 NTSYSAPI
2667 NTAPI
2669  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2670 
2671 NTSYSAPI
2672 NTSTATUS
2673 NTAPI
2675  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2676 
2677 NTSYSAPI
2678 VOID
2679 NTAPI
2681  _In_ NTSTATUS Status);
2682 
2683 NTSYSAPI
2684 VOID
2685 NTAPI
2688  _Out_ PCONTEXT ThreadContext,
2689  _In_opt_ PVOID ThreadStartParam,
2690  _In_ PTHREAD_START_ROUTINE ThreadStartAddress,
2691  _In_ PINITIAL_TEB InitialTeb
2692 );
2693 
2694 #ifdef _M_AMD64
2695 typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT;
2696 
2697 NTSYSAPI
2698 NTSTATUS
2699 NTAPI
2700 RtlWow64GetThreadContext(
2701  _In_ HANDLE ThreadHandle,
2702  _Inout_ PWOW64_CONTEXT ThreadContext
2703 );
2704 
2705 
2706 NTSYSAPI
2707 NTSTATUS
2708 NTAPI
2709 RtlWow64SetThreadContext(
2710  _In_ HANDLE ThreadHandle,
2711  _In_ PWOW64_CONTEXT ThreadContext
2712 );
2713 #endif
2714 
2715 NTSYSAPI
2716 BOOLEAN
2717 NTAPI
2719 
2720 NTSYSAPI
2722 NTAPI
2724  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2725 
2726 NTSYSAPI
2727 VOID
2728 NTAPI
2730 
2731 NTSYSAPI
2732 NTSTATUS
2733 NTAPI
2736  _In_ HANDLE Thread,
2737  _In_ PVOID CallSite,
2738  _In_ ULONG ArgumentCount,
2739  _In_ PULONG Arguments,
2740  _In_ BOOLEAN PassContext,
2741  _In_ BOOLEAN AlreadySuspended
2742 );
2743 
2744 NTSYSAPI
2745 NTSTATUS
2746 __cdecl
2748  _In_ BOOLEAN NewValue,
2749  _Out_opt_ PBOOLEAN OldValue,
2750  _In_ BOOLEAN NeedBreaks
2751 );
2752 
2753 NTSYSAPI
2754 NTSTATUS
2755 __cdecl
2757  _In_ BOOLEAN NewValue,
2758  _Out_opt_ PBOOLEAN OldValue,
2759  _In_ BOOLEAN NeedBreaks
2760 );
2761 
2762 NTSYSAPI
2763 ULONG
2764 NTAPI
2766  VOID
2767 );
2768 
2769 
2770 //
2771 // Thread Pool Functions
2772 //
2773 //
2774 NTSTATUS
2775 NTAPI
2777  _In_ PRTL_START_POOL_THREAD StartPoolThread,
2778  _In_ PRTL_EXIT_POOL_THREAD ExitPoolThread
2779 );
2780 
2781 NTSYSAPI
2782 NTSTATUS
2783 NTAPI
2785  _In_ HANDLE hWaitHandle,
2786  _In_opt_ HANDLE hCompletionEvent
2787 );
2788 
2789 NTSYSAPI
2790 NTSTATUS
2791 NTAPI
2793  _In_ HANDLE hWaitHandle
2794 );
2795 
2796 NTSYSAPI
2797 NTSTATUS
2798 NTAPI
2802  _In_ ULONG Flags
2803 );
2804 
2805 NTSYSAPI
2806 NTSTATUS
2807 NTAPI
2811  _In_ ULONG Flags
2812 );
2813 
2814 NTSYSAPI
2815 NTSTATUS
2816 NTAPI
2818  _In_ PHANDLE phNewWaitObject,
2819  _In_ HANDLE hObject,
2821  _In_ PVOID pvContext,
2822  _In_ ULONG ulMilliseconds,
2823  _In_ ULONG ulFlags
2824 );
2825 
2826 //
2827 // Environment/Path Functions
2828 //
2829 NTSYSAPI
2830 NTSTATUS
2831 NTAPI
2833  _In_ BOOLEAN Inherit,
2835 );
2836 
2837 NTSYSAPI
2838 NTSTATUS
2839 NTAPI
2841  _In_ PUNICODE_STRING DllName,
2842  _Inout_ PUNICODE_STRING RealName,
2843  _Inout_ PUNICODE_STRING LocalName
2844 );
2845 
2846 NTSYSAPI
2847 VOID
2848 NTAPI
2851 );
2852 
2853 NTSYSAPI
2854 BOOLEAN
2855 NTAPI
2858 );
2859 
2860 NTSYSAPI
2862 NTAPI
2864  _In_ PCWSTR Path
2865 );
2866 
2867 NTSYSAPI
2868 ULONG
2869 NTAPI
2871  _In_ PCWSTR Path,
2875  _Out_ PWSTR Buffer,
2876  _Out_ PWSTR *PartName
2877 );
2878 
2879 NTSYSAPI
2880 NTSTATUS
2881 NTAPI
2883  _In_ ULONG Flags,
2884  _In_ PUNICODE_STRING PathString,
2885  _In_ PUNICODE_STRING FileNameString,
2886  _In_ PUNICODE_STRING ExtensionString,
2887  _In_ PUNICODE_STRING CallerBuffer,
2889  _Out_opt_ PUNICODE_STRING* FullNameOut,
2890  _Out_opt_ PSIZE_T FilePartSize,
2892 );
2893 
2894 NTSYSAPI
2895 BOOLEAN
2896 NTAPI
2898  _In_opt_z_ PCWSTR DosPathName,
2899  _Out_ PUNICODE_STRING NtPathName,
2900  _Out_opt_ PCWSTR *NtFileNamePart,
2901  _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo
2902 );
2903 
2904 
2905 #define RTL_UNCHANGED_UNK_PATH 1
2906 #define RTL_CONVERTED_UNC_PATH 2
2907 #define RTL_CONVERTED_NT_PATH 3
2908 #define RTL_UNCHANGED_DOS_PATH 4
2909 
2910 NTSYSAPI
2911 NTSTATUS
2912 NTAPI
2914  _In_ ULONG Flags,
2918 );
2919 
2920 
2921 NTSYSAPI
2922 BOOLEAN
2923 NTAPI
2926  _Out_ PUNICODE_STRING NtName,
2927  _Out_ PCWSTR *PartName,
2928  _Out_ PRTL_RELATIVE_NAME_U RelativeName
2929 );
2930 
2932 NTSYSAPI
2933 NTSTATUS
2934 NTAPI
2940 );
2941 
2942 NTSYSAPI
2943 ULONG
2944 NTAPI
2948 );
2949 
2950 NTSYSAPI
2951 ULONG
2952 NTAPI
2955  _In_ ULONG Size,
2958 );
2959 
2960 #if (NTDDI_VERSION >= NTDDI_WIN7)
2961 NTSYSAPI
2962 NTSTATUS
2963 NTAPI
2967  _Out_ PWSTR Buffer,
2968  _Out_opt_ PWSTR *FilePart,
2969  _Out_opt_ RTL_PATH_TYPE *InputPathType
2970  );
2971 #endif
2972 
2973 NTSTATUS
2974 NTAPI
2980  _Out_opt_ PSIZE_T FilePartSize,
2984 );
2985 
2986 NTSYSAPI
2987 NTSTATUS
2988 NTAPI
2991  _In_ PCUNICODE_STRING PathString,
2993 );
2994 
2995 NTSYSAPI
2996 ULONG
2997 NTAPI
2999  VOID
3000 );
3001 
3002 NTSYSAPI
3003 ULONG
3004 NTAPI
3006  _In_ PCWSTR Name
3007 );
3008 
3009 NTSYSAPI
3010 ULONG
3011 NTAPI
3014 );
3015 
3018 NTSYSAPI
3019 BOOLEAN
3020 NTAPI
3025 );
3026 
3027 NTSYSAPI
3028 NTSTATUS
3029 NTAPI
3034 );
3035 
3036 VOID
3037 NTAPI
3039  _In_ PRTL_RELATIVE_NAME_U RelativeName
3040 );
3041 
3042 NTSYSAPI
3043 NTSTATUS
3044 NTAPI
3047 );
3048 
3049 NTSYSAPI
3050 NTSTATUS
3051 NTAPI
3056 );
3057 
3058 //
3059 // Critical Section/Resource Functions
3060 //
3061 NTSYSAPI
3062 NTSTATUS
3063 NTAPI
3066 );
3067 
3068 NTSYSAPI
3069 NTSTATUS
3070 NTAPI
3073 );
3074 
3075 NTSYSAPI
3076 NTSTATUS
3077 NTAPI
3080 );
3081 
3082 NTSYSAPI
3083 NTSTATUS
3084 NTAPI
3087  _In_ ULONG SpinCount
3088 );
3089 
3090 NTSYSAPI
3091 ULONG
3092 NTAPI
3095 );
3096 
3097 NTSYSAPI
3098 ULONG
3099 NTAPI
3102 );
3103 
3104 NTSYSAPI
3105 NTSTATUS
3106 NTAPI
3109 );
3110 
3111 NTSYSAPI
3112 BOOLEAN
3113 NTAPI
3116 );
3117 
3118 NTSYSAPI
3119 VOID
3120 NTAPI
3123 );
3124 
3125 NTSYSAPI
3126 NTSTATUS
3127 NTAPI
3130 );
3131 
3132 NTSYSAPI
3133 BOOLEAN
3134 NTAPI
3137  _In_ BOOLEAN Wait
3138 );
3139 
3140 NTSYSAPI
3141 BOOLEAN
3142 NTAPI
3145  _In_ BOOLEAN Wait
3146 );
3147 
3148 NTSYSAPI
3149 VOID
3150 NTAPI
3153 );
3154 
3155 NTSYSAPI
3156 VOID
3157 NTAPI
3160 );
3161 
3162 NTSYSAPI
3163 VOID
3164 NTAPI
3167 );
3168 
3169 NTSYSAPI
3170 VOID
3171 NTAPI
3174 );
3175 
3176 NTSYSAPI
3177 VOID
3178 NTAPI
3181 );
3182 
3183 NTSYSAPI
3184 VOID
3185 NTAPI
3188 );
3189 
3190 //
3191 // Compression Functions
3192 //
3193 NTSYSAPI //NT_RTL_COMPRESS_API
3194 NTSTATUS
3195 NTAPI
3197  _In_ USHORT CompressionFormatAndEngine,
3198  _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
3202  _In_ ULONG UncompressedChunkSize,
3203  _Out_ PULONG FinalCompressedSize,
3205 );
3206 
3208 NTSYSAPI //NT_RTL_COMPRESS_API
3209 NTSTATUS
3210 NTAPI
3212  _In_ USHORT CompressionFormat,
3218 );
3219 
3220 NTSYSAPI
3221 NTSTATUS
3222 NTAPI
3224  _In_ USHORT CompressionFormatAndEngine,
3225  _Out_ PULONG CompressBufferWorkSpaceSize,
3226  _Out_ PULONG CompressFragmentWorkSpaceSize
3227 );
3228 
3229 //
3230 // Frame Functions
3231 //
3232 NTSYSAPI
3233 VOID
3234 NTAPI
3235 RtlPopFrame(
3236  _In_ PTEB_ACTIVE_FRAME Frame
3237 );
3238 
3239 NTSYSAPI
3240 VOID
3241 NTAPI
3242 RtlPushFrame(
3243  _In_ PTEB_ACTIVE_FRAME Frame
3244 );
3245 
3246 NTSYSAPI
3248 NTAPI
3249 RtlGetFrame(
3250  VOID
3251 );
3252 
3253 //
3254 // Debug Info Functions
3255 //
3256 NTSYSAPI
3258 NTAPI
3260  _In_ ULONG Size,
3261  _In_ BOOLEAN EventPair
3262 );
3263 
3264 NTSYSAPI
3265 NTSTATUS
3266 NTAPI
3268 
3269 NTSYSAPI
3270 NTSTATUS
3271 NTAPI
3274  _In_ ULONG DebugInfoClassMask,
3275  _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer
3276 );
3277 
3278 //
3279 // Bitmap Functions
3280 //
3281 #ifdef NTOS_MODE_USER
3282 
3283 NTSYSAPI
3284 BOOLEAN
3285 NTAPI
3287  _In_ PRTL_BITMAP BitMapHeader,
3289  _In_ ULONG Length
3290 );
3291 
3292 NTSYSAPI
3293 BOOLEAN
3294 NTAPI
3296  _In_ PRTL_BITMAP BitMapHeader,
3298  _In_ ULONG Length
3299 );
3300 
3301 NTSYSAPI
3302 VOID
3303 NTAPI
3305  _In_ PRTL_BITMAP BitMapHeader
3306 );
3307 
3308 NTSYSAPI
3309 VOID
3310 NTAPI
3311 RtlClearBit(
3312  _In_ PRTL_BITMAP BitMapHeader,
3313  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3314 );
3315 
3316 NTSYSAPI
3317 VOID
3318 NTAPI
3319 RtlClearBits(
3320  _In_ PRTL_BITMAP BitMapHeader,
3321  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToClear) ULONG StartingIndex,
3322  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToClear
3323 );
3324 
3325 NTSYSAPI
3326 ULONG
3327 NTAPI
3329  _In_ PRTL_BITMAP BitMapHeader,
3332 );
3333 
3334 NTSYSAPI
3335 ULONG
3336 NTAPI
3338  _In_ PRTL_BITMAP BitMapHeader,
3341 );
3342 
3343 NTSYSAPI
3344 ULONG
3345 NTAPI
3347  _In_ PRTL_BITMAP BitMapHeader,
3349 );
3350 
3351 NTSYSAPI
3352 ULONG
3353 NTAPI
3355  _In_ PRTL_BITMAP BitMapHeader,
3356  _Out_writes_to_(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray,
3357  _In_range_(>, 0) ULONG SizeOfRunArray,
3358  _In_ BOOLEAN LocateLongestRuns
3359 );
3360 
3361 NTSYSAPI
3362 ULONG
3363 NTAPI
3365  _In_ PRTL_BITMAP BitMapHeader,
3366  _In_ ULONG FromIndex,
3367  _Out_ PULONG StartingRunIndex
3368 );
3369 
3370 NTSYSAPI
3371 CCHAR
3372 NTAPI
3375 );
3376 
3377 NTSYSAPI
3378 ULONG
3379 NTAPI
3381  _In_ PRTL_BITMAP BitMapHeader,
3383 );
3384 
3385 NTSYSAPI
3386 CCHAR
3387 NTAPI
3390 );
3391 
3392 NTSYSAPI
3393 ULONG
3394 NTAPI
3396  _In_ PRTL_BITMAP BitMapHeader,
3397  _In_ ULONG FromIndex,
3398  _Out_ PULONG StartingRunIndex
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 ULONG
3412 NTAPI
3414  _In_ PRTL_BITMAP BitMapHeader,
3417 );
3418 
3419 NTSYSAPI
3420 ULONG
3421 NTAPI
3423  _In_ PRTL_BITMAP BitMapHeader,
3426 );
3427 
3428 #ifdef __REACTOS__ // ReactOS improvement
3429 _At_(BitMapHeader->SizeOfBitMap, _Post_equal_to_(SizeOfBitMap))
3430 _At_(BitMapHeader->Buffer, _Post_equal_to_(BitMapBuffer))
3431 #endif
3432 NTSYSAPI
3433 VOID
3434 NTAPI
3436  _Out_ PRTL_BITMAP BitMapHeader,
3437  _In_opt_ __drv_aliasesMem PULONG BitMapBuffer,
3438  _In_opt_ ULONG SizeOfBitMap
3439 );
3440 
3441 NTSYSAPI
3442 ULONG
3443 NTAPI
3445  _In_ PRTL_BITMAP BitMapHeader
3446 );
3447 
3448 NTSYSAPI
3449 ULONG
3450 NTAPI
3452  _In_ PRTL_BITMAP BitMapHeader
3453 );
3454 
3455 NTSYSAPI
3456 VOID
3457 NTAPI
3458 RtlSetBit(
3459  _In_ PRTL_BITMAP BitMapHeader,
3460  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3461 );
3462 
3463 NTSYSAPI
3464 VOID
3465 NTAPI
3466 RtlSetBits(
3467  _In_ PRTL_BITMAP BitMapHeader,
3468  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToSet) ULONG StartingIndex,
3469  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToSet
3470 );
3471 
3472 NTSYSAPI
3473 VOID
3474 NTAPI
3476  _In_ PRTL_BITMAP BitMapHeader
3477 );
3478 
3480 NTSYSAPI
3481 BOOLEAN
3482 NTAPI
3483 RtlTestBit(
3484  _In_ PRTL_BITMAP BitMapHeader,
3485  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3486 );
3487 
3488 #if defined(_M_AMD64)
3491 BOOLEAN
3492 RtlCheckBit(
3493  _In_ PRTL_BITMAP BitMapHeader,
3494  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitPosition)
3495 {
3496  return BitTest64((LONG64 CONST*)BitMapHeader->Buffer, (LONG64)BitPosition);
3497 }
3498 #else
3499 #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP)/32]) >> ((BP)%32)) & 0x1)
3500 #endif /* defined(_M_AMD64) */
3501 
3502 #endif // NTOS_MODE_USER
3503 
3504 
3505 //
3506 // Timer Functions
3507 //
3508 NTSYSAPI
3509 NTSTATUS
3510 NTAPI
3512  _In_ HANDLE TimerQueue,
3513  _In_ PHANDLE phNewTimer,
3516  _In_ ULONG DueTime,
3517  _In_ ULONG Period,
3518  _In_ ULONG Flags
3519 );
3520 
3521 NTSYSAPI
3522 NTSTATUS
3523 NTAPI
3524 RtlCreateTimerQueue(PHANDLE TimerQueue);
3525 
3526 NTSYSAPI
3527 NTSTATUS
3528 NTAPI
3530  _In_ HANDLE TimerQueue,
3531  _In_ HANDLE Timer,
3532  _In_ HANDLE CompletionEvent
3533 );
3534 
3535 NTSYSAPI
3536 NTSTATUS
3537 NTAPI
3539  _In_ HANDLE TimerQueue,
3540  _In_ HANDLE Timer,
3541  _In_ ULONG DueTime,
3542  _In_ ULONG Period
3543 );
3544 
3545 NTSYSAPI
3546 NTSTATUS
3547 NTAPI
3549  _In_ HANDLE TimerQueue,
3550  _In_opt_ HANDLE CompletionEvent
3551 );
3552 
3553 NTSYSAPI
3554 NTSTATUS
3555 NTAPI
3556 RtlDeleteTimerQueue(HANDLE TimerQueue);
3557 
3558 //
3559 // SList functions
3560 //
3562 FASTCALL
3564  _Inout_ PSLIST_HEADER ListHead,
3567  _In_ ULONG Count
3568 );
3569 
3570 //
3571 // Range List functions
3572 //
3573 NTSYSAPI
3574 VOID
3575 NTAPI
3577  _Out_ PRTL_RANGE_LIST RangeList
3578 );
3579 
3580 NTSYSAPI
3581 VOID
3582 NTAPI
3584  _In_ PRTL_RANGE_LIST RangeList
3585 );
3586 
3587 NTSYSAPI
3588 NTSTATUS
3589 NTAPI
3591  _Out_ PRTL_RANGE_LIST CopyRangeList,
3592  _In_ PRTL_RANGE_LIST RangeList
3593 );
3594 
3595 NTSYSAPI
3596 NTSTATUS
3597 NTAPI
3599  _Out_ PRTL_RANGE_LIST MergedRangeList,
3600  _In_ PRTL_RANGE_LIST RangeList1,
3601  _In_ PRTL_RANGE_LIST RangeList2,
3602  _In_ ULONG Flags
3603 );
3604 
3605 NTSYSAPI
3606 NTSTATUS
3607 NTAPI
3609  _Out_ PRTL_RANGE_LIST InvertedRangeList,
3610  _In_ PRTL_RANGE_LIST RangeList
3611 );
3612 
3613 NTSYSAPI
3614 NTSTATUS
3615 NTAPI
3616 RtlAddRange(
3617  _Inout_ PRTL_RANGE_LIST RangeList,
3619  _In_ ULONGLONG End,
3621  _In_ ULONG Flags,
3624 );
3625 
3626 NTSYSAPI
3627 NTSTATUS
3628 NTAPI
3630  _Inout_ PRTL_RANGE_LIST RangeList,
3632  _In_ ULONGLONG End,
3633  _In_ PVOID Owner
3634 );
3635 
3636 NTSYSAPI
3637 NTSTATUS
3638 NTAPI
3640  _Inout_ PRTL_RANGE_LIST RangeList,
3642 );
3643 
3644 NTSYSAPI
3645 NTSTATUS
3646 NTAPI
3647 RtlFindRange(
3648  _In_ PRTL_RANGE_LIST RangeList,
3649  _In_ ULONGLONG Minimum,
3650  _In_ ULONGLONG Maximum,
3651  _In_ ULONG Length,
3653  _In_ ULONG Flags,
3654  _In_ UCHAR AttributeAvailableMask,
3656  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3658 );
3659 
3660 NTSYSAPI
3661 NTSTATUS
3662 NTAPI
3664  _In_ PRTL_RANGE_LIST RangeList,
3666  _In_ ULONGLONG End,
3667  _In_ ULONG Flags,
3668  _In_ UCHAR AttributeAvailableMask,
3670  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3671  _Out_ PBOOLEAN Available
3672 );
3673 
3674 NTSYSAPI
3675 NTSTATUS
3676 NTAPI
3678  _In_ PRTL_RANGE_LIST RangeList,
3681 );
3682 
3683 NTSYSAPI
3684 NTSTATUS
3685 NTAPI
3689  _In_ BOOLEAN MoveForwards
3690 );
3691 
3692 //
3693 // Debug Functions
3694 //
3695 ULONG
3696 __cdecl
3697 DbgPrint(
3699  ...
3700 );
3701 
3702 NTSYSAPI
3703 ULONG
3704 __cdecl
3705 DbgPrintEx(
3707  _In_ ULONG Level,
3709  ...
3710 );
3711 
3712 NTSYSAPI
3713 ULONG
3714 NTAPI
3715 DbgPrompt(
3716  _In_z_ PCCH Prompt,
3719 );
3720 
3721 #undef DbgBreakPoint
3722 VOID
3723 NTAPI
3725  VOID
3726 );
3727 
3728 VOID
3729 NTAPI
3731  _In_ PSTRING Name,
3732  _In_ PVOID Base,
3734 );
3735 
3736 VOID
3737 NTAPI
3739  _In_ PSTRING Name,
3740  _In_ PVOID Base,
3742 );
3743 
3744 VOID
3745 NTAPI
3747  _In_ PCCH Name,
3748  _In_ PCCH Command
3749 );
3750 
3751 //
3752 // Generic Table Functions
3753 //
3754 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3755 NTSYSAPI
3756 PVOID
3757 NTAPI
3762  _Out_opt_ PBOOLEAN NewElement
3763 );
3764 
3765 NTSYSAPI
3766 PVOID
3767 NTAPI
3772  _Out_opt_ PBOOLEAN NewElement,
3773  _In_ PVOID NodeOrParent,
3774  _In_ TABLE_SEARCH_RESULT SearchResult
3775 );
3776 
3777 NTSYSAPI
3778 BOOLEAN
3779 NTAPI
3782 );
3783 
3784 NTSYSAPI
3785 PVOID
3786 NTAPI
3789  _In_ PVOID Buffer,
3790  _Out_ PVOID *NodeOrParent,
3791  _Out_ TABLE_SEARCH_RESULT *SearchResult
3792 );
3793 #endif
3794 
3795 //
3796 // Handle Table Functions
3797 //
3798 NTSYSAPI
3800 NTAPI
3804 );
3805 
3806 NTSYSAPI
3807 VOID
3808 NTAPI
3811 
3812 NTSYSAPI
3813 BOOLEAN
3814 NTAPI
3818 );
3819 
3820 NTSYSAPI
3821 VOID
3822 NTAPI
3825  _In_ ULONG HandleSize,
3827 );
3828 
3829 NTSYSAPI
3830 BOOLEAN
3831 NTAPI
3835 );
3836 
3837 _Success_(return!=FALSE)
3838 NTSYSAPI
3839 BOOLEAN
3840 NTAPI
3845 );
3846 
3847 //
3848 // PE Functions
3849 //
3850 NTSYSAPI
3851 NTSTATUS
3852 NTAPI
3855  _In_ ULONG Type,
3856  _In_ ULONG Language,
3857  _In_ ULONG MessageId,
3858  _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3859 );
3860 
3861 NTSYSAPI
3862 ULONG
3863 NTAPI
3865 
3866 _Success_(return!=NULL)
3867 NTSYSAPI
3868 PVOID
3869 NTAPI
3874  _Out_ PULONG Size
3875 );
3876 
3877 NTSYSAPI
3878 PVOID
3879 NTAPI
3881  _In_ PIMAGE_NT_HEADERS NtHeader,
3883  _In_ ULONG Rva,
3884  _Inout_opt_ PIMAGE_SECTION_HEADER *SectionHeader
3885 );
3886 
3887 NTSYSAPI
3889 NTAPI
3892 
3893 NTSYSAPI
3894 NTSTATUS
3895 NTAPI
3897  _In_ ULONG Flags,
3900  _Out_ PIMAGE_NT_HEADERS *NtHeader
3901 );
3902 
3903 NTSYSAPI
3905 NTAPI
3907  _In_ PIMAGE_NT_HEADERS NtHeader,
3909  _In_ ULONG Rva
3910 );
3911 
3912 NTSYSAPI
3913 ULONG
3914 NTAPI
3916  _In_ PVOID NewAddress,
3917  _In_ LONGLONG AdditionalBias,
3918  _In_ PCCH LoaderName,
3919  _In_ ULONG Success,
3920  _In_ ULONG Conflict,
3921  _In_ ULONG Invalid
3922 );
3923 
3924 //
3925 // Activation Context Functions
3926 //
3927 #ifdef NTOS_MODE_USER
3928 NTSYSAPI
3929 NTSTATUS
3930 NTAPI
3932  _In_ ULONG Flags,
3933  _In_ PTEB Teb,
3934  _In_ PVOID Context,
3936 );
3937 
3938 NTSYSAPI
3939 NTSTATUS
3940 NTAPI
3942  _In_ ULONG Flags,
3943  _In_ HANDLE Handle,
3945 );
3946 
3947 NTSYSAPI
3948 VOID
3949 NTAPI
3952 );
3953 
3954 NTSYSAPI
3956 FASTCALL
3958  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3960 );
3961 
3962 NTSYSAPI
3963 NTSTATUS
3964 NTAPI
3967 );
3968 
3969 NTSYSAPI
3970 NTSTATUS
3971 NTAPI
3973  _In_ ULONG Flags,
3974  _In_ PACTIVATION_CONTEXT_DATA ActivationContextData,
3975  _In_ ULONG ExtraBytes,
3976  _In_ PVOID NotificationRoutine,
3979 );
3980 
3981 NTSYSAPI
3982 NTSTATUS
3983 NTAPI
3985  _In_ PVOID *Context
3986 );
3987 
3988 NTSYSAPI
3989 VOID
3990 NTAPI
3993 );
3994 
3995 NTSYSAPI
3996 NTSTATUS
3997 NTAPI
3999  _In_ ULONG dwFlags,
4000  _In_ ULONG_PTR ulCookie
4001 );
4002 
4003 NTSYSAPI
4004 VOID
4005 NTAPI
4008 );
4009 
4010 NTSYSAPI
4011 VOID
4012 NTAPI
4014 
4015 NTSYSAPI
4017 FASTCALL
4019  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
4020 );
4021 
4022 NTSYSAPI
4023 NTSTATUS
4024 NTAPI
4026  _In_ ULONG Flags,
4027  _In_ PUNICODE_STRING OriginalName,
4032  _In_ PULONG NewFlags,
4033  _In_ PSIZE_T FileNameSize,
4035 );
4036 
4037 NTSYSAPI
4038 NTSTATUS
4039 NTAPI
4041  _In_ ULONG dwFlags,
4042  _In_ const GUID *ExtensionGuid,
4043  _In_ ULONG SectionType,
4044  _In_ const UNICODE_STRING *SectionName,
4045  _Inout_ PVOID ReturnedData
4046 );
4047 
4048 NTSYSAPI
4049 NTSTATUS
4050 NTAPI
4052  _In_ DWORD dwFlags,
4054  _In_opt_ PVOID pvSubInstance,
4055  _In_ ULONG ulInfoClass,
4056  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4057  _In_opt_ SIZE_T cbBuffer,
4058  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4059 );
4060 
4061 NTSYSAPI
4062 NTSTATUS
4063 NTAPI
4065  _In_ ULONG ulInfoClass,
4066  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4067  _In_opt_ SIZE_T cbBuffer,
4068  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4069 );
4070 
4071 NTSYSAPI
4072 NTSTATUS
4073 NTAPI
4075  PVOID Context
4076 );
4077 
4078 //
4079 // WOW64 Functions
4080 //
4081 NTSYSAPI
4082 NTSTATUS
4083 NTAPI
4085  _In_ BOOLEAN Wow64FsEnableRedirection
4086 );
4087 
4088 NTSYSAPI
4089 NTSTATUS
4090 NTAPI
4092  _In_ PVOID Wow64FsEnableRedirection,
4093  _Out_ PVOID *OldFsRedirectionLevel
4094 );
4095 
4096 #endif
4097 
4098 //
4099 // Registry Functions
4100 //
4103 NTSYSAPI
4104 NTSTATUS
4105 NTAPI
4107  _In_ ULONG RelativeTo,
4108  _In_ PWSTR Path
4109 );
4110 
4111 NTSYSAPI
4112 NTSTATUS
4113 NTAPI
4115  _In_ ULONG RelativeTo,
4116  _In_ PWSTR Path
4117 );
4118 
4119 NTSYSAPI
4120 NTSTATUS
4121 NTAPI
4123  _Out_ _At_(KeyPath->Buffer, __drv_allocatesMem(Mem) _Post_bytecap_(KeyPath->MaximumLength) _Post_bytecount_(KeyPath->Length))
4124  PUNICODE_STRING KeyPath
4125 );
4126 
4127 NTSYSAPI
4128 NTSTATUS
4129 NTAPI
4133 );
4134 
4136 NTSYSAPI
4137 NTSTATUS
4138 NTAPI
4140  _In_ ULONG RelativeTo,
4141  _In_ PCWSTR Path,
4142  _Inout_ _At_(*(*QueryTable).EntryContext, _Pre_unknown_)
4146 );
4147 
4149 NTSYSAPI
4150 NTSTATUS
4151 NTAPI
4153  _In_ ULONG RelativeTo,
4159 );
4160 
4161 #ifdef NTOS_MODE_USER
4162 NTSYSAPI
4163 NTSTATUS
4164 NTAPI
4172 );
4173 
4174 NTSYSAPI
4175 NTSTATUS
4176 NTAPI
4180  _In_ ULONG Index,
4181  _In_ ULONG Unused
4182 );
4183 
4184 NTSYSAPI
4185 NTSTATUS
4186 NTAPI
4189 );
4190 
4191 NTSYSAPI
4192 NTSTATUS
4193 NTAPI
4198  _In_ ULONG Unused
4199 );
4200 
4201 NTSYSAPI
4202 NTSTATUS
4203 NTAPI
4209  _In_ ULONG Unused
4210 );
4211 
4212 NTSYSAPI
4213 NTSTATUS
4214 NTAPI
4217  _In_ ULONG Type,
4218  _In_ PVOID Data,
4220 );
4221 #endif
4222 
4223 //
4224 // NLS Functions
4225 //
4226 NTSYSAPI
4227 VOID
4228 NTAPI
4232 );
4233 
4234 NTSYSAPI
4235 VOID
4236 NTAPI
4238  _In_ PUSHORT AnsiTableBase,
4239  _In_ PUSHORT OemTableBase,
4240  _In_ PUSHORT CaseTableBase,
4241  _Out_ PNLSTABLEINFO NlsTable
4242 );
4243 
4245 NTSYSAPI
4246 VOID
4247 NTAPI
4249  _In_ PUSHORT TableBase,
4251 );
4252 
4253 NTSYSAPI
4254 VOID
4255 NTAPI
4257  _In_ PNLSTABLEINFO NlsTable);
4258 
4259 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
4260 
4261 //
4262 // Misc conversion functions
4263 //
4264 static __inline
4268  _In_ LONG SignedInteger
4269 )
4270 {
4272 
4273  Result.QuadPart = SignedInteger;
4274  return Result;
4275 }
4276 
4277 static __inline
4281  _In_ LONG Multiplicand,
4282  _In_ LONG Multiplier
4283 )
4284 {
4285  LARGE_INTEGER Product;
4286 
4287  Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4288  return Product;
4289 }
4290 
4291 static __inline
4292 ULONG
4295  _In_ ULARGE_INTEGER Dividend,
4296  _In_ ULONG Divisor,
4298 )
4299 {
4300  ULONG Quotient;
4301 
4302  Quotient = (ULONG)(Dividend.QuadPart / Divisor);
4303  if (Remainder) {
4304  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4305  }
4306 
4307  return Quotient;
4308 }
4309 
4310 static __inline
4314  _In_ ULONG Multiplicand,
4315  _In_ ULONG Multiplier
4316 )
4317 {
4318  LARGE_INTEGER Product;
4319 
4320  Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4321  return Product;
4322 }
4323 
4324 #if defined(_AMD64_) || defined(_IA64_)
4325 static __inline
4329  _In_ LARGE_INTEGER Dividend,
4330  _In_ ULONG Divisor,
4332 {
4334  ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
4335  if (Remainder)
4336  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4337  return ret;
4338 }
4339 
4340 #else
4341 NTSYSAPI
4343 NTAPI
4345  _In_ LARGE_INTEGER Dividend,
4346  _In_ ULONG Divisor,
4348 );
4349 
4350 #endif /* defined(_AMD64_) || defined(_IA64_) */
4351 
4352 #endif
4353 
4354 
4355 NTSYSAPI
4356 ULONG
4357 NTAPI
4358 RtlUniform(
4359  _In_ PULONG Seed
4360 );
4361 
4362 NTSYSAPI
4363 ULONG
4364 NTAPI
4365 RtlRandom(
4366  _Inout_ PULONG Seed
4367 );
4368 
4369 NTSYSAPI
4370 ULONG
4371 NTAPI
4373  _In_ ULONG InitialCrc,
4374  _In_ PUCHAR Buffer,
4375  _In_ ULONG Length
4376 );
4377 
4378 //
4379 // Network Functions
4380 //
4381 NTSYSAPI
4382 PSTR
4383 NTAPI
4385  _In_ const struct in_addr *Addr,
4386  _Out_writes_(16) PCHAR S
4387 );
4388 
4389 NTSYSAPI
4390 PWSTR
4391 NTAPI
4393  _In_ const struct in_addr *Addr,
4394  _Out_writes_(16) PWCHAR S
4395 );
4396 
4397 NTSYSAPI
4398 NTSTATUS
4399 NTAPI
4401  _In_ const struct in_addr *Address,
4402  _In_ USHORT Port,
4403  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PCHAR AddressString,
4404  _Inout_ PULONG AddressStringLength
4405 );
4406 
4407 NTSTATUS
4408 NTAPI
4410  _In_ const struct in_addr *Address,
4411  _In_ USHORT Port,
4412  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4413  _Inout_ PULONG AddressStringLength
4414 );
4415 
4416 NTSYSAPI
4417 NTSTATUS
4418 NTAPI
4420  _In_ PCSTR String,
4421  _In_ BOOLEAN Strict,
4422  _Out_ PCSTR *Terminator,
4423  _Out_ struct in_addr *Addr
4424 );
4425 
4426 NTSYSAPI
4427 NTSTATUS
4428 NTAPI
4430  _In_ PCWSTR String,
4431  _In_ BOOLEAN Strict,
4432  _Out_ PCWSTR *Terminator,
4433  _Out_ struct in_addr *Addr
4434 );
4435 
4436 NTSYSAPI
4437 NTSTATUS
4438 NTAPI
4440  _In_ PCSTR AddressString,
4441  _In_ BOOLEAN Strict,
4442  _Out_ struct in_addr *Address,
4444 );
4445 
4446 NTSYSAPI
4447 NTSTATUS
4448 NTAPI
4450  _In_ PCWSTR AddressString,
4451  _In_ BOOLEAN Strict,
4452  _Out_ struct in_addr *Address,
4454 );
4455 
4456 NTSYSAPI
4457 PSTR
4458 NTAPI
4460  _In_ const struct in6_addr *Addr,
4461  _Out_writes_(46) PSTR S
4462 );
4463 
4464 NTSYSAPI
4465 PWSTR
4466 NTAPI
4468  _In_ const struct in6_addr *Addr,
4469  _Out_writes_(46) PWSTR S
4470 );
4471 
4472 NTSYSAPI
4473 NTSTATUS
4474 NTAPI
4476  _In_ const struct in6_addr *Address,
4477  _In_ ULONG ScopeId,
4478  _In_ USHORT Port,
4479  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PSTR AddressString,
4480  _Inout_ PULONG AddressStringLength
4481 );
4482 
4483 NTSYSAPI
4484 NTSTATUS
4485 NTAPI
4487  _In_ const struct in6_addr *Address,
4488  _In_ ULONG ScopeId,
4489  _In_ USHORT Port,
4490  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4491  _Inout_ PULONG AddressStringLength
4492 );
4493 
4494 NTSYSAPI
4495 NTSTATUS
4496 NTAPI
4498  _In_ PCSTR String,
4499  _Out_ PCSTR *Terminator,
4500  _Out_ struct in6_addr *Addr
4501 );
4502 
4503 NTSYSAPI
4504 NTSTATUS
4505 NTAPI
4507  _In_ PCWSTR String,
4508  _Out_ PCWSTR *Terminator,
4509  _Out_ struct in6_addr *Addr
4510 );
4511 
4512 NTSYSAPI
4513 NTSTATUS
4514 NTAPI
4516  _In_ PCSTR AddressString,
4517  _Out_ struct in6_addr *Address,
4518  _Out_ PULONG ScopeId,
4520 );
4521 
4522 NTSYSAPI
4523 NTSTATUS
4524 NTAPI
4526  _In_ PCWSTR AddressString,
4527  _Out_ struct in6_addr *Address,
4528  _Out_ PULONG ScopeId,
4530 );
4531 
4532 
4533 //
4534 // Time Functions
4535 //
4536 NTSYSAPI
4537 NTSTATUS
4538 NTAPI
4540  _Out_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4541 
4542 NTSYSAPI
4543 VOID
4544 NTAPI
4546  _In_ ULONG SecondsSince1970,
4548 );
4549 
4550 NTSYSAPI
4551 NTSTATUS
4552 NTAPI
4554  _In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4555 
4556 _Success_(return!=FALSE)
4558 NTSYSAPI
4559 BOOLEAN
4560 NTAPI
4564 );
4565 
4566 _Success_(return != 0)
4568 NTSYSAPI
4569 BOOLEAN
4570 NTAPI
4574 );
4575 
4576 NTSYSAPI
4577 VOID
4578 NTAPI
4582 );
4583 
4584 NTSYSAPI
4585 NTSTATUS
4586 NTAPI
4588  _In_ PLARGE_INTEGER SystemTime,
4589  _Out_ PLARGE_INTEGER LocalTime
4590 );
4591 
4592 //
4593 // Version Functions
4594 //
4597 NTSYSAPI
4598 NTSTATUS
4599 NTAPI
4601  _In_ PRTL_OSVERSIONINFOEXW VersionInfo,
4604 );
4605 
4607 NTSYSAPI
4608 NTSTATUS
4609 NTAPI
4611  _Out_
4612  _At_(lpVersionInformation->dwOSVersionInfoSize, _Pre_ _Valid_)
4613  _When_(lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW),
4614  _At_((PRTL_OSVERSIONINFOEXW)lpVersionInformation, _Out_))
4615  PRTL_OSVERSIONINFOW lpVersionInformation
4616 );
4617 
4619 NTSYSAPI
4620 BOOLEAN
4621 NTAPI
4623 
4624 //
4625 // Secure Memory Functions
4626 //
4627 #ifdef NTOS_MODE_USER
4628 NTSYSAPI
4629 NTSTATUS
4630 NTAPI
4632  _In_ PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
4633 
4634 NTSYSAPI
4635 BOOLEAN
4636 NTAPI
4638  _In_ PVOID MemoryCache,
4639  _In_opt_ SIZE_T MemoryLength
4640 );
4641 #endif
4642 
4643 //
4644 // Boot Status Data Functions
4645 //
4646 #ifdef NTOS_MODE_USER
4647 NTSYSAPI
4648 NTSTATUS
4649 NTAPI
4651  VOID
4652 );
4653 
4654 NTSYSAPI
4655 NTSTATUS
4656 NTAPI
4659  _In_ BOOLEAN WriteMode,
4660  _In_ RTL_BSD_ITEM_TYPE DataClass,
4661  _In_ PVOID Buffer,
4664 );
4665 
4666 NTSYSAPI
4667 NTSTATUS
4668 NTAPI
4671 );
4672 
4673 NTSYSAPI
4674 NTSTATUS
4675 NTAPI
4678 );
4679 #endif
4680 
4681 #ifdef NTOS_MODE_USER
4683 NTSYSAPI
4684 NTSTATUS
4685 NTAPI
4688  _Out_ GUID *Guid);
4689 
4691 NTSYSAPI
4692 NTSTATUS
4693 NTAPI
4695  _In_ REFGUID Guid,
4696  _Out_ _At_(GuidString->Buffer, __drv_allocatesMem(Mem))
4698 
4699 NTSYSAPI
4700 NTSTATUS
4701 NTAPI
4703  _In_ HANDLE hFile,
4704  _Out_ PCHAR Hash,
4705  _In_ ULONG ImportTableHashRevision
4706 );
4707 #endif
4708 
4709 //
4710 // MemoryStream functions
4711 //
4712 #ifdef NTOS_MODE_USER
4713 
4714 NTSYSAPI
4715 VOID
4716 NTAPI
4718  _Out_ PRTL_MEMORY_STREAM Stream
4719 );
4720 
4721 NTSYSAPI
4722 VOID
4723 NTAPI
4725  _Out_ PRTL_MEMORY_STREAM Stream
4726 );
4727 
4728 NTSYSAPI
4729 VOID
4730 NTAPI
4732  _In_ PRTL_MEMORY_STREAM Stream
4733 );
4734 
4735 NTSYSAPI
4736 HRESULT
4737 NTAPI
4739  _In_ struct IStream *This,
4740  _In_ REFIID RequestedIid,
4741  _Outptr_ PVOID *ResultObject
4742 );
4743 
4744 NTSYSAPI
4745 ULONG
4746 NTAPI
4748  _In_ struct IStream *This
4749 );
4750 
4751 NTSYSAPI
4752 ULONG
4753 NTAPI
4755  _In_ struct IStream *This
4756 );
4757 
4758 NTSYSAPI
4759 HRESULT
4760 NTAPI
4762  _In_ struct IStream *This,
4764  _In_ ULONG Length,
4766 );
4767 
4768 NTSYSAPI
4769 HRESULT
4770 NTAPI
4772  _In_ struct IStream *This,
4774  _In_ ULONG Length,
4776 );
4777 
4778 NTSYSAPI
4779 HRESULT
4780 NTAPI
4782  _In_ struct IStream *This,
4783  _In_ LARGE_INTEGER RelativeOffset,
4784  _In_ ULONG Origin,
4785  _Out_opt_ PULARGE_INTEGER ResultOffset
4786 );
4787 
4788 NTSYSAPI
4789 HRESULT
4790 NTAPI
4792  _In_ struct IStream *This,
4793  _In_ struct IStream *Target,
4797 );
4798 
4799 NTSYSAPI
4800 HRESULT
4801 NTAPI
4802 RtlCopyOutOfProcessMemoryStreamTo(
4803  _In_ struct IStream *This,
4804  _In_ struct IStream *Target,
4808 );
4809 
4810 NTSYSAPI
4811 HRESULT
4812 NTAPI
4814  _In_ struct IStream *This,
4815  _Out_ struct tagSTATSTG *Stats,
4816  _In_ ULONG Flags
4817 );
4818 
4819 // Dummy functions
4820 NTSYSAPI
4821 HRESULT
4822 NTAPI
4824  _In_ struct IStream *This,
4826  _In_ ULONG Length,
4828 );
4829 
4830 NTSYSAPI
4831 HRESULT
4832 NTAPI
4834  _In_ struct IStream *This,
4836 );
4837 
4838 NTSYSAPI
4839 HRESULT
4840 NTAPI
4842  _In_ struct IStream *This,
4843  _In_ ULONG CommitFlags
4844 );
4845 
4846 NTSYSAPI
4847 HRESULT
4848 NTAPI
4850  _In_ struct IStream *This
4851 );
4852 
4853 NTSYSAPI
4854 HRESULT
4855 NTAPI
4857  _In_ struct IStream *This,
4860  _In_ ULONG LockType
4861 );
4862 
4863 NTSYSAPI
4864 HRESULT
4865 NTAPI
4867  _In_ struct IStream *This,
48