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 RtlIsRoot(Links) \
28 (RtlParent(Links) == (PRTL_SPLAY_LINKS)(Links))
30 #define RtlLeftChild(Links) \
31 (PRTL_SPLAY_LINKS)(Links)->LeftChild
33 #define RtlParent(Links) \
34 (PRTL_SPLAY_LINKS)(Links)->Parent
36 /* PROTOTYPES ****************************************************************/
39 * Splay Tree Functions
44 RtlSplay(PRTL_SPLAY_LINKS Links
);
49 RtlDelete(PRTL_SPLAY_LINKS Links
);
55 PRTL_SPLAY_LINKS Links
,
56 PRTL_SPLAY_LINKS
*Root
62 RtlSubtreeSuccessor(PRTL_SPLAY_LINKS Links
);
67 RtlSubtreePredecessor(PRTL_SPLAY_LINKS Links
);
72 RtlRealSuccessor(PRTL_SPLAY_LINKS Links
);
77 RtlRealPredecessor(PRTL_SPLAY_LINKS Links
);
80 * Error and Exception Functions
85 RtlAddVectoredExceptionHandler(
86 IN ULONG FirstHandler
,
87 IN PVECTORED_EXCEPTION_HANDLER VectoredHandler
94 PVOID FailedAssertion
,
103 RtlCaptureContext(OUT PCONTEXT ContextRecord
);
108 RtlEncodePointer(IN PVOID Pointer
);
113 RtlDecodePointer(IN PVOID Pointer
);
118 RtlDispatchException(
119 IN PEXCEPTION_RECORD ExceptionRecord
,
126 RtlNtStatusToDosError(IN NTSTATUS Status
);
131 RtlRaiseException(IN PEXCEPTION_RECORD ExceptionRecord
);
136 RtlRaiseStatus(NTSTATUS Status
);
141 RtlUnhandledExceptionFilter(struct _EXCEPTION_POINTERS
* ExceptionInfo
);
147 IN PVOID TargetFrame OPTIONAL
,
148 IN PVOID TargetIp OPTIONAL
,
149 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL
,
161 IN HANDLE HeapHandle
,
171 IN PVOID BaseAddress OPTIONAL
,
172 IN SIZE_T SizeToReserve OPTIONAL
,
173 IN SIZE_T SizeToCommit OPTIONAL
,
174 IN PVOID Lock OPTIONAL
,
175 IN PRTL_HEAP_PARAMETERS Parameters OPTIONAL
188 RtlDestroyHeap(HANDLE hheap
);
194 IN HANDLE HeapHandle
,
217 RtlLockHeap(IN HANDLE Heap
);
221 RtlUnlockHeap(IN HANDLE Heap
);
228 IN PVOID MemoryPointer
239 #define RtlGetProcessHeap() (NtCurrentPeb()->ProcessHeap)
248 RtlAbsoluteToSelfRelativeSD(
249 IN PSECURITY_DESCRIPTOR AbsoluteSecurityDescriptor
,
250 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSecurityDescriptor
,
251 IN PULONG BufferLength
257 RtlAddAccessAllowedAce(
260 ACCESS_MASK AccessMask
,
266 RtlAddAccessAllowedAceEx(
268 IN ULONG dwAceRevision
,
276 RtlAddAccessDeniedAce(
279 ACCESS_MASK AccessMask
,
285 RtlAddAccessDeniedAceEx(
289 IN ACCESS_MASK AccessMask
,
295 RtlAddAuditAccessAceEx(
299 IN ACCESS_MASK AccessMask
,
311 ULONG StartingAceIndex
,
318 RtlAddAuditAccessAce(
321 ACCESS_MASK AccessMask
,
332 IN BOOLEAN ForThread
,
333 OUT PBOOLEAN OldValue
339 RtlAllocateAndInitializeSid(
340 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
341 IN UCHAR SubAuthorityCount
,
342 IN ULONG SubAuthority0
,
343 IN ULONG SubAuthority1
,
344 IN ULONG SubAuthority2
,
345 IN ULONG SubAuthority3
,
346 IN ULONG SubAuthority4
,
347 IN ULONG SubAuthority5
,
348 IN ULONG SubAuthority6
,
349 IN ULONG SubAuthority7
,
355 RtlAreAllAccessesGranted(
356 ACCESS_MASK GrantedAccess
,
357 ACCESS_MASK DesiredAccess
362 RtlAreAnyAccessesGranted(
363 ACCESS_MASK GrantedAccess
,
364 ACCESS_MASK DesiredAccess
377 RtlCopyLuidAndAttributesArray(
379 PLUID_AND_ATTRIBUTES Src
,
380 PLUID_AND_ATTRIBUTES Dest
385 RtlCopySidAndAttributesArray(
387 PSID_AND_ATTRIBUTES Src
,
389 PSID_AND_ATTRIBUTES Dest
,
391 PVOID
* RemainingSidArea
,
392 PULONG RemainingSidAreaSize
397 RtlConvertSidToUnicodeString(
398 OUT PUNICODE_STRING DestinationString
,
400 IN BOOLEAN AllocateDestinationString
424 RtlCreateSecurityDescriptor(
425 PSECURITY_DESCRIPTOR SecurityDescriptor
,
432 RtlCreateSecurityDescriptorRelative(
433 PISECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor
,
486 RtlGetControlSecurityDescriptor(
487 PSECURITY_DESCRIPTOR SecurityDescriptor
,
488 PSECURITY_DESCRIPTOR_CONTROL Control
,
495 RtlGetDaclSecurityDescriptor(
496 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
497 OUT PBOOLEAN DaclPresent
,
499 OUT PBOOLEAN DaclDefaulted
505 RtlGetSaclSecurityDescriptor(
506 PSECURITY_DESCRIPTOR SecurityDescriptor
,
507 PBOOLEAN SaclPresent
,
509 PBOOLEAN SaclDefaulted
515 RtlGetGroupSecurityDescriptor(
516 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
518 OUT PBOOLEAN GroupDefaulted
524 RtlGetOwnerSecurityDescriptor(
525 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
527 OUT PBOOLEAN OwnerDefaulted
533 RtlGetSecurityDescriptorRMControl(
534 PSECURITY_DESCRIPTOR SecurityDescriptor
,
539 PSID_IDENTIFIER_AUTHORITY
541 RtlIdentifierAuthoritySid(PSID Sid
);
546 RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
);
553 IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority
,
554 IN UCHAR SubAuthorityCount
560 RtlLengthRequiredSid(IN ULONG SubAuthorityCount
);
565 RtlLengthSid(IN PSID Sid
);
571 PACCESS_MASK AccessMask
,
572 PGENERIC_MAPPING GenericMapping
578 RtlQueryInformationAcl(
581 ULONG InformationLength
,
582 ACL_INFORMATION_CLASS InformationClass
588 RtlSelfRelativeToAbsoluteSD(
589 IN PSECURITY_DESCRIPTOR SelfRelativeSD
,
590 OUT PSECURITY_DESCRIPTOR AbsoluteSD
,
591 IN PULONG AbsoluteSDSize
,
598 IN PSID PrimaryGroup
,
599 IN PULONG PrimaryGroupSize
605 RtlSelfRelativeToAbsoluteSD2(
606 IN OUT PSECURITY_DESCRIPTOR SelfRelativeSD
,
607 OUT PULONG BufferSize
613 RtlSetControlSecurityDescriptor(
614 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
615 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest
,
616 IN SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet
622 RtlSetDaclSecurityDescriptor (
623 PSECURITY_DESCRIPTOR SecurityDescriptor
,
626 BOOLEAN DaclDefaulted
632 RtlSetGroupSecurityDescriptor(
633 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
635 IN BOOLEAN GroupDefaulted
641 RtlSetInformationAcl(
644 ULONG InformationLength
,
645 ACL_INFORMATION_CLASS InformationClass
651 RtlSetOwnerSecurityDescriptor(
652 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
654 IN BOOLEAN OwnerDefaulted
660 RtlSetSaclSecurityDescriptor(
661 IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor
,
662 IN BOOLEAN SaclPresent
,
664 IN BOOLEAN SaclDefaulted
670 RtlSetSecurityDescriptorRMControl(
671 PSECURITY_DESCRIPTOR SecurityDescriptor
,
678 RtlSubAuthorityCountSid(
687 IN ULONG SubAuthority
693 RtlValidRelativeSecurityDescriptor(
694 IN PSECURITY_DESCRIPTOR SecurityDescriptorInput
,
695 IN ULONG SecurityDescriptorLength
,
696 IN SECURITY_INFORMATION RequiredInformation
702 RtlValidSecurityDescriptor(IN PSECURITY_DESCRIPTOR SecurityDescriptor
);
707 RtlValidSid(IN PSID Sid
);
712 RtlValidAcl(PACL Acl
);
717 RtlDeleteSecurityObject(
718 IN PSECURITY_DESCRIPTOR
*ObjectDescriptor
724 RtlNewSecurityObject(
725 IN PSECURITY_DESCRIPTOR ParentDescriptor
,
726 IN PSECURITY_DESCRIPTOR CreatorDescriptor
,
727 OUT PSECURITY_DESCRIPTOR
*NewDescriptor
,
728 IN BOOLEAN IsDirectoryObject
,
730 IN PGENERIC_MAPPING GenericMapping
736 RtlQuerySecurityObject(
737 IN PSECURITY_DESCRIPTOR ObjectDescriptor
,
738 IN SECURITY_INFORMATION SecurityInformation
,
739 OUT PSECURITY_DESCRIPTOR ResultantDescriptor
,
740 IN ULONG DescriptorLength
,
741 OUT PULONG ReturnLength
747 RtlSetSecurityObject(
748 IN SECURITY_INFORMATION SecurityInformation
,
749 IN PSECURITY_DESCRIPTOR ModificationDescriptor
,
750 OUT PSECURITY_DESCRIPTOR
*ObjectsSecurityDescriptor
,
751 IN PGENERIC_MAPPING GenericMapping
,
756 * Single-Character Functions
761 RtlLargeIntegerToChar(
762 IN PLARGE_INTEGER Value
,
771 RtlUpperChar(CHAR Source
);
776 RtlUpcaseUnicodeChar(WCHAR Source
);
781 RtlDowncaseUnicodeChar(IN WCHAR Source
);
798 IN ULONG Base OPTIONAL
,
799 IN ULONG Length OPTIONAL
,
806 RtlIntegerToUnicodeString(
809 IN OUT PUNICODE_STRING String
821 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
822 unsigned short __cdecl
_byteswap_ushort(unsigned short);
823 unsigned long __cdecl
_byteswap_ulong (unsigned long);
824 unsigned __int64 __cdecl
_byteswap_uint64(unsigned __int64
);
825 #pragma intrinsic(_byteswap_ushort)
826 #pragma intrinsic(_byteswap_ulong)
827 #pragma intrinsic(_byteswap_uint64)
828 #define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
829 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
830 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
835 RtlUshortByteSwap(IN USHORT Source
);
839 RtlUlongByteSwap(IN ULONG Source
);
843 RtlUlonglongByteSwap(IN ULONGLONG Source
);
848 * Unicode->Ansi String Functions
853 RtlxUnicodeStringToAnsiSize(IN PCUNICODE_STRING UnicodeString
);
855 #ifdef NTOS_MODE_USER
856 #define RtlUnicodeStringToAnsiSize(STRING) ( \
857 NLS_MB_CODE_PAGE_TAG ? \
858 RtlxUnicodeStringToAnsiSize(STRING) : \
859 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
866 RtlUnicodeStringToAnsiString(
867 PANSI_STRING DestinationString
,
868 PCUNICODE_STRING SourceString
,
869 BOOLEAN AllocateDestinationString
873 * Unicode->OEM String Functions
878 RtlUpcaseUnicodeStringToOemString(
879 POEM_STRING DestinationString
,
880 PCUNICODE_STRING SourceString
,
881 BOOLEAN AllocateDestinationString
887 RtlUpcaseUnicodeStringToCountedOemString(
888 IN OUT POEM_STRING DestinationString
,
889 IN PCUNICODE_STRING SourceString
,
890 IN BOOLEAN AllocateDestinationString
896 RtlUnicodeStringToOemString(
897 POEM_STRING DestinationString
,
898 PCUNICODE_STRING SourceString
,
899 BOOLEAN AllocateDestinationString
905 RtlUpcaseUnicodeToOemN(
909 PWCHAR UnicodeString
,
916 RtlxUnicodeStringToOemSize(IN PCUNICODE_STRING UnicodeString
);
918 #ifdef NTOS_MODE_USER
919 #define RtlUnicodeStringToOemSize(STRING) ( \
920 NLS_MB_OEM_CODE_PAGE_TAG ? \
921 RtlxUnicodeStringToOemSize(STRING) : \
922 ((STRING)->Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR) \
924 #define RtlUnicodeStringToCountedOemSize(STRING) ( \
925 (ULONG)(RtlUnicodeStringToOemSize(STRING) - sizeof(ANSI_NULL)) \
936 PWCHAR UnicodeString
,
941 * Unicode->MultiByte String Functions
946 RtlUnicodeToMultiByteN(
950 PWCHAR UnicodeString
,
957 RtlUpcaseUnicodeToMultiByteN(
961 PWCHAR UnicodeString
,
968 RtlUnicodeToMultiByteSize(
970 PWCHAR UnicodeString
,
977 RtlxOemStringToUnicodeSize(IN PCOEM_STRING OemString
);
980 * OEM to Unicode Functions
982 #ifdef NTOS_MODE_USER
983 #define RtlOemStringToUnicodeSize(STRING) ( \
984 NLS_MB_OEM_CODE_PAGE_TAG ? \
985 RtlxOemStringToUnicodeSize(STRING) : \
986 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
988 #define RtlOemStringToCountedUnicodeSize(STRING) ( \
989 (ULONG)(RtlOemStringToUnicodeSize(STRING) - sizeof(UNICODE_NULL)) \
996 RtlOemStringToUnicodeString(
997 PUNICODE_STRING DestinationString
,
998 PCOEM_STRING SourceString
,
999 BOOLEAN AllocateDestinationString
1006 PWSTR UnicodeString
,
1007 ULONG MaxBytesInUnicodeString
,
1008 PULONG BytesInUnicodeString
,
1010 ULONG BytesInOemString
1014 * Ansi->Unicode String Functions
1019 RtlxAnsiStringToUnicodeSize(
1020 PCANSI_STRING AnsiString
1026 RtlAnsiStringToUnicodeString(
1027 PUNICODE_STRING DestinationString
,
1028 PCANSI_STRING SourceString
,
1029 BOOLEAN AllocateDestinationString
1032 #ifdef NTOS_MODE_USER
1033 #define RtlAnsiStringToUnicodeSize(STRING) ( \
1034 NLS_MB_CODE_PAGE_TAG ? \
1035 RtlxAnsiStringToUnicodeSize(STRING) : \
1036 ((STRING)->Length + sizeof(ANSI_NULL)) * sizeof(WCHAR) \
1043 RtlCreateUnicodeStringFromAsciiz(
1044 OUT PUNICODE_STRING Destination
,
1049 * Unicode String Functions
1054 RtlAppendUnicodeToString(
1055 PUNICODE_STRING Destination
,
1062 RtlAppendUnicodeStringToString(
1063 PUNICODE_STRING Destination
,
1064 PCUNICODE_STRING Source
1070 RtlCompareUnicodeString(
1071 PCUNICODE_STRING String1
,
1072 PCUNICODE_STRING String2
,
1073 BOOLEAN CaseInsensitive
1079 RtlCopyUnicodeString(
1080 PUNICODE_STRING DestinationString
,
1081 PCUNICODE_STRING SourceString
1087 RtlCreateUnicodeString(
1088 PUNICODE_STRING DestinationString
,
1092 #ifdef NTOS_MODE_USER
1096 RtlDowncaseUnicodeString(
1097 IN OUT PUNICODE_STRING UniDest
,
1098 IN PCUNICODE_STRING UniSource
,
1099 IN BOOLEAN AllocateDestinationString
1106 RtlDuplicateUnicodeString(
1108 IN PCUNICODE_STRING SourceString
,
1109 OUT PUNICODE_STRING DestinationString
1115 RtlEqualUnicodeString(
1116 PCUNICODE_STRING String1
,
1117 PCUNICODE_STRING String2
,
1118 BOOLEAN CaseInsensitive
1124 RtlFreeUnicodeString(IN PUNICODE_STRING UnicodeString
);
1129 RtlHashUnicodeString(
1130 IN CONST UNICODE_STRING
*String
,
1131 IN BOOLEAN CaseInSensitive
,
1132 IN ULONG HashAlgorithm
,
1133 OUT PULONG HashValue
1139 RtlInitUnicodeString(
1140 IN OUT PUNICODE_STRING DestinationString
,
1141 IN PCWSTR SourceString
);
1155 RtlPrefixUnicodeString(
1156 PCUNICODE_STRING String1
,
1157 PCUNICODE_STRING String2
,
1158 BOOLEAN CaseInsensitive
1164 RtlUpcaseUnicodeString(
1165 PUNICODE_STRING DestinationString
,
1166 PCUNICODE_STRING SourceString
,
1167 BOOLEAN AllocateDestinationString
1173 RtlUnicodeStringToInteger(
1174 PCUNICODE_STRING String
,
1180 * Ansi String Functions
1185 RtlFreeAnsiString(IN PANSI_STRING AnsiString
);
1191 PANSI_STRING DestinationString
,
1196 * OEM String Functions
1201 RtlFreeOemString(IN POEM_STRING OemString
);
1204 * MultiByte->Unicode String Functions
1209 RtlMultiByteToUnicodeN(
1210 PWCHAR UnicodeString
,
1220 RtlMultiByteToUnicodeSize(
1232 RtlAddAtomToAtomTable(
1233 IN PRTL_ATOM_TABLE AtomTable
,
1243 IN OUT PRTL_ATOM_TABLE
*AtomTable
1249 RtlDeleteAtomFromAtomTable(
1250 IN PRTL_ATOM_TABLE AtomTable
,
1257 RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable
);
1262 RtlQueryAtomInAtomTable(
1263 IN PRTL_ATOM_TABLE AtomTable
,
1265 IN OUT PULONG RefCount OPTIONAL
,
1266 IN OUT PULONG PinCount OPTIONAL
,
1267 IN OUT PWSTR AtomName OPTIONAL
,
1268 IN OUT PULONG NameLength OPTIONAL
1274 RtlLookupAtomInAtomTable(
1275 IN PRTL_ATOM_TABLE AtomTable
,
1287 IN PVOID Destination
,
1293 * Process Management Functions
1298 RtlAcquirePebLock(VOID
);
1303 RtlCreateProcessParameters (
1304 OUT PRTL_USER_PROCESS_PARAMETERS
*ProcessParameters
,
1305 IN PUNICODE_STRING ImagePathName OPTIONAL
,
1306 IN PUNICODE_STRING DllPath OPTIONAL
,
1307 IN PUNICODE_STRING CurrentDirectory OPTIONAL
,
1308 IN PUNICODE_STRING CommandLine OPTIONAL
,
1309 IN PWSTR Environment OPTIONAL
,
1310 IN PUNICODE_STRING WindowTitle OPTIONAL
,
1311 IN PUNICODE_STRING DesktopInfo OPTIONAL
,
1312 IN PUNICODE_STRING ShellInfo OPTIONAL
,
1313 IN PUNICODE_STRING RuntimeInfo OPTIONAL
1319 RtlCreateUserProcess(
1320 IN PUNICODE_STRING ImageFileName
,
1321 IN ULONG Attributes
,
1322 IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
,
1323 IN PSECURITY_DESCRIPTOR ProcessSecutityDescriptor OPTIONAL
,
1324 IN PSECURITY_DESCRIPTOR ThreadSecurityDescriptor OPTIONAL
,
1325 IN HANDLE ParentProcess OPTIONAL
,
1326 IN BOOLEAN CurrentDirectory
,
1327 IN HANDLE DebugPort OPTIONAL
,
1328 IN HANDLE ExceptionPort OPTIONAL
,
1329 OUT PRTL_USER_PROCESS_INFORMATION ProcessInfo
1335 RtlCreateUserThread(
1336 IN HANDLE ProcessHandle
,
1337 IN PSECURITY_DESCRIPTOR SecurityDescriptor
,
1338 IN BOOLEAN CreateSuspended
,
1339 IN LONG StackZeroBits
,
1340 IN ULONG StackReserve
,
1341 IN ULONG StackCommit
,
1342 IN PTHREAD_START_ROUTINE StartAddress
,
1344 IN OUT PHANDLE ThreadHandle
,
1345 IN OUT PCLIENT_ID ClientId
1349 PRTL_USER_PROCESS_PARAMETERS
1351 RtlDeNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1356 RtlDestroyProcessParameters(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1361 RtlExitUserThread(NTSTATUS Status
);
1366 RtlInitializeContext(
1367 IN HANDLE ProcessHandle
,
1368 OUT PCONTEXT ThreadContext
,
1369 IN PVOID ThreadStartParam OPTIONAL
,
1370 IN PTHREAD_START_ROUTINE ThreadStartAddress
,
1371 IN PINITIAL_TEB InitialTeb
1375 PRTL_USER_PROCESS_PARAMETERS
1377 RtlNormalizeProcessParams(IN PRTL_USER_PROCESS_PARAMETERS ProcessParameters
);
1382 RtlReleasePebLock(VOID
);
1387 RtlSetProcessIsCritical(
1388 IN BOOLEAN NewValue
,
1389 OUT PBOOLEAN OldValue OPTIONAL
,
1390 IN BOOLEAN IsWinlogon
1394 * Environment/Path Functions
1399 RtlCreateEnvironment(
1407 RtlDestroyEnvironment(PWSTR Environment
);
1412 RtlDoesFileExists_U(PWSTR FileName
);
1417 RtlDetermineDosPathNameType_U(PCWSTR Path
);
1434 RtlDosPathNameToNtPathName_U(
1436 PUNICODE_STRING NtName
,
1438 PCURDIR CurrentDirectory
1444 RtlExpandEnvironmentStrings_U(
1446 PUNICODE_STRING Source
,
1447 PUNICODE_STRING Destination
,
1454 RtlGetCurrentDirectory_U(
1455 ULONG MaximumLength
,
1462 RtlGetFullPathName_U(
1463 const WCHAR
*dosname
,
1472 RtlIsNameLegalDOS8Dot3(
1473 IN PUNICODE_STRING UnicodeName
,
1474 IN PANSI_STRING AnsiName
,
1481 RtlQueryEnvironmentVariable_U(
1483 PUNICODE_STRING Name
,
1484 PUNICODE_STRING Value
1490 RtlSetCurrentDirectory_U(PUNICODE_STRING name
);
1495 RtlSetEnvironmentVariable(
1497 PUNICODE_STRING Name
,
1498 PUNICODE_STRING Value
1502 * Critical Section/Resource Functions
1507 RtlDeleteCriticalSection (
1508 IN PRTL_CRITICAL_SECTION CriticalSection
1514 RtlEnterCriticalSection(
1515 IN PRTL_CRITICAL_SECTION CriticalSection
1521 RtlInitializeCriticalSection(
1522 IN PRTL_CRITICAL_SECTION CriticalSection
1528 RtlInitializeCriticalSectionAndSpinCount(
1529 IN PRTL_CRITICAL_SECTION CriticalSection
,
1536 RtlLeaveCriticalSection(
1537 IN PRTL_CRITICAL_SECTION CriticalSection
1543 RtlpUnWaitCriticalSection(
1544 IN PRTL_CRITICAL_SECTION CriticalSection
1550 RtlpWaitForCriticalSection(
1551 IN PRTL_CRITICAL_SECTION CriticalSection
1557 RtlAcquireResourceExclusive(
1558 IN PRTL_RESOURCE Resource
,
1565 RtlAcquireResourceShared(
1566 IN PRTL_RESOURCE Resource
,
1573 RtlConvertExclusiveToShared(
1574 IN PRTL_RESOURCE Resource
1580 RtlConvertSharedToExclusive(
1581 IN PRTL_RESOURCE Resource
1588 IN PRTL_RESOURCE Resource
1595 IN PRTL_RESOURCE Resource
1601 RtlInitializeResource(
1602 IN PRTL_RESOURCE Resource
1609 IN PRTL_RESOURCE Resource
1613 * Compression Functions
1619 IN USHORT CompressionFormatAndEngine
,
1620 IN PUCHAR UncompressedBuffer
,
1621 IN ULONG UncompressedBufferSize
,
1622 OUT PUCHAR CompressedBuffer
,
1623 IN ULONG CompressedBufferSize
,
1624 IN ULONG UncompressedChunkSize
,
1625 OUT PULONG FinalCompressedSize
,
1632 RtlDecompressBuffer(
1633 IN USHORT CompressionFormat
,
1634 OUT PUCHAR UncompressedBuffer
,
1635 IN ULONG UncompressedBufferSize
,
1636 IN PUCHAR CompressedBuffer
,
1637 IN ULONG CompressedBufferSize
,
1638 OUT PULONG FinalUncompressedSize
1644 RtlGetCompressionWorkSpaceSize(
1645 IN USHORT CompressionFormatAndEngine
,
1646 OUT PULONG CompressBufferWorkSpaceSize
,
1647 OUT PULONG CompressFragmentWorkSpaceSize
1651 * Debug Info Functions
1656 RtlCreateQueryDebugBuffer(
1658 IN BOOLEAN EventPair
1664 RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER DebugBuffer
);
1669 RtlQueryProcessDebugInformation(
1671 IN ULONG DebugInfoClassMask
,
1672 IN OUT PDEBUG_BUFFER DebugBuffer
1682 IN PRTL_BITMAP BitMapHeader
,
1683 IN ULONG StartingIndex
,
1691 IN PRTL_BITMAP BitMapHeader
,
1692 IN ULONG StartingIndex
,
1700 IN PRTL_BITMAP BitMapHeader
,
1701 IN ULONG StartingIndex
,
1702 IN ULONG NumberToClear
1709 IN PRTL_BITMAP BitMapHeader
,
1710 IN ULONG NumberToFind
,
1717 RtlFindClearBitsAndSet(
1718 IN PRTL_BITMAP BitMapHeader
,
1719 IN ULONG NumberToFind
,
1726 RtlInitializeBitMap(
1727 IN PRTL_BITMAP BitMapHeader
,
1728 IN PULONG BitMapBuffer
,
1729 IN ULONG SizeOfBitMap
1736 IN PRTL_BITMAP BitMapHeader
,
1737 IN ULONG StartingIndex
,
1738 IN ULONG NumberToSet
1750 WAITORTIMERCALLBACKFUNC Callback
,
1760 RtlCreateTimerQueue(PHANDLE TimerQueue
);
1768 HANDLE CompletionEvent
1784 RtlDeleteTimerQueueEx(
1786 HANDLE CompletionEvent
1792 RtlDeleteTimerQueue(HANDLE TimerQueue
);
1806 DbgBreakPoint(VOID
);
1809 * Handle Table Functions
1812 PRTL_HANDLE_TABLE_ENTRY
1815 IN PRTL_HANDLE_TABLE HandleTable
,
1822 RtlDestroyHandleTable(IN PRTL_HANDLE_TABLE HandleTable
);
1828 IN PRTL_HANDLE_TABLE HandleTable
,
1829 IN PRTL_HANDLE_TABLE_ENTRY Handle
1835 RtlInitializeHandleTable(
1837 IN ULONG HandleSize
,
1838 IN PRTL_HANDLE_TABLE HandleTable
1845 IN PRTL_HANDLE_TABLE HandleTable
,
1846 IN PRTL_HANDLE_TABLE_ENTRY Handle
1852 RtlIsValidIndexHandle(
1853 IN PRTL_HANDLE_TABLE HandleTable
,
1855 OUT PRTL_HANDLE_TABLE_ENTRY
*Handle
1865 IN PVOID BaseAddress
,
1869 OUT PRTL_MESSAGE_RESOURCE_ENTRY
*MessageResourceEntry
1875 RtlGetNtGlobalFlags(VOID
);
1880 RtlImageDirectoryEntryToData(
1891 PIMAGE_NT_HEADERS NtHeader
,
1894 PIMAGE_SECTION_HEADER
*SectionHeader
1900 RtlImageNtHeader(IN PVOID BaseAddress
);
1903 PIMAGE_SECTION_HEADER
1905 RtlImageRvaToSection(
1906 PIMAGE_NT_HEADERS NtHeader
,
1912 * Registry Functions
1917 RtlCheckRegistryKey(
1925 RtlFormatCurrentUserKeyPath(IN OUT PUNICODE_STRING KeyPath
);
1931 OUT HANDLE KeyHandle
,
1932 IN ACCESS_MASK DesiredAccess
,
1933 IN POBJECT_ATTRIBUTES ObjectAttributes
,
1941 IN ACCESS_MASK DesiredAccess
,
1942 OUT PHANDLE KeyHandle
1948 RtlQueryRegistryValues(
1949 IN ULONG RelativeTo
,
1951 IN PRTL_QUERY_REGISTRY_TABLE QueryTable
,
1953 IN PVOID Environment
1959 RtlWriteRegistryValue(
1975 IN PUSHORT AnsiTableBase
,
1976 IN PUSHORT OemTableBase
,
1977 IN PUSHORT CaseTableBase
,
1978 OUT PNLSTABLEINFO NlsTable
1984 RtlInitCodePageTable(
1985 IN PUSHORT TableBase
,
1986 OUT PCPTABLEINFO CodePageTable
1992 RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable
);
1995 * Misc conversion functions
1997 #if defined(NTOS_MODE_USER) && !defined(NO_RTL_INLINES)
2001 RtlConvertLongToLargeInteger(LONG SignedInteger
)
2003 LARGE_INTEGER Result
;
2005 Result
.QuadPart
= SignedInteger
;
2012 RtlEnlargedIntegerMultiply(
2016 LARGE_INTEGER Product
;
2018 Product
.QuadPart
= (LONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2025 RtlEnlargedUnsignedDivide(
2026 IN ULARGE_INTEGER Dividend
,
2028 IN PULONG Remainder OPTIONAL
)
2032 Quotient
= (ULONG
)(Dividend
.QuadPart
/ Divisor
);
2034 *Remainder
= (ULONG
)(Dividend
.QuadPart
% Divisor
);
2043 RtlEnlargedUnsignedMultiply(
2047 LARGE_INTEGER Product
;
2049 Product
.QuadPart
= (ULONGLONG
)Multiplicand
* (ULONGLONG
)Multiplier
;
2057 RtlUniform(PULONG Seed
);
2065 RtlIpv4StringToAddressW(
2068 OUT PULONG PtrToIpAddr
,
2078 RtlQueryTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2083 RtlSecondsSince1970ToTime(
2084 IN ULONG SecondsSince1970
,
2085 OUT PLARGE_INTEGER Time
2091 RtlSetTimeZoneInformation(LPTIME_ZONE_INFORMATION TimeZoneInformation
);
2096 RtlTimeFieldsToTime(
2097 PTIME_FIELDS TimeFields
,
2104 RtlTimeToTimeFields(
2105 PLARGE_INTEGER Time
,
2106 PTIME_FIELDS TimeFields
2115 RtlVerifyVersionInfo(
2116 IN PRTL_OSVERSIONINFOEXW VersionInfo
,
2118 IN ULONGLONG ConditionMask
2124 RtlGetVersion(IN OUT PRTL_OSVERSIONINFOW lpVersionInformation
);
2129 RtlGetNtProductType(OUT PNT_PRODUCT_TYPE ProductType
);
2131 static __inline
struct _PEB
* NtCurrentPeb (void)
2135 #if defined(__GNUC__)
2137 __asm__ __volatile__
2139 "movl %%fs:0x30, %0\n" /* fs:30h == Teb->Peb */
2140 : "=r" (pPeb
) /* can't have two memory operands */
2144 #elif defined(_MSC_VER)
2146 __asm mov eax
, fs
:0x30;
2150 #error Unknown compiler for inline assembler