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 RtlRightChild(Links) \
28 (PRTL_SPLAY_LINKS)(Links)->RightChild
30 #define RtlIsRoot(Links) \
31 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
33 #define RtlLeftChild(Links) \
34 (PRTL_SPLAY_LINKS)(Links)->LeftChild
36 #define RtlParent(Links) \
37 (PRTL_SPLAY_LINKS)(Links)->Parent
39 #define RtlInitializeSplayLinks(Links) \
40 PRTL_SPLAY_LINKS _SplayLinks; \
41 _SplayLinks = (PRTL_SPLAY_LINKS)(Links); \
42 _SplayLinks->Parent = _SplayLinks; \
43 _SplayLinks->LeftChild = NULL; \
44 _SplayLinks->RightChild = NULL;
46 /* PROTOTYPES ****************************************************************/
49 * Splay Tree Functions
54 RtlSplay(PRTL_SPLAY_LINKS Links
);
59 RtlDelete(PRTL_SPLAY_LINKS Links
);
65 PRTL_SPLAY_LINKS Links
,
66 PRTL_SPLAY_LINKS
*Root
72 RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links
);
77 RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links
);
82 RtlRealSuccessor(PRTL_SPLAY_LINKS Links
);
87 RtlRealPredecessor(PRTL_SPLAY_LINKS Links
);
90 * Error and Exception Functions
95 RtlAddVectoredExceptionHandler(
96 IN ULONG FirstHandler
,
97 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
104 PVOID FailedAssertion
,
113 RtlCaptureContext(OUT PCONTEXT ContextRecord
);
118 RtlEncodePointer(IN PVOID Pointer
);
123 RtlDecodePointer(IN PVOID Pointer
);
128 RtlDispatchException(
129 IN PEXCEPTION_RECORD ExceptionRecord
,
136 RtlNtStatusToDosError(IN NTSTATUS Status
);
141 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord
);
146 RtlRaiseStatus(NTSTATUS Status
);
151 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS
* ExceptionInfo
);
157 IN PVOID TargetFrame OPTIONAL
,
158 IN PVOID TargetIp OPTIONAL
,
159 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL
,
171 IN HANDLE HeapHandle
,
181 IN PVOID BaseAddress OPTIONAL
,
182 IN SIZE_T SizeToReserve OPTIONAL
,
183 IN SIZE_T SizeToCommit OPTIONAL
,
184 IN PVOID Lock OPTIONAL
,
185 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
198 RtlDestroyHeap(HANDLE hheap
);
204 IN HANDLE HeapHandle
,
227 RtlLockHeap(IN HANDLE Heap
);
231 RtlUnlockHeap(IN HANDLE Heap
);
238 IN PVOID MemoryPointer
249 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
258 RtlAbsoluteToSelfRelativeSD(
259 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
260 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
261 IN PULONG BufferLength
267 RtlAddAccessAllowedAce(
270 ACCESS_MASK AccessMask
,
276 RtlAddAccessAllowedAceEx(
278 IN ULONG dwAceRevision
,
286 RtlAddAccessDeniedAce(
289 ACCESS_MASK AccessMask
,
295 RtlAddAccessDeniedAceEx(
299 IN ACCESS_MASK AccessMask
,
305 RtlAddAuditAccessAceEx(
309 IN ACCESS_MASK AccessMask
,
321 ULONG StartingAceIndex
,
328 RtlAddAuditAccessAce(
331 ACCESS_MASK AccessMask
,
342 IN BOOLEAN ForThread
,
343 OUT PBOOLEAN OldValue
349 RtlAllocateAndInitializeSid(
350 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
351 IN UCHAR SubAuthorityCount
,
352 IN ULONG SubAuthority0
,
353 IN ULONG SubAuthority1
,
354 IN ULONG SubAuthority2
,
355 IN ULONG SubAuthority3
,
356 IN ULONG SubAuthority4
,
357 IN ULONG SubAuthority5
,
358 IN ULONG SubAuthority6
,
359 IN ULONG SubAuthority7
,
365 RtlAreAllAccessesGranted(
366 ACCESS_MASK GrantedAccess
,
367 ACCESS_MASK DesiredAccess
372 RtlAreAnyAccessesGranted(
373 ACCESS_MASK GrantedAccess
,
374 ACCESS_MASK DesiredAccess
387 RtlCopyLuidAndAttributesArray(
389 PLUID_AND_ATTRIBUTES Src
,
390 PLUID_AND_ATTRIBUTES Dest
395 RtlCopySidAndAttributesArray(
397 PSID_AND_ATTRIBUTES Src
,
399 PSID_AND_ATTRIBUTES Dest
,
401 PVOID
* RemainingSidArea
,
402 PULONG RemainingSidAreaSize
407 RtlConvertSidToUnicodeString(
408 OUT PUNICODE_STRING DestinationString
,
410 IN BOOLEAN AllocateDestinationString
434 RtlCreateSecurityDescriptor(
435 PSECURITY_DESCRIPTOR SecurityDescriptor
,
442 RtlCreateSecurityDescriptorRelative(
443 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
496 RtlGetControlSecurityDescriptor(
497 PSECURITY_DESCRIPTOR SecurityDescriptor
,
498 PSECURITY_DESCRIPTOR_CONTROL Control
,
505 RtlGetDaclSecurityDescriptor(
506 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
507 OUT PBOOLEAN DaclPresent
,
509 OUT PBOOLEAN DaclDefaulted
515 RtlGetSaclSecurityDescriptor(
516 PSECURITY_DESCRIPTOR SecurityDescriptor
,
517 PBOOLEAN SaclPresent
,
519 PBOOLEAN SaclDefaulted
525 RtlGetGroupSecurityDescriptor(
526 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
528 OUT PBOOLEAN GroupDefaulted
534 RtlGetOwnerSecurityDescriptor(
535 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
537 OUT PBOOLEAN OwnerDefaulted
543 RtlGetSecurityDescriptorRMControl(
544 PSECURITY_DESCRIPTOR SecurityDescriptor
,
549 PSID_IDENTIFIER_AUTHORITY
551 RtlIdentifierAuthoritySid(PSID Sid
);
556 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
563 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
564 IN UCHAR SubAuthorityCount
570 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
575 RtlLengthSid(IN PSID Sid
);
581 PACCESS_MASK AccessMask
,
582 PGENERIC_MAPPING GenericMapping
588 RtlQueryInformationAcl(
591 ULONG InformationLength
,
592 ACL_INFORMATION_CLASS InformationClass
598 RtlSelfRelativeToAbsoluteSD(
599 IN PSECURITY_DESCRIPTOR SelfRelativeSD
,
600 OUT PSECURITY_DESCRIPTOR AbsoluteSD
,
601 IN PULONG AbsoluteSDSize
,
608 IN PSID PrimaryGroup
,
609 IN PULONG PrimaryGroupSize
615 RtlSelfRelativeToAbsoluteSD2(
616 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD
,
617 OUT PULONG BufferSize
623 RtlSetControlSecurityDescriptor(
624 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
625 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
626 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
632 RtlSetDaclSecurityDescriptor (
633 PSECURITY_DESCRIPTOR SecurityDescriptor
,
636 BOOLEAN DaclDefaulted
642 RtlSetGroupSecurityDescriptor(
643 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
645 IN BOOLEAN GroupDefaulted
651 RtlSetInformationAcl(
654 ULONG InformationLength
,
655 ACL_INFORMATION_CLASS InformationClass
661 RtlSetOwnerSecurityDescriptor(
662 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
664 IN BOOLEAN OwnerDefaulted
670 RtlSetSaclSecurityDescriptor(
671 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
672 IN BOOLEAN SaclPresent
,
674 IN BOOLEAN SaclDefaulted
680 RtlSetSecurityDescriptorRMControl(
681 PSECURITY_DESCRIPTOR SecurityDescriptor
,
688 RtlSubAuthorityCountSid(
697 IN ULONG SubAuthority
703 RtlValidRelativeSecurityDescriptor(
704 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
705 IN ULONG SecurityDescriptorLength
,
706 IN SECURITY_INFORMATION RequiredInformation
712 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
717 RtlValidSid(IN PSID Sid
);
722 RtlValidAcl(PACL Acl
);
727 RtlDeleteSecurityObject(
728 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
734 RtlNewSecurityObject(
735 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
736 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
737 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
738 IN BOOLEAN IsDirectoryObject
,
740 IN PGENERIC_MAPPING GenericMapping
746 RtlQuerySecurityObject(
747 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
748 IN SECURITY_INFORMATION SecurityInformation
,
749 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
750 IN ULONG DescriptorLength
,
751 OUT PULONG ReturnLength
757 RtlSetSecurityObject(
758 IN SECURITY_INFORMATION SecurityInformation
,
759 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
760 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
761 IN PGENERIC_MAPPING GenericMapping
,
766 * Single-Character Functions
771 RtlLargeIntegerToChar(
772 IN PLARGE_INTEGER Value
,
781 RtlUpperChar(CHAR Source
);
786 RtlUpcaseUnicodeChar(WCHAR Source
);
791 RtlDowncaseUnicodeChar(IN WCHAR Source
);
808 IN ULONG Base OPTIONAL
,
809 IN ULONG Length OPTIONAL
,
816 RtlIntegerToUnicodeString(
819 IN OUT PUNICODE_STRING String
831 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
832 unsigned short __cdecl
_byteswap_ushort(unsigned short);
833 unsigned long __cdecl
_byteswap_ulong (unsigned long);
834 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
835 #pragma intrinsic(_byteswap_ushort)
836 #pragma intrinsic(_byteswap_ulong)
837 #pragma intrinsic(_byteswap_uint64)
838 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
839 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
840 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
845 RtlUshortByteSwap(IN USHORT Source
);
849 RtlUlongByteSwap(IN ULONG Source
);
853 RtlUlonglongByteSwap(IN ULONGLONG Source
);
858 * Unicode->Ansi String Functions
863 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
865 #ifdef NTOS_MODE_USER
866 #define RtlUnicodeStringToAnsiSize(STRING) ( \
867 NLS_MB_CODE_PAGE_TAG ? \
868 RtlxUnicodeStringToAnsiSize(STRING) : \
869 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
876 RtlUnicodeStringToAnsiString(
877 PANSI_STRING DestinationString
,
878 PCUNICODE_STRING SourceString
,
879 BOOLEAN AllocateDestinationString
883 * Unicode->OEM String Functions
888 RtlUpcaseUnicodeStringToOemString(
889 POEM_STRING DestinationString
,
890 PCUNICODE_STRING SourceString
,
891 BOOLEAN AllocateDestinationString
897 RtlUpcaseUnicodeStringToCountedOemString(
898 IN OUT POEM_STRING DestinationString
,
899 IN PCUNICODE_STRING SourceString
,
900 IN BOOLEAN AllocateDestinationString
906 RtlUnicodeStringToOemString(
907 POEM_STRING DestinationString
,
908 PCUNICODE_STRING SourceString
,
909 BOOLEAN AllocateDestinationString
915 RtlUpcaseUnicodeToOemN(
919 PWCHAR UnicodeString
,
926 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
928 #ifdef NTOS_MODE_USER
929 #define RtlUnicodeStringToOemSize(STRING) ( \
930 NLS_MB_OEM_CODE_PAGE_TAG ? \
931 RtlxUnicodeStringToOemSize(STRING) : \
932 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
934 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
935 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
946 PWCHAR UnicodeString
,
951 * Unicode->MultiByte String Functions
956 RtlUnicodeToMultiByteN(
960 PWCHAR UnicodeString
,
967 RtlUpcaseUnicodeToMultiByteN(
971 PWCHAR UnicodeString
,
978 RtlUnicodeToMultiByteSize(
980 PWCHAR UnicodeString
,
987 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
990 * OEM to Unicode Functions
992 #ifdef NTOS_MODE_USER
993 #define RtlOemStringToUnicodeSize(STRING) ( \
994 NLS_MB_OEM_CODE_PAGE_TAG ? \
995 RtlxOemStringToUnicodeSize(STRING) : \
996 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
998 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
999 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
1006 RtlOemStringToUnicodeString(
1007 PUNICODE_STRING DestinationString
,
1008 PCOEM_STRING SourceString
,
1009 BOOLEAN AllocateDestinationString
1016 PWSTR UnicodeString
,
1017 ULONG MaxBytesInUnicodeString
,
1018 PULONG BytesInUnicodeString
,
1020 ULONG BytesInOemString
1024 * Ansi->Unicode String Functions
1029 RtlxAnsiStringToUnicodeSize(
1030 PCANSI_STRING AnsiString
1036 RtlAnsiStringToUnicodeString(
1037 PUNICODE_STRING DestinationString
,
1038 PCANSI_STRING SourceString
,
1039 BOOLEAN AllocateDestinationString
1042 #ifdef NTOS_MODE_USER
1043 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1044 NLS_MB_CODE_PAGE_TAG ? \
1045 RtlxAnsiStringToUnicodeSize(STRING) : \
1046 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1053 RtlCreateUnicodeStringFromAsciiz(
1054 OUT PUNICODE_STRING Destination
,
1059 * Unicode String Functions
1064 RtlAppendUnicodeToString(
1065 PUNICODE_STRING Destination
,
1072 RtlAppendUnicodeStringToString(
1073 PUNICODE_STRING Destination
,
1074 PCUNICODE_STRING Source
1080 RtlCompareUnicodeString(
1081 PCUNICODE_STRING String1
,
1082 PCUNICODE_STRING String2
,
1083 BOOLEAN CaseInsensitive
1089 RtlCopyUnicodeString(
1090 PUNICODE_STRING DestinationString
,
1091 PCUNICODE_STRING SourceString
1097 RtlCreateUnicodeString(
1098 PUNICODE_STRING DestinationString
,
1102 #ifdef NTOS_MODE_USER
1106 RtlDowncaseUnicodeString(
1107 IN OUT PUNICODE_STRING UniDest
,
1108 IN PCUNICODE_STRING UniSource
,
1109 IN BOOLEAN AllocateDestinationString
1116 RtlDuplicateUnicodeString(
1118 IN PCUNICODE_STRING SourceString
,
1119 OUT PUNICODE_STRING DestinationString
1125 RtlEqualUnicodeString(
1126 PCUNICODE_STRING String1
,
1127 PCUNICODE_STRING String2
,
1128 BOOLEAN CaseInsensitive
1134 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1139 RtlHashUnicodeString(
1140 IN CONST UNICODE_STRING
*String
,
1141 IN BOOLEAN CaseInSensitive
,
1142 IN ULONG HashAlgorithm
,
1143 OUT PULONG HashValue
1149 RtlInitUnicodeString(
1150 IN OUT PUNICODE_STRING DestinationString
,
1151 IN PCWSTR SourceString
);
1165 RtlPrefixUnicodeString(
1166 PCUNICODE_STRING String1
,
1167 PCUNICODE_STRING String2
,
1168 BOOLEAN CaseInsensitive
1174 RtlUpcaseUnicodeString(
1175 PUNICODE_STRING DestinationString
,
1176 PCUNICODE_STRING SourceString
,
1177 BOOLEAN AllocateDestinationString
1183 RtlUnicodeStringToInteger(
1184 PCUNICODE_STRING String
,
1190 * Ansi String Functions
1195 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1201 PANSI_STRING DestinationString
,
1206 * OEM String Functions
1211 RtlFreeOemString(IN POEM_STRING OemString
);
1214 * MultiByte->Unicode String Functions
1219 RtlMultiByteToUnicodeN(
1220 PWCHAR UnicodeString
,
1230 RtlMultiByteToUnicodeSize(
1242 RtlAddAtomToAtomTable(
1243 IN PRTL_ATOM_TABLE AtomTable
,
1253 IN OUT PRTL_ATOM_TABLE
*AtomTable
1259 RtlDeleteAtomFromAtomTable(
1260 IN PRTL_ATOM_TABLE AtomTable
,
1267 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1272 RtlQueryAtomInAtomTable(
1273 IN PRTL_ATOM_TABLE AtomTable
,
1275 IN OUT PULONG RefCount OPTIONAL
,
1276 IN OUT PULONG PinCount OPTIONAL
,
1277 IN OUT PWSTR AtomName OPTIONAL
,
1278 IN OUT PULONG NameLength OPTIONAL
1284 RtlLookupAtomInAtomTable(
1285 IN PRTL_ATOM_TABLE AtomTable
,
1297 IN PVOID Destination
,
1303 * Process Management Functions
1308 RtlAcquirePebLock(VOID
);
1313 RtlCreateProcessParameters (
1314 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1315 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1316 IN PUNICODE_STRING DllPath OPTIONAL
,
1317 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1318 IN PUNICODE_STRING CommandLine OPTIONAL
,
1319 IN PWSTR Environment OPTIONAL
,
1320 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1321 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1322 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1323 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1329 RtlCreateUserProcess(
1330 IN PUNICODE_STRING ImageFileName
,
1331 IN ULONG Attributes
,
1332 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1333 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1334 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1335 IN HANDLE ParentProcess OPTIONAL
,
1336 IN BOOLEAN CurrentDirectory
,
1337 IN HANDLE DebugPort OPTIONAL
,
1338 IN HANDLE ExceptionPort OPTIONAL
,
1339 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1345 RtlCreateUserThread(
1346 IN HANDLE ProcessHandle
,
1347 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1348 IN BOOLEAN CreateSuspended
,
1349 IN LONG StackZeroBits
,
1350 IN ULONG StackReserve
,
1351 IN ULONG StackCommit
,
1352 IN PTHREAD_START_ROUTINE StartAddress
,
1354 IN OUT PHANDLE ThreadHandle
,
1355 IN OUT PCLIENT_ID ClientId
1359 PRTL_USER_PROCESS_PARAMETERS
1361 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1366 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1371 RtlExitUserThread(NTSTATUS Status
);
1376 RtlInitializeContext(
1377 IN HANDLE ProcessHandle
,
1378 OUT PCONTEXT ThreadContext
,
1379 IN PVOID ThreadStartParam OPTIONAL
,
1380 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1381 IN PINITIAL_TEB InitialTeb
1385 PRTL_USER_PROCESS_PARAMETERS
1387 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1392 RtlReleasePebLock(VOID
);
1397 RtlSetProcessIsCritical(
1398 IN BOOLEAN NewValue
,
1399 OUT PBOOLEAN OldValue OPTIONAL
,
1400 IN BOOLEAN IsWinlogon
1404 * Environment/Path Functions
1409 RtlCreateEnvironment(
1417 RtlDestroyEnvironment(PWSTR Environment
);
1422 RtlDoesFileExists_U(PWSTR FileName
);
1427 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1444 RtlDosPathNameToNtPathName_U(
1446 PUNICODE_STRING NtName
,
1448 PCURDIR CurrentDirectory
1454 RtlExpandEnvironmentStrings_U(
1456 PUNICODE_STRING Source
,
1457 PUNICODE_STRING Destination
,
1464 RtlGetCurrentDirectory_U(
1465 ULONG MaximumLength
,
1472 RtlGetFullPathName_U(
1473 const WCHAR
*dosname
,
1482 RtlIsNameLegalDOS8Dot3(
1483 IN PUNICODE_STRING UnicodeName
,
1484 IN PANSI_STRING AnsiName
,
1491 RtlQueryEnvironmentVariable_U(
1493 PUNICODE_STRING Name
,
1494 PUNICODE_STRING Value
1500 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1505 RtlSetEnvironmentVariable(
1507 PUNICODE_STRING Name
,
1508 PUNICODE_STRING Value
1512 * Critical Section/Resource Functions
1517 RtlDeleteCriticalSection (
1518 IN PRTL_CRITICAL_SECTION CriticalSection
1524 RtlEnterCriticalSection(
1525 IN PRTL_CRITICAL_SECTION CriticalSection
1531 RtlInitializeCriticalSection(
1532 IN PRTL_CRITICAL_SECTION CriticalSection
1538 RtlInitializeCriticalSectionAndSpinCount(
1539 IN PRTL_CRITICAL_SECTION CriticalSection
,
1546 RtlLeaveCriticalSection(
1547 IN PRTL_CRITICAL_SECTION CriticalSection
1553 RtlpUnWaitCriticalSection(
1554 IN PRTL_CRITICAL_SECTION CriticalSection
1560 RtlpWaitForCriticalSection(
1561 IN PRTL_CRITICAL_SECTION CriticalSection
1567 RtlAcquireResourceExclusive(
1568 IN PRTL_RESOURCE Resource
,
1575 RtlAcquireResourceShared(
1576 IN PRTL_RESOURCE Resource
,
1583 RtlConvertExclusiveToShared(
1584 IN PRTL_RESOURCE Resource
1590 RtlConvertSharedToExclusive(
1591 IN PRTL_RESOURCE Resource
1598 IN PRTL_RESOURCE Resource
1605 IN PRTL_RESOURCE Resource
1611 RtlInitializeResource(
1612 IN PRTL_RESOURCE Resource
1619 IN PRTL_RESOURCE Resource
1623 * Compression Functions
1629 IN USHORT CompressionFormatAndEngine
,
1630 IN PUCHAR UncompressedBuffer
,
1631 IN ULONG UncompressedBufferSize
,
1632 OUT PUCHAR CompressedBuffer
,
1633 IN ULONG CompressedBufferSize
,
1634 IN ULONG UncompressedChunkSize
,
1635 OUT PULONG FinalCompressedSize
,
1642 RtlDecompressBuffer(
1643 IN USHORT CompressionFormat
,
1644 OUT PUCHAR UncompressedBuffer
,
1645 IN ULONG UncompressedBufferSize
,
1646 IN PUCHAR CompressedBuffer
,
1647 IN ULONG CompressedBufferSize
,
1648 OUT PULONG FinalUncompressedSize
1654 RtlGetCompressionWorkSpaceSize(
1655 IN USHORT CompressionFormatAndEngine
,
1656 OUT PULONG CompressBufferWorkSpaceSize
,
1657 OUT PULONG CompressFragmentWorkSpaceSize
1661 * Debug Info Functions
1666 RtlCreateQueryDebugBuffer(
1668 IN BOOLEAN EventPair
1674 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer
);
1679 RtlQueryProcessDebugInformation(
1681 IN ULONG DebugInfoClassMask
,
1682 IN OUT PDEBUG_BUFFER DebugBuffer
1692 IN PRTL_BITMAP BitMapHeader
,
1693 IN ULONG StartingIndex
,
1701 IN PRTL_BITMAP BitMapHeader
,
1702 IN ULONG StartingIndex
,
1710 IN PRTL_BITMAP BitMapHeader
,
1711 IN ULONG StartingIndex
,
1712 IN ULONG NumberToClear
1719 IN PRTL_BITMAP BitMapHeader
,
1720 IN ULONG NumberToFind
,
1727 RtlFindClearBitsAndSet(
1728 IN PRTL_BITMAP BitMapHeader
,
1729 IN ULONG NumberToFind
,
1736 RtlInitializeBitMap(
1737 IN PRTL_BITMAP BitMapHeader
,
1738 IN PULONG BitMapBuffer
,
1739 IN ULONG SizeOfBitMap
1746 IN PRTL_BITMAP BitMapHeader
,
1747 IN ULONG StartingIndex
,
1748 IN ULONG NumberToSet
1760 WAITORTIMERCALLBACKFUNC Callback
,
1770 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1778 HANDLE CompletionEvent
1794 RtlDeleteTimerQueueEx(
1796 HANDLE CompletionEvent
1802 RtlDeleteTimerQueue(HANDLE TimerQueue
);
1816 DbgBreakPoint(VOID
);
1819 * Handle Table Functions
1822 PRTL_HANDLE_TABLE_ENTRY
1825 IN PRTL_HANDLE_TABLE HandleTable
,
1832 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
1838 IN PRTL_HANDLE_TABLE HandleTable
,
1839 IN PRTL_HANDLE_TABLE_ENTRY Handle
1845 RtlInitializeHandleTable(
1847 IN ULONG HandleSize
,
1848 IN PRTL_HANDLE_TABLE HandleTable
1855 IN PRTL_HANDLE_TABLE HandleTable
,
1856 IN PRTL_HANDLE_TABLE_ENTRY Handle
1862 RtlIsValidIndexHandle(
1863 IN PRTL_HANDLE_TABLE HandleTable
,
1865 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
1875 IN PVOID BaseAddress
,
1879 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
1885 RtlGetNtGlobalFlags(VOID
);
1890 RtlImageDirectoryEntryToData(
1901 PIMAGE_NT_HEADERS NtHeader
,
1904 PIMAGE_SECTION_HEADER
*SectionHeader
1910 RtlImageNtHeader(IN PVOID BaseAddress
);
1913 PIMAGE_SECTION_HEADER
1915 RtlImageRvaToSection(
1916 PIMAGE_NT_HEADERS NtHeader
,
1922 * Registry Functions
1927 RtlCheckRegistryKey(
1935 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
1941 OUT HANDLE KeyHandle
,
1942 IN ACCESS_MASK DesiredAccess
,
1943 IN POBJECT_ATTRIBUTES ObjectAttributes
,
1951 IN ACCESS_MASK DesiredAccess
,
1952 OUT PHANDLE KeyHandle
1958 RtlQueryRegistryValues(
1959 IN ULONG RelativeTo
,
1961 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
1963 IN PVOID Environment
1969 RtlWriteRegistryValue(
1985 IN PUSHORT AnsiTableBase
,
1986 IN PUSHORT OemTableBase
,
1987 IN PUSHORT CaseTableBase
,
1988 OUT PNLSTABLEINFO NlsTable
1994 RtlInitCodePageTable(
1995 IN PUSHORT TableBase
,
1996 OUT PCPTABLEINFO CodePageTable
2002 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
2005 * Misc conversion functions
2007 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2011 RtlConvertLongToLargeInteger(LONG SignedInteger
)
2013 LARGE_INTEGER Result
;
2015 Result
.QuadPart
= SignedInteger
;
2022 RtlEnlargedIntegerMultiply(
2026 LARGE_INTEGER Product
;
2028 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2035 RtlEnlargedUnsignedDivide(
2036 IN ULARGE_INTEGER Dividend
,
2038 IN PULONG Remainder OPTIONAL
)
2042 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
2044 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
2053 RtlEnlargedUnsignedMultiply(
2057 LARGE_INTEGER Product
;
2059 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2067 RtlUniform(PULONG Seed
);
2075 RtlIpv4StringToAddressW(
2078 OUT PULONG PtrToIpAddr
,
2088 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2093 RtlSecondsSince1970ToTime(
2094 IN ULONG SecondsSince1970
,
2095 OUT PLARGE_INTEGER Time
2101 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2106 RtlTimeFieldsToTime(
2107 PTIME_FIELDS TimeFields
,
2114 RtlTimeToTimeFields(
2115 PLARGE_INTEGER Time
,
2116 PTIME_FIELDS TimeFields
2125 RtlVerifyVersionInfo(
2126 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2128 IN ULONGLONG ConditionMask
2134 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2139 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);
2141 static __inline
struct _PEB
* NtCurrentPeb (void)
2145 #if defined(__GNUC__)
2147 __asm__ __volatile__
2149 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2150 : "=r" (pPeb
) /* can't have two memory operands */
2154 #elif defined(_MSC_VER)
2156 __asm mov eax
, fs
:0x30;
2160 #error Unknown compiler for inline assembler