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 /* PROTOTYPES ****************************************************************/
20 * Error and Exception Functions
25 RtlAddVectoredExceptionHandler(
26 IN ULONG FirstHandler
,
27 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
34 PVOID FailedAssertion
,
43 RtlCaptureContext(OUT PCONTEXT ContextRecord
);
48 RtlEncodePointer(IN PVOID Pointer
);
53 RtlDecodePointer(IN PVOID Pointer
);
59 IN PEXCEPTION_RECORD ExceptionRecord
,
66 RtlNtStatusToDosError(IN NTSTATUS Status
);
71 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord
);
76 RtlRaiseStatus(NTSTATUS Status
);
81 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS
* ExceptionInfo
);
87 IN PVOID TargetFrame OPTIONAL
,
88 IN PVOID TargetIp OPTIONAL
,
89 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL
,
101 IN HANDLE HeapHandle
,
111 IN PVOID BaseAddress OPTIONAL
,
112 IN SIZE_T SizeToReserve OPTIONAL
,
113 IN SIZE_T SizeToCommit OPTIONAL
,
114 IN PVOID Lock OPTIONAL
,
115 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
128 RtlDestroyHeap(HANDLE hheap
);
134 IN HANDLE HeapHandle
,
157 RtlLockHeap(IN HANDLE Heap
);
161 RtlUnlockHeap(IN HANDLE Heap
);
168 IN PVOID MemoryPointer
179 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
188 RtlAbsoluteToSelfRelativeSD(
189 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
190 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
191 IN PULONG BufferLength
197 RtlAddAccessAllowedAce(
200 ACCESS_MASK AccessMask
,
206 RtlAddAccessAllowedAceEx(
208 IN ULONG dwAceRevision
,
216 RtlAddAccessDeniedAce(
219 ACCESS_MASK AccessMask
,
225 RtlAddAccessDeniedAceEx(
229 IN ACCESS_MASK AccessMask
,
235 RtlAddAuditAccessAceEx(
239 IN ACCESS_MASK AccessMask
,
251 ULONG StartingAceIndex
,
258 RtlAddAuditAccessAce(
261 ACCESS_MASK AccessMask
,
272 IN BOOLEAN ForThread
,
273 OUT PBOOLEAN OldValue
279 RtlAllocateAndInitializeSid(
280 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
281 IN UCHAR SubAuthorityCount
,
282 IN ULONG SubAuthority0
,
283 IN ULONG SubAuthority1
,
284 IN ULONG SubAuthority2
,
285 IN ULONG SubAuthority3
,
286 IN ULONG SubAuthority4
,
287 IN ULONG SubAuthority5
,
288 IN ULONG SubAuthority6
,
289 IN ULONG SubAuthority7
,
295 RtlAreAllAccessesGranted(
296 ACCESS_MASK GrantedAccess
,
297 ACCESS_MASK DesiredAccess
302 RtlAreAnyAccessesGranted(
303 ACCESS_MASK GrantedAccess
,
304 ACCESS_MASK DesiredAccess
317 RtlCopyLuidAndAttributesArray(
319 PLUID_AND_ATTRIBUTES Src
,
320 PLUID_AND_ATTRIBUTES Dest
325 RtlCopySidAndAttributesArray(
327 PSID_AND_ATTRIBUTES Src
,
329 PSID_AND_ATTRIBUTES Dest
,
331 PVOID
* RemainingSidArea
,
332 PULONG RemainingSidAreaSize
337 RtlConvertSidToUnicodeString(
338 OUT PUNICODE_STRING DestinationString
,
340 IN BOOLEAN AllocateDestinationString
364 RtlCreateSecurityDescriptor(
365 PSECURITY_DESCRIPTOR SecurityDescriptor
,
372 RtlCreateSecurityDescriptorRelative(
373 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
426 RtlGetControlSecurityDescriptor(
427 PSECURITY_DESCRIPTOR SecurityDescriptor
,
428 PSECURITY_DESCRIPTOR_CONTROL Control
,
435 RtlGetDaclSecurityDescriptor(
436 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
437 OUT PBOOLEAN DaclPresent
,
439 OUT PBOOLEAN DaclDefaulted
445 RtlGetSaclSecurityDescriptor(
446 PSECURITY_DESCRIPTOR SecurityDescriptor
,
447 PBOOLEAN SaclPresent
,
449 PBOOLEAN SaclDefaulted
455 RtlGetGroupSecurityDescriptor(
456 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
458 OUT PBOOLEAN GroupDefaulted
464 RtlGetOwnerSecurityDescriptor(
465 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
467 OUT PBOOLEAN OwnerDefaulted
473 RtlGetSecurityDescriptorRMControl(
474 PSECURITY_DESCRIPTOR SecurityDescriptor
,
479 PSID_IDENTIFIER_AUTHORITY
481 RtlIdentifierAuthoritySid(PSID Sid
);
486 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
493 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
494 IN UCHAR SubAuthorityCount
500 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
505 RtlLengthSid(IN PSID Sid
);
511 PACCESS_MASK AccessMask
,
512 PGENERIC_MAPPING GenericMapping
518 RtlQueryInformationAcl(
521 ULONG InformationLength
,
522 ACL_INFORMATION_CLASS InformationClass
528 RtlSelfRelativeToAbsoluteSD(
529 IN PSECURITY_DESCRIPTOR SelfRelativeSD
,
530 OUT PSECURITY_DESCRIPTOR AbsoluteSD
,
531 IN PULONG AbsoluteSDSize
,
538 IN PSID PrimaryGroup
,
539 IN PULONG PrimaryGroupSize
545 RtlSetControlSecurityDescriptor(
546 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
547 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
548 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
554 RtlSetDaclSecurityDescriptor (
555 PSECURITY_DESCRIPTOR SecurityDescriptor
,
558 BOOLEAN DaclDefaulted
564 RtlSetGroupSecurityDescriptor(
565 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
567 IN BOOLEAN GroupDefaulted
573 RtlSetInformationAcl(
576 ULONG InformationLength
,
577 ACL_INFORMATION_CLASS InformationClass
583 RtlSetOwnerSecurityDescriptor(
584 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
586 IN BOOLEAN OwnerDefaulted
592 RtlSetSaclSecurityDescriptor(
593 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
594 IN BOOLEAN SaclPresent
,
596 IN BOOLEAN SaclDefaulted
602 RtlSetSecurityDescriptorRMControl(
603 PSECURITY_DESCRIPTOR SecurityDescriptor
,
610 RtlSubAuthorityCountSid(
619 IN ULONG SubAuthority
625 RtlValidRelativeSecurityDescriptor(
626 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
627 IN ULONG SecurityDescriptorLength
,
628 IN SECURITY_INFORMATION RequiredInformation
634 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
639 RtlValidSid(IN PSID Sid
);
644 RtlValidAcl(PACL Acl
);
649 RtlDeleteSecurityObject(
650 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
656 RtlNewSecurityObject(
657 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
658 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
659 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
660 IN BOOLEAN IsDirectoryObject
,
662 IN PGENERIC_MAPPING GenericMapping
668 RtlQuerySecurityObject(
669 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
670 IN SECURITY_INFORMATION SecurityInformation
,
671 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
672 IN ULONG DescriptorLength
,
673 OUT PULONG ReturnLength
679 RtlSetSecurityObject(
680 IN SECURITY_INFORMATION SecurityInformation
,
681 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
682 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
683 IN PGENERIC_MAPPING GenericMapping
,
688 * Single-Character Functions
693 RtlLargeIntegerToChar(
694 IN PLARGE_INTEGER Value
,
703 RtlUpperChar(CHAR Source
);
708 RtlUpcaseUnicodeChar(WCHAR Source
);
713 RtlDowncaseUnicodeChar(IN WCHAR Source
);
730 IN ULONG Base OPTIONAL
,
731 IN ULONG Length OPTIONAL
,
738 RtlIntegerToUnicodeString(
741 IN OUT PUNICODE_STRING String
753 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
754 unsigned short __cdecl
_byteswap_ushort(unsigned short);
755 unsigned long __cdecl
_byteswap_ulong (unsigned long);
756 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
757 #pragma intrinsic(_byteswap_ushort)
758 #pragma intrinsic(_byteswap_ulong)
759 #pragma intrinsic(_byteswap_uint64)
760 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
761 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
762 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
767 RtlUshortByteSwap(IN USHORT Source
);
771 RtlUlongByteSwap(IN ULONG Source
);
775 RtlUlonglongByteSwap(IN ULONGLONG Source
);
780 * Unicode->Ansi String Functions
785 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
787 #ifdef NTOS_MODE_USER
788 #define RtlUnicodeStringToAnsiSize(STRING) ( \
789 NLS_MB_CODE_PAGE_TAG ? \
790 RtlxUnicodeStringToAnsiSize(STRING) : \
791 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
798 RtlUnicodeStringToAnsiString(
799 PANSI_STRING DestinationString
,
800 PCUNICODE_STRING SourceString
,
801 BOOLEAN AllocateDestinationString
805 * Unicode->OEM String Functions
810 RtlUpcaseUnicodeStringToOemString(
811 POEM_STRING DestinationString
,
812 PCUNICODE_STRING SourceString
,
813 BOOLEAN AllocateDestinationString
819 RtlUpcaseUnicodeStringToCountedOemString(
820 IN OUT POEM_STRING DestinationString
,
821 IN PCUNICODE_STRING SourceString
,
822 IN BOOLEAN AllocateDestinationString
828 RtlUnicodeStringToOemString(
829 POEM_STRING DestinationString
,
830 PCUNICODE_STRING SourceString
,
831 BOOLEAN AllocateDestinationString
837 RtlUpcaseUnicodeToOemN(
841 PWCHAR UnicodeString
,
848 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
850 #ifdef NTOS_MODE_USER
851 #define RtlUnicodeStringToOemSize(STRING) ( \
852 NLS_MB_OEM_CODE_PAGE_TAG ? \
853 RtlxUnicodeStringToOemSize(STRING) : \
854 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
856 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
857 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
868 PWCHAR UnicodeString
,
873 * Unicode->MultiByte String Functions
878 RtlUnicodeToMultiByteN(
882 PWCHAR UnicodeString
,
889 RtlUpcaseUnicodeToMultiByteN(
893 PWCHAR UnicodeString
,
900 RtlUnicodeToMultiByteSize(
902 PWCHAR UnicodeString
,
909 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
912 * OEM to Unicode Functions
914 #ifdef NTOS_MODE_USER
915 #define RtlOemStringToUnicodeSize(STRING) ( \
916 NLS_MB_OEM_CODE_PAGE_TAG ? \
917 RtlxOemStringToUnicodeSize(STRING) : \
918 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
920 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
921 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
928 RtlOemStringToUnicodeString(
929 PUNICODE_STRING DestinationString
,
930 PCOEM_STRING SourceString
,
931 BOOLEAN AllocateDestinationString
939 ULONG MaxBytesInUnicodeString
,
940 PULONG BytesInUnicodeString
,
942 ULONG BytesInOemString
946 * Ansi->Unicode String Functions
951 RtlxAnsiStringToUnicodeSize(
952 PCANSI_STRING AnsiString
958 RtlAnsiStringToUnicodeString(
959 PUNICODE_STRING DestinationString
,
960 PCANSI_STRING SourceString
,
961 BOOLEAN AllocateDestinationString
964 #ifdef NTOS_MODE_USER
965 #define RtlAnsiStringToUnicodeSize(STRING) ( \
966 NLS_MB_CODE_PAGE_TAG ? \
967 RtlxAnsiStringToUnicodeSize(STRING) : \
968 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
975 RtlCreateUnicodeStringFromAsciiz(
976 OUT PUNICODE_STRING Destination
,
981 * Unicode String Functions
986 RtlAppendUnicodeToString(
987 PUNICODE_STRING Destination
,
994 RtlAppendUnicodeStringToString(
995 PUNICODE_STRING Destination
,
996 PCUNICODE_STRING Source
1002 RtlCompareUnicodeString(
1003 PCUNICODE_STRING String1
,
1004 PCUNICODE_STRING String2
,
1005 BOOLEAN CaseInsensitive
1011 RtlCopyUnicodeString(
1012 PUNICODE_STRING DestinationString
,
1013 PCUNICODE_STRING SourceString
1019 RtlCreateUnicodeString(
1020 PUNICODE_STRING DestinationString
,
1024 #ifdef NTOS_MODE_USER
1028 RtlDowncaseUnicodeString(
1029 IN OUT PUNICODE_STRING UniDest
,
1030 IN PCUNICODE_STRING UniSource
,
1031 IN BOOLEAN AllocateDestinationString
1038 RtlDuplicateUnicodeString(
1040 IN PCUNICODE_STRING SourceString
,
1041 OUT PUNICODE_STRING DestinationString
1047 RtlEqualUnicodeString(
1048 PCUNICODE_STRING String1
,
1049 PCUNICODE_STRING String2
,
1050 BOOLEAN CaseInsensitive
1056 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1061 RtlHashUnicodeString(
1062 IN CONST UNICODE_STRING
*String
,
1063 IN BOOLEAN CaseInSensitive
,
1064 IN ULONG HashAlgorithm
,
1065 OUT PULONG HashValue
1071 RtlInitUnicodeString(
1072 IN OUT PUNICODE_STRING DestinationString
,
1073 IN PCWSTR SourceString
);
1087 RtlPrefixUnicodeString(
1088 PCUNICODE_STRING String1
,
1089 PCUNICODE_STRING String2
,
1090 BOOLEAN CaseInsensitive
1096 RtlUpcaseUnicodeString(
1097 PUNICODE_STRING DestinationString
,
1098 PCUNICODE_STRING SourceString
,
1099 BOOLEAN AllocateDestinationString
1105 RtlUnicodeStringToInteger(
1106 PCUNICODE_STRING String
,
1112 * Ansi String Functions
1117 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1123 PANSI_STRING DestinationString
,
1128 * OEM String Functions
1133 RtlFreeOemString(IN POEM_STRING OemString
);
1136 * MultiByte->Unicode String Functions
1141 RtlMultiByteToUnicodeN(
1142 PWCHAR UnicodeString
,
1152 RtlMultiByteToUnicodeSize(
1164 RtlAddAtomToAtomTable(
1165 IN PRTL_ATOM_TABLE AtomTable
,
1175 IN OUT PRTL_ATOM_TABLE
*AtomTable
1181 RtlDeleteAtomFromAtomTable(
1182 IN PRTL_ATOM_TABLE AtomTable
,
1189 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1194 RtlQueryAtomInAtomTable(
1195 IN PRTL_ATOM_TABLE AtomTable
,
1197 IN OUT PULONG RefCount OPTIONAL
,
1198 IN OUT PULONG PinCount OPTIONAL
,
1199 IN OUT PWSTR AtomName OPTIONAL
,
1200 IN OUT PULONG NameLength OPTIONAL
1206 RtlLookupAtomInAtomTable(
1207 IN PRTL_ATOM_TABLE AtomTable
,
1219 IN PVOID Destination
,
1225 * Process Management Functions
1230 RtlAcquirePebLock(VOID
);
1235 RtlCreateProcessParameters (
1236 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1237 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1238 IN PUNICODE_STRING DllPath OPTIONAL
,
1239 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1240 IN PUNICODE_STRING CommandLine OPTIONAL
,
1241 IN PWSTR Environment OPTIONAL
,
1242 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1243 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1244 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1245 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1251 RtlCreateUserProcess(
1252 IN PUNICODE_STRING ImageFileName
,
1253 IN ULONG Attributes
,
1254 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1255 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1256 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1257 IN HANDLE ParentProcess OPTIONAL
,
1258 IN BOOLEAN CurrentDirectory
,
1259 IN HANDLE DebugPort OPTIONAL
,
1260 IN HANDLE ExceptionPort OPTIONAL
,
1261 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1267 RtlCreateUserThread(
1268 IN HANDLE ProcessHandle
,
1269 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1270 IN BOOLEAN CreateSuspended
,
1271 IN LONG StackZeroBits
,
1272 IN ULONG StackReserve
,
1273 IN ULONG StackCommit
,
1274 IN PTHREAD_START_ROUTINE StartAddress
,
1276 IN OUT PHANDLE ThreadHandle
,
1277 IN OUT PCLIENT_ID ClientId
1281 PRTL_USER_PROCESS_PARAMETERS
1283 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1288 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1293 RtlExitUserThread(NTSTATUS Status
);
1298 RtlInitializeContext(
1299 IN HANDLE ProcessHandle
,
1300 OUT PCONTEXT ThreadContext
,
1301 IN PVOID ThreadStartParam OPTIONAL
,
1302 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1303 IN PINITIAL_TEB InitialTeb
1307 PRTL_USER_PROCESS_PARAMETERS
1309 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1314 RtlReleasePebLock(VOID
);
1319 RtlSetProcessIsCritical(
1320 IN BOOLEAN NewValue
,
1321 OUT PBOOLEAN OldValue OPTIONAL
,
1322 IN BOOLEAN IsWinlogon
1326 * Environment/Path Functions
1331 RtlCreateEnvironment(
1339 RtlDestroyEnvironment(PWSTR Environment
);
1344 RtlDoesFileExists_U(PWSTR FileName
);
1349 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1366 RtlDosPathNameToNtPathName_U(
1368 PUNICODE_STRING NtName
,
1370 PCURDIR CurrentDirectory
1376 RtlExpandEnvironmentStrings_U(
1378 PUNICODE_STRING Source
,
1379 PUNICODE_STRING Destination
,
1386 RtlGetCurrentDirectory_U(
1387 ULONG MaximumLength
,
1394 RtlGetFullPathName_U(
1395 const WCHAR
*dosname
,
1404 RtlIsNameLegalDOS8Dot3(
1405 IN PUNICODE_STRING UnicodeName
,
1406 IN PANSI_STRING AnsiName
,
1413 RtlQueryEnvironmentVariable_U(
1415 PUNICODE_STRING Name
,
1416 PUNICODE_STRING Value
1422 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1427 RtlSetEnvironmentVariable(
1429 PUNICODE_STRING Name
,
1430 PUNICODE_STRING Value
1434 * Critical Section/Resource Functions
1439 RtlDeleteCriticalSection (
1440 IN PRTL_CRITICAL_SECTION CriticalSection
1446 RtlEnterCriticalSection(
1447 IN PRTL_CRITICAL_SECTION CriticalSection
1453 RtlInitializeCriticalSection(
1454 IN PRTL_CRITICAL_SECTION CriticalSection
1460 RtlInitializeCriticalSectionAndSpinCount(
1461 IN PRTL_CRITICAL_SECTION CriticalSection
,
1468 RtlLeaveCriticalSection(
1469 IN PRTL_CRITICAL_SECTION CriticalSection
1475 RtlpUnWaitCriticalSection(
1476 IN PRTL_CRITICAL_SECTION CriticalSection
1482 RtlpWaitForCriticalSection(
1483 IN PRTL_CRITICAL_SECTION CriticalSection
1489 RtlAcquireResourceExclusive(
1490 IN PRTL_RESOURCE Resource
,
1497 RtlAcquireResourceShared(
1498 IN PRTL_RESOURCE Resource
,
1505 RtlConvertExclusiveToShared(
1506 IN PRTL_RESOURCE Resource
1512 RtlConvertSharedToExclusive(
1513 IN PRTL_RESOURCE Resource
1520 IN PRTL_RESOURCE Resource
1527 IN PRTL_RESOURCE Resource
1533 RtlInitializeResource(
1534 IN PRTL_RESOURCE Resource
1541 IN PRTL_RESOURCE Resource
1545 * Compression Functions
1551 IN USHORT CompressionFormatAndEngine
,
1552 IN PUCHAR UncompressedBuffer
,
1553 IN ULONG UncompressedBufferSize
,
1554 OUT PUCHAR CompressedBuffer
,
1555 IN ULONG CompressedBufferSize
,
1556 IN ULONG UncompressedChunkSize
,
1557 OUT PULONG FinalCompressedSize
,
1564 RtlDecompressBuffer(
1565 IN USHORT CompressionFormat
,
1566 OUT PUCHAR UncompressedBuffer
,
1567 IN ULONG UncompressedBufferSize
,
1568 IN PUCHAR CompressedBuffer
,
1569 IN ULONG CompressedBufferSize
,
1570 OUT PULONG FinalUncompressedSize
1576 RtlGetCompressionWorkSpaceSize(
1577 IN USHORT CompressionFormatAndEngine
,
1578 OUT PULONG CompressBufferWorkSpaceSize
,
1579 OUT PULONG CompressFragmentWorkSpaceSize
1583 * Debug Info Functions
1588 RtlCreateQueryDebugBuffer(
1590 IN BOOLEAN EventPair
1596 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer
);
1601 RtlQueryProcessDebugInformation(
1603 IN ULONG DebugInfoClassMask
,
1604 IN OUT PDEBUG_BUFFER DebugBuffer
1614 IN PRTL_BITMAP BitMapHeader
,
1615 IN ULONG StartingIndex
,
1623 IN PRTL_BITMAP BitMapHeader
,
1624 IN ULONG StartingIndex
,
1632 IN PRTL_BITMAP BitMapHeader
,
1633 IN ULONG StartingIndex
,
1634 IN ULONG NumberToClear
1641 IN PRTL_BITMAP BitMapHeader
,
1642 IN ULONG NumberToFind
,
1649 RtlFindClearBitsAndSet(
1650 IN PRTL_BITMAP BitMapHeader
,
1651 IN ULONG NumberToFind
,
1658 RtlInitializeBitMap(
1659 IN PRTL_BITMAP BitMapHeader
,
1660 IN PULONG BitMapBuffer
,
1661 IN ULONG SizeOfBitMap
1668 IN PRTL_BITMAP BitMapHeader
,
1669 IN ULONG StartingIndex
,
1670 IN ULONG NumberToSet
1682 WAITORTIMERCALLBACKFUNC Callback
,
1692 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1700 HANDLE CompletionEvent
1716 RtlDeleteTimerQueueEx(
1718 HANDLE CompletionEvent
1724 RtlDeleteTimerQueue(HANDLE TimerQueue
);
1738 DbgBreakPoint(VOID
);
1741 * Handle Table Functions
1744 PRTL_HANDLE_TABLE_ENTRY
1747 IN PRTL_HANDLE_TABLE HandleTable
,
1754 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
1760 IN PRTL_HANDLE_TABLE HandleTable
,
1761 IN PRTL_HANDLE_TABLE_ENTRY Handle
1767 RtlInitializeHandleTable(
1769 IN ULONG HandleSize
,
1770 IN PRTL_HANDLE_TABLE HandleTable
1777 IN PRTL_HANDLE_TABLE HandleTable
,
1778 IN PRTL_HANDLE_TABLE_ENTRY Handle
1784 RtlIsValidIndexHandle(
1785 IN PRTL_HANDLE_TABLE HandleTable
,
1787 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
1797 IN PVOID BaseAddress
,
1801 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
1807 RtlGetNtGlobalFlags(VOID
);
1812 RtlImageDirectoryEntryToData(
1823 PIMAGE_NT_HEADERS NtHeader
,
1826 PIMAGE_SECTION_HEADER
*SectionHeader
1832 RtlImageNtHeader(IN PVOID BaseAddress
);
1835 PIMAGE_SECTION_HEADER
1837 RtlImageRvaToSection(
1838 PIMAGE_NT_HEADERS NtHeader
,
1844 * Registry Functions
1849 RtlCheckRegistryKey(
1857 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
1863 OUT HANDLE KeyHandle
,
1864 IN ACCESS_MASK DesiredAccess
,
1865 IN POBJECT_ATTRIBUTES ObjectAttributes
,
1873 IN ACCESS_MASK DesiredAccess
,
1874 OUT PHANDLE KeyHandle
1880 RtlQueryRegistryValues(
1881 IN ULONG RelativeTo
,
1883 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
1885 IN PVOID Environment
1891 RtlWriteRegistryValue(
1907 IN PUSHORT AnsiTableBase
,
1908 IN PUSHORT OemTableBase
,
1909 IN PUSHORT CaseTableBase
,
1910 OUT PNLSTABLEINFO NlsTable
1916 RtlInitCodePageTable(
1917 IN PUSHORT TableBase
,
1918 OUT PCPTABLEINFO CodePageTable
1924 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
1927 * Misc conversion functions
1929 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
1933 RtlConvertLongToLargeInteger(LONG SignedInteger
)
1935 LARGE_INTEGER Result
;
1937 Result
.QuadPart
= SignedInteger
;
1944 RtlEnlargedIntegerMultiply(
1948 LARGE_INTEGER Product
;
1950 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
1957 RtlEnlargedUnsignedDivide(
1958 IN ULARGE_INTEGER Dividend
,
1960 IN PULONG Remainder OPTIONAL
)
1964 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
1966 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
1975 RtlEnlargedUnsignedMultiply(
1979 LARGE_INTEGER Product
;
1981 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
1989 RtlUniform(PULONG Seed
);
1997 RtlIpv4StringToAddressW(
2000 OUT PULONG PtrToIpAddr
,
2010 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2015 RtlSecondsSince1970ToTime(
2016 IN ULONG SecondsSince1970
,
2017 OUT PLARGE_INTEGER Time
2023 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2028 RtlTimeFieldsToTime(
2029 PTIME_FIELDS TimeFields
,
2036 RtlTimeToTimeFields(
2037 PLARGE_INTEGER Time
,
2038 PTIME_FIELDS TimeFields
2047 RtlVerifyVersionInfo(
2048 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2050 IN ULONGLONG ConditionMask
2056 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2061 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);
2063 static __inline
struct _PEB
* NtCurrentPeb (void)
2067 #if defined(__GNUC__)
2069 __asm__ __volatile__
2071 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2072 : "=r" (pPeb
) /* can't have two memory operands */
2076 #elif defined(_MSC_VER)
2078 __asm mov eax
, fs
:0x30;
2082 #error Unknown compiler for inline assembler