3 Copyright (c) Alex Ionescu. All rights reserved.
11 Function definitions for the Run-Time Library
15 Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
45 _Out_ PLIST_ENTRY ListHead
48 ListHead
->Flink
= ListHead
->Blink
= ListHead
;
54 _Inout_ PLIST_ENTRY ListHead
,
55 _Inout_ PLIST_ENTRY Entry
59 OldFlink
= ListHead
->Flink
;
60 Entry
->Flink
= OldFlink
;
61 Entry
->Blink
= ListHead
;
62 OldFlink
->Blink
= Entry
;
63 ListHead
->Flink
= Entry
;
69 _Inout_ PLIST_ENTRY ListHead
,
70 _Inout_ PLIST_ENTRY Entry
74 OldBlink
= ListHead
->Blink
;
75 Entry
->Flink
= ListHead
;
76 Entry
->Blink
= OldBlink
;
77 OldBlink
->Flink
= Entry
;
78 ListHead
->Blink
= Entry
;
85 _In_
const LIST_ENTRY
* ListHead
88 return (BOOLEAN
)(ListHead
->Flink
== ListHead
);
94 _Inout_ PSINGLE_LIST_ENTRY ListHead
97 PSINGLE_LIST_ENTRY FirstEntry
;
98 FirstEntry
= ListHead
->Next
;
99 if (FirstEntry
!= NULL
) {
100 ListHead
->Next
= FirstEntry
->Next
;
109 _Inout_ PSINGLE_LIST_ENTRY ListHead
,
110 _Inout_ PSINGLE_LIST_ENTRY Entry
113 Entry
->Next
= ListHead
->Next
;
114 ListHead
->Next
= Entry
;
120 _In_ PLIST_ENTRY Entry
)
122 PLIST_ENTRY OldFlink
;
123 PLIST_ENTRY OldBlink
;
125 OldFlink
= Entry
->Flink
;
126 OldBlink
= Entry
->Blink
;
127 OldFlink
->Blink
= OldBlink
;
128 OldBlink
->Flink
= OldFlink
;
129 return (BOOLEAN
)(OldFlink
== OldBlink
);
135 _Inout_ PLIST_ENTRY ListHead
)
140 Entry
= ListHead
->Flink
;
141 Flink
= Entry
->Flink
;
142 ListHead
->Flink
= Flink
;
143 Flink
->Blink
= ListHead
;
150 _Inout_ PLIST_ENTRY ListHead
)
155 Entry
= ListHead
->Blink
;
156 Blink
= Entry
->Blink
;
157 ListHead
->Blink
= Blink
;
158 Blink
->Flink
= ListHead
;
163 // Unicode string macros
165 _At_(UnicodeString
->Buffer
, _Post_equal_to_(Buffer
))
166 _At_(UnicodeString
->Length
, _Post_equal_to_(0))
167 _At_(UnicodeString
->MaximumLength
, _Post_equal_to_(BufferSize
))
170 RtlInitEmptyUnicodeString(
171 _Out_ PUNICODE_STRING UnicodeString
,
172 _When_(BufferSize
!= 0, _Notnull_
) _Writable_bytes_(BufferSize
) __drv_aliasesMem PWCHAR Buffer
,
173 _In_ USHORT BufferSize
)
175 UnicodeString
->Length
= 0;
176 UnicodeString
->MaximumLength
= BufferSize
;
177 UnicodeString
->Buffer
= Buffer
;
180 _At_(AnsiString
->Buffer
, _Post_equal_to_(Buffer
))
181 _At_(AnsiString
->Length
, _Post_equal_to_(0))
182 _At_(AnsiString
->MaximumLength
, _Post_equal_to_(BufferSize
))
185 RtlInitEmptyAnsiString(
186 _Out_ PANSI_STRING AnsiString
,
187 _When_(BufferSize
!= 0, _Notnull_
) _Writable_bytes_(BufferSize
) __drv_aliasesMem PCHAR Buffer
,
188 _In_ USHORT BufferSize
)
190 AnsiString
->Length
= 0;
191 AnsiString
->MaximumLength
= BufferSize
;
192 AnsiString
->Buffer
= Buffer
;
198 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
199 ((L1)->LowPart == (L2)->LowPart))
203 RtlConvertUlongToLuid(
208 TempLuid
.LowPart
= Ulong
;
209 TempLuid
.HighPart
= 0;
219 #define ASSERT( exp ) \
221 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, NULL ),FALSE) : \
224 #define ASSERTMSG( msg, exp ) \
226 (RtlAssert( (PVOID)#exp, (PVOID)__FILE__, __LINE__, (PCHAR)msg ),FALSE) : \
231 #define ASSERT( exp ) ((void) 0)
232 #define ASSERTMSG( msg, exp ) ((void) 0)
237 #ifdef NTOS_KERNEL_RUNTIME
240 // Executing RTL functions at DISPATCH_LEVEL or higher will result in a
243 #define RTL_PAGED_CODE PAGED_CODE
248 // This macro does nothing in user mode
250 #define RTL_PAGED_CODE()
255 // RTL Splay Tree Functions
257 #ifndef RTL_USE_AVL_TABLES
262 RtlInitializeGenericTable(
263 _Out_ PRTL_GENERIC_TABLE Table
,
264 _In_ PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine
,
265 _In_opt_ PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine
,
266 _In_opt_ PRTL_GENERIC_FREE_ROUTINE FreeRoutine
,
267 _In_opt_ PVOID TableContext
273 RtlInsertElementGenericTable(
274 _In_ PRTL_GENERIC_TABLE Table
,
275 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
276 _In_ CLONG BufferSize
,
277 _Out_opt_ PBOOLEAN NewElement
283 RtlInsertElementGenericTableFull(
284 _In_ PRTL_GENERIC_TABLE Table
,
285 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
286 _In_ CLONG BufferSize
,
287 _Out_opt_ PBOOLEAN NewElement
,
288 _In_ PVOID NodeOrParent
,
289 _In_ TABLE_SEARCH_RESULT SearchResult
295 RtlDeleteElementGenericTable(
296 _In_ PRTL_GENERIC_TABLE Table
,
300 _Must_inspect_result_
304 RtlLookupElementGenericTable(
305 _In_ PRTL_GENERIC_TABLE Table
,
312 RtlLookupElementGenericTableFull(
313 _In_ PRTL_GENERIC_TABLE Table
,
315 _Out_ PVOID
*NodeOrParent
,
316 _Out_ TABLE_SEARCH_RESULT
*SearchResult
319 _Must_inspect_result_
323 RtlEnumerateGenericTable(
324 _In_ PRTL_GENERIC_TABLE Table
,
328 _Must_inspect_result_
332 RtlEnumerateGenericTableWithoutSplaying(
333 _In_ PRTL_GENERIC_TABLE Table
,
334 _Inout_ PVOID
*RestartKey
337 _Must_inspect_result_
341 RtlGetElementGenericTable(
342 _In_ PRTL_GENERIC_TABLE Table
,
349 RtlNumberGenericTableElements(
350 _In_ PRTL_GENERIC_TABLE Table
353 _Must_inspect_result_
357 RtlIsGenericTableEmpty(
358 _In_ PRTL_GENERIC_TABLE Table
361 #endif /* !RTL_USE_AVL_TABLES */
367 _Inout_ PRTL_SPLAY_LINKS Links
374 _In_ PRTL_SPLAY_LINKS Links
381 _In_ PRTL_SPLAY_LINKS Links
,
382 _Inout_ PRTL_SPLAY_LINKS
*Root
385 _Must_inspect_result_
390 _In_ PRTL_SPLAY_LINKS Links
393 _Must_inspect_result_
397 RtlSubtreePredecessor(
398 _In_ PRTL_SPLAY_LINKS Links
401 _Must_inspect_result_
406 _In_ PRTL_SPLAY_LINKS Links
409 _Must_inspect_result_
414 _In_ PRTL_SPLAY_LINKS Links
417 #define RtlIsLeftChild(Links) \
418 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
420 #define RtlIsRightChild(Links) \
421 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
423 #define RtlRightChild(Links) \
424 ((PRTL_SPLAY_LINKS)(Links))->RightChild
426 #define RtlIsRoot(Links) \
427 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
429 #define RtlLeftChild(Links) \
430 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
432 #define RtlParent(Links) \
433 ((PRTL_SPLAY_LINKS)(Links))->Parent
435 // FIXME: use inline function
437 #define RtlInitializeSplayLinks(Links) \
439 PRTL_SPLAY_LINKS _SplayLinks; \
440 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
441 _SplayLinks->Parent = _SplayLinks; \
442 _SplayLinks->LeftChild = NULL; \
443 _SplayLinks->RightChild = NULL; \
446 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
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; \
456 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
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; \
467 // RTL AVL Tree Functions
472 RtlInitializeGenericTableAvl(
473 _Out_ PRTL_AVL_TABLE Table
,
474 _In_ PRTL_AVL_COMPARE_ROUTINE CompareRoutine
,
475 _In_opt_ PRTL_AVL_ALLOCATE_ROUTINE AllocateRoutine
,
476 _In_opt_ PRTL_AVL_FREE_ROUTINE FreeRoutine
,
477 _In_opt_ PVOID TableContext
483 RtlInsertElementGenericTableAvl(
484 _In_ PRTL_AVL_TABLE Table
,
485 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
486 _In_ CLONG BufferSize
,
487 _Out_opt_ PBOOLEAN NewElement
493 RtlInsertElementGenericTableFullAvl(
494 _In_ PRTL_AVL_TABLE Table
,
495 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
496 _In_ CLONG BufferSize
,
497 _Out_opt_ PBOOLEAN NewElement
,
498 _In_ PVOID NodeOrParent
,
499 _In_ TABLE_SEARCH_RESULT SearchResult
505 RtlDeleteElementGenericTableAvl(
506 _In_ PRTL_AVL_TABLE Table
,
510 _Must_inspect_result_
514 RtlLookupElementGenericTableAvl(
515 _In_ PRTL_AVL_TABLE Table
,
522 RtlLookupElementGenericTableFullAvl(
523 _In_ PRTL_AVL_TABLE Table
,
525 _Out_ PVOID
*NodeOrParent
,
526 _Out_ TABLE_SEARCH_RESULT
*SearchResult
529 _Must_inspect_result_
533 RtlEnumerateGenericTableAvl(
534 _In_ PRTL_AVL_TABLE Table
,
538 _Must_inspect_result_
542 RtlEnumerateGenericTableWithoutSplayingAvl(
543 _In_ PRTL_AVL_TABLE Table
,
544 _Inout_ PVOID
*RestartKey
547 _Must_inspect_result_
551 RtlLookupFirstMatchingElementGenericTableAvl(
552 _In_ PRTL_AVL_TABLE Table
,
554 _Out_ PVOID
*RestartKey
557 _Must_inspect_result_
561 RtlEnumerateGenericTableLikeADirectory(
562 _In_ PRTL_AVL_TABLE Table
,
563 _In_opt_ PRTL_AVL_MATCH_FUNCTION MatchFunction
,
564 _In_opt_ PVOID MatchData
,
566 _Inout_ PVOID
*RestartKey
,
567 _Inout_ PULONG DeleteCount
,
571 _Must_inspect_result_
575 RtlGetElementGenericTableAvl(
576 _In_ PRTL_AVL_TABLE Table
,
583 RtlNumberGenericTableElementsAvl(
584 _In_ PRTL_AVL_TABLE Table
587 _Must_inspect_result_
591 RtlIsGenericTableEmptyAvl(
592 _In_ PRTL_AVL_TABLE Table
595 #ifdef RTL_USE_AVL_TABLES
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
609 #endif /* RTL_USE_AVL_TABLES */
612 // Exception and Error Functions
617 RtlAddVectoredExceptionHandler(
618 _In_ ULONG FirstHandler
,
619 _In_ PVECTORED_EXCEPTION_HANDLER VectoredHandler
625 RtlRemoveVectoredExceptionHandler(
626 _In_ PVOID VectoredHandlerHandle
632 RtlAddVectoredContinueHandler(
633 _In_ ULONG FirstHandler
,
634 _In_ PVECTORED_EXCEPTION_HANDLER VectoredHandler
640 RtlRemoveVectoredContinueHandler(
641 _In_ PVOID VectoredHandlerHandle
647 RtlSetUnhandledExceptionFilter(
648 _In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
654 RtlUnhandledExceptionFilter(
655 _In_
struct _EXCEPTION_POINTERS
* ExceptionInfo
663 _In_ PVOID FailedAssertion
,
665 _In_ ULONG LineNumber
,
666 _In_opt_z_ PCHAR Message
686 RtlEncodeSystemPointer(
693 RtlDecodeSystemPointer(
707 RtlGetLastWin32Error(
714 RtlSetLastWin32Error(
721 RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
728 RtlSetThreadErrorMode(
730 _Out_opt_ PULONG OldMode
736 RtlGetThreadErrorMode(
740 #endif /* NTOS_MODE_USER */
746 _Out_ PCONTEXT ContextRecord
752 RtlDispatchException(
753 _In_ PEXCEPTION_RECORD ExceptionRecord
,
754 _In_ PCONTEXT Context
757 _IRQL_requires_max_(APC_LEVEL
)
758 _When_(Status
< 0, _Out_range_(>, 0))
759 _When_(Status
>= 0, _Out_range_(==, 0))
763 RtlNtStatusToDosError(
767 _When_(Status
< 0, _Out_range_(>, 0))
768 _When_(Status
>= 0, _Out_range_(==, 0))
772 RtlNtStatusToDosErrorNoTeb(
779 RtlMapSecurityErrorToNtStatus(
780 _In_ ULONG SecurityError
787 _In_ PEXCEPTION_RECORD ExceptionRecord
802 _In_opt_ PVOID TargetFrame
,
803 _In_opt_ PVOID TargetIp
,
804 _In_opt_ PEXCEPTION_RECORD ExceptionRecord
,
805 _In_ PVOID ReturnValue
808 #define RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT 8
817 _Out_writes_(Count
- (Flags
>> RTL_STACK_WALKING_MODE_FRAMES_TO_SKIP_SHIFT
)) PVOID
*Callers
,
825 RtlLogStackBackTrace(
829 #ifdef NTOS_MODE_USER
833 _Must_inspect_result_
835 _Post_writable_byte_size_(Size
)
840 _In_ PVOID HeapHandle
,
841 _In_opt_ ULONG Flags
,
845 _Must_inspect_result_
851 _In_opt_ PVOID BaseAddress
,
852 _In_opt_ SIZE_T SizeToReserve
,
853 _In_opt_ SIZE_T SizeToCommit
,
855 _In_opt_ PRTL_HEAP_PARAMETERS Parameters
862 _In_ HANDLE HeapHandle
,
865 _In_ PWSTR TagSubName
875 _Must_inspect_result_
881 _In_opt_ PVOID BaseAddress
,
882 _In_opt_ SIZE_T SizeToReserve
,
883 _In_opt_ SIZE_T SizeToCommit
,
885 _In_opt_ PRTL_HEAP_PARAMETERS Parameters
892 _In_ _Post_invalid_ HANDLE Heap
905 _Success_(return != 0)
910 _In_ HANDLE HeapHandle
,
911 _In_opt_ ULONG Flags
,
912 _In_ _Post_invalid_ PVOID P
918 _In_ ULONG HeapCount
,
919 _Out_cap_(HeapCount
) HANDLE
*HeapArray
922 _Success_(return != 0)
926 _In_ PVOID HeapHandle
,
928 _In_ PVOID BaseAddress
,
929 _Inout_opt_ PVOID
*UserValue
,
930 _Out_opt_ PULONG UserFlags
937 _In_ PVOID HeapHandle
,
944 RtlQueryHeapInformation(
945 _In_ PVOID HeapHandle
,
946 _In_ HEAP_INFORMATION_CLASS HeapInformationClass
,
947 _Out_ PVOID HeapInformation
,
948 _In_ SIZE_T HeapInformationLength
,
949 _When_(HeapInformationClass
==HeapCompatibilityInformation
, _On_failure_(_Out_opt_
))
950 _Out_opt_ PSIZE_T ReturnLength
958 _In_ PVOID HeapHandle
,
960 _In_ USHORT TagIndex
,
961 _In_ BOOLEAN ResetCounters
,
962 _Out_ PRTL_HEAP_TAG_INFO HeapTagInfo
965 _Must_inspect_result_
967 _Post_writable_byte_size_(Size
)
973 _In_opt_ ULONG Flags
,
974 _In_ _Post_invalid_ PVOID Ptr
,
981 RtlSetHeapInformation(
982 _In_ PVOID HeapHandle
,
983 _In_ HEAP_INFORMATION_CLASS HeapInformationClass
,
984 _When_(HeapInformationClass
==HeapCompatibilityInformation
,_In_
) PVOID HeapInformation
,
985 _In_ SIZE_T HeapInformationLength
995 _Must_inspect_result_
999 RtlMultipleAllocateHeap (
1000 _In_ HANDLE HeapHandle
,
1004 _Out_cap_(Count
) _Deref_post_bytecap_(Size
) PVOID
* Array
1010 RtlMultipleFreeHeap (
1011 _In_ HANDLE HeapHandle
,
1014 _In_count_(Count
) /* _Deref_ _Post_invalid_ */ PVOID
* Array
1023 _Out_ PRTL_HEAP_USAGE Usage
1035 RtlSetUserValueHeap(
1036 _In_ PVOID HeapHandle
,
1038 _In_ PVOID BaseAddress
,
1039 _In_ PVOID UserValue
1044 RtlSetUserFlagsHeap(
1045 _In_ PVOID HeapHandle
,
1047 _In_ PVOID BaseAddress
,
1048 _In_ ULONG UserFlagsReset
,
1049 _In_ ULONG UserFlagsSet
1065 _In_ HANDLE HeapHandle
,
1066 _In_ PVOID HeapEntry
1069 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
1071 #endif // NTOS_MODE_USER
1073 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
1079 _In_ PVOID HeapHandle
,
1081 _In_ PVOID MemoryPointer
1086 // Security Functions
1088 _IRQL_requires_max_(APC_LEVEL
)
1092 RtlAbsoluteToSelfRelativeSD(
1093 _In_ PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
1094 _Out_writes_bytes_to_opt_(*BufferLength
, *BufferLength
) PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
1095 _Inout_ PULONG BufferLength
1098 _IRQL_requires_max_(APC_LEVEL
)
1102 RtlAddAccessAllowedAce(
1104 _In_ ULONG Revision
,
1105 _In_ ACCESS_MASK AccessMask
,
1109 _IRQL_requires_max_(APC_LEVEL
)
1113 RtlAddAccessAllowedAceEx(
1115 _In_ ULONG dwAceRevision
,
1116 _In_ ULONG AceFlags
,
1117 _In_ ACCESS_MASK AccessMask
,
1124 RtlAddAccessAllowedObjectAce(
1126 _In_ ULONG dwAceRevision
,
1127 _In_ ULONG AceFlags
,
1128 _In_ ACCESS_MASK AccessMask
,
1129 _In_opt_ GUID
*ObjectTypeGuid
,
1130 _In_opt_ GUID
*InheritedObjectTypeGuid
,
1137 RtlAddAccessDeniedAce(
1139 _In_ ULONG Revision
,
1140 _In_ ACCESS_MASK AccessMask
,
1147 RtlAddAccessDeniedAceEx(
1149 _In_ ULONG Revision
,
1151 _In_ ACCESS_MASK AccessMask
,
1158 RtlAddAccessDeniedObjectAce(
1160 _In_ ULONG dwAceRevision
,
1161 _In_ ULONG AceFlags
,
1162 _In_ ACCESS_MASK AccessMask
,
1163 _In_opt_ GUID
*ObjectTypeGuid
,
1164 _In_opt_ GUID
*InheritedObjectTypeGuid
,
1173 _In_ ULONG AceRevision
,
1174 _In_ ULONG StartingAceIndex
,
1175 _In_reads_bytes_(AceListLength
) PVOID AceList
,
1176 _In_ ULONG AceListLength
1182 RtlAddAuditAccessAce(
1184 _In_ ULONG Revision
,
1185 _In_ ACCESS_MASK AccessMask
,
1187 _In_ BOOLEAN Success
,
1188 _In_ BOOLEAN Failure
1194 RtlAcquirePrivilege(
1195 _In_ PULONG Privilege
,
1198 _Out_ PVOID
*ReturnedState
1204 RtlAddAuditAccessAceEx(
1206 _In_ ULONG Revision
,
1208 _In_ ACCESS_MASK AccessMask
,
1210 _In_ BOOLEAN Success
,
1211 _In_ BOOLEAN Failure
1217 RtlAddAuditAccessObjectAce(
1219 _In_ ULONG Revision
,
1221 _In_ ACCESS_MASK AccessMask
,
1222 _In_opt_ GUID
*ObjectTypeGuid
,
1223 _In_opt_ GUID
*InheritedObjectTypeGuid
,
1225 _In_ BOOLEAN Success
,
1226 _In_ BOOLEAN Failure
1234 _In_ ULONG Revision
,
1236 _In_ ULONG MandatoryFlags
,
1238 _In_ PSID LabelSid
);
1244 _In_ ULONG Privilege
,
1245 _In_ BOOLEAN NewValue
,
1246 _In_ BOOLEAN ForThread
,
1247 _Out_ PBOOLEAN OldValue
1250 _Must_inspect_result_
1254 RtlAllocateAndInitializeSid(
1255 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
1256 _In_ UCHAR SubAuthorityCount
,
1257 _In_ ULONG SubAuthority0
,
1258 _In_ ULONG SubAuthority1
,
1259 _In_ ULONG SubAuthority2
,
1260 _In_ ULONG SubAuthority3
,
1261 _In_ ULONG SubAuthority4
,
1262 _In_ ULONG SubAuthority5
,
1263 _In_ ULONG SubAuthority6
,
1264 _In_ ULONG SubAuthority7
,
1271 RtlAreAllAccessesGranted(
1272 ACCESS_MASK GrantedAccess
,
1273 ACCESS_MASK DesiredAccess
1279 RtlAreAnyAccessesGranted(
1280 ACCESS_MASK GrantedAccess
,
1281 ACCESS_MASK DesiredAccess
1284 _IRQL_requires_max_(APC_LEVEL
)
1289 _Out_ PLUID DestinationLuid
,
1290 _In_ PLUID SourceLuid
1296 RtlCopyLuidAndAttributesArray(
1298 PLUID_AND_ATTRIBUTES Src
,
1299 PLUID_AND_ATTRIBUTES Dest
1305 RtlCopySidAndAttributesArray(
1307 _In_ PSID_AND_ATTRIBUTES Src
,
1308 _In_ ULONG SidAreaSize
,
1309 _In_ PSID_AND_ATTRIBUTES Dest
,
1311 _Out_ PSID
* RemainingSidArea
,
1312 _Out_ PULONG RemainingSidAreaSize
1315 _IRQL_requires_max_(APC_LEVEL
)
1319 RtlConvertSidToUnicodeString(
1320 _Inout_ PUNICODE_STRING UnicodeString
,
1322 _In_ BOOLEAN AllocateDestinationString
1325 _IRQL_requires_max_(APC_LEVEL
)
1330 _In_ ULONG DestinationSidLength
,
1331 _Out_writes_bytes_(DestinationSidLength
) PSID DestinationSid
,
1347 RtlCreateSecurityDescriptor(
1348 _Out_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1355 RtlCreateSecurityDescriptorRelative(
1356 _Out_ PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
1363 RtlCopySecurityDescriptor(
1364 _In_ PSECURITY_DESCRIPTOR pSourceSecurityDescriptor
,
1365 _Out_ PSECURITY_DESCRIPTOR
*pDestinationSecurityDescriptor
1404 _In_ _Post_invalid_ PSID Sid
1419 RtlGetControlSecurityDescriptor(
1420 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1421 _Out_ PSECURITY_DESCRIPTOR_CONTROL Control
,
1422 _Out_ PULONG Revision
1428 RtlGetDaclSecurityDescriptor(
1429 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1430 _Out_ PBOOLEAN DaclPresent
,
1432 _Out_ PBOOLEAN DaclDefaulted
1438 RtlGetSaclSecurityDescriptor(
1439 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1440 _Out_ PBOOLEAN SaclPresent
,
1442 _Out_ PBOOLEAN SaclDefaulted
1448 RtlGetGroupSecurityDescriptor(
1449 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1451 _Out_ PBOOLEAN GroupDefaulted
1457 RtlGetOwnerSecurityDescriptor(
1458 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1460 _Out_ PBOOLEAN OwnerDefaulted
1466 RtlGetSecurityDescriptorRMControl(
1467 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1468 _Out_ PUCHAR RMControl
1472 PSID_IDENTIFIER_AUTHORITY
1474 RtlIdentifierAuthoritySid(PSID Sid
);
1479 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
1481 _IRQL_requires_max_(APC_LEVEL
)
1487 _In_ PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
1488 _In_ UCHAR SubAuthorityCount
1494 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
1496 _IRQL_requires_max_(APC_LEVEL
)
1500 RtlLengthSecurityDescriptor(
1501 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
);
1506 RtlLengthSid(IN PSID Sid
);
1511 RtlMakeSelfRelativeSD(
1512 _In_ PSECURITY_DESCRIPTOR AbsoluteSD
,
1513 _Out_ PSECURITY_DESCRIPTOR SelfRelativeSD
,
1514 _Inout_ PULONG BufferLength
);
1520 PACCESS_MASK AccessMask
,
1521 PGENERIC_MAPPING GenericMapping
1524 #ifdef NTOS_MODE_USER
1529 RtlQueryInformationAcl(
1532 ULONG InformationLength
,
1533 ACL_INFORMATION_CLASS InformationClass
1541 RtlReleasePrivilege(
1542 _In_ PVOID ReturnedState
1545 _IRQL_requires_max_(APC_LEVEL
)
1549 RtlSelfRelativeToAbsoluteSD(
1550 _In_ PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
1551 _Out_writes_bytes_to_opt_(*AbsoluteSecurityDescriptorSize
, *AbsoluteSecurityDescriptorSize
) PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
1552 _Inout_ PULONG AbsoluteSecurityDescriptorSize
,
1553 _Out_writes_bytes_to_opt_(*DaclSize
, *DaclSize
) PACL Dacl
,
1554 _Inout_ PULONG DaclSize
,
1555 _Out_writes_bytes_to_opt_(*SaclSize
, *SaclSize
) PACL Sacl
,
1556 _Inout_ PULONG SaclSize
,
1557 _Out_writes_bytes_to_opt_(*OwnerSize
, *OwnerSize
) PSID Owner
,
1558 _Inout_ PULONG OwnerSize
,
1559 _Out_writes_bytes_to_opt_(*PrimaryGroupSize
, *PrimaryGroupSize
) PSID PrimaryGroup
,
1560 _Inout_ PULONG PrimaryGroupSize
1566 RtlSelfRelativeToAbsoluteSD2(
1567 _Inout_ PSECURITY_DESCRIPTOR SelfRelativeSD
,
1568 _Out_ PULONG BufferSize
1574 RtlSetAttributesSecurityDescriptor(
1575 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1576 _In_ SECURITY_DESCRIPTOR_CONTROL Control
,
1577 _Out_ PULONG Revision
1583 RtlSetControlSecurityDescriptor(
1584 _In_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1585 _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
1586 _In_ SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
1589 _IRQL_requires_max_(APC_LEVEL
)
1593 RtlSetDaclSecurityDescriptor(
1594 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1595 _In_ BOOLEAN DaclPresent
,
1597 _In_opt_ BOOLEAN DaclDefaulted
1600 _IRQL_requires_max_(APC_LEVEL
)
1604 RtlSetGroupSecurityDescriptor(
1605 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1606 _In_opt_ PSID Group
,
1607 _In_opt_ BOOLEAN GroupDefaulted
1610 #ifdef NTOS_MODE_USER
1615 RtlSetInformationAcl(
1618 ULONG InformationLength
,
1619 ACL_INFORMATION_CLASS InformationClass
1624 _IRQL_requires_max_(APC_LEVEL
)
1628 RtlSetOwnerSecurityDescriptor(
1629 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1630 _In_opt_ PSID Owner
,
1631 _In_opt_ BOOLEAN OwnerDefaulted
1637 RtlSetSaclSecurityDescriptor(
1638 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1639 _In_ BOOLEAN SaclPresent
,
1641 _In_ BOOLEAN SaclDefaulted
1647 RtlSetSecurityDescriptorRMControl(
1648 _Inout_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
1649 _In_ PUCHAR RMControl
1655 RtlSubAuthorityCountSid(
1664 _In_ ULONG SubAuthority
1667 _IRQL_requires_max_(APC_LEVEL
)
1668 _Must_inspect_result_
1672 RtlValidRelativeSecurityDescriptor(
1673 _In_reads_bytes_(SecurityDescriptorLength
) PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
1674 _In_ ULONG SecurityDescriptorLength
,
1675 _In_ SECURITY_INFORMATION RequiredInformation
1681 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
1686 RtlValidSid(IN PSID Sid
);
1691 RtlValidAcl(PACL Acl
);
1696 RtlDeleteSecurityObject(
1697 _In_ PSECURITY_DESCRIPTOR
*ObjectDescriptor
1703 RtlNewSecurityObject(
1704 _In_ PSECURITY_DESCRIPTOR ParentDescriptor
,
1705 _In_ PSECURITY_DESCRIPTOR CreatorDescriptor
,
1706 _Out_ PSECURITY_DESCRIPTOR
*NewDescriptor
,
1707 _In_ BOOLEAN IsDirectoryObject
,
1709 _In_ PGENERIC_MAPPING GenericMapping
1715 RtlQuerySecurityObject(
1716 _In_ PSECURITY_DESCRIPTOR ObjectDescriptor
,
1717 _In_ SECURITY_INFORMATION SecurityInformation
,
1718 _Out_ PSECURITY_DESCRIPTOR ResultantDescriptor
,
1719 _In_ ULONG DescriptorLength
,
1720 _Out_ PULONG ReturnLength
1726 RtlSetSecurityObject(
1727 _In_ SECURITY_INFORMATION SecurityInformation
,
1728 _In_ PSECURITY_DESCRIPTOR ModificationDescriptor
,
1729 _Out_ PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
1730 _In_ PGENERIC_MAPPING GenericMapping
,
1735 // Single-Character Functions
1740 RtlLargeIntegerToChar(
1741 _In_ PLARGE_INTEGER Value
,
1750 RtlUpperChar(CHAR Source
);
1755 RtlUpcaseUnicodeChar(WCHAR Source
);
1760 RtlDowncaseUnicodeChar(IN WCHAR Source
);
1775 RtlIntegerToUnicode(
1777 _In_opt_ ULONG Base
,
1778 _In_opt_ ULONG Length
,
1779 _Inout_ LPWSTR String
1782 _IRQL_requires_max_(PASSIVE_LEVEL
)
1783 _At_(String
->MaximumLength
, _Const_
)
1787 RtlIntegerToUnicodeString(
1789 _In_opt_ ULONG Base
,
1790 _Inout_ PUNICODE_STRING String
1803 // Byte Swap Functions
1805 #ifdef NTOS_MODE_USER
1807 unsigned short __cdecl
_byteswap_ushort(unsigned short);
1808 unsigned long __cdecl
_byteswap_ulong (unsigned long);
1809 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
1811 #pragma intrinsic(_byteswap_ushort)
1812 #pragma intrinsic(_byteswap_ulong)
1813 #pragma intrinsic(_byteswap_uint64)
1815 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1816 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1817 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1819 #endif // NTOS_MODE_USER
1822 // Unicode->Ansi String Functions
1827 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
1829 #ifdef NTOS_MODE_USER
1831 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1832 NLS_MB_CODE_PAGE_TAG ? \
1833 RtlxUnicodeStringToAnsiSize(STRING) : \
1834 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1842 RtlUnicodeStringToAnsiString(
1843 PANSI_STRING DestinationString
,
1844 PCUNICODE_STRING SourceString
,
1845 BOOLEAN AllocateDestinationString
1849 // Unicode->OEM String Functions
1854 RtlUpcaseUnicodeStringToOemString(
1855 POEM_STRING DestinationString
,
1856 PCUNICODE_STRING SourceString
,
1857 BOOLEAN AllocateDestinationString
1860 _IRQL_requires_max_(PASSIVE_LEVEL
)
1861 _Must_inspect_result_
1862 //_At_(DestinationString->Buffer, _Post_bytecount_(DestinationString->Length))
1866 RtlUpcaseUnicodeStringToCountedOemString(
1867 _When_(AllocateDestinationString
, _Out_
_At_(DestinationString
->Buffer
, __drv_allocatesMem(Mem
)))
1868 _When_(!AllocateDestinationString
, _Inout_
)
1869 POEM_STRING DestinationString
,
1870 _In_ PCUNICODE_STRING SourceString
,
1871 _In_ BOOLEAN AllocateDestinationString
1877 RtlUnicodeStringToOemString(
1878 POEM_STRING DestinationString
,
1879 PCUNICODE_STRING SourceString
,
1880 BOOLEAN AllocateDestinationString
1886 RtlUpcaseUnicodeToOemN(
1890 PCWCH UnicodeString
,
1897 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
1899 #ifdef NTOS_MODE_USER
1901 #define RtlUnicodeStringToOemSize(STRING) ( \
1902 NLS_MB_OEM_CODE_PAGE_TAG ? \
1903 RtlxUnicodeStringToOemSize(STRING) : \
1904 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1907 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1908 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1920 PCWCH UnicodeString
,
1925 // Unicode->MultiByte String Functions
1930 RtlUnicodeToMultiByteN(
1934 PCWCH UnicodeString
,
1941 RtlUpcaseUnicodeToMultiByteN(
1945 PCWCH UnicodeString
,
1952 RtlUnicodeToMultiByteSize(
1954 PCWCH UnicodeString
,
1961 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
1964 // OEM to Unicode Functions
1969 RtlOemStringToUnicodeString(
1970 PUNICODE_STRING DestinationString
,
1971 PCOEM_STRING SourceString
,
1972 BOOLEAN AllocateDestinationString
1975 _IRQL_requires_max_(PASSIVE_LEVEL
)
1980 _Out_writes_bytes_to_(MaxBytesInUnicodeString
, *BytesInUnicodeString
) PWCH UnicodeString
,
1981 _In_ ULONG MaxBytesInUnicodeString
,
1982 _Out_opt_ PULONG BytesInUnicodeString
,
1983 _In_reads_bytes_(BytesInOemString
) PCCH OemString
,
1984 _In_ ULONG BytesInOemString
1987 #ifdef NTOS_MODE_USER
1989 #define RtlOemStringToUnicodeSize(STRING) ( \
1990 NLS_MB_OEM_CODE_PAGE_TAG ? \
1991 RtlxOemStringToUnicodeSize(STRING) : \
1992 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1995 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1996 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
2002 // Ansi->Unicode String Functions
2004 _IRQL_requires_max_(APC_LEVEL
)
2008 RtlAnsiCharToUnicodeChar(
2009 _Inout_ PUCHAR
*SourceCharacter
);
2014 RtlAnsiStringToUnicodeString(
2015 PUNICODE_STRING DestinationString
,
2016 PCANSI_STRING SourceString
,
2017 BOOLEAN AllocateDestinationString
2023 RtlxAnsiStringToUnicodeSize(
2024 PCANSI_STRING AnsiString
2027 #ifdef NTOS_MODE_USER
2029 #define RtlAnsiStringToUnicodeSize(STRING) ( \
2030 NLS_MB_CODE_PAGE_TAG ? \
2031 RtlxAnsiStringToUnicodeSize(STRING) : \
2032 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
2040 RtlCreateUnicodeStringFromAsciiz(
2041 _Out_ PUNICODE_STRING Destination
,
2046 // Unicode String Functions
2051 RtlAppendUnicodeToString(
2052 PUNICODE_STRING Destination
,
2059 RtlAppendUnicodeStringToString(
2060 PUNICODE_STRING Destination
,
2061 PCUNICODE_STRING Source
2067 RtlCompareUnicodeString(
2068 PCUNICODE_STRING String1
,
2069 PCUNICODE_STRING String2
,
2070 BOOLEAN CaseInsensitive
2076 RtlCopyUnicodeString(
2077 PUNICODE_STRING DestinationString
,
2078 PCUNICODE_STRING SourceString
2084 RtlCreateUnicodeString(
2085 PUNICODE_STRING DestinationString
,
2089 #ifdef NTOS_MODE_USER
2094 RtlDowncaseUnicodeString(
2095 _Inout_ PUNICODE_STRING UniDest
,
2096 _In_ PCUNICODE_STRING UniSource
,
2097 _In_ BOOLEAN AllocateDestinationString
2103 RtlDuplicateUnicodeString(
2105 _In_ PCUNICODE_STRING SourceString
,
2106 _Out_ PUNICODE_STRING DestinationString
2112 RtlFindCharInUnicodeString(
2114 _In_ PCUNICODE_STRING SearchString
,
2115 _In_ PCUNICODE_STRING MatchString
,
2116 _Out_ PUSHORT Position
2122 #if defined(_M_AMD64)
2127 _Out_writes_bytes_all_(Length
) PVOID Destination
,
2131 PULONG Address
= (PULONG
)Destination
;
2132 if ((Length
/= 4) != 0) {
2133 if (((ULONG64
)Address
& 4) != 0) {
2135 if ((Length
-= 1) == 0) {
2140 __stosq((PULONG64
)(Address
), Pattern
| ((ULONG64
)Pattern
<< 32), Length
/ 2);
2141 if ((Length
& 1) != 0) Address
[Length
- 1] = Pattern
;
2146 #define RtlFillMemoryUlonglong(Destination, Length, Pattern) \
2147 __stosq((PULONG64)(Destination), Pattern, (Length) / 8)
2155 _Out_writes_bytes_all_(Length
) PVOID Destination
,
2163 RtlFillMemoryUlonglong(
2164 _Out_ PVOID Destination
,
2166 _In_ ULONGLONG Pattern
2174 RtlCopyMappedMemory(
2175 _Out_writes_bytes_all_(Size
) PVOID Destination
,
2176 _In_reads_bytes_(Size
) const VOID
*Source
,
2183 RtlCompareMemoryUlong(
2189 #ifndef RtlEqualMemory
2190 #define RtlEqualMemory(Destination, Source, Length) \
2191 (!memcmp(Destination, Source, Length))
2194 #define RtlCopyBytes RtlCopyMemory
2195 #define RtlFillBytes RtlFillMemory
2196 #define RtlZeroBytes RtlZeroMemory
2203 RtlEqualUnicodeString(
2204 PCUNICODE_STRING String1
,
2205 PCUNICODE_STRING String2
,
2206 BOOLEAN CaseInsensitive
2209 _IRQL_requires_max_(PASSIVE_LEVEL
)
2213 RtlFreeUnicodeString(
2214 _Inout_
_At_(UnicodeString
->Buffer
, __drv_freesMem(Mem
))
2215 PUNICODE_STRING UnicodeString
2221 RtlEraseUnicodeString(
2222 _Inout_ PUNICODE_STRING String
2228 RtlHashUnicodeString(
2229 _In_ CONST UNICODE_STRING
*String
,
2230 _In_ BOOLEAN CaseInSensitive
,
2231 _In_ ULONG HashAlgorithm
,
2232 _Out_ PULONG HashValue
2235 _IRQL_requires_max_(DISPATCH_LEVEL
)
2236 _At_(DestinationString
->Buffer
, _Post_equal_to_(SourceString
))
2237 _When_(SourceString
!= NULL
,
2238 _At_(DestinationString
->Length
, _Post_equal_to_(_String_length_(SourceString
)))
2239 _At_(DestinationString
->MaximumLength
, _Post_equal_to_(DestinationString
->Length
+ sizeof(CHAR
))))
2240 _When_(SourceString
== NULL
,
2241 _At_(DestinationString
->Length
, _Post_equal_to_(0))
2242 _At_(DestinationString
->MaximumLength
, _Post_equal_to_(0)))
2247 _Out_ PSTRING DestinationString
,
2248 _In_opt_z_ __drv_aliasesMem PCSTR SourceString
2251 _IRQL_requires_max_(DISPATCH_LEVEL
)
2252 _At_(DestinationString
->Buffer
, _Post_equal_to_(SourceString
))
2253 _When_(SourceString
!= NULL
,
2254 _At_(DestinationString
->Length
, _Post_equal_to_(_String_length_(SourceString
) * sizeof(WCHAR
)))
2255 _At_(DestinationString
->MaximumLength
, _Post_equal_to_(DestinationString
->Length
+ sizeof(WCHAR
))))
2256 _When_(SourceString
== NULL
,
2257 _At_(DestinationString
->Length
, _Post_equal_to_(0))
2258 _At_(DestinationString
->MaximumLength
, _Post_equal_to_(0)))
2262 RtlInitUnicodeString(
2263 _Out_ PUNICODE_STRING DestinationString
,
2264 _In_opt_z_ __drv_aliasesMem PCWSTR SourceString
2267 _IRQL_requires_max_(DISPATCH_LEVEL
)
2271 RtlInitUnicodeStringEx(
2272 _Out_ PUNICODE_STRING DestinationString
,
2273 _In_opt_z_ __drv_aliasesMem PCWSTR SourceString
2280 _In_ CONST VOID
* Buffer
,
2282 _Inout_opt_ INT
* Flags
2285 _IRQL_requires_max_(PASSIVE_LEVEL
)
2286 _Must_inspect_result_
2291 _In_
const STRING
*String1
,
2292 _In_
const STRING
*String2
,
2293 _In_ BOOLEAN CaseInsensitive
2296 _IRQL_requires_max_(PASSIVE_LEVEL
)
2297 _Must_inspect_result_
2301 RtlPrefixUnicodeString(
2302 _In_ PCUNICODE_STRING String1
,
2303 _In_ PCUNICODE_STRING String2
,
2304 _In_ BOOLEAN CaseInsensitive
2307 _IRQL_requires_max_(PASSIVE_LEVEL
)
2312 _Inout_ PSTRING DestinationString
,
2313 _In_
const STRING
*SourceString
2316 _IRQL_requires_max_(PASSIVE_LEVEL
)
2317 _Must_inspect_result_
2322 _In_
const STRING
*String1
,
2323 _In_
const STRING
*String2
,
2324 _In_ BOOLEAN CaseInSensitive
2331 _Out_ PSTRING DestinationString
,
2332 _In_opt_
const STRING
*SourceString
2335 _IRQL_requires_max_(PASSIVE_LEVEL
)
2336 _Must_inspect_result_
2341 _In_
const STRING
*String1
,
2342 _In_
const STRING
*String2
,
2343 _In_ BOOLEAN CaseInSensitive
2346 _IRQL_requires_max_(APC_LEVEL
)
2350 RtlAppendStringToString(
2351 _Inout_ PSTRING Destination
,
2352 _In_
const STRING
*Source
2355 _IRQL_requires_max_(PASSIVE_LEVEL
)
2356 _When_(AllocateDestinationString
, _Must_inspect_result_
)
2360 RtlUpcaseUnicodeString(
2361 _When_(AllocateDestinationString
, _Out_
_At_(DestinationString
->Buffer
, __drv_allocatesMem(Mem
)))
2362 _When_(!AllocateDestinationString
, _Inout_
)
2363 PUNICODE_STRING DestinationString
,
2364 _In_ PCUNICODE_STRING SourceString
,
2365 _In_ BOOLEAN AllocateDestinationString
2368 _IRQL_requires_max_(PASSIVE_LEVEL
)
2372 RtlUnicodeStringToInteger(
2373 _In_ PCUNICODE_STRING String
,
2374 _In_opt_ ULONG Base
,
2381 RtlValidateUnicodeString(
2383 _In_ PCUNICODE_STRING String
2386 #define RTL_SKIP_BUFFER_COPY 0x00000001
2391 RtlpEnsureBufferSize(
2393 _Inout_ PRTL_BUFFER Buffer
,
2394 _In_ SIZE_T RequiredSize
2397 #ifdef NTOS_MODE_USER
2402 _Inout_ PRTL_BUFFER Buffer
,
2407 Buffer
->Buffer
= Buffer
->StaticBuffer
= Data
;
2408 Buffer
->Size
= Buffer
->StaticSize
= DataSize
;
2409 Buffer
->ReservedForAllocatedSize
= 0;
2410 Buffer
->ReservedForIMalloc
= NULL
;
2415 RtlEnsureBufferSize(
2417 _Inout_ PRTL_BUFFER Buffer
,
2418 _In_ ULONG RequiredSize
2421 if (Buffer
&& RequiredSize
<= Buffer
->Size
)
2422 return STATUS_SUCCESS
;
2423 return RtlpEnsureBufferSize(Flags
, Buffer
, RequiredSize
);
2429 _Inout_ PRTL_BUFFER Buffer
2432 if (Buffer
->Buffer
!= Buffer
->StaticBuffer
&& Buffer
->Buffer
)
2433 RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer
->Buffer
);
2434 Buffer
->Buffer
= Buffer
->StaticBuffer
;
2435 Buffer
->Size
= Buffer
->StaticSize
;
2438 #endif /* NTOS_MODE_USER */
2441 // Ansi String Functions
2443 _IRQL_requires_max_(PASSIVE_LEVEL
)
2448 _Inout_
_At_(AnsiString
->Buffer
, __drv_freesMem(Mem
))
2449 PANSI_STRING AnsiString
2452 _IRQL_requires_max_(DISPATCH_LEVEL
)
2457 _Out_ PANSI_STRING DestinationString
,
2458 _In_opt_z_ __drv_aliasesMem PCSZ SourceString
2461 _IRQL_requires_max_(DISPATCH_LEVEL
)
2465 RtlInitAnsiStringEx(
2466 _Out_ PANSI_STRING DestinationString
,
2467 _In_opt_z_ __drv_aliasesMem PCSZ SourceString
2471 // OEM String Functions
2473 _IRQL_requires_max_(PASSIVE_LEVEL
)
2478 _Inout_
_At_(OemString
->Buffer
, __drv_freesMem(Mem
))
2479 POEM_STRING OemString
2483 // MultiByte->Unicode String Functions
2485 _IRQL_requires_max_(PASSIVE_LEVEL
)
2489 RtlMultiByteToUnicodeN(
2490 _Out_writes_bytes_to_(MaxBytesInUnicodeString
, *BytesInUnicodeString
) PWCH UnicodeString
,
2491 _In_ ULONG MaxBytesInUnicodeString
,
2492 _Out_opt_ PULONG BytesInUnicodeString
,
2493 _In_reads_bytes_(BytesInMultiByteString
) const CHAR
*MultiByteString
,
2494 _In_ ULONG BytesInMultiByteString
2497 _IRQL_requires_max_(PASSIVE_LEVEL
)
2501 RtlMultiByteToUnicodeSize(
2502 _Out_ PULONG BytesInUnicodeString
,
2503 _In_reads_bytes_(BytesInMultiByteString
) const CHAR
*MultiByteString
,
2504 _In_ ULONG BytesInMultiByteString
2513 RtlAddAtomToAtomTable(
2514 _In_ PRTL_ATOM_TABLE AtomTable
,
2515 _In_ PWSTR AtomName
,
2516 _Out_ PRTL_ATOM Atom
2523 _In_ ULONG TableSize
,
2524 _Inout_ PRTL_ATOM_TABLE
*AtomTable
2530 RtlDeleteAtomFromAtomTable(
2531 _In_ PRTL_ATOM_TABLE AtomTable
,
2538 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
2543 RtlQueryAtomInAtomTable(
2544 _In_ PRTL_ATOM_TABLE AtomTable
,
2546 _Out_opt_ PULONG RefCount
,
2547 _Out_opt_ PULONG PinCount
,
2548 _Out_opt_z_bytecap_(*NameLength
) PWSTR AtomName
,
2549 _Inout_opt_ PULONG NameLength
2555 RtlPinAtomInAtomTable(
2556 _In_ PRTL_ATOM_TABLE AtomTable
,
2563 RtlLookupAtomInAtomTable(
2564 _In_ PRTL_ATOM_TABLE AtomTable
,
2565 _In_ PWSTR AtomName
,
2566 _Out_ PRTL_ATOM Atom
2570 // Process Management Functions
2582 RtlAcquirePebLock(VOID
);
2587 RtlCreateProcessParameters (
2588 _Out_ PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
2589 _In_ PUNICODE_STRING ImagePathName
,
2590 _In_opt_ PUNICODE_STRING DllPath
,
2591 _In_opt_ PUNICODE_STRING CurrentDirectory
,
2592 _In_opt_ PUNICODE_STRING CommandLine
,
2593 _In_opt_ PWSTR Environment
,
2594 _In_opt_ PUNICODE_STRING WindowTitle
,
2595 _In_opt_ PUNICODE_STRING DesktopInfo
,
2596 _In_opt_ PUNICODE_STRING ShellInfo
,
2597 _In_opt_ PUNICODE_STRING RuntimeInfo
2603 RtlCreateUserProcess(
2604 _In_ PUNICODE_STRING ImageFileName
,
2605 _In_ ULONG Attributes
,
2606 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
2607 _In_opt_ PSECURITY_DESCRIPTOR ProcessSecutityDescriptor
,
2608 _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor
,
2609 _In_opt_ HANDLE ParentProcess
,
2610 _In_ BOOLEAN CurrentDirectory
,
2611 _In_opt_ HANDLE DebugPort
,
2612 _In_opt_ HANDLE ExceptionPort
,
2613 _Out_ PRTL_USER_PROCESS_INFORMATION ProcessInfo
2616 #if (NTDDI_VERSION >= NTDDI_WIN7)
2620 RtlCreateUserThread(
2621 _In_ PVOID ThreadContext
,
2622 _Out_ HANDLE
*OutThreadHandle
,
2623 _Reserved_ PVOID Reserved1
,
2624 _Reserved_ PVOID Reserved2
,
2625 _Reserved_ PVOID Reserved3
,
2626 _Reserved_ PVOID Reserved4
,
2627 _Reserved_ PVOID Reserved5
,
2628 _Reserved_ PVOID Reserved6
,
2629 _Reserved_ PVOID Reserved7
,
2630 _Reserved_ PVOID Reserved8
2636 RtlCreateUserThread(
2637 _In_ HANDLE ProcessHandle
,
2638 _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
,
2639 _In_ BOOLEAN CreateSuspended
,
2640 _In_ ULONG StackZeroBits
,
2641 _In_ SIZE_T StackReserve
,
2642 _In_ SIZE_T StackCommit
,
2643 _In_ PTHREAD_START_ROUTINE StartAddress
,
2644 _In_ PVOID Parameter
,
2645 _Out_opt_ PHANDLE ThreadHandle
,
2646 _Out_opt_ PCLIENT_ID ClientId
2651 PRTL_USER_PROCESS_PARAMETERS
2653 RtlDeNormalizeProcessParams(
2654 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
2659 RtlDestroyProcessParameters(
2660 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
2666 _In_ NTSTATUS Status
);
2671 RtlInitializeContext(
2672 _In_ HANDLE ProcessHandle
,
2673 _Out_ PCONTEXT ThreadContext
,
2674 _In_opt_ PVOID ThreadStartParam
,
2675 _In_ PTHREAD_START_ROUTINE ThreadStartAddress
,
2676 _In_ PINITIAL_TEB InitialTeb
2680 typedef struct _WOW64_CONTEXT
*PWOW64_CONTEXT
;
2685 RtlWow64GetThreadContext(
2686 _In_ HANDLE ThreadHandle
,
2687 _Inout_ PWOW64_CONTEXT ThreadContext
2694 RtlWow64SetThreadContext(
2695 _In_ HANDLE ThreadHandle
,
2696 _In_ PWOW64_CONTEXT ThreadContext
2703 RtlIsThreadWithinLoaderCallout(VOID
);
2706 PRTL_USER_PROCESS_PARAMETERS
2708 RtlNormalizeProcessParams(
2709 _In_ PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
2714 RtlReleasePebLock(VOID
);
2720 _In_ HANDLE Process
,
2722 _In_ PVOID CallSite
,
2723 _In_ ULONG ArgumentCount
,
2724 _In_ PULONG Arguments
,
2725 _In_ BOOLEAN PassContext
,
2726 _In_ BOOLEAN AlreadySuspended
2732 RtlSetProcessIsCritical(
2733 _In_ BOOLEAN NewValue
,
2734 _Out_opt_ PBOOLEAN OldValue
,
2735 _In_ BOOLEAN NeedBreaks
2741 RtlSetThreadIsCritical(
2742 _In_ BOOLEAN NewValue
,
2743 _Out_opt_ PBOOLEAN OldValue
,
2744 _In_ BOOLEAN NeedBreaks
2750 RtlGetCurrentProcessorNumber(
2756 // Thread Pool Functions
2761 RtlSetThreadPoolStartFunc(
2762 _In_ PRTL_START_POOL_THREAD StartPoolThread
,
2763 _In_ PRTL_EXIT_POOL_THREAD ExitPoolThread
2769 RtlDeregisterWaitEx(
2770 _In_ HANDLE hWaitHandle
,
2771 _In_opt_ HANDLE hCompletionEvent
2778 _In_ HANDLE hWaitHandle
2785 _In_ WORKERCALLBACKFUNC Function
,
2786 _In_opt_ PVOID Context
,
2793 RtlSetIoCompletionCallback(
2794 _In_ HANDLE FileHandle
,
2795 _In_ PIO_APC_ROUTINE Callback
,
2803 _In_ PHANDLE phNewWaitObject
,
2804 _In_ HANDLE hObject
,
2805 _In_ WAITORTIMERCALLBACKFUNC Callback
,
2806 _In_ PVOID pvContext
,
2807 _In_ ULONG ulMilliseconds
,
2812 // Environment/Path Functions
2817 RtlCreateEnvironment(
2818 _In_ BOOLEAN Inherit
,
2819 _Out_ PWSTR
*Environment
2825 RtlComputePrivatizedDllName_U(
2826 _In_ PUNICODE_STRING DllName
,
2827 _Inout_ PUNICODE_STRING RealName
,
2828 _Inout_ PUNICODE_STRING LocalName
2834 RtlDestroyEnvironment(
2835 _In_ PWSTR Environment
2841 RtlDoesFileExists_U(
2842 _In_ PCWSTR FileName
2848 RtlDetermineDosPathNameType_U(
2857 _In_ PCWSTR FileName
,
2858 _In_ PCWSTR Extension
,
2859 _In_ ULONG BufferSize
,
2861 _Out_ PWSTR
*PartName
2867 RtlDosSearchPath_Ustr(
2869 _In_ PUNICODE_STRING PathString
,
2870 _In_ PUNICODE_STRING FileNameString
,
2871 _In_ PUNICODE_STRING ExtensionString
,
2872 _In_ PUNICODE_STRING CallerBuffer
,
2873 _Inout_opt_ PUNICODE_STRING DynamicString
,
2874 _Out_opt_ PUNICODE_STRING
* FullNameOut
,
2875 _Out_opt_ PSIZE_T FilePartSize
,
2876 _Out_opt_ PSIZE_T LengthNeeded
2882 RtlDosPathNameToNtPathName_U(
2883 _In_opt_z_ PCWSTR DosPathName
,
2884 _Out_ PUNICODE_STRING NtPathName
,
2885 _Out_opt_ PCWSTR
*NtFileNamePart
,
2886 _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo
2890 #define RTL_UNCHANGED_UNK_PATH 1
2891 #define RTL_CONVERTED_UNC_PATH 2
2892 #define RTL_CONVERTED_NT_PATH 3
2893 #define RTL_UNCHANGED_DOS_PATH 4
2898 RtlNtPathNameToDosPathName(
2900 _Inout_ PRTL_UNICODE_STRING_BUFFER Path
,
2901 _Out_opt_ PULONG PathType
,
2902 _Out_opt_ PULONG Unknown
2909 RtlDosPathNameToRelativeNtPathName_U(
2910 _In_ PCWSTR DosName
,
2911 _Out_ PUNICODE_STRING NtName
,
2912 _Out_ PCWSTR
*PartName
,
2913 _Out_ PRTL_RELATIVE_NAME_U RelativeName
2916 _At_(Destination
->Buffer
, _Out_bytecap_(Destination
->MaximumLength
))
2920 RtlExpandEnvironmentStrings_U(
2921 _In_z_ PWSTR Environment
,
2922 _In_ PUNICODE_STRING Source
,
2923 _Inout_ PUNICODE_STRING Destination
,
2930 RtlGetCurrentDirectory_U(
2931 _In_ ULONG MaximumLength
,
2932 _Out_bytecap_(MaximumLength
) PWSTR Buffer
2938 RtlGetFullPathName_U(
2939 _In_ PCWSTR FileName
,
2941 _Out_z_bytecap_(Size
) PWSTR Buffer
,
2942 _Out_opt_ PWSTR
*ShortName
2945 #if (NTDDI_VERSION >= NTDDI_WIN7)
2949 RtlGetFullPathName_UEx(
2950 _In_ PWSTR FileName
,
2951 _In_ ULONG BufferLength
,
2953 _Out_opt_ PWSTR
*FilePart
,
2954 _Out_opt_ RTL_PATH_TYPE
*InputPathType
2960 RtlGetFullPathName_UstrEx(
2961 _In_ PUNICODE_STRING FileName
,
2962 _In_opt_ PUNICODE_STRING StaticString
,
2963 _In_opt_ PUNICODE_STRING DynamicString
,
2964 _Out_opt_ PUNICODE_STRING
*StringUsed
,
2965 _Out_opt_ PSIZE_T FilePartSize
,
2966 _Out_opt_ PBOOLEAN NameInvalid
,
2967 _Out_ RTL_PATH_TYPE
* PathType
,
2968 _Out_opt_ PSIZE_T LengthNeeded
2974 RtlGetLengthWithoutTrailingPathSeperators(
2975 _Reserved_ ULONG Flags
,
2976 _In_ PCUNICODE_STRING PathString
,
2983 RtlGetLongestNtPathLength(
2990 RtlIsDosDeviceName_U(
2997 RtlIsDosDeviceName_Ustr(
2998 _In_ PCUNICODE_STRING Name
3001 _IRQL_requires_max_(PASSIVE_LEVEL
)
3002 _Must_inspect_result_
3006 RtlIsNameLegalDOS8Dot3(
3007 _In_ PCUNICODE_STRING Name
,
3008 _Inout_opt_ POEM_STRING OemName
,
3009 _Out_opt_ PBOOLEAN NameContainsSpaces
3015 RtlQueryEnvironmentVariable_U(
3016 _In_opt_ PWSTR Environment
,
3017 _In_ PCUNICODE_STRING Name
,
3018 _Out_ PUNICODE_STRING Value
3023 RtlReleaseRelativeName(
3024 _In_ PRTL_RELATIVE_NAME_U RelativeName
3030 RtlSetCurrentDirectory_U(
3031 _In_ PUNICODE_STRING name
3037 RtlSetEnvironmentVariable(
3038 _In_z_ PWSTR
*Environment
,
3039 _In_ PUNICODE_STRING Name
,
3040 _In_ PUNICODE_STRING Value
3044 // Critical Section/Resource Functions
3049 RtlDeleteCriticalSection (
3050 _In_ PRTL_CRITICAL_SECTION CriticalSection
3056 RtlEnterCriticalSection(
3057 _In_ PRTL_CRITICAL_SECTION CriticalSection
3063 RtlInitializeCriticalSection(
3064 _In_ PRTL_CRITICAL_SECTION CriticalSection
3070 RtlInitializeCriticalSectionAndSpinCount(
3071 _In_ PRTL_CRITICAL_SECTION CriticalSection
,
3072 _In_ ULONG SpinCount
3078 RtlIsCriticalSectionLocked(
3079 _In_ PRTL_CRITICAL_SECTION CriticalSection
3085 RtlIsCriticalSectionLockedByThread(
3086 _In_ PRTL_CRITICAL_SECTION CriticalSection
3092 RtlLeaveCriticalSection(
3093 _In_ PRTL_CRITICAL_SECTION CriticalSection
3099 RtlTryEnterCriticalSection(
3100 _In_ PRTL_CRITICAL_SECTION CriticalSection
3106 RtlpUnWaitCriticalSection(
3107 _In_ PRTL_CRITICAL_SECTION CriticalSection
3113 RtlpWaitForCriticalSection(
3114 _In_ PRTL_CRITICAL_SECTION CriticalSection
3120 RtlAcquireResourceExclusive(
3121 _In_ PRTL_RESOURCE Resource
,
3128 RtlAcquireResourceShared(
3129 _In_ PRTL_RESOURCE Resource
,
3136 RtlConvertExclusiveToShared(
3137 _In_ PRTL_RESOURCE Resource
3143 RtlConvertSharedToExclusive(
3144 _In_ PRTL_RESOURCE Resource
3151 _In_ PRTL_RESOURCE Resource
3158 _In_ PRTL_RESOURCE Resource
3164 RtlInitializeResource(
3165 _In_ PRTL_RESOURCE Resource
3172 _In_ PRTL_RESOURCE Resource
3176 // Compression Functions
3178 NTSYSAPI
//NT_RTL_COMPRESS_API
3182 _In_ USHORT CompressionFormatAndEngine
,
3183 _In_reads_bytes_(UncompressedBufferSize
) PUCHAR UncompressedBuffer
,
3184 _In_ ULONG UncompressedBufferSize
,
3185 _Out_writes_bytes_to_(CompressedBufferSize
, *FinalCompressedSize
) PUCHAR CompressedBuffer
,
3186 _In_ ULONG CompressedBufferSize
,
3187 _In_ ULONG UncompressedChunkSize
,
3188 _Out_ PULONG FinalCompressedSize
,
3189 _In_ PVOID WorkSpace
3192 _IRQL_requires_max_(APC_LEVEL
)
3193 NTSYSAPI
//NT_RTL_COMPRESS_API
3196 RtlDecompressBuffer(
3197 _In_ USHORT CompressionFormat
,
3198 _Out_writes_bytes_to_(UncompressedBufferSize
, *FinalUncompressedSize
) PUCHAR UncompressedBuffer
,
3199 _In_ ULONG UncompressedBufferSize
,
3200 _In_reads_bytes_(CompressedBufferSize
) PUCHAR CompressedBuffer
,
3201 _In_ ULONG CompressedBufferSize
,
3202 _Out_ PULONG FinalUncompressedSize
3208 RtlGetCompressionWorkSpaceSize(
3209 _In_ USHORT CompressionFormatAndEngine
,
3210 _Out_ PULONG CompressBufferWorkSpaceSize
,
3211 _Out_ PULONG CompressFragmentWorkSpaceSize
3221 _In_ PTEB_ACTIVE_FRAME Frame
3228 _In_ PTEB_ACTIVE_FRAME Frame
3239 // Debug Info Functions
3242 PRTL_DEBUG_INFORMATION
3244 RtlCreateQueryDebugBuffer(
3246 _In_ BOOLEAN EventPair
3252 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_INFORMATION DebugBuffer
);
3257 RtlQueryProcessDebugInformation(
3258 _In_ ULONG ProcessId
,
3259 _In_ ULONG DebugInfoClassMask
,
3260 _Inout_ PRTL_DEBUG_INFORMATION DebugBuffer
3266 #ifdef NTOS_MODE_USER
3272 _In_ PRTL_BITMAP BitMapHeader
,
3273 _In_ ULONG StartingIndex
,
3281 _In_ PRTL_BITMAP BitMapHeader
,
3282 _In_ ULONG StartingIndex
,
3290 _In_ PRTL_BITMAP BitMapHeader
3297 _In_ PRTL_BITMAP BitMapHeader
,
3298 _In_range_(<, BitMapHeader
->SizeOfBitMap
) ULONG BitNumber
3305 _In_ PRTL_BITMAP BitMapHeader
,
3306 _In_range_(0, BitMapHeader
->SizeOfBitMap
- NumberToClear
) ULONG StartingIndex
,
3307 _In_range_(0, BitMapHeader
->SizeOfBitMap
- StartingIndex
) ULONG NumberToClear
3314 _In_ PRTL_BITMAP BitMapHeader
,
3315 _In_ ULONG NumberToFind
,
3316 _In_ ULONG HintIndex
3322 RtlFindClearBitsAndSet(
3323 _In_ PRTL_BITMAP BitMapHeader
,
3324 _In_ ULONG NumberToFind
,
3325 _In_ ULONG HintIndex
3331 RtlFindFirstRunClear(
3332 _In_ PRTL_BITMAP BitMapHeader
,
3333 _Out_ PULONG StartingIndex
3340 _In_ PRTL_BITMAP BitMapHeader
,
3341 _Out_writes_to_(SizeOfRunArray
, return) PRTL_BITMAP_RUN RunArray
,
3342 _In_range_(>, 0) ULONG SizeOfRunArray
,
3343 _In_ BOOLEAN LocateLongestRuns
3349 RtlFindLastBackwardRunClear(
3350 _In_ PRTL_BITMAP BitMapHeader
,
3351 _In_ ULONG FromIndex
,
3352 _Out_ PULONG StartingRunIndex
3358 RtlFindLeastSignificantBit(
3359 _In_ ULONGLONG Value
3365 RtlFindLongestRunClear(
3366 _In_ PRTL_BITMAP BitMapHeader
,
3367 _Out_ PULONG StartingIndex
3373 RtlFindMostSignificantBit(
3374 _In_ ULONGLONG Value
3380 RtlFindNextForwardRunClear(
3381 _In_ PRTL_BITMAP BitMapHeader
,
3382 _In_ ULONG FromIndex
,
3383 _Out_ PULONG StartingRunIndex
3389 RtlFindNextForwardRunSet(
3390 _In_ PRTL_BITMAP BitMapHeader
,
3391 _In_ ULONG FromIndex
,
3392 _Out_ PULONG StartingRunIndex
3399 _In_ PRTL_BITMAP BitMapHeader
,
3400 _In_ ULONG NumberToFind
,
3401 _In_ ULONG HintIndex
3407 RtlFindSetBitsAndClear(
3408 _In_ PRTL_BITMAP BitMapHeader
,
3409 _In_ ULONG NumberToFind
,
3410 _In_ ULONG HintIndex
3413 #ifdef __REACTOS__ // ReactOS improvement
3414 _At_(BitMapHeader
->SizeOfBitMap
, _Post_equal_to_(SizeOfBitMap
))
3415 _At_(BitMapHeader
->Buffer
, _Post_equal_to_(BitMapBuffer
))
3420 RtlInitializeBitMap(
3421 _Out_ PRTL_BITMAP BitMapHeader
,
3422 _In_opt_ __drv_aliasesMem PULONG BitMapBuffer
,
3423 _In_opt_ ULONG SizeOfBitMap
3429 RtlNumberOfClearBits(
3430 _In_ PRTL_BITMAP BitMapHeader
3437 _In_ PRTL_BITMAP BitMapHeader
3444 _In_ PRTL_BITMAP BitMapHeader
,
3445 _In_range_(<, BitMapHeader
->SizeOfBitMap
) ULONG BitNumber
3452 _In_ PRTL_BITMAP BitMapHeader
,
3453 _In_range_(0, BitMapHeader
->SizeOfBitMap
- NumberToSet
) ULONG StartingIndex
,
3454 _In_range_(0, BitMapHeader
->SizeOfBitMap
- StartingIndex
) ULONG NumberToSet
3461 _In_ PRTL_BITMAP BitMapHeader
3464 _Must_inspect_result_
3469 _In_ PRTL_BITMAP BitMapHeader
,
3470 _In_range_(<, BitMapHeader
->SizeOfBitMap
) ULONG BitNumber
3473 #if defined(_M_AMD64)
3474 _Must_inspect_result_
3478 _In_ PRTL_BITMAP BitMapHeader
,
3479 _In_range_(<, BitMapHeader
->SizeOfBitMap
) ULONG BitPosition
)
3481 return BitTest64((LONG64 CONST
*)BitMapHeader
->Buffer
, (LONG64
)BitPosition
);
3484 #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP)/32]) >> ((BP)%32)) & 0x1)
3485 #endif /* defined(_M_AMD64) */
3487 #endif // NTOS_MODE_USER
3497 _In_ HANDLE TimerQueue
,
3498 _In_ PHANDLE phNewTimer
,
3499 _In_ WAITORTIMERCALLBACKFUNC Callback
,
3500 _In_ PVOID Parameter
,
3509 RtlCreateTimerQueue(PHANDLE TimerQueue
);
3515 _In_ HANDLE TimerQueue
,
3517 _In_ HANDLE CompletionEvent
3524 _In_ HANDLE TimerQueue
,
3533 RtlDeleteTimerQueueEx(
3534 _In_ HANDLE TimerQueue
,
3535 _In_opt_ HANDLE CompletionEvent
3541 RtlDeleteTimerQueue(HANDLE TimerQueue
);
3548 InterlockedPushListSList(
3549 _Inout_ PSLIST_HEADER ListHead
,
3550 _Inout_ __drv_aliasesMem PSLIST_ENTRY List
,
3551 _Inout_ PSLIST_ENTRY ListEnd
,
3556 // Range List functions
3561 RtlInitializeRangeList(
3562 _Inout_ PRTL_RANGE_LIST RangeList
3569 _In_ PRTL_RANGE_LIST RangeList
3576 _Inout_ PRTL_RANGE_LIST RangeList
,
3577 _In_ ULONGLONG Start
,
3579 _In_ UCHAR Attributes
,
3581 _In_opt_ PVOID UserData
,
3582 _In_opt_ PVOID Owner
3591 _In_z_ _Printf_format_string_ PCSTR Format
,
3599 _In_ ULONG ComponentId
,
3601 _In_z_ _Printf_format_string_ PCSTR Format
,
3610 _Out_writes_bytes_(MaximumResponseLength
) PCH Response
,
3611 _In_ ULONG MaximumResponseLength
3614 #undef DbgBreakPoint
3623 DbgLoadImageSymbols(
3626 _In_ ULONG_PTR ProcessId
3631 DbgUnLoadImageSymbols(
3634 _In_ ULONG_PTR ProcessId
3645 // Generic Table Functions
3647 #if defined(NTOS_MODE_USER) || defined(_NTIFS_)
3651 RtlInsertElementGenericTable(
3652 _In_ PRTL_GENERIC_TABLE Table
,
3653 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
3654 _In_ CLONG BufferSize
,
3655 _Out_opt_ PBOOLEAN NewElement
3661 RtlInsertElementGenericTableFull(
3662 _In_ PRTL_GENERIC_TABLE Table
,
3663 _In_reads_bytes_(BufferSize
) PVOID Buffer
,
3664 _In_ CLONG BufferSize
,
3665 _Out_opt_ PBOOLEAN NewElement
,
3666 _In_ PVOID NodeOrParent
,
3667 _In_ TABLE_SEARCH_RESULT SearchResult
3673 RtlIsGenericTableEmpty(
3674 _In_ PRTL_GENERIC_TABLE Table
3680 RtlLookupElementGenericTableFull(
3681 _In_ PRTL_GENERIC_TABLE Table
,
3683 _Out_ PVOID
*NodeOrParent
,
3684 _Out_ TABLE_SEARCH_RESULT
*SearchResult
3689 // Handle Table Functions
3692 PRTL_HANDLE_TABLE_ENTRY
3695 _In_ PRTL_HANDLE_TABLE HandleTable
,
3696 _Inout_ PULONG Index
3702 RtlDestroyHandleTable(
3703 _Inout_ PRTL_HANDLE_TABLE HandleTable
);
3709 _In_ PRTL_HANDLE_TABLE HandleTable
,
3710 _In_ PRTL_HANDLE_TABLE_ENTRY Handle
3716 RtlInitializeHandleTable(
3717 _In_ ULONG TableSize
,
3718 _In_ ULONG HandleSize
,
3719 _In_ PRTL_HANDLE_TABLE HandleTable
3726 _In_ PRTL_HANDLE_TABLE HandleTable
,
3727 _In_ PRTL_HANDLE_TABLE_ENTRY Handle
3730 _Success_(return!=FALSE
)
3734 RtlIsValidIndexHandle(
3735 _In_ PRTL_HANDLE_TABLE HandleTable
,
3737 _Out_ PRTL_HANDLE_TABLE_ENTRY
*Handle
3747 _In_ PVOID BaseAddress
,
3749 _In_ ULONG Language
,
3750 _In_ ULONG MessageId
,
3751 _Out_ PMESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
3757 RtlGetNtGlobalFlags(VOID
);
3759 _Success_(return!=NULL
)
3763 RtlImageDirectoryEntryToData(
3764 _In_ PVOID BaseAddress
,
3765 _In_ BOOLEAN MappedAsImage
,
3766 _In_ USHORT Directory
,
3774 _In_ PIMAGE_NT_HEADERS NtHeader
,
3775 _In_ PVOID BaseAddress
,
3777 _Inout_opt_ PIMAGE_SECTION_HEADER
*SectionHeader
3784 _In_ PVOID BaseAddress
);
3791 _In_ PVOID BaseAddress
,
3792 _In_ ULONGLONG Size
,
3793 _Out_ PIMAGE_NT_HEADERS
*NtHeader
3797 PIMAGE_SECTION_HEADER
3799 RtlImageRvaToSection(
3800 _In_ PIMAGE_NT_HEADERS NtHeader
,
3801 _In_ PVOID BaseAddress
,
3808 LdrRelocateImageWithBias(
3809 _In_ PVOID NewAddress
,
3810 _In_ LONGLONG AdditionalBias
,
3811 _In_ PCCH LoaderName
,
3813 _In_ ULONG Conflict
,
3818 // Activation Context Functions
3820 #ifdef NTOS_MODE_USER
3824 RtlActivateActivationContextEx(
3828 _Out_ PULONG_PTR Cookie
3834 RtlActivateActivationContext(
3837 _Out_ PULONG_PTR Cookie
3843 RtlAddRefActivationContext(
3848 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3850 RtlActivateActivationContextUnsafeFast(
3851 _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
,
3858 RtlAllocateActivationContextStack(
3859 _In_ PACTIVATION_CONTEXT_STACK
*Stack
3865 RtlCreateActivationContext(
3867 _In_ PACTIVATION_CONTEXT_DATA ActivationContextData
,
3868 _In_ ULONG ExtraBytes
,
3869 _In_ PVOID NotificationRoutine
,
3870 _In_ PVOID NotificationContext
,
3871 _Out_ PACTIVATION_CONTEXT
*ActCtx
3877 RtlGetActiveActivationContext(
3884 RtlReleaseActivationContext(
3891 RtlDeactivateActivationContext(
3893 _In_ ULONG_PTR ulCookie
3899 RtlFreeActivationContextStack(
3900 _In_ PACTIVATION_CONTEXT_STACK Stack
3906 RtlFreeThreadActivationContextStack(VOID
);
3909 PRTL_ACTIVATION_CONTEXT_STACK_FRAME
3911 RtlDeactivateActivationContextUnsafeFast(
3912 _In_ PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame
3918 RtlDosApplyFileIsolationRedirection_Ustr(
3920 _In_ PUNICODE_STRING OriginalName
,
3921 _In_ PUNICODE_STRING Extension
,
3922 _Inout_ PUNICODE_STRING StaticString
,
3923 _Inout_ PUNICODE_STRING DynamicString
,
3924 _Inout_ PUNICODE_STRING
*NewName
,
3925 _In_ PULONG NewFlags
,
3926 _In_ PSIZE_T FileNameSize
,
3927 _In_ PSIZE_T RequiredLength
3933 RtlFindActivationContextSectionString(
3935 _In_
const GUID
*ExtensionGuid
,
3936 _In_ ULONG SectionType
,
3937 _In_
const UNICODE_STRING
*SectionName
,
3938 _Inout_ PVOID ReturnedData
3944 RtlQueryInformationActivationContext(
3946 _In_opt_ PVOID Context
,
3947 _In_opt_ PVOID pvSubInstance
,
3948 _In_ ULONG ulInfoClass
,
3949 _Out_bytecap_(cbBuffer
) PVOID pvBuffer
,
3950 _In_opt_ SIZE_T cbBuffer
,
3951 _Out_opt_ SIZE_T
*pcbWrittenOrRequired
3957 RtlQueryInformationActiveActivationContext(
3958 _In_ ULONG ulInfoClass
,
3959 _Out_bytecap_(cbBuffer
) PVOID pvBuffer
,
3960 _In_opt_ SIZE_T cbBuffer
,
3961 _Out_opt_ SIZE_T
*pcbWrittenOrRequired
3967 RtlZombifyActivationContext(
3977 RtlWow64EnableFsRedirection(
3978 _In_ BOOLEAN Wow64FsEnableRedirection
3984 RtlWow64EnableFsRedirectionEx(
3985 _In_ PVOID Wow64FsEnableRedirection
,
3986 _Out_ PVOID
*OldFsRedirectionLevel
3992 // Registry Functions
3994 _IRQL_requires_max_(PASSIVE_LEVEL
)
3995 _Must_inspect_result_
3999 RtlCheckRegistryKey(
4000 _In_ ULONG RelativeTo
,
4007 RtlCreateRegistryKey(
4008 _In_ ULONG RelativeTo
,
4015 RtlFormatCurrentUserKeyPath(
4016 _Out_
_At_(KeyPath
->Buffer
, __drv_allocatesMem(Mem
) _Post_bytecap_(KeyPath
->MaximumLength
) _Post_bytecount_(KeyPath
->Length
))
4017 PUNICODE_STRING KeyPath
4024 _In_ ACCESS_MASK DesiredAccess
,
4025 _Out_ PHANDLE KeyHandle
4028 _IRQL_requires_max_(PASSIVE_LEVEL
)
4032 RtlQueryRegistryValues(
4033 _In_ ULONG RelativeTo
,
4035 _Inout_
_At_(*(*QueryTable
).EntryContext
, _Pre_unknown_
)
4036 PRTL_QUERY_REGISTRY_TABLE QueryTable
,
4037 _In_opt_ PVOID Context
,
4038 _In_opt_ PVOID Environment
4041 _IRQL_requires_max_(PASSIVE_LEVEL
)
4045 RtlWriteRegistryValue(
4046 _In_ ULONG RelativeTo
,
4048 _In_z_ PCWSTR ValueName
,
4049 _In_ ULONG ValueType
,
4050 _In_reads_bytes_opt_(ValueLength
) PVOID ValueData
,
4051 _In_ ULONG ValueLength
4054 #ifdef NTOS_MODE_USER
4059 _Out_ HANDLE KeyHandle
,
4060 _In_ ACCESS_MASK DesiredAccess
,
4061 _In_ POBJECT_ATTRIBUTES ObjectAttributes
,
4062 _In_ ULONG TitleIndex
,
4063 _In_ PUNICODE_STRING Class
,
4064 _Out_ PULONG Disposition
4070 RtlpNtEnumerateSubKey(
4071 _In_ HANDLE KeyHandle
,
4072 _Inout_ PUNICODE_STRING SubKeyName
,
4080 RtlpNtMakeTemporaryKey(
4081 _In_ HANDLE KeyHandle
4088 _Out_ HANDLE KeyHandle
,
4089 _In_ ACCESS_MASK DesiredAccess
,
4090 _In_ POBJECT_ATTRIBUTES ObjectAttributes
,
4097 RtlpNtQueryValueKey(
4098 _In_ HANDLE KeyHandle
,
4099 _Out_opt_ PULONG Type
,
4100 _Out_opt_ PVOID Data
,
4101 _Inout_opt_ PULONG DataLength
,
4109 _In_ HANDLE KeyHandle
,
4112 _In_ ULONG DataLength
4122 RtlGetDefaultCodePage(
4123 _Out_ PUSHORT AnsiCodePage
,
4124 _Out_ PUSHORT OemCodePage
4131 _In_ PUSHORT AnsiTableBase
,
4132 _In_ PUSHORT OemTableBase
,
4133 _In_ PUSHORT CaseTableBase
,
4134 _Out_ PNLSTABLEINFO NlsTable
4137 _IRQL_requires_max_(PASSIVE_LEVEL
)
4141 RtlInitCodePageTable(
4142 _In_ PUSHORT TableBase
,
4143 _Out_ PCPTABLEINFO CodePageTable
4149 RtlResetRtlTranslations(
4150 _In_ PNLSTABLEINFO NlsTable
);
4152 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
4155 // Misc conversion functions
4160 RtlConvertLongToLargeInteger(
4161 _In_ LONG SignedInteger
4164 LARGE_INTEGER Result
;
4166 Result
.QuadPart
= SignedInteger
;
4173 RtlEnlargedIntegerMultiply(
4174 _In_ LONG Multiplicand
,
4175 _In_ LONG Multiplier
4178 LARGE_INTEGER Product
;
4180 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
4187 RtlEnlargedUnsignedDivide(
4188 _In_ ULARGE_INTEGER Dividend
,
4190 _In_opt_ PULONG Remainder
4195 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
4197 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
4206 RtlEnlargedUnsignedMultiply(
4207 _In_ ULONG Multiplicand
,
4208 _In_ ULONG Multiplier
4211 LARGE_INTEGER Product
;
4213 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
4217 #if defined(_AMD64_) || defined(_IA64_)
4221 RtlExtendedLargeIntegerDivide(
4222 _In_ LARGE_INTEGER Dividend
,
4224 _Out_opt_ PULONG Remainder
)
4227 ret
.QuadPart
= (ULONG64
)Dividend
.QuadPart
/ Divisor
;
4229 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
4237 RtlExtendedLargeIntegerDivide(
4238 _In_ LARGE_INTEGER Dividend
,
4240 _Out_opt_ PULONG Remainder
4243 #endif /* defined(_AMD64_) || defined(_IA64_) */
4266 _In_ ULONG InitialCrc
,
4272 // Network Functions
4277 RtlIpv4AddressToStringA(
4278 _In_
const struct in_addr
*Addr
,
4279 _Out_writes_(16) PCHAR S
4285 RtlIpv4AddressToStringW(
4286 _In_
const struct in_addr
*Addr
,
4287 _Out_writes_(16) PWCHAR S
4293 RtlIpv4AddressToStringExA(
4294 _In_
const struct in_addr
*Address
,
4296 _Out_writes_to_(*AddressStringLength
, *AddressStringLength
) PCHAR AddressString
,
4297 _Inout_ PULONG AddressStringLength
4302 RtlIpv4AddressToStringExW(
4303 _In_
const struct in_addr
*Address
,
4305 _Out_writes_to_(*AddressStringLength
, *AddressStringLength
) PWCHAR AddressString
,
4306 _Inout_ PULONG AddressStringLength
4312 RtlIpv4StringToAddressA(
4314 _In_ BOOLEAN Strict
,
4315 _Out_ PCSTR
*Terminator
,
4316 _Out_
struct in_addr
*Addr
4322 RtlIpv4StringToAddressW(
4324 _In_ BOOLEAN Strict
,
4325 _Out_ PCWSTR
*Terminator
,
4326 _Out_
struct in_addr
*Addr
4332 RtlIpv4StringToAddressExA(
4333 _In_ PCSTR AddressString
,
4334 _In_ BOOLEAN Strict
,
4335 _Out_
struct in_addr
*Address
,
4342 RtlIpv4StringToAddressExW(
4343 _In_ PCWSTR AddressString
,
4344 _In_ BOOLEAN Strict
,
4345 _Out_
struct in_addr
*Address
,
4352 RtlIpv6AddressToStringA(
4353 _In_
const struct in6_addr
*Addr
,
4354 _Out_writes_(46) PSTR S
4360 RtlIpv6AddressToStringW(
4361 _In_
const struct in6_addr
*Addr
,
4362 _Out_writes_(46) PWSTR S
4368 RtlIpv6AddressToStringExA(
4369 _In_
const struct in6_addr
*Address
,
4372 _Out_writes_to_(*AddressStringLength
, *AddressStringLength
) PSTR AddressString
,
4373 _Inout_ PULONG AddressStringLength
4379 RtlIpv6AddressToStringExW(
4380 _In_
const struct in6_addr
*Address
,
4383 _Out_writes_to_(*AddressStringLength
, *AddressStringLength
) PWCHAR AddressString
,
4384 _Inout_ PULONG AddressStringLength
4390 RtlIpv6StringToAddressA(
4392 _Out_ PCSTR
*Terminator
,
4393 _Out_
struct in6_addr
*Addr
4399 RtlIpv6StringToAddressW(
4401 _Out_ PCWSTR
*Terminator
,
4402 _Out_
struct in6_addr
*Addr
4408 RtlIpv6StringToAddressExA(
4409 _In_ PCSTR AddressString
,
4410 _Out_
struct in6_addr
*Address
,
4411 _Out_ PULONG ScopeId
,
4418 RtlIpv6StringToAddressExW(
4419 _In_ PCWSTR AddressString
,
4420 _Out_
struct in6_addr
*Address
,
4421 _Out_ PULONG ScopeId
,
4432 RtlQueryTimeZoneInformation(
4433 _Out_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation
);
4438 RtlSecondsSince1970ToTime(
4439 _In_ ULONG SecondsSince1970
,
4440 _Out_ PLARGE_INTEGER Time
4446 RtlSetTimeZoneInformation(
4447 _In_ PRTL_TIME_ZONE_INFORMATION TimeZoneInformation
);
4449 _Success_(return!=FALSE
)
4450 _Must_inspect_result_
4454 RtlTimeFieldsToTime(
4455 _In_ PTIME_FIELDS TimeFields
,
4456 _Out_ PLARGE_INTEGER Time
4459 _Success_(return != 0)
4460 _Must_inspect_result_
4464 RtlTimeToSecondsSince1970(
4465 _In_ PLARGE_INTEGER Time
,
4466 _Out_ PULONG ElapsedSeconds
4472 RtlTimeToTimeFields(
4473 PLARGE_INTEGER Time
,
4474 PTIME_FIELDS TimeFields
4480 RtlSystemTimeToLocalTime(
4481 _In_ PLARGE_INTEGER SystemTime
,
4482 _Out_ PLARGE_INTEGER LocalTime
4486 // Version Functions
4488 _IRQL_requires_max_(PASSIVE_LEVEL
)
4489 _Must_inspect_result_
4493 RtlVerifyVersionInfo(
4494 _In_ PRTL_OSVERSIONINFOEXW VersionInfo
,
4495 _In_ ULONG TypeMask
,
4496 _In_ ULONGLONG ConditionMask
4499 _IRQL_requires_max_(PASSIVE_LEVEL
)
4505 _At_(lpVersionInformation
->dwOSVersionInfoSize
, _Pre_ _Valid_
)
4506 _When_(lpVersionInformation
->dwOSVersionInfoSize
== sizeof(RTL_OSVERSIONINFOEXW
),
4507 _At_((PRTL_OSVERSIONINFOEXW
)lpVersionInformation
, _Out_
))
4508 PRTL_OSVERSIONINFOW lpVersionInformation
4514 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);
4517 // Secure Memory Functions
4519 #ifdef NTOS_MODE_USER
4523 RtlRegisterSecureMemoryCacheCallback(
4524 _In_ PRTL_SECURE_MEMORY_CACHE_CALLBACK Callback
);
4529 RtlFlushSecureMemoryCache(
4530 _In_ PVOID MemoryCache
,
4531 _In_opt_ SIZE_T MemoryLength
4536 // Boot Status Data Functions
4538 #ifdef NTOS_MODE_USER
4542 RtlCreateBootStatusDataFile(
4549 RtlGetSetBootStatusData(
4550 _In_ HANDLE FileHandle
,
4551 _In_ BOOLEAN WriteMode
,
4552 _In_ RTL_BSD_ITEM_TYPE DataClass
,
4554 _In_ ULONG BufferSize
,
4555 _Out_opt_ PULONG ReturnLength
4561 RtlLockBootStatusData(
4562 _Out_ PHANDLE FileHandle
4568 RtlUnlockBootStatusData(
4569 _In_ HANDLE FileHandle
4573 #ifdef NTOS_MODE_USER
4574 _Must_inspect_result_
4579 _In_ PUNICODE_STRING GuidString
,
4582 _Must_inspect_result_
4588 _Out_
_At_(GuidString
->Buffer
, __drv_allocatesMem(Mem
))
4589 PUNICODE_STRING GuidString
);
4594 RtlComputeImportTableHash(
4597 _In_ ULONG ImportTableHashRevision
4602 // MemoryStream functions
4604 #ifdef NTOS_MODE_USER
4609 RtlInitMemoryStream(
4610 _Out_ PRTL_MEMORY_STREAM Stream
4616 RtlInitOutOfProcessMemoryStream(
4617 _Out_ PRTL_MEMORY_STREAM Stream
4623 RtlFinalReleaseOutOfProcessMemoryStream(
4624 _In_ PRTL_MEMORY_STREAM Stream
4630 RtlQueryInterfaceMemoryStream(
4631 _In_
struct IStream
*This
,
4632 _In_ REFIID RequestedIid
,
4633 _Outptr_ PVOID
*ResultObject
4639 RtlAddRefMemoryStream(
4640 _In_
struct IStream
*This
4646 RtlReleaseMemoryStream(
4647 _In_
struct IStream
*This
4653 RtlReadMemoryStream(
4654 _In_
struct IStream
*This
,
4655 _Out_writes_bytes_(Length
) PVOID Buffer
,
4657 _Out_opt_ PULONG BytesRead
4663 RtlReadOutOfProcessMemoryStream(
4664 _In_
struct IStream
*This
,
4665 _Out_writes_bytes_(Length
) PVOID Buffer
,
4667 _Out_opt_ PULONG BytesRead
4673 RtlSeekMemoryStream(
4674 _In_
struct IStream
*This
,
4675 _In_ LARGE_INTEGER RelativeOffset
,
4677 _Out_opt_ PULARGE_INTEGER ResultOffset
4683 RtlCopyMemoryStreamTo(
4684 _In_
struct IStream
*This
,
4685 _In_
struct IStream
*Target
,
4686 _In_ ULARGE_INTEGER Length
,
4687 _Out_opt_ PULARGE_INTEGER BytesRead
,
4688 _Out_opt_ PULARGE_INTEGER BytesWritten
4694 RtlCopyOutOfProcessMemoryStreamTo(
4695 _In_
struct IStream
*This
,
4696 _In_
struct IStream
*Target
,
4697 _In_ ULARGE_INTEGER Length
,
4698 _Out_opt_ PULARGE_INTEGER BytesRead
,
4699 _Out_opt_ PULARGE_INTEGER BytesWritten
4705 RtlStatMemoryStream(
4706 _In_
struct IStream
*This
,
4707 _Out_
struct tagSTATSTG
*Stats
,
4715 RtlWriteMemoryStream(
4716 _In_
struct IStream
*This
,
4717 _In_reads_bytes_(Length
) CONST VOID
*Buffer
,
4719 _Out_opt_ PULONG BytesWritten
4725 RtlSetMemoryStreamSize(
4726 _In_
struct IStream
*This
,
4727 _In_ ULARGE_INTEGER NewSize
4733 RtlCommitMemoryStream(
4734 _In_
struct IStream
*This
,
4735 _In_ ULONG CommitFlags
4741 RtlRevertMemoryStream(
4742 _In_
struct IStream
*This
4748 RtlLockMemoryStreamRegion(
4749 _In_
struct IStream
*This
,
4750 _In_ ULARGE_INTEGER Offset
,
4751 _In_ ULARGE_INTEGER Length
,
4758 RtlUnlockMemoryStreamRegion(
4759 _In_
struct IStream
*This
,
4760 _In_ ULARGE_INTEGER Offset
,
4761 _In_ ULARGE_INTEGER Length
,
4768 RtlCloneMemoryStream(
4769 _In_
struct IStream
*This
,
4770 _Outptr_
struct IStream
**ResultStream
4776 RtlGetNativeSystemInformation(
4777 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass
,
4778 _Out_writes_bytes_to_opt_(SystemInformationLength
, *ReturnLength
) PVOID SystemInformation
,
4779 _In_ ULONG SystemInformationLength
,
4780 _Out_opt_ PULONG ReturnLength
4783 #endif // NTOS_MODE_USER
4788 RtlFindActivationContextSectionGuid(
4790 const GUID
*extguid
,