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 RtlAnsiStringToUnicodeString(
952 PUNICODE_STRING DestinationString
,
953 PCANSI_STRING SourceString
,
954 BOOLEAN AllocateDestinationString
957 #ifdef NTOS_MODE_USER
958 #define RtlAnsiStringToUnicodeSize(STRING) ( \
959 NLS_MB_CODE_PAGE_TAG ? \
960 RtlxAnsiStringToUnicodeSize(STRING) : \
961 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
968 RtlCreateUnicodeStringFromAsciiz(
969 OUT PUNICODE_STRING Destination
,
974 * Unicode String Functions
979 RtlAppendUnicodeToString(
980 PUNICODE_STRING Destination
,
987 RtlAppendUnicodeStringToString(
988 PUNICODE_STRING Destination
,
989 PCUNICODE_STRING Source
995 RtlCompareUnicodeString(
996 PCUNICODE_STRING String1
,
997 PCUNICODE_STRING String2
,
998 BOOLEAN CaseInsensitive
1004 RtlCopyUnicodeString(
1005 PUNICODE_STRING DestinationString
,
1006 PCUNICODE_STRING SourceString
1012 RtlCreateUnicodeString(
1013 PUNICODE_STRING DestinationString
,
1017 #ifdef NTOS_MODE_USER
1021 RtlDowncaseUnicodeString(
1022 IN OUT PUNICODE_STRING UniDest
,
1023 IN PCUNICODE_STRING UniSource
,
1024 IN BOOLEAN AllocateDestinationString
1031 RtlDuplicateUnicodeString(
1033 IN PCUNICODE_STRING SourceString
,
1034 OUT PUNICODE_STRING DestinationString
1040 RtlEqualUnicodeString(
1041 PCUNICODE_STRING String1
,
1042 PCUNICODE_STRING String2
,
1043 BOOLEAN CaseInsensitive
1049 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1054 RtlHashUnicodeString(
1055 IN CONST UNICODE_STRING
*String
,
1056 IN BOOLEAN CaseInSensitive
,
1057 IN ULONG HashAlgorithm
,
1058 OUT PULONG HashValue
1064 RtlInitUnicodeString(
1065 IN OUT PUNICODE_STRING DestinationString
,
1066 IN PCWSTR SourceString
);
1080 RtlPrefixUnicodeString(
1081 PCUNICODE_STRING String1
,
1082 PCUNICODE_STRING String2
,
1083 BOOLEAN CaseInsensitive
1089 RtlUpcaseUnicodeString(
1090 PUNICODE_STRING DestinationString
,
1091 PCUNICODE_STRING SourceString
,
1092 BOOLEAN AllocateDestinationString
1098 RtlUnicodeStringToInteger(
1099 PCUNICODE_STRING String
,
1105 * Ansi String Functions
1110 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1116 PANSI_STRING DestinationString
,
1121 * OEM String Functions
1126 RtlFreeOemString(IN POEM_STRING OemString
);
1129 * MultiByte->Unicode String Functions
1134 RtlMultiByteToUnicodeN(
1135 PWCHAR UnicodeString
,
1145 RtlMultiByteToUnicodeSize(
1157 RtlAddAtomToAtomTable(
1158 IN PRTL_ATOM_TABLE AtomTable
,
1168 IN OUT PRTL_ATOM_TABLE
*AtomTable
1174 RtlDeleteAtomFromAtomTable(
1175 IN PRTL_ATOM_TABLE AtomTable
,
1182 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1187 RtlQueryAtomInAtomTable(
1188 IN PRTL_ATOM_TABLE AtomTable
,
1190 IN OUT PULONG RefCount OPTIONAL
,
1191 IN OUT PULONG PinCount OPTIONAL
,
1192 IN OUT PWSTR AtomName OPTIONAL
,
1193 IN OUT PULONG NameLength OPTIONAL
1199 RtlLookupAtomInAtomTable(
1200 IN PRTL_ATOM_TABLE AtomTable
,
1212 IN PVOID Destination
,
1218 * Process Management Functions
1223 RtlAcquirePebLock(VOID
);
1228 RtlCreateProcessParameters (
1229 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1230 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1231 IN PUNICODE_STRING DllPath OPTIONAL
,
1232 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1233 IN PUNICODE_STRING CommandLine OPTIONAL
,
1234 IN PWSTR Environment OPTIONAL
,
1235 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1236 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1237 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1238 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1244 RtlCreateUserProcess(
1245 IN PUNICODE_STRING ImageFileName
,
1246 IN ULONG Attributes
,
1247 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1248 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1249 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1250 IN HANDLE ParentProcess OPTIONAL
,
1251 IN BOOLEAN CurrentDirectory
,
1252 IN HANDLE DebugPort OPTIONAL
,
1253 IN HANDLE ExceptionPort OPTIONAL
,
1254 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1260 RtlCreateUserThread(
1261 IN HANDLE ProcessHandle
,
1262 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1263 IN BOOLEAN CreateSuspended
,
1264 IN LONG StackZeroBits
,
1265 IN ULONG StackReserve
,
1266 IN ULONG StackCommit
,
1267 IN PTHREAD_START_ROUTINE StartAddress
,
1269 IN OUT PHANDLE ThreadHandle
,
1270 IN OUT PCLIENT_ID ClientId
1274 PRTL_USER_PROCESS_PARAMETERS
1276 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1281 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1286 RtlExitUserThread(NTSTATUS Status
);
1291 RtlInitializeContext(
1292 IN HANDLE ProcessHandle
,
1293 OUT PCONTEXT ThreadContext
,
1294 IN PVOID ThreadStartParam OPTIONAL
,
1295 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1296 IN PINITIAL_TEB InitialTeb
1300 PRTL_USER_PROCESS_PARAMETERS
1302 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1307 RtlReleasePebLock(VOID
);
1310 * Environment/Path Functions
1315 RtlCreateEnvironment(
1323 RtlDestroyEnvironment(PWSTR Environment
);
1328 RtlDoesFileExists_U(PWSTR FileName
);
1333 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1350 RtlDosPathNameToNtPathName_U(
1352 PUNICODE_STRING NtName
,
1354 PCURDIR CurrentDirectory
1360 RtlExpandEnvironmentStrings_U(
1362 PUNICODE_STRING Source
,
1363 PUNICODE_STRING Destination
,
1370 RtlGetCurrentDirectory_U(
1371 ULONG MaximumLength
,
1378 RtlGetFullPathName_U(
1379 const WCHAR
*dosname
,
1388 RtlIsNameLegalDOS8Dot3(
1389 IN PUNICODE_STRING UnicodeName
,
1390 IN PANSI_STRING AnsiName
,
1397 RtlQueryEnvironmentVariable_U(
1399 PUNICODE_STRING Name
,
1400 PUNICODE_STRING Value
1406 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1411 RtlSetEnvironmentVariable(
1413 PUNICODE_STRING Name
,
1414 PUNICODE_STRING Value
1418 * Critical Section/Resource Functions
1423 RtlDeleteCriticalSection (
1424 IN PRTL_CRITICAL_SECTION CriticalSection
1430 RtlEnterCriticalSection(
1431 IN PRTL_CRITICAL_SECTION CriticalSection
1437 RtlInitializeCriticalSection(
1438 IN PRTL_CRITICAL_SECTION CriticalSection
1444 RtlInitializeCriticalSectionAndSpinCount(
1445 IN PRTL_CRITICAL_SECTION CriticalSection
,
1452 RtlLeaveCriticalSection(
1453 IN PRTL_CRITICAL_SECTION CriticalSection
1459 RtlpUnWaitCriticalSection(
1460 IN PRTL_CRITICAL_SECTION CriticalSection
1466 RtlpWaitForCriticalSection(
1467 IN PRTL_CRITICAL_SECTION CriticalSection
1473 RtlAcquireResourceExclusive(
1474 IN PRTL_RESOURCE Resource
,
1481 RtlAcquireResourceShared(
1482 IN PRTL_RESOURCE Resource
,
1489 RtlConvertExclusiveToShared(
1490 IN PRTL_RESOURCE Resource
1496 RtlConvertSharedToExclusive(
1497 IN PRTL_RESOURCE Resource
1504 IN PRTL_RESOURCE Resource
1511 IN PRTL_RESOURCE Resource
1517 RtlInitializeResource(
1518 IN PRTL_RESOURCE Resource
1525 IN PRTL_RESOURCE Resource
1529 * Compression Functions
1535 IN USHORT CompressionFormatAndEngine
,
1536 IN PUCHAR UncompressedBuffer
,
1537 IN ULONG UncompressedBufferSize
,
1538 OUT PUCHAR CompressedBuffer
,
1539 IN ULONG CompressedBufferSize
,
1540 IN ULONG UncompressedChunkSize
,
1541 OUT PULONG FinalCompressedSize
,
1548 RtlDecompressBuffer(
1549 IN USHORT CompressionFormat
,
1550 OUT PUCHAR UncompressedBuffer
,
1551 IN ULONG UncompressedBufferSize
,
1552 IN PUCHAR CompressedBuffer
,
1553 IN ULONG CompressedBufferSize
,
1554 OUT PULONG FinalUncompressedSize
1560 RtlGetCompressionWorkSpaceSize(
1561 IN USHORT CompressionFormatAndEngine
,
1562 OUT PULONG CompressBufferWorkSpaceSize
,
1563 OUT PULONG CompressFragmentWorkSpaceSize
1567 * Debug Info Functions
1572 RtlCreateQueryDebugBuffer(
1574 IN BOOLEAN EventPair
1580 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer
);
1585 RtlQueryProcessDebugInformation(
1587 IN ULONG DebugInfoClassMask
,
1588 IN OUT PDEBUG_BUFFER DebugBuffer
1598 IN PRTL_BITMAP BitMapHeader
,
1599 IN ULONG StartingIndex
,
1607 IN PRTL_BITMAP BitMapHeader
,
1608 IN ULONG StartingIndex
,
1616 IN PRTL_BITMAP BitMapHeader
,
1617 IN ULONG StartingIndex
,
1618 IN ULONG NumberToClear
1625 IN PRTL_BITMAP BitMapHeader
,
1626 IN ULONG NumberToFind
,
1633 RtlFindClearBitsAndSet(
1634 IN PRTL_BITMAP BitMapHeader
,
1635 IN ULONG NumberToFind
,
1642 RtlInitializeBitMap(
1643 IN PRTL_BITMAP BitMapHeader
,
1644 IN PULONG BitMapBuffer
,
1645 IN ULONG SizeOfBitMap
1652 IN PRTL_BITMAP BitMapHeader
,
1653 IN ULONG StartingIndex
,
1654 IN ULONG NumberToSet
1666 WAITORTIMERCALLBACKFUNC Callback
,
1676 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1684 HANDLE CompletionEvent
1700 RtlDeleteTimerQueueEx(
1702 HANDLE CompletionEvent
1708 RtlDeleteTimerQueue(HANDLE TimerQueue
);
1722 DbgBreakPoint(VOID
);
1725 * Handle Table Functions
1728 PRTL_HANDLE_TABLE_ENTRY
1731 IN PRTL_HANDLE_TABLE HandleTable
,
1738 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
1744 IN PRTL_HANDLE_TABLE HandleTable
,
1745 IN PRTL_HANDLE_TABLE_ENTRY Handle
1751 RtlInitializeHandleTable(
1753 IN ULONG HandleSize
,
1754 IN PRTL_HANDLE_TABLE HandleTable
1761 IN PRTL_HANDLE_TABLE HandleTable
,
1762 IN PRTL_HANDLE_TABLE_ENTRY Handle
1768 RtlIsValidIndexHandle(
1769 IN PRTL_HANDLE_TABLE HandleTable
,
1771 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
1781 IN PVOID BaseAddress
,
1785 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
1791 RtlGetNtGlobalFlags(VOID
);
1796 RtlImageDirectoryEntryToData(
1807 PIMAGE_NT_HEADERS NtHeader
,
1810 PIMAGE_SECTION_HEADER
*SectionHeader
1816 RtlImageNtHeader(IN PVOID BaseAddress
);
1819 PIMAGE_SECTION_HEADER
1821 RtlImageRvaToSection(
1822 PIMAGE_NT_HEADERS NtHeader
,
1828 * Registry Functions
1833 RtlCheckRegistryKey(
1841 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
1847 OUT HANDLE KeyHandle
,
1848 IN ACCESS_MASK DesiredAccess
,
1849 IN POBJECT_ATTRIBUTES ObjectAttributes
,
1857 IN ACCESS_MASK DesiredAccess
,
1858 OUT PHANDLE KeyHandle
1864 RtlQueryRegistryValues(
1865 IN ULONG RelativeTo
,
1867 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
1869 IN PVOID Environment
1875 RtlWriteRegistryValue(
1891 IN PUSHORT AnsiTableBase
,
1892 IN PUSHORT OemTableBase
,
1893 IN PUSHORT CaseTableBase
,
1894 OUT PNLSTABLEINFO NlsTable
1900 RtlInitCodePageTable(
1901 IN PUSHORT TableBase
,
1902 OUT PCPTABLEINFO CodePageTable
1908 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
1911 * Misc conversion functions
1913 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
1917 RtlConvertLongToLargeInteger(LONG SignedInteger
)
1919 LARGE_INTEGER Result
;
1921 Result
.QuadPart
= SignedInteger
;
1928 RtlEnlargedIntegerMultiply(
1932 LARGE_INTEGER Product
;
1934 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
1941 RtlEnlargedUnsignedDivide(
1942 IN ULARGE_INTEGER Dividend
,
1944 IN PULONG Remainder OPTIONAL
)
1948 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
1950 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
1959 RtlEnlargedUnsignedMultiply(
1963 LARGE_INTEGER Product
;
1965 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
1973 RtlUniform(PULONG Seed
);
1981 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
1986 RtlSecondsSince1970ToTime(
1987 IN ULONG SecondsSince1970
,
1988 OUT PLARGE_INTEGER Time
1994 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
1999 RtlTimeFieldsToTime(
2000 PTIME_FIELDS TimeFields
,
2007 RtlTimeToTimeFields(
2008 PLARGE_INTEGER Time
,
2009 PTIME_FIELDS TimeFields
2018 RtlVerifyVersionInfo(
2019 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2021 IN ULONGLONG ConditionMask
2027 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2030 static __inline
struct _PEB
* NtCurrentPeb (void)
2034 #if defined(__GNUC__)
2036 __asm__ __volatile__
2038 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2039 : "=r" (pPeb
) /* can't have two memory operands */
2043 #elif defined(_MSC_VER)
2045 __asm mov eax
, fs
:0x30;
2049 #error Unknown compiler for inline assembler