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 OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
601 RtlCreateSecurityDescriptorRelative(
602 OUT PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
655 RtlGetControlSecurityDescriptor(
656 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
657 OUT PSECURITY_DESCRIPTOR_CONTROL Control
,
664 RtlGetDaclSecurityDescriptor(
665 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
666 OUT PBOOLEAN DaclPresent
,
668 OUT PBOOLEAN DaclDefaulted
674 RtlGetSaclSecurityDescriptor(
675 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
676 OUT PBOOLEAN SaclPresent
,
678 OUT 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 IN 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 RtlSetAttributesSecurityDescriptor(
791 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
792 IN SECURITY_DESCRIPTOR_CONTROL Control
,
799 RtlSetControlSecurityDescriptor(
800 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
801 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
802 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
808 RtlSetDaclSecurityDescriptor (
809 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
810 IN BOOLEAN DaclPresent
,
812 IN BOOLEAN DaclDefaulted
818 RtlSetGroupSecurityDescriptor(
819 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
821 IN BOOLEAN GroupDefaulted
827 RtlSetInformationAcl(
830 ULONG InformationLength
,
831 ACL_INFORMATION_CLASS InformationClass
837 RtlSetOwnerSecurityDescriptor(
838 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
840 IN BOOLEAN OwnerDefaulted
846 RtlSetSaclSecurityDescriptor(
847 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
848 IN BOOLEAN SaclPresent
,
850 IN BOOLEAN SaclDefaulted
856 RtlSetSecurityDescriptorRMControl(
857 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
864 RtlSubAuthorityCountSid(
873 IN ULONG SubAuthority
879 RtlValidRelativeSecurityDescriptor(
880 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
881 IN ULONG SecurityDescriptorLength
,
882 IN SECURITY_INFORMATION RequiredInformation
888 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
893 RtlValidSid(IN PSID Sid
);
898 RtlValidAcl(PACL Acl
);
903 RtlDeleteSecurityObject(
904 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
910 RtlNewSecurityObject(
911 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
912 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
913 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
914 IN BOOLEAN IsDirectoryObject
,
916 IN PGENERIC_MAPPING GenericMapping
922 RtlQuerySecurityObject(
923 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
924 IN SECURITY_INFORMATION SecurityInformation
,
925 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
926 IN ULONG DescriptorLength
,
927 OUT PULONG ReturnLength
933 RtlSetSecurityObject(
934 IN SECURITY_INFORMATION SecurityInformation
,
935 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
936 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
937 IN PGENERIC_MAPPING GenericMapping
,
942 // Single-Character Functions
947 RtlLargeIntegerToChar(
948 IN PLARGE_INTEGER Value
,
957 RtlUpperChar(CHAR Source
);
962 RtlUpcaseUnicodeChar(WCHAR Source
);
967 RtlDowncaseUnicodeChar(IN WCHAR Source
);
984 IN ULONG Base OPTIONAL
,
985 IN ULONG Length OPTIONAL
,
992 RtlIntegerToUnicodeString(
995 IN OUT PUNICODE_STRING String
1008 // Byte Swap Functions
1010 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
1011 ((defined(_M_AMD64) || \
1012 defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
1014 unsigned short __cdecl
_byteswap_ushort(unsigned short);
1015 unsigned long __cdecl
_byteswap_ulong (unsigned long);
1016 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
1017 #pragma intrinsic(_byteswap_ushort)
1018 #pragma intrinsic(_byteswap_ulong)
1019 #pragma intrinsic(_byteswap_uint64)
1020 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
1021 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
1022 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
1028 RtlUshortByteSwap(IN USHORT Source
);
1032 RtlUlongByteSwap(IN ULONG Source
);
1036 RtlUlonglongByteSwap(IN ULONGLONG Source
);
1041 // Unicode->Ansi String Functions
1046 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
1048 #ifdef NTOS_MODE_USER
1050 #define RtlUnicodeStringToAnsiSize(STRING) ( \
1051 NLS_MB_CODE_PAGE_TAG ? \
1052 RtlxUnicodeStringToAnsiSize(STRING) : \
1053 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1061 RtlUnicodeStringToAnsiString(
1062 PANSI_STRING DestinationString
,
1063 PCUNICODE_STRING SourceString
,
1064 BOOLEAN AllocateDestinationString
1068 // Unicode->OEM String Functions
1073 RtlUpcaseUnicodeStringToOemString(
1074 POEM_STRING DestinationString
,
1075 PCUNICODE_STRING SourceString
,
1076 BOOLEAN AllocateDestinationString
1082 RtlUpcaseUnicodeStringToCountedOemString(
1083 IN OUT POEM_STRING DestinationString
,
1084 IN PCUNICODE_STRING SourceString
,
1085 IN BOOLEAN AllocateDestinationString
1091 RtlUnicodeStringToOemString(
1092 POEM_STRING DestinationString
,
1093 PCUNICODE_STRING SourceString
,
1094 BOOLEAN AllocateDestinationString
1100 RtlUpcaseUnicodeToOemN(
1104 PWCHAR UnicodeString
,
1111 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
1113 #ifdef NTOS_MODE_USER
1115 #define RtlUnicodeStringToOemSize(STRING) ( \
1116 NLS_MB_OEM_CODE_PAGE_TAG ? \
1117 RtlxUnicodeStringToOemSize(STRING) : \
1118 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
1121 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
1122 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
1134 PWCHAR UnicodeString
,
1139 // Unicode->MultiByte String Functions
1144 RtlUnicodeToMultiByteN(
1148 PWCHAR UnicodeString
,
1155 RtlUpcaseUnicodeToMultiByteN(
1159 PWCHAR UnicodeString
,
1166 RtlUnicodeToMultiByteSize(
1168 PWCHAR UnicodeString
,
1175 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
1178 // OEM to Unicode Functions
1183 RtlOemStringToUnicodeString(
1184 PUNICODE_STRING DestinationString
,
1185 PCOEM_STRING SourceString
,
1186 BOOLEAN AllocateDestinationString
1193 PWSTR UnicodeString
,
1194 ULONG MaxBytesInUnicodeString
,
1195 PULONG BytesInUnicodeString
,
1197 ULONG BytesInOemString
1200 #ifdef NTOS_MODE_USER
1202 #define RtlOemStringToUnicodeSize(STRING) ( \
1203 NLS_MB_OEM_CODE_PAGE_TAG ? \
1204 RtlxOemStringToUnicodeSize(STRING) : \
1205 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1208 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1209 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1215 // Ansi->Unicode String Functions
1220 RtlxAnsiStringToUnicodeSize(
1221 PCANSI_STRING AnsiString
1227 RtlAnsiStringToUnicodeString(
1228 PUNICODE_STRING DestinationString
,
1229 PCANSI_STRING SourceString
,
1230 BOOLEAN AllocateDestinationString
1233 #ifdef NTOS_MODE_USER
1235 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1236 NLS_MB_CODE_PAGE_TAG ? \
1237 RtlxAnsiStringToUnicodeSize(STRING) : \
1238 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1246 RtlCreateUnicodeStringFromAsciiz(
1247 OUT PUNICODE_STRING Destination
,
1252 // Unicode String Functions
1257 RtlAppendUnicodeToString(
1258 PUNICODE_STRING Destination
,
1265 RtlAppendUnicodeStringToString(
1266 PUNICODE_STRING Destination
,
1267 PCUNICODE_STRING Source
1273 RtlCompareUnicodeString(
1274 PCUNICODE_STRING String1
,
1275 PCUNICODE_STRING String2
,
1276 BOOLEAN CaseInsensitive
1282 RtlCopyUnicodeString(
1283 PUNICODE_STRING DestinationString
,
1284 PCUNICODE_STRING SourceString
1290 RtlCreateUnicodeString(
1291 PUNICODE_STRING DestinationString
,
1295 #ifdef NTOS_MODE_USER
1300 RtlDowncaseUnicodeString(
1301 IN OUT PUNICODE_STRING UniDest
,
1302 IN PCUNICODE_STRING UniSource
,
1303 IN BOOLEAN AllocateDestinationString
1311 RtlDuplicateUnicodeString(
1313 IN PCUNICODE_STRING SourceString
,
1314 OUT PUNICODE_STRING DestinationString
1320 RtlEqualUnicodeString(
1321 PCUNICODE_STRING String1
,
1322 PCUNICODE_STRING String2
,
1323 BOOLEAN CaseInsensitive
1329 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1334 RtlHashUnicodeString(
1335 IN CONST UNICODE_STRING
*String
,
1336 IN BOOLEAN CaseInSensitive
,
1337 IN ULONG HashAlgorithm
,
1338 OUT PULONG HashValue
1344 RtlInitUnicodeString(
1345 IN OUT PUNICODE_STRING DestinationString
,
1346 IN PCWSTR SourceString
);
1361 PCANSI_STRING String1
,
1362 PCANSI_STRING String2
,
1363 BOOLEAN CaseInsensitive
1369 RtlPrefixUnicodeString(
1370 PCUNICODE_STRING String1
,
1371 PCUNICODE_STRING String2
,
1372 BOOLEAN CaseInsensitive
1378 RtlUpcaseUnicodeString(
1379 PUNICODE_STRING DestinationString
,
1380 PCUNICODE_STRING SourceString
,
1381 BOOLEAN AllocateDestinationString
1387 RtlUnicodeStringToInteger(
1388 PCUNICODE_STRING String
,
1394 // Ansi String Functions
1399 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1405 PANSI_STRING DestinationString
,
1410 // OEM String Functions
1415 RtlFreeOemString(IN POEM_STRING OemString
);
1418 // MultiByte->Unicode String Functions
1423 RtlMultiByteToUnicodeN(
1424 PWCHAR UnicodeString
,
1434 RtlMultiByteToUnicodeSize(
1446 RtlAddAtomToAtomTable(
1447 IN PRTL_ATOM_TABLE AtomTable
,
1457 IN OUT PRTL_ATOM_TABLE
*AtomTable
1463 RtlDeleteAtomFromAtomTable(
1464 IN PRTL_ATOM_TABLE AtomTable
,
1471 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1476 RtlQueryAtomInAtomTable(
1477 IN PRTL_ATOM_TABLE AtomTable
,
1479 IN OUT PULONG RefCount OPTIONAL
,
1480 IN OUT PULONG PinCount OPTIONAL
,
1481 IN OUT PWSTR AtomName OPTIONAL
,
1482 IN OUT PULONG NameLength OPTIONAL
1488 RtlPinAtomInAtomTable(
1489 IN PRTL_ATOM_TABLE AtomTable
,
1496 RtlLookupAtomInAtomTable(
1497 IN PRTL_ATOM_TABLE AtomTable
,
1509 IN PVOID Destination
,
1515 // Process Management Functions
1520 RtlAcquirePebLock(VOID
);
1525 RtlCreateProcessParameters (
1526 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1527 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1528 IN PUNICODE_STRING DllPath OPTIONAL
,
1529 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1530 IN PUNICODE_STRING CommandLine OPTIONAL
,
1531 IN PWSTR Environment OPTIONAL
,
1532 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1533 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1534 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1535 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1541 RtlCreateUserProcess(
1542 IN PUNICODE_STRING ImageFileName
,
1543 IN ULONG Attributes
,
1544 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1545 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1546 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1547 IN HANDLE ParentProcess OPTIONAL
,
1548 IN BOOLEAN CurrentDirectory
,
1549 IN HANDLE DebugPort OPTIONAL
,
1550 IN HANDLE ExceptionPort OPTIONAL
,
1551 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1557 RtlCreateUserThread(
1558 IN HANDLE ProcessHandle
,
1559 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1560 IN BOOLEAN CreateSuspended
,
1561 IN LONG StackZeroBits
,
1562 IN ULONG StackReserve
,
1563 IN ULONG StackCommit
,
1564 IN PTHREAD_START_ROUTINE StartAddress
,
1566 IN OUT PHANDLE ThreadHandle
,
1567 IN OUT PCLIENT_ID ClientId
1571 PRTL_USER_PROCESS_PARAMETERS
1573 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1578 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1583 RtlExitUserThread(NTSTATUS Status
);
1588 RtlInitializeContext(
1589 IN HANDLE ProcessHandle
,
1590 OUT PCONTEXT ThreadContext
,
1591 IN PVOID ThreadStartParam OPTIONAL
,
1592 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1593 IN PINITIAL_TEB InitialTeb
1597 PRTL_USER_PROCESS_PARAMETERS
1599 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1604 RtlReleasePebLock(VOID
);
1609 RtlSetProcessIsCritical(
1610 IN BOOLEAN NewValue
,
1611 OUT PBOOLEAN OldValue OPTIONAL
,
1612 IN BOOLEAN IsWinlogon
1615 #define NtCurrentPeb() (NtCurrentTeb()->ProcessEnvironmentBlock)
1618 // Environment/Path Functions
1623 RtlCreateEnvironment(
1631 RtlDestroyEnvironment(PWSTR Environment
);
1636 RtlDoesFileExists_U(PWSTR FileName
);
1641 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1658 RtlDosPathNameToNtPathName_U(
1659 IN PCWSTR DosPathName
,
1660 OUT PUNICODE_STRING NtPathName
,
1661 OUT PCWSTR
*NtFileNamePart
,
1662 OUT CURDIR
*DirectoryInfo
1668 RtlExpandEnvironmentStrings_U(
1670 PUNICODE_STRING Source
,
1671 PUNICODE_STRING Destination
,
1678 RtlGetCurrentDirectory_U(
1679 ULONG MaximumLength
,
1686 RtlGetFullPathName_U(
1687 const WCHAR
*dosname
,
1696 RtlIsNameLegalDOS8Dot3(
1697 IN PUNICODE_STRING UnicodeName
,
1698 IN PANSI_STRING AnsiName
,
1705 RtlQueryEnvironmentVariable_U(
1707 PUNICODE_STRING Name
,
1708 PUNICODE_STRING Value
1714 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1719 RtlSetEnvironmentVariable(
1721 PUNICODE_STRING Name
,
1722 PUNICODE_STRING Value
1726 // Critical Section/Resource Functions
1731 RtlDeleteCriticalSection (
1732 IN PRTL_CRITICAL_SECTION CriticalSection
1738 RtlEnterCriticalSection(
1739 IN PRTL_CRITICAL_SECTION CriticalSection
1745 RtlInitializeCriticalSection(
1746 IN PRTL_CRITICAL_SECTION CriticalSection
1752 RtlInitializeCriticalSectionAndSpinCount(
1753 IN PRTL_CRITICAL_SECTION CriticalSection
,
1760 RtlLeaveCriticalSection(
1761 IN PRTL_CRITICAL_SECTION CriticalSection
1767 RtlpUnWaitCriticalSection(
1768 IN PRTL_CRITICAL_SECTION CriticalSection
1774 RtlpWaitForCriticalSection(
1775 IN PRTL_CRITICAL_SECTION CriticalSection
1781 RtlAcquireResourceExclusive(
1782 IN PRTL_RESOURCE Resource
,
1789 RtlAcquireResourceShared(
1790 IN PRTL_RESOURCE Resource
,
1797 RtlConvertExclusiveToShared(
1798 IN PRTL_RESOURCE Resource
1804 RtlConvertSharedToExclusive(
1805 IN PRTL_RESOURCE Resource
1812 IN PRTL_RESOURCE Resource
1819 IN PRTL_RESOURCE Resource
1825 RtlInitializeResource(
1826 IN PRTL_RESOURCE Resource
1833 IN PRTL_RESOURCE Resource
1837 // Compression Functions
1843 IN USHORT CompressionFormatAndEngine
,
1844 IN PUCHAR UncompressedBuffer
,
1845 IN ULONG UncompressedBufferSize
,
1846 OUT PUCHAR CompressedBuffer
,
1847 IN ULONG CompressedBufferSize
,
1848 IN ULONG UncompressedChunkSize
,
1849 OUT PULONG FinalCompressedSize
,
1856 RtlDecompressBuffer(
1857 IN USHORT CompressionFormat
,
1858 OUT PUCHAR UncompressedBuffer
,
1859 IN ULONG UncompressedBufferSize
,
1860 IN PUCHAR CompressedBuffer
,
1861 IN ULONG CompressedBufferSize
,
1862 OUT PULONG FinalUncompressedSize
1868 RtlGetCompressionWorkSpaceSize(
1869 IN USHORT CompressionFormatAndEngine
,
1870 OUT PULONG CompressBufferWorkSpaceSize
,
1871 OUT PULONG CompressFragmentWorkSpaceSize
1875 // Debug Info Functions
1880 RtlCreateQueryDebugBuffer(
1882 IN BOOLEAN EventPair
1888 RtlDestroyQueryDebugBuffer(IN PRTL_DEBUG_BUFFER DebugBuffer
);
1893 RtlQueryProcessDebugInformation(
1895 IN ULONG DebugInfoClassMask
,
1896 IN OUT PRTL_DEBUG_BUFFER DebugBuffer
1906 IN PRTL_BITMAP BitMapHeader
,
1907 IN ULONG StartingIndex
,
1915 IN PRTL_BITMAP BitMapHeader
,
1916 IN ULONG StartingIndex
,
1924 IN PRTL_BITMAP BitMapHeader
,
1925 IN ULONG StartingIndex
,
1926 IN ULONG NumberToClear
1933 IN PRTL_BITMAP BitMapHeader
,
1934 IN ULONG NumberToFind
,
1941 RtlFindClearBitsAndSet(
1942 IN PRTL_BITMAP BitMapHeader
,
1943 IN ULONG NumberToFind
,
1950 RtlInitializeBitMap(
1951 IN PRTL_BITMAP BitMapHeader
,
1952 IN PULONG BitMapBuffer
,
1953 IN ULONG SizeOfBitMap
1960 IN PRTL_BITMAP BitMapHeader
,
1961 IN ULONG StartingIndex
,
1962 IN ULONG NumberToSet
1974 WAITORTIMERCALLBACKFUNC Callback
,
1984 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1992 HANDLE CompletionEvent
2008 RtlDeleteTimerQueueEx(
2010 HANDLE CompletionEvent
2016 RtlDeleteTimerQueue(HANDLE TimerQueue
);
2030 DbgBreakPoint(VOID
);
2033 // Handle Table Functions
2036 PRTL_HANDLE_TABLE_ENTRY
2039 IN PRTL_HANDLE_TABLE HandleTable
,
2046 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
2052 IN PRTL_HANDLE_TABLE HandleTable
,
2053 IN PRTL_HANDLE_TABLE_ENTRY Handle
2059 RtlInitializeHandleTable(
2061 IN ULONG HandleSize
,
2062 IN PRTL_HANDLE_TABLE HandleTable
2069 IN PRTL_HANDLE_TABLE HandleTable
,
2070 IN PRTL_HANDLE_TABLE_ENTRY Handle
2076 RtlIsValidIndexHandle(
2077 IN PRTL_HANDLE_TABLE HandleTable
,
2079 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
2089 IN PVOID BaseAddress
,
2093 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
2099 RtlGetNtGlobalFlags(VOID
);
2104 RtlImageDirectoryEntryToData(
2115 PIMAGE_NT_HEADERS NtHeader
,
2118 PIMAGE_SECTION_HEADER
*SectionHeader
2124 RtlImageNtHeader(IN PVOID BaseAddress
);
2127 PIMAGE_SECTION_HEADER
2129 RtlImageRvaToSection(
2130 PIMAGE_NT_HEADERS NtHeader
,
2136 // Registry Functions
2141 RtlCheckRegistryKey(
2149 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
2155 OUT HANDLE KeyHandle
,
2156 IN ACCESS_MASK DesiredAccess
,
2157 IN POBJECT_ATTRIBUTES ObjectAttributes
,
2165 IN ACCESS_MASK DesiredAccess
,
2166 OUT PHANDLE KeyHandle
2172 RtlQueryRegistryValues(
2173 IN ULONG RelativeTo
,
2175 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
2177 IN PVOID Environment
2183 RtlWriteRegistryValue(
2199 IN PUSHORT AnsiTableBase
,
2200 IN PUSHORT OemTableBase
,
2201 IN PUSHORT CaseTableBase
,
2202 OUT PNLSTABLEINFO NlsTable
2208 RtlInitCodePageTable(
2209 IN PUSHORT TableBase
,
2210 OUT PCPTABLEINFO CodePageTable
2216 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
2218 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2221 // Misc conversion functions
2226 RtlConvertLongToLargeInteger(
2230 LARGE_INTEGER Result
;
2232 Result
.QuadPart
= SignedInteger
;
2239 RtlEnlargedIntegerMultiply(
2244 LARGE_INTEGER Product
;
2246 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2253 RtlEnlargedUnsignedDivide(
2254 IN ULARGE_INTEGER Dividend
,
2256 IN PULONG Remainder OPTIONAL
2261 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
2263 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
2272 RtlEnlargedUnsignedMultiply(
2277 LARGE_INTEGER Product
;
2279 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2287 RtlUniform(PULONG Seed
);
2290 // Network Functions
2295 RtlIpv4StringToAddressW(
2298 OUT PULONG PtrToIpAddr
,
2305 RtlIpv6StringToAddressA(
2314 RtlIpv6StringToAddressW(
2323 RtlIpv6StringToAddressExA(
2324 IN LPSTR AddressName
,
2333 RtlIpv6StringToAddressExW(
2334 IN LPWSTR AddressName
,
2347 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2352 RtlSecondsSince1970ToTime(
2353 IN ULONG SecondsSince1970
,
2354 OUT PLARGE_INTEGER Time
2360 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2365 RtlTimeFieldsToTime(
2366 PTIME_FIELDS TimeFields
,
2373 RtlTimeToTimeFields(
2374 PLARGE_INTEGER Time
,
2375 PTIME_FIELDS TimeFields
2379 // Version Functions
2384 RtlVerifyVersionInfo(
2385 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2387 IN ULONGLONG ConditionMask
2393 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2398 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);