2 * PROJECT: ReactOS Native Headers
3 * FILE: include/ndk/rtlfuncs.h
4 * PURPOSE: Prototypes for Runtime Library Functions not defined in DDK/IFS
5 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
12 /* DEPENDENCIES **************************************************************/
17 /* MACROS ********************************************************************/
19 /* FIXME: Eventually move the ones in rtltypes.h here... */
24 #define RtlIsLeftChild(Links) \
25 (RtlLeftChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
27 #define RtlIsRightChild(Links) \
28 (RtlRightChild(RtlParent(Links)) == (PRTL_SPLAY_LINKS)(Links))
30 #define RtlRightChild(Links) \
31 ((PRTL_SPLAY_LINKS)(Links))->RightChild
33 #define RtlIsRoot(Links) \
34 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
36 #define RtlLeftChild(Links) \
37 ((PRTL_SPLAY_LINKS)(Links))->LeftChild
39 #define RtlParent(Links) \
40 ((PRTL_SPLAY_LINKS)(Links))->Parent
42 #define RtlInitializeSplayLinks(Links) \
44 PRTL_SPLAY_LINKS _SplayLinks; \
45 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
46 _SplayLinks->Parent = _SplayLinks; \
47 _SplayLinks->LeftChild = NULL; \
48 _SplayLinks->RightChild = NULL; \
51 #define RtlInsertAsLeftChild(ParentLinks,ChildLinks) \
53 PRTL_SPLAY_LINKS _SplayParent; \
54 PRTL_SPLAY_LINKS _SplayChild; \
55 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
56 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
57 _SplayParent->LeftChild = _SplayChild; \
58 _SplayChild->Parent = _SplayParent; \
61 #define RtlInsertAsRightChild(ParentLinks,ChildLinks) \
63 PRTL_SPLAY_LINKS _SplayParent; \
64 PRTL_SPLAY_LINKS _SplayChild; \
65 _SplayParent = (PRTL_SPLAY_LINKS)(ParentLinks); \
66 _SplayChild = (PRTL_SPLAY_LINKS)(ChildLinks); \
67 _SplayParent->RightChild = _SplayChild; \
68 _SplayChild->Parent = _SplayParent; \
71 /* PROTOTYPES ****************************************************************/
74 * Splay Tree Functions
79 RtlSplay(PRTL_SPLAY_LINKS Links
);
84 RtlDelete(PRTL_SPLAY_LINKS Links
);
90 PRTL_SPLAY_LINKS Links
,
91 PRTL_SPLAY_LINKS
*Root
97 RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links
);
102 RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links
);
107 RtlRealSuccessor(PRTL_SPLAY_LINKS Links
);
112 RtlRealPredecessor(PRTL_SPLAY_LINKS Links
);
115 * Error and Exception Functions
120 RtlAddVectoredExceptionHandler(
121 IN ULONG FirstHandler
,
122 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
129 PVOID FailedAssertion
,
138 RtlCaptureContext(OUT PCONTEXT ContextRecord
);
143 RtlEncodePointer(IN PVOID Pointer
);
148 RtlDecodePointer(IN PVOID Pointer
);
153 RtlDispatchException(
154 IN PEXCEPTION_RECORD ExceptionRecord
,
161 RtlNtStatusToDosError(IN NTSTATUS Status
);
166 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord
);
171 RtlRaiseStatus(NTSTATUS Status
);
176 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS
* ExceptionInfo
);
182 IN PVOID TargetFrame OPTIONAL
,
183 IN PVOID TargetIp OPTIONAL
,
184 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL
,
196 IN HANDLE HeapHandle
,
206 IN PVOID BaseAddress OPTIONAL
,
207 IN SIZE_T SizeToReserve OPTIONAL
,
208 IN SIZE_T SizeToCommit OPTIONAL
,
209 IN PVOID Lock OPTIONAL
,
210 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
223 RtlDestroyHeap(HANDLE hheap
);
229 IN HANDLE HeapHandle
,
252 RtlLockHeap(IN HANDLE Heap
);
256 RtlUnlockHeap(IN HANDLE Heap
);
263 IN PVOID MemoryPointer
274 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
283 RtlAbsoluteToSelfRelativeSD(
284 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
285 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
286 IN PULONG BufferLength
292 RtlAddAccessAllowedAce(
295 ACCESS_MASK AccessMask
,
301 RtlAddAccessAllowedAceEx(
303 IN ULONG dwAceRevision
,
311 RtlAddAccessDeniedAce(
314 ACCESS_MASK AccessMask
,
320 RtlAddAccessDeniedAceEx(
324 IN ACCESS_MASK AccessMask
,
330 RtlAddAuditAccessAceEx(
334 IN ACCESS_MASK AccessMask
,
346 ULONG StartingAceIndex
,
353 RtlAddAuditAccessAce(
356 ACCESS_MASK AccessMask
,
367 IN BOOLEAN ForThread
,
368 OUT PBOOLEAN OldValue
374 RtlAllocateAndInitializeSid(
375 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
376 IN UCHAR SubAuthorityCount
,
377 IN ULONG SubAuthority0
,
378 IN ULONG SubAuthority1
,
379 IN ULONG SubAuthority2
,
380 IN ULONG SubAuthority3
,
381 IN ULONG SubAuthority4
,
382 IN ULONG SubAuthority5
,
383 IN ULONG SubAuthority6
,
384 IN ULONG SubAuthority7
,
390 RtlAreAllAccessesGranted(
391 ACCESS_MASK GrantedAccess
,
392 ACCESS_MASK DesiredAccess
397 RtlAreAnyAccessesGranted(
398 ACCESS_MASK GrantedAccess
,
399 ACCESS_MASK DesiredAccess
412 RtlCopyLuidAndAttributesArray(
414 PLUID_AND_ATTRIBUTES Src
,
415 PLUID_AND_ATTRIBUTES Dest
420 RtlCopySidAndAttributesArray(
422 PSID_AND_ATTRIBUTES Src
,
424 PSID_AND_ATTRIBUTES Dest
,
426 PVOID
* RemainingSidArea
,
427 PULONG RemainingSidAreaSize
432 RtlConvertSidToUnicodeString(
433 OUT PUNICODE_STRING DestinationString
,
435 IN BOOLEAN AllocateDestinationString
459 RtlCreateSecurityDescriptor(
460 PSECURITY_DESCRIPTOR SecurityDescriptor
,
467 RtlCreateSecurityDescriptorRelative(
468 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
521 RtlGetControlSecurityDescriptor(
522 PSECURITY_DESCRIPTOR SecurityDescriptor
,
523 PSECURITY_DESCRIPTOR_CONTROL Control
,
530 RtlGetDaclSecurityDescriptor(
531 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
532 OUT PBOOLEAN DaclPresent
,
534 OUT PBOOLEAN DaclDefaulted
540 RtlGetSaclSecurityDescriptor(
541 PSECURITY_DESCRIPTOR SecurityDescriptor
,
542 PBOOLEAN SaclPresent
,
544 PBOOLEAN SaclDefaulted
550 RtlGetGroupSecurityDescriptor(
551 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
553 OUT PBOOLEAN GroupDefaulted
559 RtlGetOwnerSecurityDescriptor(
560 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
562 OUT PBOOLEAN OwnerDefaulted
568 RtlGetSecurityDescriptorRMControl(
569 PSECURITY_DESCRIPTOR SecurityDescriptor
,
574 PSID_IDENTIFIER_AUTHORITY
576 RtlIdentifierAuthoritySid(PSID Sid
);
581 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
588 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
589 IN UCHAR SubAuthorityCount
595 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
600 RtlLengthSid(IN PSID Sid
);
606 PACCESS_MASK AccessMask
,
607 PGENERIC_MAPPING GenericMapping
613 RtlQueryInformationAcl(
616 ULONG InformationLength
,
617 ACL_INFORMATION_CLASS InformationClass
623 RtlSelfRelativeToAbsoluteSD(
624 IN PSECURITY_DESCRIPTOR SelfRelativeSD
,
625 OUT PSECURITY_DESCRIPTOR AbsoluteSD
,
626 IN PULONG AbsoluteSDSize
,
633 IN PSID PrimaryGroup
,
634 IN PULONG PrimaryGroupSize
640 RtlSelfRelativeToAbsoluteSD2(
641 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD
,
642 OUT PULONG BufferSize
648 RtlSetControlSecurityDescriptor(
649 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
650 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
651 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
657 RtlSetDaclSecurityDescriptor (
658 PSECURITY_DESCRIPTOR SecurityDescriptor
,
661 BOOLEAN DaclDefaulted
667 RtlSetGroupSecurityDescriptor(
668 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
670 IN BOOLEAN GroupDefaulted
676 RtlSetInformationAcl(
679 ULONG InformationLength
,
680 ACL_INFORMATION_CLASS InformationClass
686 RtlSetOwnerSecurityDescriptor(
687 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
689 IN BOOLEAN OwnerDefaulted
695 RtlSetSaclSecurityDescriptor(
696 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
697 IN BOOLEAN SaclPresent
,
699 IN BOOLEAN SaclDefaulted
705 RtlSetSecurityDescriptorRMControl(
706 PSECURITY_DESCRIPTOR SecurityDescriptor
,
713 RtlSubAuthorityCountSid(
722 IN ULONG SubAuthority
728 RtlValidRelativeSecurityDescriptor(
729 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
730 IN ULONG SecurityDescriptorLength
,
731 IN SECURITY_INFORMATION RequiredInformation
737 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
742 RtlValidSid(IN PSID Sid
);
747 RtlValidAcl(PACL Acl
);
752 RtlDeleteSecurityObject(
753 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
759 RtlNewSecurityObject(
760 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
761 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
762 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
763 IN BOOLEAN IsDirectoryObject
,
765 IN PGENERIC_MAPPING GenericMapping
771 RtlQuerySecurityObject(
772 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
773 IN SECURITY_INFORMATION SecurityInformation
,
774 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
775 IN ULONG DescriptorLength
,
776 OUT PULONG ReturnLength
782 RtlSetSecurityObject(
783 IN SECURITY_INFORMATION SecurityInformation
,
784 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
785 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
786 IN PGENERIC_MAPPING GenericMapping
,
791 * Single-Character Functions
796 RtlLargeIntegerToChar(
797 IN PLARGE_INTEGER Value
,
806 RtlUpperChar(CHAR Source
);
811 RtlUpcaseUnicodeChar(WCHAR Source
);
816 RtlDowncaseUnicodeChar(IN WCHAR Source
);
833 IN ULONG Base OPTIONAL
,
834 IN ULONG Length OPTIONAL
,
841 RtlIntegerToUnicodeString(
844 IN OUT PUNICODE_STRING String
856 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
857 unsigned short __cdecl
_byteswap_ushort(unsigned short);
858 unsigned long __cdecl
_byteswap_ulong (unsigned long);
859 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
860 #pragma intrinsic(_byteswap_ushort)
861 #pragma intrinsic(_byteswap_ulong)
862 #pragma intrinsic(_byteswap_uint64)
863 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
864 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
865 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
870 RtlUshortByteSwap(IN USHORT Source
);
874 RtlUlongByteSwap(IN ULONG Source
);
878 RtlUlonglongByteSwap(IN ULONGLONG Source
);
883 * Unicode->Ansi String Functions
888 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
890 #ifdef NTOS_MODE_USER
891 #define RtlUnicodeStringToAnsiSize(STRING) ( \
892 NLS_MB_CODE_PAGE_TAG ? \
893 RtlxUnicodeStringToAnsiSize(STRING) : \
894 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
901 RtlUnicodeStringToAnsiString(
902 PANSI_STRING DestinationString
,
903 PCUNICODE_STRING SourceString
,
904 BOOLEAN AllocateDestinationString
908 * Unicode->OEM String Functions
913 RtlUpcaseUnicodeStringToOemString(
914 POEM_STRING DestinationString
,
915 PCUNICODE_STRING SourceString
,
916 BOOLEAN AllocateDestinationString
922 RtlUpcaseUnicodeStringToCountedOemString(
923 IN OUT POEM_STRING DestinationString
,
924 IN PCUNICODE_STRING SourceString
,
925 IN BOOLEAN AllocateDestinationString
931 RtlUnicodeStringToOemString(
932 POEM_STRING DestinationString
,
933 PCUNICODE_STRING SourceString
,
934 BOOLEAN AllocateDestinationString
940 RtlUpcaseUnicodeToOemN(
944 PWCHAR UnicodeString
,
951 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
953 #ifdef NTOS_MODE_USER
954 #define RtlUnicodeStringToOemSize(STRING) ( \
955 NLS_MB_OEM_CODE_PAGE_TAG ? \
956 RtlxUnicodeStringToOemSize(STRING) : \
957 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
959 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
960 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
971 PWCHAR UnicodeString
,
976 * Unicode->MultiByte String Functions
981 RtlUnicodeToMultiByteN(
985 PWCHAR UnicodeString
,
992 RtlUpcaseUnicodeToMultiByteN(
996 PWCHAR UnicodeString
,
1003 RtlUnicodeToMultiByteSize(
1005 PWCHAR UnicodeString
,
1012 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
1015 * OEM to Unicode Functions
1017 #ifdef NTOS_MODE_USER
1018 #define RtlOemStringToUnicodeSize(STRING) ( \
1019 NLS_MB_OEM_CODE_PAGE_TAG ? \
1020 RtlxOemStringToUnicodeSize(STRING) : \
1021 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1023 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
1024 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1031 RtlOemStringToUnicodeString(
1032 PUNICODE_STRING DestinationString
,
1033 PCOEM_STRING SourceString
,
1034 BOOLEAN AllocateDestinationString
1041 PWSTR UnicodeString
,
1042 ULONG MaxBytesInUnicodeString
,
1043 PULONG BytesInUnicodeString
,
1045 ULONG BytesInOemString
1049 * Ansi->Unicode String Functions
1054 RtlxAnsiStringToUnicodeSize(
1055 PCANSI_STRING AnsiString
1061 RtlAnsiStringToUnicodeString(
1062 PUNICODE_STRING DestinationString
,
1063 PCANSI_STRING SourceString
,
1064 BOOLEAN AllocateDestinationString
1067 #ifdef NTOS_MODE_USER
1068 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1069 NLS_MB_CODE_PAGE_TAG ? \
1070 RtlxAnsiStringToUnicodeSize(STRING) : \
1071 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1078 RtlCreateUnicodeStringFromAsciiz(
1079 OUT PUNICODE_STRING Destination
,
1084 * Unicode String Functions
1089 RtlAppendUnicodeToString(
1090 PUNICODE_STRING Destination
,
1097 RtlAppendUnicodeStringToString(
1098 PUNICODE_STRING Destination
,
1099 PCUNICODE_STRING Source
1105 RtlCompareUnicodeString(
1106 PCUNICODE_STRING String1
,
1107 PCUNICODE_STRING String2
,
1108 BOOLEAN CaseInsensitive
1114 RtlCopyUnicodeString(
1115 PUNICODE_STRING DestinationString
,
1116 PCUNICODE_STRING SourceString
1122 RtlCreateUnicodeString(
1123 PUNICODE_STRING DestinationString
,
1127 #ifdef NTOS_MODE_USER
1131 RtlDowncaseUnicodeString(
1132 IN OUT PUNICODE_STRING UniDest
,
1133 IN PCUNICODE_STRING UniSource
,
1134 IN BOOLEAN AllocateDestinationString
1141 RtlDuplicateUnicodeString(
1143 IN PCUNICODE_STRING SourceString
,
1144 OUT PUNICODE_STRING DestinationString
1150 RtlEqualUnicodeString(
1151 PCUNICODE_STRING String1
,
1152 PCUNICODE_STRING String2
,
1153 BOOLEAN CaseInsensitive
1159 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1164 RtlHashUnicodeString(
1165 IN CONST UNICODE_STRING
*String
,
1166 IN BOOLEAN CaseInSensitive
,
1167 IN ULONG HashAlgorithm
,
1168 OUT PULONG HashValue
1174 RtlInitUnicodeString(
1175 IN OUT PUNICODE_STRING DestinationString
,
1176 IN PCWSTR SourceString
);
1191 PCANSI_STRING String1
,
1192 PCANSI_STRING String2
,
1193 BOOLEAN CaseInsensitive
1199 RtlPrefixUnicodeString(
1200 PCUNICODE_STRING String1
,
1201 PCUNICODE_STRING String2
,
1202 BOOLEAN CaseInsensitive
1208 RtlUpcaseUnicodeString(
1209 PUNICODE_STRING DestinationString
,
1210 PCUNICODE_STRING SourceString
,
1211 BOOLEAN AllocateDestinationString
1217 RtlUnicodeStringToInteger(
1218 PCUNICODE_STRING String
,
1224 * Ansi String Functions
1229 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1235 PANSI_STRING DestinationString
,
1240 * OEM String Functions
1245 RtlFreeOemString(IN POEM_STRING OemString
);
1248 * MultiByte->Unicode String Functions
1253 RtlMultiByteToUnicodeN(
1254 PWCHAR UnicodeString
,
1264 RtlMultiByteToUnicodeSize(
1276 RtlAddAtomToAtomTable(
1277 IN PRTL_ATOM_TABLE AtomTable
,
1287 IN OUT PRTL_ATOM_TABLE
*AtomTable
1293 RtlDeleteAtomFromAtomTable(
1294 IN PRTL_ATOM_TABLE AtomTable
,
1301 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1306 RtlQueryAtomInAtomTable(
1307 IN PRTL_ATOM_TABLE AtomTable
,
1309 IN OUT PULONG RefCount OPTIONAL
,
1310 IN OUT PULONG PinCount OPTIONAL
,
1311 IN OUT PWSTR AtomName OPTIONAL
,
1312 IN OUT PULONG NameLength OPTIONAL
1318 RtlLookupAtomInAtomTable(
1319 IN PRTL_ATOM_TABLE AtomTable
,
1331 IN PVOID Destination
,
1337 * Process Management Functions
1342 RtlAcquirePebLock(VOID
);
1347 RtlCreateProcessParameters (
1348 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1349 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1350 IN PUNICODE_STRING DllPath OPTIONAL
,
1351 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1352 IN PUNICODE_STRING CommandLine OPTIONAL
,
1353 IN PWSTR Environment OPTIONAL
,
1354 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1355 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1356 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1357 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1363 RtlCreateUserProcess(
1364 IN PUNICODE_STRING ImageFileName
,
1365 IN ULONG Attributes
,
1366 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1367 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1368 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1369 IN HANDLE ParentProcess OPTIONAL
,
1370 IN BOOLEAN CurrentDirectory
,
1371 IN HANDLE DebugPort OPTIONAL
,
1372 IN HANDLE ExceptionPort OPTIONAL
,
1373 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1379 RtlCreateUserThread(
1380 IN HANDLE ProcessHandle
,
1381 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1382 IN BOOLEAN CreateSuspended
,
1383 IN LONG StackZeroBits
,
1384 IN ULONG StackReserve
,
1385 IN ULONG StackCommit
,
1386 IN PTHREAD_START_ROUTINE StartAddress
,
1388 IN OUT PHANDLE ThreadHandle
,
1389 IN OUT PCLIENT_ID ClientId
1393 PRTL_USER_PROCESS_PARAMETERS
1395 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1400 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1405 RtlExitUserThread(NTSTATUS Status
);
1410 RtlInitializeContext(
1411 IN HANDLE ProcessHandle
,
1412 OUT PCONTEXT ThreadContext
,
1413 IN PVOID ThreadStartParam OPTIONAL
,
1414 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1415 IN PINITIAL_TEB InitialTeb
1419 PRTL_USER_PROCESS_PARAMETERS
1421 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1426 RtlReleasePebLock(VOID
);
1431 RtlSetProcessIsCritical(
1432 IN BOOLEAN NewValue
,
1433 OUT PBOOLEAN OldValue OPTIONAL
,
1434 IN BOOLEAN IsWinlogon
1438 * Environment/Path Functions
1443 RtlCreateEnvironment(
1451 RtlDestroyEnvironment(PWSTR Environment
);
1456 RtlDoesFileExists_U(PWSTR FileName
);
1461 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1478 RtlDosPathNameToNtPathName_U(
1480 PUNICODE_STRING NtName
,
1482 PCURDIR CurrentDirectory
1488 RtlExpandEnvironmentStrings_U(
1490 PUNICODE_STRING Source
,
1491 PUNICODE_STRING Destination
,
1498 RtlGetCurrentDirectory_U(
1499 ULONG MaximumLength
,
1506 RtlGetFullPathName_U(
1507 const WCHAR
*dosname
,
1516 RtlIsNameLegalDOS8Dot3(
1517 IN PUNICODE_STRING UnicodeName
,
1518 IN PANSI_STRING AnsiName
,
1525 RtlQueryEnvironmentVariable_U(
1527 PUNICODE_STRING Name
,
1528 PUNICODE_STRING Value
1534 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1539 RtlSetEnvironmentVariable(
1541 PUNICODE_STRING Name
,
1542 PUNICODE_STRING Value
1546 * Critical Section/Resource Functions
1551 RtlDeleteCriticalSection (
1552 IN PRTL_CRITICAL_SECTION CriticalSection
1558 RtlEnterCriticalSection(
1559 IN PRTL_CRITICAL_SECTION CriticalSection
1565 RtlInitializeCriticalSection(
1566 IN PRTL_CRITICAL_SECTION CriticalSection
1572 RtlInitializeCriticalSectionAndSpinCount(
1573 IN PRTL_CRITICAL_SECTION CriticalSection
,
1580 RtlLeaveCriticalSection(
1581 IN PRTL_CRITICAL_SECTION CriticalSection
1587 RtlpUnWaitCriticalSection(
1588 IN PRTL_CRITICAL_SECTION CriticalSection
1594 RtlpWaitForCriticalSection(
1595 IN PRTL_CRITICAL_SECTION CriticalSection
1601 RtlAcquireResourceExclusive(
1602 IN PRTL_RESOURCE Resource
,
1609 RtlAcquireResourceShared(
1610 IN PRTL_RESOURCE Resource
,
1617 RtlConvertExclusiveToShared(
1618 IN PRTL_RESOURCE Resource
1624 RtlConvertSharedToExclusive(
1625 IN PRTL_RESOURCE Resource
1632 IN PRTL_RESOURCE Resource
1639 IN PRTL_RESOURCE Resource
1645 RtlInitializeResource(
1646 IN PRTL_RESOURCE Resource
1653 IN PRTL_RESOURCE Resource
1657 * Compression Functions
1663 IN USHORT CompressionFormatAndEngine
,
1664 IN PUCHAR UncompressedBuffer
,
1665 IN ULONG UncompressedBufferSize
,
1666 OUT PUCHAR CompressedBuffer
,
1667 IN ULONG CompressedBufferSize
,
1668 IN ULONG UncompressedChunkSize
,
1669 OUT PULONG FinalCompressedSize
,
1676 RtlDecompressBuffer(
1677 IN USHORT CompressionFormat
,
1678 OUT PUCHAR UncompressedBuffer
,
1679 IN ULONG UncompressedBufferSize
,
1680 IN PUCHAR CompressedBuffer
,
1681 IN ULONG CompressedBufferSize
,
1682 OUT PULONG FinalUncompressedSize
1688 RtlGetCompressionWorkSpaceSize(
1689 IN USHORT CompressionFormatAndEngine
,
1690 OUT PULONG CompressBufferWorkSpaceSize
,
1691 OUT PULONG CompressFragmentWorkSpaceSize
1695 * Debug Info Functions
1700 RtlCreateQueryDebugBuffer(
1702 IN BOOLEAN EventPair
1708 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer
);
1713 RtlQueryProcessDebugInformation(
1715 IN ULONG DebugInfoClassMask
,
1716 IN OUT PDEBUG_BUFFER DebugBuffer
1726 IN PRTL_BITMAP BitMapHeader
,
1727 IN ULONG StartingIndex
,
1735 IN PRTL_BITMAP BitMapHeader
,
1736 IN ULONG StartingIndex
,
1744 IN PRTL_BITMAP BitMapHeader
,
1745 IN ULONG StartingIndex
,
1746 IN ULONG NumberToClear
1753 IN PRTL_BITMAP BitMapHeader
,
1754 IN ULONG NumberToFind
,
1761 RtlFindClearBitsAndSet(
1762 IN PRTL_BITMAP BitMapHeader
,
1763 IN ULONG NumberToFind
,
1770 RtlInitializeBitMap(
1771 IN PRTL_BITMAP BitMapHeader
,
1772 IN PULONG BitMapBuffer
,
1773 IN ULONG SizeOfBitMap
1780 IN PRTL_BITMAP BitMapHeader
,
1781 IN ULONG StartingIndex
,
1782 IN ULONG NumberToSet
1794 WAITORTIMERCALLBACKFUNC Callback
,
1804 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1812 HANDLE CompletionEvent
1828 RtlDeleteTimerQueueEx(
1830 HANDLE CompletionEvent
1836 RtlDeleteTimerQueue(HANDLE TimerQueue
);
1850 DbgBreakPoint(VOID
);
1853 * Handle Table Functions
1856 PRTL_HANDLE_TABLE_ENTRY
1859 IN PRTL_HANDLE_TABLE HandleTable
,
1866 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
1872 IN PRTL_HANDLE_TABLE HandleTable
,
1873 IN PRTL_HANDLE_TABLE_ENTRY Handle
1879 RtlInitializeHandleTable(
1881 IN ULONG HandleSize
,
1882 IN PRTL_HANDLE_TABLE HandleTable
1889 IN PRTL_HANDLE_TABLE HandleTable
,
1890 IN PRTL_HANDLE_TABLE_ENTRY Handle
1896 RtlIsValidIndexHandle(
1897 IN PRTL_HANDLE_TABLE HandleTable
,
1899 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
1909 IN PVOID BaseAddress
,
1913 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
1919 RtlGetNtGlobalFlags(VOID
);
1924 RtlImageDirectoryEntryToData(
1935 PIMAGE_NT_HEADERS NtHeader
,
1938 PIMAGE_SECTION_HEADER
*SectionHeader
1944 RtlImageNtHeader(IN PVOID BaseAddress
);
1947 PIMAGE_SECTION_HEADER
1949 RtlImageRvaToSection(
1950 PIMAGE_NT_HEADERS NtHeader
,
1956 * Registry Functions
1961 RtlCheckRegistryKey(
1969 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
1975 OUT HANDLE KeyHandle
,
1976 IN ACCESS_MASK DesiredAccess
,
1977 IN POBJECT_ATTRIBUTES ObjectAttributes
,
1985 IN ACCESS_MASK DesiredAccess
,
1986 OUT PHANDLE KeyHandle
1992 RtlQueryRegistryValues(
1993 IN ULONG RelativeTo
,
1995 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
1997 IN PVOID Environment
2003 RtlWriteRegistryValue(
2019 IN PUSHORT AnsiTableBase
,
2020 IN PUSHORT OemTableBase
,
2021 IN PUSHORT CaseTableBase
,
2022 OUT PNLSTABLEINFO NlsTable
2028 RtlInitCodePageTable(
2029 IN PUSHORT TableBase
,
2030 OUT PCPTABLEINFO CodePageTable
2036 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
2039 * Misc conversion functions
2041 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2045 RtlConvertLongToLargeInteger(LONG SignedInteger
)
2047 LARGE_INTEGER Result
;
2049 Result
.QuadPart
= SignedInteger
;
2056 RtlEnlargedIntegerMultiply(
2060 LARGE_INTEGER Product
;
2062 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2069 RtlEnlargedUnsignedDivide(
2070 IN ULARGE_INTEGER Dividend
,
2072 IN PULONG Remainder OPTIONAL
)
2076 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
2078 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
2087 RtlEnlargedUnsignedMultiply(
2091 LARGE_INTEGER Product
;
2093 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2101 RtlUniform(PULONG Seed
);
2109 RtlIpv4StringToAddressW(
2112 OUT PULONG PtrToIpAddr
,
2122 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2127 RtlSecondsSince1970ToTime(
2128 IN ULONG SecondsSince1970
,
2129 OUT PLARGE_INTEGER Time
2135 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2140 RtlTimeFieldsToTime(
2141 PTIME_FIELDS TimeFields
,
2148 RtlTimeToTimeFields(
2149 PLARGE_INTEGER Time
,
2150 PTIME_FIELDS TimeFields
2159 RtlVerifyVersionInfo(
2160 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2162 IN ULONGLONG ConditionMask
2168 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2173 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);
2175 static __inline
struct _PEB
* NtCurrentPeb (void)
2179 #if defined(__GNUC__)
2181 __asm__ __volatile__
2183 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2184 : "=r" (pPeb
) /* can't have two memory operands */
2188 #elif defined(_MSC_VER)
2190 __asm mov eax
, fs
:0x30;
2194 #error Unknown compiler for inline assembler