3 Copyright (c) Alex Ionescu. All rights reserved.
11 Function definitions for the Run-Time Library
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
38 IN PLIST_ENTRY ListHead
41 ListHead
->Flink
= ListHead
->Blink
= ListHead
;
47 IN PLIST_ENTRY ListHead
,
52 OldFlink
= ListHead
->Flink
;
53 Entry
->Flink
= OldFlink
;
54 Entry
->Blink
= ListHead
;
55 OldFlink
->Blink
= Entry
;
56 ListHead
->Flink
= Entry
;
62 IN PLIST_ENTRY ListHead
,
67 OldBlink
= ListHead
->Blink
;
68 Entry
->Flink
= ListHead
;
69 Entry
->Blink
= OldBlink
;
70 OldBlink
->Flink
= Entry
;
71 ListHead
->Blink
= Entry
;
77 IN
const LIST_ENTRY
* ListHead
80 return (BOOLEAN
)(ListHead
->Flink
== ListHead
);
86 PSINGLE_LIST_ENTRY ListHead
89 PSINGLE_LIST_ENTRY FirstEntry
;
90 FirstEntry
= ListHead
->Next
;
91 if (FirstEntry
!= NULL
) {
92 ListHead
->Next
= FirstEntry
->Next
;
101 PSINGLE_LIST_ENTRY ListHead
,
102 PSINGLE_LIST_ENTRY Entry
105 Entry
->Next
= ListHead
->Next
;
106 ListHead
->Next
= Entry
;
112 IN PLIST_ENTRY Entry
)
114 PLIST_ENTRY OldFlink
;
115 PLIST_ENTRY OldBlink
;
117 OldFlink
= Entry
->Flink
;
118 OldBlink
= Entry
->Blink
;
119 OldFlink
->Blink
= OldBlink
;
120 OldBlink
->Flink
= OldFlink
;
121 return (BOOLEAN
)(OldFlink
== OldBlink
);
127 IN PLIST_ENTRY ListHead
)
132 Entry
= ListHead
->Flink
;
133 Flink
= Entry
->Flink
;
134 ListHead
->Flink
= Flink
;
135 Flink
->Blink
= ListHead
;
142 IN PLIST_ENTRY ListHead
)
147 Entry
= ListHead
->Blink
;
148 Blink
= Entry
->Blink
;
149 ListHead
->Blink
= Blink
;
150 Blink
->Flink
= ListHead
;
157 #define RtlEqualLuid(L1, L2) (((L1)->HighPart == (L2)->HighPart) && \
158 ((L1)->LowPart == (L2)->LowPart))
163 // RTL Splay Tree Functions
168 RtlSplay(PRTL_SPLAY_LINKS Links
);
173 RtlDelete(PRTL_SPLAY_LINKS Links
);
179 PRTL_SPLAY_LINKS Links
,
180 PRTL_SPLAY_LINKS
*Root
186 RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links
);
191 RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links
);
196 RtlRealSuccessor(PRTL_SPLAY_LINKS Links
);
201 RtlRealPredecessor(PRTL_SPLAY_LINKS Links
);
203 #define RtlIsLeftChild(Links) \
204 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
206 #define RtlIsRightChild(Links) \
207 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
209 #define RtlRightChild(Links) \
210 ((PRTL_SPLAY_LINKS)(Links))->RightChild
212 #define RtlIsRoot(Links) \
213 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
215 #define RtlLeftChild(Links) \
216 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
218 #define RtlParent(Links) \
219 ((PRTL_SPLAY_LINKS)(Links))->Parent
221 #define RtlInitializeSplayLinks(Links) \
223 PRTL_SPLAY_LINKS _SplayLinks; \
224 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
225 _SplayLinks->Parent = _SplayLinks; \
226 _SplayLinks->LeftChild = NULL; \
227 _SplayLinks->RightChild = NULL; \
230 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
232 PRTL_SPLAY_LINKS _SplayParent; \
233 PRTL_SPLAY_LINKS _SplayChild; \
234 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
235 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
236 _SplayParent->LeftChild = _SplayChild; \
237 _SplayChild->Parent = _SplayParent; \
240 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
242 PRTL_SPLAY_LINKS _SplayParent; \
243 PRTL_SPLAY_LINKS _SplayChild; \
244 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
245 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
246 _SplayParent->RightChild = _SplayChild; \
247 _SplayChild->Parent = _SplayParent; \
251 // Error and Exception Functions
256 RtlAddVectoredExceptionHandler(
257 IN ULONG FirstHandler
,
258 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
265 PVOID FailedAssertion
,
274 RtlCaptureContext(OUT PCONTEXT ContextRecord
);
279 RtlEncodePointer(IN PVOID Pointer
);
284 RtlDecodePointer(IN PVOID Pointer
);
289 RtlDispatchException(
290 IN PEXCEPTION_RECORD ExceptionRecord
,
297 RtlNtStatusToDosError(IN NTSTATUS Status
);
302 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord
);
307 RtlRaiseStatus(NTSTATUS Status
);
312 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS
* ExceptionInfo
);
318 IN PVOID TargetFrame OPTIONAL
,
319 IN PVOID TargetIp OPTIONAL
,
320 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL
,
331 IN HANDLE HeapHandle
,
341 IN PVOID BaseAddress OPTIONAL
,
342 IN SIZE_T SizeToReserve OPTIONAL
,
343 IN SIZE_T SizeToCommit OPTIONAL
,
344 IN PVOID Lock OPTIONAL
,
345 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
358 RtlDestroyHeap(HANDLE hheap
);
364 IN HANDLE HeapHandle
,
387 RtlLockHeap(IN HANDLE Heap
);
391 RtlUnlockHeap(IN HANDLE Heap
);
398 IN PVOID MemoryPointer
409 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
412 // Security Functions
417 RtlAbsoluteToSelfRelativeSD(
418 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
419 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
420 IN PULONG BufferLength
426 RtlAddAccessAllowedAce(
429 ACCESS_MASK AccessMask
,
435 RtlAddAccessAllowedAceEx(
437 IN ULONG dwAceRevision
,
445 RtlAddAccessDeniedAce(
448 ACCESS_MASK AccessMask
,
454 RtlAddAccessDeniedAceEx(
458 IN ACCESS_MASK AccessMask
,
464 RtlAddAuditAccessAceEx(
468 IN ACCESS_MASK AccessMask
,
480 ULONG StartingAceIndex
,
487 RtlAddAuditAccessAce(
490 ACCESS_MASK AccessMask
,
501 IN BOOLEAN ForThread
,
502 OUT PBOOLEAN OldValue
508 RtlAllocateAndInitializeSid(
509 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
510 IN UCHAR SubAuthorityCount
,
511 IN ULONG SubAuthority0
,
512 IN ULONG SubAuthority1
,
513 IN ULONG SubAuthority2
,
514 IN ULONG SubAuthority3
,
515 IN ULONG SubAuthority4
,
516 IN ULONG SubAuthority5
,
517 IN ULONG SubAuthority6
,
518 IN ULONG SubAuthority7
,
524 RtlAreAllAccessesGranted(
525 ACCESS_MASK GrantedAccess
,
526 ACCESS_MASK DesiredAccess
531 RtlAreAnyAccessesGranted(
532 ACCESS_MASK GrantedAccess
,
533 ACCESS_MASK DesiredAccess
546 RtlCopyLuidAndAttributesArray(
548 PLUID_AND_ATTRIBUTES Src
,
549 PLUID_AND_ATTRIBUTES Dest
554 RtlCopySidAndAttributesArray(
556 PSID_AND_ATTRIBUTES Src
,
558 PSID_AND_ATTRIBUTES Dest
,
560 PVOID
* RemainingSidArea
,
561 PULONG RemainingSidAreaSize
566 RtlConvertSidToUnicodeString(
567 OUT PUNICODE_STRING DestinationString
,
569 IN BOOLEAN AllocateDestinationString
593 RtlCreateSecurityDescriptor(
594 PSECURITY_DESCRIPTOR SecurityDescriptor
,
601 RtlCreateSecurityDescriptorRelative(
602 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
655 RtlGetControlSecurityDescriptor(
656 PSECURITY_DESCRIPTOR SecurityDescriptor
,
657 PSECURITY_DESCRIPTOR_CONTROL Control
,
664 RtlGetDaclSecurityDescriptor(
665 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
666 OUT PBOOLEAN DaclPresent
,
668 OUT PBOOLEAN DaclDefaulted
674 RtlGetSaclSecurityDescriptor(
675 PSECURITY_DESCRIPTOR SecurityDescriptor
,
676 PBOOLEAN SaclPresent
,
678 PBOOLEAN SaclDefaulted
684 RtlGetGroupSecurityDescriptor(
685 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
687 OUT PBOOLEAN GroupDefaulted
693 RtlGetOwnerSecurityDescriptor(
694 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
696 OUT PBOOLEAN OwnerDefaulted
702 RtlGetSecurityDescriptorRMControl(
703 PSECURITY_DESCRIPTOR SecurityDescriptor
,
708 PSID_IDENTIFIER_AUTHORITY
710 RtlIdentifierAuthoritySid(PSID Sid
);
715 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
722 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
723 IN UCHAR SubAuthorityCount
729 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
734 RtlLengthSid(IN PSID Sid
);
739 RtlMakeSelfRelativeSD(
740 IN PSECURITY_DESCRIPTOR AbsoluteSD
,
741 OUT PSECURITY_DESCRIPTOR SelfRelativeSD
,
742 IN OUT PULONG BufferLength
);
748 PACCESS_MASK AccessMask
,
749 PGENERIC_MAPPING GenericMapping
755 RtlQueryInformationAcl(
758 ULONG InformationLength
,
759 ACL_INFORMATION_CLASS InformationClass
765 RtlSelfRelativeToAbsoluteSD(
766 IN PSECURITY_DESCRIPTOR SelfRelativeSD
,
767 OUT PSECURITY_DESCRIPTOR AbsoluteSD
,
768 IN PULONG AbsoluteSDSize
,
775 IN PSID PrimaryGroup
,
776 IN PULONG PrimaryGroupSize
782 RtlSelfRelativeToAbsoluteSD2(
783 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD
,
784 OUT PULONG BufferSize
790 RtlSetControlSecurityDescriptor(
791 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
792 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
793 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
799 RtlSetDaclSecurityDescriptor (
800 PSECURITY_DESCRIPTOR SecurityDescriptor
,
803 BOOLEAN DaclDefaulted
809 RtlSetGroupSecurityDescriptor(
810 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
812 IN BOOLEAN GroupDefaulted
818 RtlSetInformationAcl(
821 ULONG InformationLength
,
822 ACL_INFORMATION_CLASS InformationClass
828 RtlSetOwnerSecurityDescriptor(
829 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
831 IN BOOLEAN OwnerDefaulted
837 RtlSetSaclSecurityDescriptor(
838 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
839 IN BOOLEAN SaclPresent
,
841 IN BOOLEAN SaclDefaulted
847 RtlSetSecurityDescriptorRMControl(
848 PSECURITY_DESCRIPTOR SecurityDescriptor
,
855 RtlSubAuthorityCountSid(
864 IN ULONG SubAuthority
870 RtlValidRelativeSecurityDescriptor(
871 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
872 IN ULONG SecurityDescriptorLength
,
873 IN SECURITY_INFORMATION RequiredInformation
879 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
884 RtlValidSid(IN PSID Sid
);
889 RtlValidAcl(PACL Acl
);
894 RtlDeleteSecurityObject(
895 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
901 RtlNewSecurityObject(
902 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
903 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
904 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
905 IN BOOLEAN IsDirectoryObject
,
907 IN PGENERIC_MAPPING GenericMapping
913 RtlQuerySecurityObject(
914 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
915 IN SECURITY_INFORMATION SecurityInformation
,
916 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
917 IN ULONG DescriptorLength
,
918 OUT PULONG ReturnLength
924 RtlSetSecurityObject(
925 IN SECURITY_INFORMATION SecurityInformation
,
926 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
927 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
928 IN PGENERIC_MAPPING GenericMapping
,
933 // Single-Character Functions
938 RtlLargeIntegerToChar(
939 IN PLARGE_INTEGER Value
,
948 RtlUpperChar(CHAR Source
);
953 RtlUpcaseUnicodeChar(WCHAR Source
);
958 RtlDowncaseUnicodeChar(IN WCHAR Source
);
975 IN ULONG Base OPTIONAL
,
976 IN ULONG Length OPTIONAL
,
983 RtlIntegerToUnicodeString(
986 IN OUT PUNICODE_STRING String
999 // Byte Swap Functions
1001 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
1002 ((defined(_M_AMD64) || \
1003 defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
1005 unsigned short __cdecl
_byteswap_ushort(unsigned short);
1006 unsigned long __cdecl
_byteswap_ulong (unsigned long);
1007 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
1008 #pragma intrinsic(_byteswap_ushort)
1009 #pragma intrinsic(_byteswap_ulong)
1010 #pragma intrinsic(_byteswap_uint64)
1011 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1012 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1013 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1019 RtlUshortByteSwap(IN USHORT Source
);
1023 RtlUlongByteSwap(IN ULONG Source
);
1027 RtlUlonglongByteSwap(IN ULONGLONG Source
);
1032 // Unicode->Ansi String Functions
1037 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
1039 #ifdef NTOS_MODE_USER
1041 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1042 NLS_MB_CODE_PAGE_TAG ? \
1043 RtlxUnicodeStringToAnsiSize(STRING) : \
1044 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1052 RtlUnicodeStringToAnsiString(
1053 PANSI_STRING DestinationString
,
1054 PCUNICODE_STRING SourceString
,
1055 BOOLEAN AllocateDestinationString
1059 // Unicode->OEM String Functions
1064 RtlUpcaseUnicodeStringToOemString(
1065 POEM_STRING DestinationString
,
1066 PCUNICODE_STRING SourceString
,
1067 BOOLEAN AllocateDestinationString
1073 RtlUpcaseUnicodeStringToCountedOemString(
1074 IN OUT POEM_STRING DestinationString
,
1075 IN PCUNICODE_STRING SourceString
,
1076 IN BOOLEAN AllocateDestinationString
1082 RtlUnicodeStringToOemString(
1083 POEM_STRING DestinationString
,
1084 PCUNICODE_STRING SourceString
,
1085 BOOLEAN AllocateDestinationString
1091 RtlUpcaseUnicodeToOemN(
1095 PWCHAR UnicodeString
,
1102 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
1104 #ifdef NTOS_MODE_USER
1106 #define RtlUnicodeStringToOemSize(STRING) ( \
1107 NLS_MB_OEM_CODE_PAGE_TAG ? \
1108 RtlxUnicodeStringToOemSize(STRING) : \
1109 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1112 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1113 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1125 PWCHAR UnicodeString
,
1130 // Unicode->MultiByte String Functions
1135 RtlUnicodeToMultiByteN(
1139 PWCHAR UnicodeString
,
1146 RtlUpcaseUnicodeToMultiByteN(
1150 PWCHAR UnicodeString
,
1157 RtlUnicodeToMultiByteSize(
1159 PWCHAR UnicodeString
,
1166 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
1169 // OEM to Unicode Functions
1174 RtlOemStringToUnicodeString(
1175 PUNICODE_STRING DestinationString
,
1176 PCOEM_STRING SourceString
,
1177 BOOLEAN AllocateDestinationString
1184 PWSTR UnicodeString
,
1185 ULONG MaxBytesInUnicodeString
,
1186 PULONG BytesInUnicodeString
,
1188 ULONG BytesInOemString
1191 #ifdef NTOS_MODE_USER
1193 #define RtlOemStringToUnicodeSize(STRING) ( \
1194 NLS_MB_OEM_CODE_PAGE_TAG ? \
1195 RtlxOemStringToUnicodeSize(STRING) : \
1196 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1199 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1200 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1206 // Ansi->Unicode String Functions
1211 RtlxAnsiStringToUnicodeSize(
1212 PCANSI_STRING AnsiString
1218 RtlAnsiStringToUnicodeString(
1219 PUNICODE_STRING DestinationString
,
1220 PCANSI_STRING SourceString
,
1221 BOOLEAN AllocateDestinationString
1224 #ifdef NTOS_MODE_USER
1226 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1227 NLS_MB_CODE_PAGE_TAG ? \
1228 RtlxAnsiStringToUnicodeSize(STRING) : \
1229 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1237 RtlCreateUnicodeStringFromAsciiz(
1238 OUT PUNICODE_STRING Destination
,
1243 // Unicode String Functions
1248 RtlAppendUnicodeToString(
1249 PUNICODE_STRING Destination
,
1256 RtlAppendUnicodeStringToString(
1257 PUNICODE_STRING Destination
,
1258 PCUNICODE_STRING Source
1264 RtlCompareUnicodeString(
1265 PCUNICODE_STRING String1
,
1266 PCUNICODE_STRING String2
,
1267 BOOLEAN CaseInsensitive
1273 RtlCopyUnicodeString(
1274 PUNICODE_STRING DestinationString
,
1275 PCUNICODE_STRING SourceString
1281 RtlCreateUnicodeString(
1282 PUNICODE_STRING DestinationString
,
1286 #ifdef NTOS_MODE_USER
1291 RtlDowncaseUnicodeString(
1292 IN OUT PUNICODE_STRING UniDest
,
1293 IN PCUNICODE_STRING UniSource
,
1294 IN BOOLEAN AllocateDestinationString
1302 RtlDuplicateUnicodeString(
1304 IN PCUNICODE_STRING SourceString
,
1305 OUT PUNICODE_STRING DestinationString
1311 RtlEqualUnicodeString(
1312 PCUNICODE_STRING String1
,
1313 PCUNICODE_STRING String2
,
1314 BOOLEAN CaseInsensitive
1320 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1325 RtlHashUnicodeString(
1326 IN CONST UNICODE_STRING
*String
,
1327 IN BOOLEAN CaseInSensitive
,
1328 IN ULONG HashAlgorithm
,
1329 OUT PULONG HashValue
1335 RtlInitUnicodeString(
1336 IN OUT PUNICODE_STRING DestinationString
,
1337 IN PCWSTR SourceString
);
1352 PCANSI_STRING String1
,
1353 PCANSI_STRING String2
,
1354 BOOLEAN CaseInsensitive
1360 RtlPrefixUnicodeString(
1361 PCUNICODE_STRING String1
,
1362 PCUNICODE_STRING String2
,
1363 BOOLEAN CaseInsensitive
1369 RtlUpcaseUnicodeString(
1370 PUNICODE_STRING DestinationString
,
1371 PCUNICODE_STRING SourceString
,
1372 BOOLEAN AllocateDestinationString
1378 RtlUnicodeStringToInteger(
1379 PCUNICODE_STRING String
,
1385 // Ansi String Functions
1390 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1396 PANSI_STRING DestinationString
,
1401 // OEM String Functions
1406 RtlFreeOemString(IN POEM_STRING OemString
);
1409 // MultiByte->Unicode String Functions
1414 RtlMultiByteToUnicodeN(
1415 PWCHAR UnicodeString
,
1425 RtlMultiByteToUnicodeSize(
1437 RtlAddAtomToAtomTable(
1438 IN PRTL_ATOM_TABLE AtomTable
,
1448 IN OUT PRTL_ATOM_TABLE
*AtomTable
1454 RtlDeleteAtomFromAtomTable(
1455 IN PRTL_ATOM_TABLE AtomTable
,
1462 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1467 RtlQueryAtomInAtomTable(
1468 IN PRTL_ATOM_TABLE AtomTable
,
1470 IN OUT PULONG RefCount OPTIONAL
,
1471 IN OUT PULONG PinCount OPTIONAL
,
1472 IN OUT PWSTR AtomName OPTIONAL
,
1473 IN OUT PULONG NameLength OPTIONAL
1479 RtlPinAtomInAtomTable(
1480 IN PRTL_ATOM_TABLE AtomTable
,
1487 RtlLookupAtomInAtomTable(
1488 IN PRTL_ATOM_TABLE AtomTable
,
1500 IN PVOID Destination
,
1506 // Process Management Functions
1511 RtlAcquirePebLock(VOID
);
1516 RtlCreateProcessParameters (
1517 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1518 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1519 IN PUNICODE_STRING DllPath OPTIONAL
,
1520 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1521 IN PUNICODE_STRING CommandLine OPTIONAL
,
1522 IN PWSTR Environment OPTIONAL
,
1523 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1524 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1525 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1526 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1532 RtlCreateUserProcess(
1533 IN PUNICODE_STRING ImageFileName
,
1534 IN ULONG Attributes
,
1535 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1536 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1537 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1538 IN HANDLE ParentProcess OPTIONAL
,
1539 IN BOOLEAN CurrentDirectory
,
1540 IN HANDLE DebugPort OPTIONAL
,
1541 IN HANDLE ExceptionPort OPTIONAL
,
1542 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1548 RtlCreateUserThread(
1549 IN HANDLE ProcessHandle
,
1550 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1551 IN BOOLEAN CreateSuspended
,
1552 IN LONG StackZeroBits
,
1553 IN ULONG StackReserve
,
1554 IN ULONG StackCommit
,
1555 IN PTHREAD_START_ROUTINE StartAddress
,
1557 IN OUT PHANDLE ThreadHandle
,
1558 IN OUT PCLIENT_ID ClientId
1562 PRTL_USER_PROCESS_PARAMETERS
1564 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1569 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1574 RtlExitUserThread(NTSTATUS Status
);
1579 RtlInitializeContext(
1580 IN HANDLE ProcessHandle
,
1581 OUT PCONTEXT ThreadContext
,
1582 IN PVOID ThreadStartParam OPTIONAL
,
1583 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1584 IN PINITIAL_TEB InitialTeb
1588 PRTL_USER_PROCESS_PARAMETERS
1590 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1595 RtlReleasePebLock(VOID
);
1600 RtlSetProcessIsCritical(
1601 IN BOOLEAN NewValue
,
1602 OUT PBOOLEAN OldValue OPTIONAL
,
1603 IN BOOLEAN IsWinlogon
1606 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
1609 // Environment/Path Functions
1614 RtlCreateEnvironment(
1622 RtlDestroyEnvironment(PWSTR Environment
);
1627 RtlDoesFileExists_U(PWSTR FileName
);
1632 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1649 RtlDosPathNameToNtPathName_U(
1650 IN PCWSTR DosPathName
,
1651 OUT PUNICODE_STRING NtPathName
,
1652 OUT PCWSTR
*NtFileNamePart
,
1653 OUT CURDIR
*DirectoryInfo
1659 RtlExpandEnvironmentStrings_U(
1661 PUNICODE_STRING Source
,
1662 PUNICODE_STRING Destination
,
1669 RtlGetCurrentDirectory_U(
1670 ULONG MaximumLength
,
1677 RtlGetFullPathName_U(
1678 const WCHAR
*dosname
,
1687 RtlIsNameLegalDOS8Dot3(
1688 IN PUNICODE_STRING UnicodeName
,
1689 IN PANSI_STRING AnsiName
,
1696 RtlQueryEnvironmentVariable_U(
1698 PUNICODE_STRING Name
,
1699 PUNICODE_STRING Value
1705 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1710 RtlSetEnvironmentVariable(
1712 PUNICODE_STRING Name
,
1713 PUNICODE_STRING Value
1717 // Critical Section/Resource Functions
1722 RtlDeleteCriticalSection (
1723 IN PRTL_CRITICAL_SECTION CriticalSection
1729 RtlEnterCriticalSection(
1730 IN PRTL_CRITICAL_SECTION CriticalSection
1736 RtlInitializeCriticalSection(
1737 IN PRTL_CRITICAL_SECTION CriticalSection
1743 RtlInitializeCriticalSectionAndSpinCount(
1744 IN PRTL_CRITICAL_SECTION CriticalSection
,
1751 RtlLeaveCriticalSection(
1752 IN PRTL_CRITICAL_SECTION CriticalSection
1758 RtlpUnWaitCriticalSection(
1759 IN PRTL_CRITICAL_SECTION CriticalSection
1765 RtlpWaitForCriticalSection(
1766 IN PRTL_CRITICAL_SECTION CriticalSection
1772 RtlAcquireResourceExclusive(
1773 IN PRTL_RESOURCE Resource
,
1780 RtlAcquireResourceShared(
1781 IN PRTL_RESOURCE Resource
,
1788 RtlConvertExclusiveToShared(
1789 IN PRTL_RESOURCE Resource
1795 RtlConvertSharedToExclusive(
1796 IN PRTL_RESOURCE Resource
1803 IN PRTL_RESOURCE Resource
1810 IN PRTL_RESOURCE Resource
1816 RtlInitializeResource(
1817 IN PRTL_RESOURCE Resource
1824 IN PRTL_RESOURCE Resource
1828 // Compression Functions
1834 IN USHORT CompressionFormatAndEngine
,
1835 IN PUCHAR UncompressedBuffer
,
1836 IN ULONG UncompressedBufferSize
,
1837 OUT PUCHAR CompressedBuffer
,
1838 IN ULONG CompressedBufferSize
,
1839 IN ULONG UncompressedChunkSize
,
1840 OUT PULONG FinalCompressedSize
,
1847 RtlDecompressBuffer(
1848 IN USHORT CompressionFormat
,
1849 OUT PUCHAR UncompressedBuffer
,
1850 IN ULONG UncompressedBufferSize
,
1851 IN PUCHAR CompressedBuffer
,
1852 IN ULONG CompressedBufferSize
,
1853 OUT PULONG FinalUncompressedSize
1859 RtlGetCompressionWorkSpaceSize(
1860 IN USHORT CompressionFormatAndEngine
,
1861 OUT PULONG CompressBufferWorkSpaceSize
,
1862 OUT PULONG CompressFragmentWorkSpaceSize
1866 // Debug Info Functions
1871 RtlCreateQueryDebugBuffer(
1873 IN BOOLEAN EventPair
1879 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER DebugBuffer
);
1884 RtlQueryProcessDebugInformation(
1886 IN ULONG DebugInfoClassMask
,
1887 IN OUT PRTL_DEBUG_BUFFER DebugBuffer
1897 IN PRTL_BITMAP BitMapHeader
,
1898 IN ULONG StartingIndex
,
1906 IN PRTL_BITMAP BitMapHeader
,
1907 IN ULONG StartingIndex
,
1915 IN PRTL_BITMAP BitMapHeader
,
1916 IN ULONG StartingIndex
,
1917 IN ULONG NumberToClear
1924 IN PRTL_BITMAP BitMapHeader
,
1925 IN ULONG NumberToFind
,
1932 RtlFindClearBitsAndSet(
1933 IN PRTL_BITMAP BitMapHeader
,
1934 IN ULONG NumberToFind
,
1941 RtlInitializeBitMap(
1942 IN PRTL_BITMAP BitMapHeader
,
1943 IN PULONG BitMapBuffer
,
1944 IN ULONG SizeOfBitMap
1951 IN PRTL_BITMAP BitMapHeader
,
1952 IN ULONG StartingIndex
,
1953 IN ULONG NumberToSet
1965 WAITORTIMERCALLBACKFUNC Callback
,
1975 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1983 HANDLE CompletionEvent
1999 RtlDeleteTimerQueueEx(
2001 HANDLE CompletionEvent
2007 RtlDeleteTimerQueue(HANDLE TimerQueue
);
2021 DbgBreakPoint(VOID
);
2024 // Handle Table Functions
2027 PRTL_HANDLE_TABLE_ENTRY
2030 IN PRTL_HANDLE_TABLE HandleTable
,
2037 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
2043 IN PRTL_HANDLE_TABLE HandleTable
,
2044 IN PRTL_HANDLE_TABLE_ENTRY Handle
2050 RtlInitializeHandleTable(
2052 IN ULONG HandleSize
,
2053 IN PRTL_HANDLE_TABLE HandleTable
2060 IN PRTL_HANDLE_TABLE HandleTable
,
2061 IN PRTL_HANDLE_TABLE_ENTRY Handle
2067 RtlIsValidIndexHandle(
2068 IN PRTL_HANDLE_TABLE HandleTable
,
2070 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
2080 IN PVOID BaseAddress
,
2084 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
2090 RtlGetNtGlobalFlags(VOID
);
2095 RtlImageDirectoryEntryToData(
2106 PIMAGE_NT_HEADERS NtHeader
,
2109 PIMAGE_SECTION_HEADER
*SectionHeader
2115 RtlImageNtHeader(IN PVOID BaseAddress
);
2118 PIMAGE_SECTION_HEADER
2120 RtlImageRvaToSection(
2121 PIMAGE_NT_HEADERS NtHeader
,
2127 // Registry Functions
2132 RtlCheckRegistryKey(
2140 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
2146 OUT HANDLE KeyHandle
,
2147 IN ACCESS_MASK DesiredAccess
,
2148 IN POBJECT_ATTRIBUTES ObjectAttributes
,
2156 IN ACCESS_MASK DesiredAccess
,
2157 OUT PHANDLE KeyHandle
2163 RtlQueryRegistryValues(
2164 IN ULONG RelativeTo
,
2166 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
2168 IN PVOID Environment
2174 RtlWriteRegistryValue(
2190 IN PUSHORT AnsiTableBase
,
2191 IN PUSHORT OemTableBase
,
2192 IN PUSHORT CaseTableBase
,
2193 OUT PNLSTABLEINFO NlsTable
2199 RtlInitCodePageTable(
2200 IN PUSHORT TableBase
,
2201 OUT PCPTABLEINFO CodePageTable
2207 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
2209 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2212 // Misc conversion functions
2217 RtlConvertLongToLargeInteger(
2221 LARGE_INTEGER Result
;
2223 Result
.QuadPart
= SignedInteger
;
2230 RtlEnlargedIntegerMultiply(
2235 LARGE_INTEGER Product
;
2237 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2244 RtlEnlargedUnsignedDivide(
2245 IN ULARGE_INTEGER Dividend
,
2247 IN PULONG Remainder OPTIONAL
2252 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
2254 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
2263 RtlEnlargedUnsignedMultiply(
2268 LARGE_INTEGER Product
;
2270 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2278 RtlUniform(PULONG Seed
);
2281 // Network Functions
2286 RtlIpv4StringToAddressW(
2289 OUT PULONG PtrToIpAddr
,
2296 RtlIpv6StringToAddressA(
2305 RtlIpv6StringToAddressW(
2314 RtlIpv6StringToAddressExA(
2315 IN LPSTR AddressName
,
2324 RtlIpv6StringToAddressExW(
2325 IN LPWSTR AddressName
,
2338 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2343 RtlSecondsSince1970ToTime(
2344 IN ULONG SecondsSince1970
,
2345 OUT PLARGE_INTEGER Time
2351 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2356 RtlTimeFieldsToTime(
2357 PTIME_FIELDS TimeFields
,
2364 RtlTimeToTimeFields(
2365 PLARGE_INTEGER Time
,
2366 PTIME_FIELDS TimeFields
2370 // Version Functions
2375 RtlVerifyVersionInfo(
2376 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2378 IN ULONGLONG ConditionMask
2384 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2389 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);