ReactOS  0.4.15-dev-3291-gea4c1a0
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 
1884 NTSYSAPI
1885 NTSTATUS
1886 NTAPI
1887 RtlUnicodeStringToCountedOemString(
1893 );
1894 
1895 NTSYSAPI
1896 NTSTATUS
1897 NTAPI
1899  PCHAR OemString,
1900  ULONG OemSize,
1901  PULONG ResultSize,
1903  ULONG UnicodeSize
1904 );
1905 
1906 NTSYSAPI
1907 ULONG
1908 NTAPI
1910 
1911 #ifdef NTOS_MODE_USER
1912 
1913 #define RtlUnicodeStringToOemSize(STRING) ( \
1914  NLS_MB_OEM_CODE_PAGE_TAG ? \
1915  RtlxUnicodeStringToOemSize(STRING) : \
1916  ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1917 )
1918 
1919 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1920  (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1921 )
1922 
1923 #endif
1924 
1925 NTSYSAPI
1926 NTSTATUS
1927 NTAPI
1929  PCHAR OemString,
1930  ULONG OemSize,
1931  PULONG ResultSize,
1933  ULONG UnicodeSize
1934 );
1935 
1936 //
1937 // Unicode->MultiByte String Functions
1938 //
1939 NTSYSAPI
1940 NTSTATUS
1941 NTAPI
1943  PCHAR MbString,
1944  ULONG MbSize,
1945  PULONG ResultSize,
1947  ULONG UnicodeSize
1948 );
1949 
1950 NTSYSAPI
1951 NTSTATUS
1952 NTAPI
1954  PCHAR MbString,
1955  ULONG MbSize,
1956  PULONG ResultSize,
1958  ULONG UnicodeSize
1959 );
1960 
1961 NTSYSAPI
1962 NTSTATUS
1963 NTAPI
1965  PULONG MbSize,
1967  ULONG UnicodeSize
1968 );
1969 
1970 NTSYSAPI
1971 ULONG
1972 NTAPI
1974 
1975 //
1976 // OEM to Unicode Functions
1977 //
1978 NTSYSAPI
1979 NTSTATUS
1980 NTAPI
1985 );
1986 
1988 NTSYSAPI
1989 NTSTATUS
1990 NTAPI
1997 );
1998 
1999 #ifdef NTOS_MODE_USER
2000 
2001 #define RtlOemStringToUnicodeSize(STRING) ( \
2002  NLS_MB_OEM_CODE_PAGE_TAG ? \
2003  RtlxOemStringToUnicodeSize(STRING) : \
2004  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2005 )
2006 
2007 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
2008  (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
2009 )
2010 
2011 #endif
2012 
2013 //
2014 // Ansi->Unicode String Functions
2015 //
2017 NTSYSAPI
2018 WCHAR
2019 NTAPI
2021  _Inout_ PUCHAR *SourceCharacter);
2022 
2023 NTSYSAPI
2024 NTSTATUS
2025 NTAPI
2030 );
2031 
2032 NTSYSAPI
2033 ULONG
2034 NTAPI
2037 );
2038 
2039 #ifdef NTOS_MODE_USER
2040 
2041 #define RtlAnsiStringToUnicodeSize(STRING) ( \
2042  NLS_MB_CODE_PAGE_TAG ? \
2043  RtlxAnsiStringToUnicodeSize(STRING) : \
2044  ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2045 )
2046 
2047 #endif
2048 
2049 NTSYSAPI
2050 BOOLEAN
2051 NTAPI
2054  _In_ PCSZ Source
2055 );
2056 
2057 //
2058 // Unicode String Functions
2059 //
2060 NTSYSAPI
2061 NTSTATUS
2062 NTAPI
2065  PCWSTR Source
2066 );
2067 
2068 NTSYSAPI
2069 NTSTATUS
2070 NTAPI
2074 );
2075 
2076 NTSYSAPI
2077 LONG
2078 NTAPI
2080  PCUNICODE_STRING String1,
2083 );
2084 
2085 NTSYSAPI
2086 VOID
2087 NTAPI
2091 );
2092 
2093 NTSYSAPI
2094 BOOLEAN
2095 NTAPI
2099 );
2100 
2101 #ifdef NTOS_MODE_USER
2102 
2103 NTSYSAPI
2104 NTSTATUS
2105 NTAPI
2107  _Inout_ PUNICODE_STRING UniDest,
2108  _In_ PCUNICODE_STRING UniSource,
2110 );
2111 
2112 NTSYSAPI
2113 NTSTATUS
2114 NTAPI
2116  _In_ ULONG Flags,
2119 );
2120 
2121 NTSYSAPI
2122 NTSTATUS
2123 NTAPI
2125  _In_ ULONG Flags,
2126  _In_ PCUNICODE_STRING SearchString,
2127  _In_ PCUNICODE_STRING MatchString,
2129 );
2130 
2131 //
2132 // Memory Functions
2133 //
2134 #if defined(_M_AMD64)
2135 
2137 VOID
2140  _In_ SIZE_T Length,
2141  _In_ ULONG Pattern)
2142 {
2144  if ((Length /= 4) != 0) {
2145  if (((ULONG64)Address & 4) != 0) {
2146  *Address = Pattern;
2147  if ((Length -= 1) == 0) {
2148  return;
2149  }
2150  Address += 1;
2151  }
2152  __stosq((PULONG64)(Address), Pattern | ((ULONG64)Pattern << 32), Length / 2);
2153  if ((Length & 1) != 0) Address[Length - 1] = Pattern;
2154  }
2155  return;
2156 }
2157 
2158 #define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
2159  __stosq((PULONG64)(Destination), Pattern, (Length) / 8)
2160 
2161 #else
2162 
2163 NTSYSAPI
2164 VOID
2165 NTAPI
2168  _In_ SIZE_T Length,
2169  _In_ ULONG Pattern
2170 );
2171 
2172 NTSYSAPI
2173 VOID
2174 NTAPI
2177  _In_ SIZE_T Length,
2178  _In_ ULONGLONG Pattern
2179 );
2180 
2181 #endif
2182 
2183 NTSYSAPI
2184 NTSTATUS
2185 NTAPI
2188  _In_reads_bytes_(Size) const VOID *Source,
2189  _In_ SIZE_T Size
2190 );
2191 
2192 NTSYSAPI
2193 SIZE_T
2194 NTAPI
2196  _In_ PVOID Source,
2197  _In_ SIZE_T Length,
2198  _In_ ULONG Pattern
2199 );
2200 
2201 #ifndef RtlEqualMemory
2202 #define RtlEqualMemory(Destination, Source, Length) \
2203  (!memcmp(Destination, Source, Length))
2204 #endif
2205 
2206 #define RtlCopyBytes RtlCopyMemory
2207 #define RtlFillBytes RtlFillMemory
2208 #define RtlZeroBytes RtlZeroMemory
2209 
2210 #endif
2211 
2212 NTSYSAPI
2213 BOOLEAN
2214 NTAPI
2216  PCUNICODE_STRING String1,
2219 );
2220 
2222 NTSYSAPI
2223 VOID
2224 NTAPI
2226  _Inout_ _At_(UnicodeString->Buffer, __drv_freesMem(Mem))
2228 );
2229 
2230 NTSYSAPI
2231 VOID
2232 NTAPI
2235 );
2236 
2237 NTSYSAPI
2238 NTSTATUS
2239 NTAPI
2245 );
2246 
2255 NTSYSAPI
2256 VOID
2257 NTAPI
2261 );
2262 
2271 NTSYSAPI
2272 VOID
2273 NTAPI
2277 );
2278 
2280 NTSYSAPI
2281 NTSTATUS
2282 NTAPI
2286 );
2287 
2288 NTSYSAPI
2289 BOOLEAN
2290 NTAPI
2292  _In_ CONST VOID* Buffer,
2293  _In_ INT Size,
2295 );
2296 
2299 NTSYSAPI
2300 BOOLEAN
2301 NTAPI
2303  _In_ const STRING *String1,
2306 );
2307 
2310 NTSYSAPI
2311 BOOLEAN
2312 NTAPI
2314  _In_ PCUNICODE_STRING String1,
2317 );
2318 
2320 NTSYSAPI
2321 VOID
2322 NTAPI
2326 );
2327 
2330 NTSYSAPI
2331 LONG
2332 NTAPI
2334  _In_ const STRING *String1,
2337 );
2338 
2339 NTSYSAPI
2340 VOID
2341 NTAPI
2345 );
2346 
2349 NTSYSAPI
2350 BOOLEAN
2351 NTAPI
2353  _In_ const STRING *String1,
2356 );
2357 
2359 NTSYSAPI
2360 NTSTATUS
2361 NTAPI
2365 );
2366 
2369 NTSYSAPI
2370 NTSTATUS
2371 NTAPI
2378 );
2379 
2381 NTSYSAPI
2382 NTSTATUS
2383 NTAPI
2388 );
2389 
2390 NTSYSAPI
2391 NTSTATUS
2392 NTAPI
2394  _In_ ULONG Flags,
2396 );
2397 
2398 #define RTL_SKIP_BUFFER_COPY 0x00000001
2399 
2400 NTSYSAPI
2401 NTSTATUS
2402 NTAPI
2404  _In_ ULONG Flags,
2407 );
2408 
2409 #ifdef NTOS_MODE_USER
2410 
2412 VOID
2413 RtlInitBuffer(
2415  _In_ PUCHAR Data,
2417 )
2418 {
2419  Buffer->Buffer = Buffer->StaticBuffer = Data;
2420  Buffer->Size = Buffer->StaticSize = DataSize;
2421  Buffer->ReservedForAllocatedSize = 0;
2422  Buffer->ReservedForIMalloc = NULL;
2423 }
2424 
2426 NTSTATUS
2427 RtlEnsureBufferSize(
2428  _In_ ULONG Flags,
2431 )
2432 {
2434  return STATUS_SUCCESS;
2436 }
2437 
2439 VOID
2440 RtlFreeBuffer(
2442 )
2443 {
2444  if (Buffer->Buffer != Buffer->StaticBuffer && Buffer->Buffer)
2445  RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer->Buffer);
2446  Buffer->Buffer = Buffer->StaticBuffer;
2447  Buffer->Size = Buffer->StaticSize;
2448 }
2449 
2450 NTSYSAPI
2451 VOID
2452 NTAPI
2456 );
2457 
2458 NTSYSAPI
2459 VOID
2460 NTAPI
2462  _In_ UCHAR Hash,
2464 );
2465 
2466 #endif /* NTOS_MODE_USER */
2467 
2468 //
2469 // Ansi String Functions
2470 //
2472 NTSYSAPI
2473 VOID
2474 NTAPI
2476  _Inout_ _At_(AnsiString->Buffer, __drv_freesMem(Mem))
2478 );
2479 
2481 NTSYSAPI
2482 VOID
2483 NTAPI
2487 );
2488 
2490 NTSYSAPI
2491 NTSTATUS
2492 NTAPI
2496 );
2497 
2498 //
2499 // OEM String Functions
2500 //
2502 NTSYSAPI
2503 VOID
2504 NTAPI
2506  _Inout_ _At_(OemString->Buffer, __drv_freesMem(Mem))
2508 );
2509 
2510 //
2511 // MultiByte->Unicode String Functions
2512 //
2514 NTSYSAPI
2515 NTSTATUS
2516 NTAPI
2523 );
2524 
2526 NTSYSAPI
2527 NTSTATUS
2528 NTAPI
2533 );
2534 
2535 //
2536 // Atom Functions
2537 //
2538 NTSYSAPI
2539 NTSTATUS
2540 NTAPI
2542  _In_ PRTL_ATOM_TABLE AtomTable,
2543  _In_ PWSTR AtomName,
2545 );
2546 
2547 NTSYSAPI
2548 NTSTATUS
2549 NTAPI
2552  _Inout_ PRTL_ATOM_TABLE *AtomTable
2553 );
2554 
2555 NTSYSAPI
2556 NTSTATUS
2557 NTAPI
2559  _In_ PRTL_ATOM_TABLE AtomTable,
2561 );
2562 
2563 NTSYSAPI
2564 NTSTATUS
2565 NTAPI
2567 
2568 NTSYSAPI
2569 NTSTATUS
2570 NTAPI
2572  _In_ PRTL_ATOM_TABLE AtomTable,
2573  _In_ RTL_ATOM Atom,
2574  _Out_opt_ PULONG RefCount,
2576  _Out_opt_z_bytecap_(*NameLength) PWSTR AtomName,
2577  _Inout_opt_ PULONG NameLength
2578 );
2579 
2580 NTSYSAPI
2581 NTSTATUS
2582 NTAPI
2584  _In_ PRTL_ATOM_TABLE AtomTable,
2586 );
2587 
2588 NTSYSAPI
2589 NTSTATUS
2590 NTAPI
2592  _In_ PRTL_ATOM_TABLE AtomTable,
2593  _In_ PWSTR AtomName,
2595 );
2596 
2597 //
2598 // Process Management Functions
2599 //
2600 NTSYSAPI
2601 PPEB
2602 NTAPI
2604  VOID
2605 );
2606 
2607 NTSYSAPI
2608 VOID
2609 NTAPI
2611 
2612 NTSYSAPI
2613 NTSTATUS
2614 NTAPI
2616  _Out_ PRTL_USER_PROCESS_PARAMETERS *ProcessParameters,
2617  _In_ PUNICODE_STRING ImagePathName,
2620  _In_opt_ PUNICODE_STRING CommandLine,
2622  _In_opt_ PUNICODE_STRING WindowTitle,
2623  _In_opt_ PUNICODE_STRING DesktopInfo,
2624  _In_opt_ PUNICODE_STRING ShellInfo,
2625  _In_opt_ PUNICODE_STRING RuntimeInfo
2626 );
2627 
2628 NTSYSAPI
2629 NTSTATUS
2630 NTAPI
2632  _In_ PUNICODE_STRING ImageFileName,
2634  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters,
2635  _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor,
2636  _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor,
2637  _In_opt_ HANDLE ParentProcess,
2639  _In_opt_ HANDLE DebugPort,
2640  _In_opt_ HANDLE ExceptionPort,
2642 );
2643 
2644 #if (NTDDI_VERSION >= NTDDI_WIN7)
2645 NTSYSAPI
2646 NTSTATUS
2647 NTAPI
2649  _In_ PVOID ThreadContext,
2650  _Out_ HANDLE *OutThreadHandle,
2656  _Reserved_ PVOID Reserved6,
2658  _Reserved_ PVOID Reserved8
2659 );
2660 #else
2661 NTSYSAPI
2662 NTSTATUS
2663 NTAPI
2667  _In_ BOOLEAN CreateSuspended,
2668  _In_ ULONG StackZeroBits,
2669  _In_ SIZE_T StackReserve,
2670  _In_ SIZE_T StackCommit,
2671  _In_ PTHREAD_START_ROUTINE StartAddress,
2673  _Out_opt_ PHANDLE ThreadHandle,
2675 );
2676 #endif
2677 
2678 NTSYSAPI
2680 NTAPI
2682  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2683 
2684 NTSYSAPI
2685 NTSTATUS
2686 NTAPI
2688  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2689 
2690 NTSYSAPI
2691 VOID
2692 NTAPI
2694  _In_ NTSTATUS Status);
2695 
2696 NTSYSAPI
2697 VOID
2698 NTAPI
2701  _Out_ PCONTEXT ThreadContext,
2702  _In_opt_ PVOID ThreadStartParam,
2703  _In_ PTHREAD_START_ROUTINE ThreadStartAddress,
2704  _In_ PINITIAL_TEB InitialTeb
2705 );
2706 
2707 #ifdef _M_AMD64
2708 typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT;
2709 
2710 NTSYSAPI
2711 NTSTATUS
2712 NTAPI
2713 RtlWow64GetThreadContext(
2714  _In_ HANDLE ThreadHandle,
2715  _Inout_ PWOW64_CONTEXT ThreadContext
2716 );
2717 
2718 
2719 NTSYSAPI
2720 NTSTATUS
2721 NTAPI
2722 RtlWow64SetThreadContext(
2723  _In_ HANDLE ThreadHandle,
2724  _In_ PWOW64_CONTEXT ThreadContext
2725 );
2726 #endif
2727 
2728 NTSYSAPI
2729 BOOLEAN
2730 NTAPI
2732 
2733 NTSYSAPI
2735 NTAPI
2737  _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters);
2738 
2739 NTSYSAPI
2740 VOID
2741 NTAPI
2743 
2744 NTSYSAPI
2745 NTSTATUS
2746 NTAPI
2749  _In_ HANDLE Thread,
2750  _In_ PVOID CallSite,
2751  _In_ ULONG ArgumentCount,
2752  _In_ PULONG Arguments,
2753  _In_ BOOLEAN PassContext,
2754  _In_ BOOLEAN AlreadySuspended
2755 );
2756 
2757 NTSYSAPI
2758 NTSTATUS
2759 __cdecl
2761  _In_ BOOLEAN NewValue,
2762  _Out_opt_ PBOOLEAN OldValue,
2763  _In_ BOOLEAN NeedBreaks
2764 );
2765 
2766 NTSYSAPI
2767 NTSTATUS
2768 __cdecl
2770  _In_ BOOLEAN NewValue,
2771  _Out_opt_ PBOOLEAN OldValue,
2772  _In_ BOOLEAN NeedBreaks
2773 );
2774 
2775 NTSYSAPI
2776 ULONG
2777 NTAPI
2779  VOID
2780 );
2781 
2782 
2783 //
2784 // Thread Pool Functions
2785 //
2786 //
2787 NTSTATUS
2788 NTAPI
2790  _In_ PRTL_START_POOL_THREAD StartPoolThread,
2791  _In_ PRTL_EXIT_POOL_THREAD ExitPoolThread
2792 );
2793 
2794 NTSYSAPI
2795 NTSTATUS
2796 NTAPI
2798  _In_ HANDLE hWaitHandle,
2799  _In_opt_ HANDLE hCompletionEvent
2800 );
2801 
2802 NTSYSAPI
2803 NTSTATUS
2804 NTAPI
2806  _In_ HANDLE hWaitHandle
2807 );
2808 
2809 NTSYSAPI
2810 NTSTATUS
2811 NTAPI
2815  _In_ ULONG Flags
2816 );
2817 
2818 NTSYSAPI
2819 NTSTATUS
2820 NTAPI
2824  _In_ ULONG Flags
2825 );
2826 
2827 NTSYSAPI
2828 NTSTATUS
2829 NTAPI
2831  _In_ PHANDLE phNewWaitObject,
2832  _In_ HANDLE hObject,
2834  _In_ PVOID pvContext,
2835  _In_ ULONG ulMilliseconds,
2836  _In_ ULONG ulFlags
2837 );
2838 
2839 //
2840 // Environment/Path Functions
2841 //
2842 NTSYSAPI
2843 NTSTATUS
2844 NTAPI
2846  _In_ BOOLEAN Inherit,
2848 );
2849 
2850 NTSYSAPI
2851 NTSTATUS
2852 NTAPI
2854  _In_ PUNICODE_STRING DllName,
2855  _Inout_ PUNICODE_STRING RealName,
2856  _Inout_ PUNICODE_STRING LocalName
2857 );
2858 
2859 NTSYSAPI
2860 VOID
2861 NTAPI
2864 );
2865 
2866 NTSYSAPI
2867 BOOLEAN
2868 NTAPI
2871 );
2872 
2873 NTSYSAPI
2875 NTAPI
2877  _In_ PCWSTR Path
2878 );
2879 
2880 NTSYSAPI
2881 ULONG
2882 NTAPI
2884  _In_ PCWSTR Path,
2888  _Out_ PWSTR Buffer,
2889  _Out_ PWSTR *PartName
2890 );
2891 
2892 NTSYSAPI
2893 NTSTATUS
2894 NTAPI
2896  _In_ ULONG Flags,
2897  _In_ PUNICODE_STRING PathString,
2898  _In_ PUNICODE_STRING FileNameString,
2899  _In_ PUNICODE_STRING ExtensionString,
2900  _In_ PUNICODE_STRING CallerBuffer,
2902  _Out_opt_ PUNICODE_STRING* FullNameOut,
2903  _Out_opt_ PSIZE_T FilePartSize,
2905 );
2906 
2907 NTSYSAPI
2908 BOOLEAN
2909 NTAPI
2911  _In_opt_z_ PCWSTR DosPathName,
2912  _Out_ PUNICODE_STRING NtPathName,
2913  _Out_opt_ PCWSTR *NtFileNamePart,
2914  _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo
2915 );
2916 
2917 
2918 #define RTL_UNCHANGED_UNK_PATH 1
2919 #define RTL_CONVERTED_UNC_PATH 2
2920 #define RTL_CONVERTED_NT_PATH 3
2921 #define RTL_UNCHANGED_DOS_PATH 4
2922 
2923 NTSYSAPI
2924 NTSTATUS
2925 NTAPI
2927  _In_ ULONG Flags,
2931 );
2932 
2933 
2934 NTSYSAPI
2935 BOOLEAN
2936 NTAPI
2939  _Out_ PUNICODE_STRING NtName,
2940  _Out_ PCWSTR *PartName,
2941  _Out_ PRTL_RELATIVE_NAME_U RelativeName
2942 );
2943 
2945 NTSYSAPI
2946 NTSTATUS
2947 NTAPI
2953 );
2954 
2955 NTSYSAPI
2956 ULONG
2957 NTAPI
2961 );
2962 
2963 NTSYSAPI
2964 ULONG
2965 NTAPI
2968  _In_ ULONG Size,
2971 );
2972 
2973 #if (NTDDI_VERSION >= NTDDI_WIN7)
2974 NTSYSAPI
2975 NTSTATUS
2976 NTAPI
2980  _Out_ PWSTR Buffer,
2981  _Out_opt_ PWSTR *FilePart,
2982  _Out_opt_ RTL_PATH_TYPE *InputPathType
2983  );
2984 #endif
2985 
2986 NTSTATUS
2987 NTAPI
2993  _Out_opt_ PSIZE_T FilePartSize,
2997 );
2998 
2999 NTSYSAPI
3000 NTSTATUS
3001 NTAPI
3004  _In_ PCUNICODE_STRING PathString,
3006 );
3007 
3008 NTSYSAPI
3009 ULONG
3010 NTAPI
3012  VOID
3013 );
3014 
3015 NTSYSAPI
3016 ULONG
3017 NTAPI
3019  _In_ PCWSTR Name
3020 );
3021 
3022 NTSYSAPI
3023 ULONG
3024 NTAPI
3027 );
3028 
3031 NTSYSAPI
3032 BOOLEAN
3033 NTAPI
3038 );
3039 
3040 NTSYSAPI
3041 NTSTATUS
3042 NTAPI
3047 );
3048 
3049 VOID
3050 NTAPI
3052  _In_ PRTL_RELATIVE_NAME_U RelativeName
3053 );
3054 
3055 NTSYSAPI
3056 NTSTATUS
3057 NTAPI
3060 );
3061 
3062 NTSYSAPI
3063 NTSTATUS
3064 NTAPI
3069 );
3070 
3071 //
3072 // Critical Section/Resource Functions
3073 //
3074 NTSYSAPI
3075 NTSTATUS
3076 NTAPI
3079 );
3080 
3081 NTSYSAPI
3082 NTSTATUS
3083 NTAPI
3086 );
3087 
3088 NTSYSAPI
3089 NTSTATUS
3090 NTAPI
3093 );
3094 
3095 NTSYSAPI
3096 NTSTATUS
3097 NTAPI
3100  _In_ ULONG SpinCount
3101 );
3102 
3103 NTSYSAPI
3104 ULONG
3105 NTAPI
3108 );
3109 
3110 NTSYSAPI
3111 ULONG
3112 NTAPI
3115 );
3116 
3117 NTSYSAPI
3118 NTSTATUS
3119 NTAPI
3122 );
3123 
3124 NTSYSAPI
3125 BOOLEAN
3126 NTAPI
3129 );
3130 
3131 NTSYSAPI
3132 VOID
3133 NTAPI
3136 );
3137 
3138 NTSYSAPI
3139 NTSTATUS
3140 NTAPI
3143 );
3144 
3145 NTSYSAPI
3146 BOOLEAN
3147 NTAPI
3150  _In_ BOOLEAN Wait
3151 );
3152 
3153 NTSYSAPI
3154 BOOLEAN
3155 NTAPI
3158  _In_ BOOLEAN Wait
3159 );
3160 
3161 NTSYSAPI
3162 VOID
3163 NTAPI
3166 );
3167 
3168 NTSYSAPI
3169 VOID
3170 NTAPI
3173 );
3174 
3175 NTSYSAPI
3176 VOID
3177 NTAPI
3180 );
3181 
3182 NTSYSAPI
3183 VOID
3184 NTAPI
3187 );
3188 
3189 NTSYSAPI
3190 VOID
3191 NTAPI
3194 );
3195 
3196 NTSYSAPI
3197 VOID
3198 NTAPI
3201 );
3202 
3203 //
3204 // Compression Functions
3205 //
3206 NTSYSAPI //NT_RTL_COMPRESS_API
3207 NTSTATUS
3208 NTAPI
3210  _In_ USHORT CompressionFormatAndEngine,
3211  _In_reads_bytes_(UncompressedBufferSize) PUCHAR UncompressedBuffer,
3215  _In_ ULONG UncompressedChunkSize,
3216  _Out_ PULONG FinalCompressedSize,
3218 );
3219 
3221 NTSYSAPI //NT_RTL_COMPRESS_API
3222 NTSTATUS
3223 NTAPI
3225  _In_ USHORT CompressionFormat,
3231 );
3232 
3233 NTSYSAPI
3234 NTSTATUS
3235 NTAPI
3237  _In_ USHORT CompressionFormatAndEngine,
3238  _Out_ PULONG CompressBufferWorkSpaceSize,
3239  _Out_ PULONG CompressFragmentWorkSpaceSize
3240 );
3241 
3242 //
3243 // Frame Functions
3244 //
3245 NTSYSAPI
3246 VOID
3247 NTAPI
3248 RtlPopFrame(
3249  _In_ PTEB_ACTIVE_FRAME Frame
3250 );
3251 
3252 NTSYSAPI
3253 VOID
3254 NTAPI
3255 RtlPushFrame(
3256  _In_ PTEB_ACTIVE_FRAME Frame
3257 );
3258 
3259 NTSYSAPI
3261 NTAPI
3262 RtlGetFrame(
3263  VOID
3264 );
3265 
3266 //
3267 // Debug Info Functions
3268 //
3269 NTSYSAPI
3271 NTAPI
3273  _In_ ULONG Size,
3274  _In_ BOOLEAN EventPair
3275 );
3276 
3277 NTSYSAPI
3278 NTSTATUS
3279 NTAPI
3281 
3282 NTSYSAPI
3283 NTSTATUS
3284 NTAPI
3287  _In_ ULONG DebugInfoClassMask,
3288  _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer
3289 );
3290 
3291 //
3292 // Bitmap Functions
3293 //
3294 #ifdef NTOS_MODE_USER
3295 
3296 NTSYSAPI
3297 BOOLEAN
3298 NTAPI
3300  _In_ PRTL_BITMAP BitMapHeader,
3302  _In_ ULONG Length
3303 );
3304 
3305 NTSYSAPI
3306 BOOLEAN
3307 NTAPI
3309  _In_ PRTL_BITMAP BitMapHeader,
3311  _In_ ULONG Length
3312 );
3313 
3314 NTSYSAPI
3315 VOID
3316 NTAPI
3318  _In_ PRTL_BITMAP BitMapHeader
3319 );
3320 
3321 NTSYSAPI
3322 VOID
3323 NTAPI
3324 RtlClearBit(
3325  _In_ PRTL_BITMAP BitMapHeader,
3326  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3327 );
3328 
3329 NTSYSAPI
3330 VOID
3331 NTAPI
3332 RtlClearBits(
3333  _In_ PRTL_BITMAP BitMapHeader,
3334  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToClear) ULONG StartingIndex,
3335  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToClear
3336 );
3337 
3338 NTSYSAPI
3339 ULONG
3340 NTAPI
3342  _In_ PRTL_BITMAP BitMapHeader,
3345 );
3346 
3347 NTSYSAPI
3348 ULONG
3349 NTAPI
3351  _In_ PRTL_BITMAP BitMapHeader,
3354 );
3355 
3356 NTSYSAPI
3357 ULONG
3358 NTAPI
3360  _In_ PRTL_BITMAP BitMapHeader,
3362 );
3363 
3364 NTSYSAPI
3365 ULONG
3366 NTAPI
3368  _In_ PRTL_BITMAP BitMapHeader,
3369  _Out_writes_to_(SizeOfRunArray, return) PRTL_BITMAP_RUN RunArray,
3370  _In_range_(>, 0) ULONG SizeOfRunArray,
3371  _In_ BOOLEAN LocateLongestRuns
3372 );
3373 
3374 NTSYSAPI
3375 ULONG
3376 NTAPI
3378  _In_ PRTL_BITMAP BitMapHeader,
3379  _In_ ULONG FromIndex,
3380  _Out_ PULONG StartingRunIndex
3381 );
3382 
3383 NTSYSAPI
3384 CCHAR
3385 NTAPI
3388 );
3389 
3390 NTSYSAPI
3391 ULONG
3392 NTAPI
3394  _In_ PRTL_BITMAP BitMapHeader,
3396 );
3397 
3398 NTSYSAPI
3399 CCHAR
3400 NTAPI
3403 );
3404 
3405 NTSYSAPI
3406 ULONG
3407 NTAPI
3409  _In_ PRTL_BITMAP BitMapHeader,
3410  _In_ ULONG FromIndex,
3411  _Out_ PULONG StartingRunIndex
3412 );
3413 
3414 NTSYSAPI
3415 ULONG
3416 NTAPI
3418  _In_ PRTL_BITMAP BitMapHeader,
3419  _In_ ULONG FromIndex,
3420  _Out_ PULONG StartingRunIndex
3421 );
3422 
3423 NTSYSAPI
3424 ULONG
3425 NTAPI
3427  _In_ PRTL_BITMAP BitMapHeader,
3430 );
3431 
3432 NTSYSAPI
3433 ULONG
3434 NTAPI
3436  _In_ PRTL_BITMAP BitMapHeader,
3439 );
3440 
3441 #ifdef __REACTOS__ // ReactOS improvement
3442 _At_(BitMapHeader->SizeOfBitMap, _Post_equal_to_(SizeOfBitMap))
3443 _At_(BitMapHeader->Buffer, _Post_equal_to_(BitMapBuffer))
3444 #endif
3445 NTSYSAPI
3446 VOID
3447 NTAPI
3449  _Out_ PRTL_BITMAP BitMapHeader,
3450  _In_opt_ __drv_aliasesMem PULONG BitMapBuffer,
3451  _In_opt_ ULONG SizeOfBitMap
3452 );
3453 
3454 NTSYSAPI
3455 ULONG
3456 NTAPI
3458  _In_ PRTL_BITMAP BitMapHeader
3459 );
3460 
3461 NTSYSAPI
3462 ULONG
3463 NTAPI
3465  _In_ PRTL_BITMAP BitMapHeader
3466 );
3467 
3468 NTSYSAPI
3469 VOID
3470 NTAPI
3471 RtlSetBit(
3472  _In_ PRTL_BITMAP BitMapHeader,
3473  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3474 );
3475 
3476 NTSYSAPI
3477 VOID
3478 NTAPI
3479 RtlSetBits(
3480  _In_ PRTL_BITMAP BitMapHeader,
3481  _In_range_(0, BitMapHeader->SizeOfBitMap - NumberToSet) ULONG StartingIndex,
3482  _In_range_(0, BitMapHeader->SizeOfBitMap - StartingIndex) ULONG NumberToSet
3483 );
3484 
3485 NTSYSAPI
3486 VOID
3487 NTAPI
3489  _In_ PRTL_BITMAP BitMapHeader
3490 );
3491 
3493 NTSYSAPI
3494 BOOLEAN
3495 NTAPI
3496 RtlTestBit(
3497  _In_ PRTL_BITMAP BitMapHeader,
3498  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitNumber
3499 );
3500 
3501 #if defined(_M_AMD64)
3504 BOOLEAN
3505 RtlCheckBit(
3506  _In_ PRTL_BITMAP BitMapHeader,
3507  _In_range_(<, BitMapHeader->SizeOfBitMap) ULONG BitPosition)
3508 {
3509  return BitTest64((LONG64 CONST*)BitMapHeader->Buffer, (LONG64)BitPosition);
3510 }
3511 #else
3512 #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP)/32]) >> ((BP)%32)) & 0x1)
3513 #endif /* defined(_M_AMD64) */
3514 
3515 #endif // NTOS_MODE_USER
3516 
3517 
3518 //
3519 // Timer Functions
3520 //
3521 NTSYSAPI
3522 NTSTATUS
3523 NTAPI
3525  _In_ HANDLE TimerQueue,
3526  _In_ PHANDLE phNewTimer,
3529  _In_ ULONG DueTime,
3530  _In_ ULONG Period,
3531  _In_ ULONG Flags
3532 );
3533 
3534 NTSYSAPI
3535 NTSTATUS
3536 NTAPI
3537 RtlCreateTimerQueue(PHANDLE TimerQueue);
3538 
3539 NTSYSAPI
3540 NTSTATUS
3541 NTAPI
3543  _In_ HANDLE TimerQueue,
3544  _In_ HANDLE Timer,
3545  _In_ HANDLE CompletionEvent
3546 );
3547 
3548 NTSYSAPI
3549 NTSTATUS
3550 NTAPI
3552  _In_ HANDLE TimerQueue,
3553  _In_ HANDLE Timer,
3554  _In_ ULONG DueTime,
3555  _In_ ULONG Period
3556 );
3557 
3558 NTSYSAPI
3559 NTSTATUS
3560 NTAPI
3562  _In_ HANDLE TimerQueue,
3563  _In_opt_ HANDLE CompletionEvent
3564 );
3565 
3566 NTSYSAPI
3567 NTSTATUS
3568 NTAPI
3569 RtlDeleteTimerQueue(HANDLE TimerQueue);
3570 
3571 //
3572 // SList functions
3573 //
3575 FASTCALL
3577  _Inout_ PSLIST_HEADER ListHead,
3580  _In_ ULONG Count
3581 );
3582 
3583 //
3584 // Range List functions
3585 //
3586 NTSYSAPI
3587 VOID
3588 NTAPI
3590  _Out_ PRTL_RANGE_LIST RangeList
3591 );
3592 
3593 NTSYSAPI
3594 VOID
3595 NTAPI
3597  _In_ PRTL_RANGE_LIST RangeList
3598 );
3599 
3600 NTSYSAPI
3601 NTSTATUS
3602 NTAPI
3604  _Out_ PRTL_RANGE_LIST CopyRangeList,
3605  _In_ PRTL_RANGE_LIST RangeList
3606 );
3607 
3608 NTSYSAPI
3609 NTSTATUS
3610 NTAPI
3612  _Out_ PRTL_RANGE_LIST MergedRangeList,
3613  _In_ PRTL_RANGE_LIST RangeList1,
3614  _In_ PRTL_RANGE_LIST RangeList2,
3615  _In_ ULONG Flags
3616 );
3617 
3618 NTSYSAPI
3619 NTSTATUS
3620 NTAPI
3622  _Out_ PRTL_RANGE_LIST InvertedRangeList,
3623  _In_ PRTL_RANGE_LIST RangeList
3624 );
3625 
3626 NTSYSAPI
3627 NTSTATUS
3628 NTAPI
3629 RtlAddRange(
3630  _Inout_ PRTL_RANGE_LIST RangeList,
3632  _In_ ULONGLONG End,
3634  _In_ ULONG Flags,
3637 );
3638 
3639 NTSYSAPI
3640 NTSTATUS
3641 NTAPI
3643  _Inout_ PRTL_RANGE_LIST RangeList,
3645  _In_ ULONGLONG End,
3646  _In_ PVOID Owner
3647 );
3648 
3649 NTSYSAPI
3650 NTSTATUS
3651 NTAPI
3653  _Inout_ PRTL_RANGE_LIST RangeList,
3655 );
3656 
3657 NTSYSAPI
3658 NTSTATUS
3659 NTAPI
3660 RtlFindRange(
3661  _In_ PRTL_RANGE_LIST RangeList,
3662  _In_ ULONGLONG Minimum,
3663  _In_ ULONGLONG Maximum,
3664  _In_ ULONG Length,
3666  _In_ ULONG Flags,
3667  _In_ UCHAR AttributeAvailableMask,
3669  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3671 );
3672 
3673 NTSYSAPI
3674 NTSTATUS
3675 NTAPI
3677  _In_ PRTL_RANGE_LIST RangeList,
3679  _In_ ULONGLONG End,
3680  _In_ ULONG Flags,
3681  _In_ UCHAR AttributeAvailableMask,
3683  _In_opt_ PRTL_CONFLICT_RANGE_CALLBACK Callback,
3684  _Out_ PBOOLEAN Available
3685 );
3686 
3687 NTSYSAPI
3688 NTSTATUS
3689 NTAPI
3691  _In_ PRTL_RANGE_LIST RangeList,
3694 );
3695 
3696 NTSYSAPI
3697 NTSTATUS
3698 NTAPI
3702  _In_ BOOLEAN MoveForwards
3703 );
3704 
3705 //
3706 // Debug Functions
3707 //
3708 ULONG
3709 __cdecl
3710 DbgPrint(
3712  ...
3713 );
3714 
3715 NTSYSAPI
3716 ULONG
3717 __cdecl
3718 DbgPrintEx(
3720  _In_ ULONG Level,
3722  ...
3723 );
3724 
3725 NTSYSAPI
3726 ULONG
3727 NTAPI
3728 DbgPrompt(
3729  _In_z_ PCCH Prompt,
3732 );
3733 
3734 #undef DbgBreakPoint
3735 VOID
3736 NTAPI
3738  VOID
3739 );
3740 
3741 VOID
3742 NTAPI
3744  _In_ PSTRING Name,
3745  _In_ PVOID Base,
3747 );
3748 
3749 VOID
3750 NTAPI
3752  _In_ PSTRING Name,
3753  _In_ PVOID Base,
3755 );
3756 
3757 VOID
3758 NTAPI
3760  _In_ PCCH Name,
3761  _In_ PCCH Command
3762 );
3763 
3764 //
3765 // Generic Table Functions
3766 //
3767 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3768 NTSYSAPI
3769 PVOID
3770 NTAPI
3775  _Out_opt_ PBOOLEAN NewElement
3776 );
3777 
3778 NTSYSAPI
3779 PVOID
3780 NTAPI
3785  _Out_opt_ PBOOLEAN NewElement,
3786  _In_ PVOID NodeOrParent,
3787  _In_ TABLE_SEARCH_RESULT SearchResult
3788 );
3789 
3790 NTSYSAPI
3791 BOOLEAN
3792 NTAPI
3795 );
3796 
3797 NTSYSAPI
3798 PVOID
3799 NTAPI
3802  _In_ PVOID Buffer,
3803  _Out_ PVOID *NodeOrParent,
3804  _Out_ TABLE_SEARCH_RESULT *SearchResult
3805 );
3806 #endif
3807 
3808 //
3809 // Handle Table Functions
3810 //
3811 NTSYSAPI
3813 NTAPI
3817 );
3818 
3819 NTSYSAPI
3820 VOID
3821 NTAPI
3824 
3825 NTSYSAPI
3826 BOOLEAN
3827 NTAPI
3831 );
3832 
3833 NTSYSAPI
3834 VOID
3835 NTAPI
3838  _In_ ULONG HandleSize,
3840 );
3841 
3842 NTSYSAPI
3843 BOOLEAN
3844 NTAPI
3848 );
3849 
3850 _Success_(return!=FALSE)
3851 NTSYSAPI
3852 BOOLEAN
3853 NTAPI
3858 );
3859 
3860 //
3861 // PE Functions
3862 //
3863 NTSYSAPI
3864 NTSTATUS
3865 NTAPI
3868  _In_ ULONG Type,
3869  _In_ ULONG Language,
3870  _In_ ULONG MessageId,
3871  _Out_ PMESSAGE_RESOURCE_ENTRY *MessageResourceEntry
3872 );
3873 
3874 NTSYSAPI
3875 ULONG
3876 NTAPI
3878 
3879 _Success_(return!=NULL)
3880 NTSYSAPI
3881 PVOID
3882 NTAPI
3887  _Out_ PULONG Size
3888 );
3889 
3890 NTSYSAPI
3891 PVOID
3892 NTAPI
3894  _In_ PIMAGE_NT_HEADERS NtHeader,
3896  _In_ ULONG Rva,
3897  _Inout_opt_ PIMAGE_SECTION_HEADER *SectionHeader
3898 );
3899 
3900 NTSYSAPI
3902 NTAPI
3905 
3906 NTSYSAPI
3907 NTSTATUS
3908 NTAPI
3910  _In_ ULONG Flags,
3913  _Out_ PIMAGE_NT_HEADERS *NtHeader
3914 );
3915 
3916 NTSYSAPI
3918 NTAPI
3920  _In_ PIMAGE_NT_HEADERS NtHeader,
3922  _In_ ULONG Rva
3923 );
3924 
3925 NTSYSAPI
3926 ULONG
3927 NTAPI
3929  _In_ PVOID NewAddress,
3930  _In_ LONGLONG AdditionalBias,
3931  _In_ PCCH LoaderName,
3932  _In_ ULONG Success,
3933  _In_ ULONG Conflict,
3934  _In_ ULONG Invalid
3935 );
3936 
3937 //
3938 // Activation Context Functions
3939 //
3940 #ifdef NTOS_MODE_USER
3941 NTSYSAPI
3942 NTSTATUS
3943 NTAPI
3945  _In_ ULONG Flags,
3946  _In_ PTEB Teb,
3947  _In_ PVOID Context,
3949 );
3950 
3951 NTSYSAPI
3952 NTSTATUS
3953 NTAPI
3955  _In_ ULONG Flags,
3956  _In_ HANDLE Handle,
3958 );
3959 
3960 NTSYSAPI
3961 VOID
3962 NTAPI
3965 );
3966 
3967 NTSYSAPI
3969 FASTCALL
3971  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame,
3973 );
3974 
3975 NTSYSAPI
3976 NTSTATUS
3977 NTAPI
3980 );
3981 
3982 NTSYSAPI
3983 NTSTATUS
3984 NTAPI
3986  _In_ ULONG Flags,
3987  _In_ PACTIVATION_CONTEXT_DATA ActivationContextData,
3988  _In_ ULONG ExtraBytes,
3989  _In_ PVOID NotificationRoutine,
3992 );
3993 
3994 NTSYSAPI
3995 NTSTATUS
3996 NTAPI
3998  _In_ PVOID *Context
3999 );
4000 
4001 NTSYSAPI
4002 VOID
4003 NTAPI
4006 );
4007 
4008 NTSYSAPI
4009 NTSTATUS
4010 NTAPI
4012  _In_ ULONG dwFlags,
4013  _In_ ULONG_PTR ulCookie
4014 );
4015 
4016 NTSYSAPI
4017 VOID
4018 NTAPI
4021 );
4022 
4023 NTSYSAPI
4024 VOID
4025 NTAPI
4027 
4028 NTSYSAPI
4030 FASTCALL
4032  _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
4033 );
4034 
4035 NTSYSAPI
4036 NTSTATUS
4037 NTAPI
4039  _In_ ULONG Flags,
4040  _In_ PUNICODE_STRING OriginalName,
4045  _In_ PULONG NewFlags,
4046  _In_ PSIZE_T FileNameSize,
4048 );
4049 
4050 NTSYSAPI
4051 NTSTATUS
4052 NTAPI
4054  _In_ ULONG dwFlags,
4055  _In_ const GUID *ExtensionGuid,
4056  _In_ ULONG SectionType,
4057  _In_ const UNICODE_STRING *SectionName,
4058  _Inout_ PVOID ReturnedData
4059 );
4060 
4061 NTSYSAPI
4062 NTSTATUS
4063 NTAPI
4065  _In_ DWORD dwFlags,
4067  _In_opt_ PVOID pvSubInstance,
4068  _In_ ULONG ulInfoClass,
4069  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4070  _In_opt_ SIZE_T cbBuffer,
4071  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4072 );
4073 
4074 NTSYSAPI
4075 NTSTATUS
4076 NTAPI
4078  _In_ ULONG ulInfoClass,
4079  _Out_bytecap_(cbBuffer) PVOID pvBuffer,
4080  _In_opt_ SIZE_T cbBuffer,
4081  _Out_opt_ SIZE_T *pcbWrittenOrRequired
4082 );
4083 
4084 NTSYSAPI
4085 NTSTATUS
4086 NTAPI
4088  PVOID Context
4089 );
4090 
4091 //
4092 // WOW64 Functions
4093 //
4094 NTSYSAPI
4095 NTSTATUS
4096 NTAPI
4098  _In_ BOOLEAN Wow64FsEnableRedirection
4099 );
4100 
4101 NTSYSAPI
4102 NTSTATUS
4103 NTAPI
4105  _In_ PVOID Wow64FsEnableRedirection,
4106  _Out_ PVOID *OldFsRedirectionLevel
4107 );
4108 
4109 #endif
4110 
4111 //
4112 // Registry Functions
4113 //
4116 NTSYSAPI
4117 NTSTATUS
4118 NTAPI
4120  _In_ ULONG RelativeTo,
4121  _In_ PWSTR Path
4122 );
4123 
4124 NTSYSAPI
4125 NTSTATUS
4126 NTAPI
4128  _In_ ULONG RelativeTo,
4129  _In_ PWSTR Path
4130 );
4131 
4132 NTSYSAPI
4133 NTSTATUS
4134 NTAPI
4136  _Out_ _At_(KeyPath->Buffer, __drv_allocatesMem(Mem) _Post_bytecap_(KeyPath->MaximumLength) _Post_bytecount_(KeyPath->Length))
4137  PUNICODE_STRING KeyPath
4138 );
4139 
4140 NTSYSAPI
4141 NTSTATUS
4142 NTAPI
4146 );
4147 
4149 NTSYSAPI
4150 NTSTATUS
4151 NTAPI
4153  _In_ ULONG RelativeTo,
4154  _In_ PCWSTR Path,
4155  _Inout_ _At_(*(*QueryTable).EntryContext, _Pre_unknown_)
4159 );
4160 
4162 NTSYSAPI
4163 NTSTATUS
4164 NTAPI
4166  _In_ ULONG RelativeTo,
4172 );
4173 
4174 #ifdef NTOS_MODE_USER
4175 NTSYSAPI
4176 NTSTATUS
4177 NTAPI
4185 );
4186 
4187 NTSYSAPI
4188 NTSTATUS
4189 NTAPI
4193  _In_ ULONG Index,
4194  _In_ ULONG Unused
4195 );
4196 
4197 NTSYSAPI
4198 NTSTATUS
4199 NTAPI
4202 );
4203 
4204 NTSYSAPI
4205 NTSTATUS
4206 NTAPI
4211  _In_ ULONG Unused
4212 );
4213 
4214 NTSYSAPI
4215 NTSTATUS
4216 NTAPI
4222  _In_ ULONG Unused
4223 );
4224 
4225 NTSYSAPI
4226 NTSTATUS
4227 NTAPI
4230  _In_ ULONG Type,
4231  _In_ PVOID Data,
4233 );
4234 #endif
4235 
4236 //
4237 // NLS Functions
4238 //
4239 NTSYSAPI
4240 VOID
4241 NTAPI
4245 );
4246 
4247 NTSYSAPI
4248 VOID
4249 NTAPI
4251  _In_ PUSHORT AnsiTableBase,
4252  _In_ PUSHORT OemTableBase,
4253  _In_ PUSHORT CaseTableBase,
4254  _Out_ PNLSTABLEINFO NlsTable
4255 );
4256 
4258 NTSYSAPI
4259 VOID
4260 NTAPI
4262  _In_ PUSHORT TableBase,
4264 );
4265 
4266 NTSYSAPI
4267 VOID
4268 NTAPI
4270  _In_ PNLSTABLEINFO NlsTable);
4271 
4272 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
4273 
4274 //
4275 // Misc conversion functions
4276 //
4277 static __inline
4281  _In_ LONG SignedInteger
4282 )
4283 {
4285 
4286  Result.QuadPart = SignedInteger;
4287  return Result;
4288 }
4289 
4290 static __inline
4294  _In_ LONG Multiplicand,
4295  _In_ LONG Multiplier
4296 )
4297 {
4298  LARGE_INTEGER Product;
4299 
4300  Product.QuadPart = (LONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4301  return Product;
4302 }
4303 
4304 static __inline
4305 ULONG
4308  _In_ ULARGE_INTEGER Dividend,
4309  _In_ ULONG Divisor,
4311 )
4312 {
4313  ULONG Quotient;
4314 
4315  Quotient = (ULONG)(Dividend.QuadPart / Divisor);
4316  if (Remainder) {
4317  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4318  }
4319 
4320  return Quotient;
4321 }
4322 
4323 static __inline
4327  _In_ ULONG Multiplicand,
4328  _In_ ULONG Multiplier
4329 )
4330 {
4331  LARGE_INTEGER Product;
4332 
4333  Product.QuadPart = (ULONGLONG)Multiplicand * (ULONGLONG)Multiplier;
4334  return Product;
4335 }
4336 
4337 #if defined(_AMD64_) || defined(_IA64_)
4338 static __inline
4342  _In_ LARGE_INTEGER Dividend,
4343  _In_ ULONG Divisor,
4345 {
4347  ret.QuadPart = (ULONG64)Dividend.QuadPart / Divisor;
4348  if (Remainder)
4349  *Remainder = (ULONG)(Dividend.QuadPart % Divisor);
4350  return ret;
4351 }
4352 
4353 #else
4354 NTSYSAPI
4356 NTAPI
4358  _In_ LARGE_INTEGER Dividend,
4359  _In_ ULONG Divisor,
4361 );
4362 
4363 #endif /* defined(_AMD64_) || defined(_IA64_) */
4364 
4365 #endif
4366 
4367 
4368 NTSYSAPI
4369 ULONG
4370 NTAPI
4371 RtlUniform(
4372  _In_ PULONG Seed
4373 );
4374 
4375 NTSYSAPI
4376 ULONG
4377 NTAPI
4378 RtlRandom(
4379  _Inout_ PULONG Seed
4380 );
4381 
4382 NTSYSAPI
4383 ULONG
4384 NTAPI
4386  _In_ ULONG InitialCrc,
4387  _In_ PUCHAR Buffer,
4388  _In_ ULONG Length
4389 );
4390 
4391 //
4392 // Network Functions
4393 //
4394 NTSYSAPI
4395 PSTR
4396 NTAPI
4398  _In_ const struct in_addr *Addr,
4399  _Out_writes_(16) PCHAR S
4400 );
4401 
4402 NTSYSAPI
4403 PWSTR
4404 NTAPI
4406  _In_ const struct in_addr *Addr,
4407  _Out_writes_(16) PWCHAR S
4408 );
4409 
4410 NTSYSAPI
4411 NTSTATUS
4412 NTAPI
4414  _In_ const struct in_addr *Address,
4415  _In_ USHORT Port,
4416  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PCHAR AddressString,
4417  _Inout_ PULONG AddressStringLength
4418 );
4419 
4420 NTSTATUS
4421 NTAPI
4423  _In_ const struct in_addr *Address,
4424  _In_ USHORT Port,
4425  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4426  _Inout_ PULONG AddressStringLength
4427 );
4428 
4429 NTSYSAPI
4430 NTSTATUS
4431 NTAPI
4433  _In_ PCSTR String,
4434  _In_ BOOLEAN Strict,
4435  _Out_ PCSTR *Terminator,
4436  _Out_ struct in_addr *Addr
4437 );
4438 
4439 NTSYSAPI
4440 NTSTATUS
4441 NTAPI
4443  _In_ PCWSTR String,
4444  _In_ BOOLEAN Strict,
4445  _Out_ PCWSTR *Terminator,
4446  _Out_ struct in_addr *Addr
4447 );
4448 
4449 NTSYSAPI
4450 NTSTATUS
4451 NTAPI
4453  _In_ PCSTR AddressString,
4454  _In_ BOOLEAN Strict,
4455  _Out_ struct in_addr *Address,
4457 );
4458 
4459 NTSYSAPI
4460 NTSTATUS
4461 NTAPI
4463  _In_ PCWSTR AddressString,
4464  _In_ BOOLEAN Strict,
4465  _Out_ struct in_addr *Address,
4467 );
4468 
4469 NTSYSAPI
4470 PSTR
4471 NTAPI
4473  _In_ const struct in6_addr *Addr,
4474  _Out_writes_(46) PSTR S
4475 );
4476 
4477 NTSYSAPI
4478 PWSTR
4479 NTAPI
4481  _In_ const struct in6_addr *Addr,
4482  _Out_writes_(46) PWSTR S
4483 );
4484 
4485 NTSYSAPI
4486 NTSTATUS
4487 NTAPI
4489  _In_ const struct in6_addr *Address,
4490  _In_ ULONG ScopeId,
4491  _In_ USHORT Port,
4492  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PSTR AddressString,
4493  _Inout_ PULONG AddressStringLength
4494 );
4495 
4496 NTSYSAPI
4497 NTSTATUS
4498 NTAPI
4500  _In_ const struct in6_addr *Address,
4501  _In_ ULONG ScopeId,
4502  _In_ USHORT Port,
4503  _Out_writes_to_(*AddressStringLength, *AddressStringLength) PWCHAR AddressString,
4504  _Inout_ PULONG AddressStringLength
4505 );
4506 
4507 NTSYSAPI
4508 NTSTATUS
4509 NTAPI
4511  _In_ PCSTR String,
4512  _Out_ PCSTR *Terminator,
4513  _Out_ struct in6_addr *Addr
4514 );
4515 
4516 NTSYSAPI
4517 NTSTATUS
4518 NTAPI
4520  _In_ PCWSTR String,
4521  _Out_ PCWSTR *Terminator,
4522  _Out_ struct in6_addr *Addr
4523 );
4524 
4525 NTSYSAPI
4526 NTSTATUS
4527 NTAPI
4529  _In_ PCSTR AddressString,
4530  _Out_ struct in6_addr *Address,
4531  _Out_ PULONG ScopeId,
4533 );
4534 
4535 NTSYSAPI
4536 NTSTATUS
4537 NTAPI
4539  _In_ PCWSTR AddressString,
4540  _Out_ struct in6_addr *Address,
4541  _Out_ PULONG ScopeId,
4543 );
4544 
4545 
4546 //
4547 // Time Functions
4548 //
4549 NTSYSAPI
4550 BOOLEAN
4551 NTAPI
4553  _In_ PTIME_FIELDS CutoverTimeFields,
4554  _Out_ PLARGE_INTEGER SystemTime,
4555  _In_ PLARGE_INTEGER CurrentTime,
4556  _In_ BOOLEAN ThisYearsCutoverOnly);
4557 
4558 NTSYSAPI
4559 NTSTATUS
4560 NTAPI
4562  _Out_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4563 
4564 NTSYSAPI
4565 VOID
4566 NTAPI
4568  _In_ ULONG SecondsSince1970,
4570 );
4571 
4572 NTSYSAPI
4573 NTSTATUS
4574 NTAPI
4576  _In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation);
4577 
4578 _Success_(return != FALSE)
4579 NTSYSAPI
4580 BOOLEAN
4581 NTAPI
4585 );
4586 
4587 _Success_(return != FALSE)
4588 NTSYSAPI
4589 BOOLEAN
4590 NTAPI
4594 );
4595 
4596 NTSYSAPI
4597 VOID
4598 NTAPI
4602 );
4603 
4604 NTSYSAPI
4605 NTSTATUS
4606 NTAPI
4608  _In_ PLARGE_INTEGER SystemTime,
4609  _Out_ PLARGE_INTEGER LocalTime
4610 );
4611 
4612 //
4613 // Version Functions
4614 //
4617 NTSYSAPI
4618 NTSTATUS
4619 NTAPI
4624 );
4625 
4627 NTSYSAPI
4628 NTSTATUS
4629 NTAPI
4631  _Out_
4632  _At_(lpVersionInformation->dwOSVersionInfoSize, _Pre_ _Valid_)
4633  _When_(lpVersionInformation->dwOSVersionInfoSize == sizeof(RTL_OSVERSIONINFOEXW),
4634  _At_((PRTL_OSVERSIONINFOEXW)lpVersionInformation, _Out_))
4635  PRTL_OSVERSIONINFOW lpVersionInformation
4636 );
4637 
4639 NTSYSAPI
4640 BOOLEAN
4641 NTAPI
4643 
4644 //
4645 // Secure Memory Functions
4646 //
4647 #ifdef NTOS_MODE_USER
4648 NTSYSAPI
4649 NTSTATUS
4650 NTAPI
4652  _In_ PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback);
4653 
4654 NTSYSAPI
4655 BOOLEAN
4656 NTAPI
4658  _In_ PVOID MemoryCache,
4659  _In_opt_ SIZE_T MemoryLength
4660 );
4661 #endif
4662 
4663 //
4664 // Boot Status Data Functions
4665 //
4666 #ifdef NTOS_MODE_USER
4667 NTSYSAPI
4668 NTSTATUS
4669 NTAPI
4671  VOID
4672 );
4673 
4674 NTSYSAPI
4675 NTSTATUS
4676 NTAPI
4679  _In_ BOOLEAN WriteMode,
4680  _In_ RTL_BSD_ITEM_TYPE DataClass,
4681  _In_ PVOID Buffer,
4684 );
4685 
4686 NTSYSAPI
4687 NTSTATUS
4688 NTAPI
4691 );
4692 
4693 NTSYSAPI
4694 NTSTATUS
4695 NTAPI
4698 );
4699 #endif
4700 
4701 #ifdef NTOS_MODE_USER
4703 NTSYSAPI
4704 NTSTATUS
4705 NTAPI
4708  _Out_ GUID *Guid);
4709 
4711 NTSYSAPI
4712 NTSTATUS
4713 NTAPI
4715  _In_ REFGUID Guid,
4716  _Out_ _At_(GuidString->Buffer, __drv_allocatesMem(Mem))
4718 
4719 NTSYSAPI
4720 NTSTATUS
4721 NTAPI
4723  _In_ HANDLE hFile,
4724  _Out_ PCHAR Hash,
4725  _In_ ULONG ImportTableHashRevision
4726 );
4727 #endif
4728 
4729 //
4730 // MemoryStream functions
4731 //
4732 #ifdef NTOS_MODE_USER
4733 
4734 NTSYSAPI
4735 VOID
4736 NTAPI
4738  _Out_ PRTL_MEMORY_STREAM Stream
4739 );
4740 
4741 NTSYSAPI
4742 VOID
4743 NTAPI
4745  _Out_ PRTL_MEMORY_STREAM Stream
4746 );
4747 
4748 NTSYSAPI
4749 VOID
4750 NTAPI
4752  _In_ PRTL_MEMORY_STREAM Stream
4753 );
4754 
4755 NTSYSAPI
4756 HRESULT
4757 NTAPI
4759  _In_ struct IStream *This,
4760  _In_ REFIID RequestedIid,
4761  _Outptr_ PVOID *ResultObject
4762 );
4763 
4764 NTSYSAPI
4765 ULONG
4766 NTAPI
4768  _In_ struct IStream *This
4769 );
4770 
4771 NTSYSAPI
4772 ULONG
4773 NTAPI
4775  _In_ struct IStream *This
4776 );
4777 
4778 NTSYSAPI
4779 HRESULT
4780 NTAPI
4782  _In_ struct IStream *This,
4784  _In_ ULONG Length,
4786 );
4787 
4788 NTSYSAPI
4789 HRESULT
4790 NTAPI
4792  _In_ struct IStream *This,
4794  _In_ ULONG Length,
4796 );
4797 
4798 NTSYSAPI
4799 HRESULT
4800 NTAPI
4802  _In_ struct IStream *This,
4803  _In_ LARGE_INTEGER RelativeOffset,
4804  _In_ ULONG Origin,
4805  _Out_opt_ PULARGE_INTEGER ResultOffset
4806 );
4807 
4808 NTSYSAPI
4809 HRESULT
4810 NTAPI
4812  _In_ struct IStream *This,
4813  _In_ struct IStream *Target,
4817 );
4818 
4819 NTSYSAPI
4820 HRESULT
4821 NTAPI
4822 RtlCopyOutOfProcessMemoryStreamTo(
4823  _In_ struct IStream *This,
4824  _In_ struct IStream *Target,
4828 );
4829 
4830 NTSYSAPI
4831 HRESULT
4832 NTAPI
4834  _In_ struct IStream *This,
4835  _Out_ struct tagSTATSTG *Stats,
4836  _In_ ULONG Flags
4837 );
4838 
4839 // Dummy functions
4840 NTSYSAPI
4841 HRESULT
4842 NTAPI
4844  _In_ struct IStream *This,
4846  _In_ ULONG Length,
4848 );
4849 
4850 NTSYSAPI
4851 HRESULT
4852 NTAPI
4854  _In_ struct IStream *This,
4856 );
4857 
4858 NTSYSAPI
4859 HRESULT
4860 NTAPI
4862  _In_ struct IStream *This,
4863  _In_ ULONG CommitFlags
4864 );
4865 
4866 NTSYSAPI
4867 HRESULT
4868 NTAPI
4870  _In_ struct IStream *This
4871 );
4872 
4873