From 776c66054258e67e95425fe5f689eb325c8cb3c2 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 23 Feb 2025 09:54:56 +0200 Subject: [PATCH] [NTDLL] Export RTL locale functions The exports are NT6, but the table is initialized unconditionally, because the functions will be used later internally. --- dll/ntdll/def/ntdll.spec | 12 ++++++------ dll/ntdll/ldr/ldrinit.c | 8 ++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec index fa2dabbcc93..00b45a76973 100644 --- a/dll/ntdll/def/ntdll.spec +++ b/dll/ntdll/def/ntdll.spec @@ -695,7 +695,7 @@ @ stdcall -stub -version=0x600+ RtlConnectToSm(ptr ptr long ptr) @ stdcall RtlConsoleMultiByteToUnicodeN(ptr long ptr ptr long ptr) @ stdcall RtlConvertExclusiveToShared(ptr) -@ stdcall -stub -version=0x600+ RtlConvertLCIDToString(long long long ptr long) +@ stdcall -version=0x600+ RtlConvertLCIDToString(long long long ptr long) @ stdcall -arch=win32 -ret64 RtlConvertLongToLargeInteger(long) @ stdcall RtlConvertSharedToExclusive(ptr) @ stdcall RtlConvertSidToUnicodeString(ptr ptr long) @@ -741,7 +741,7 @@ @ stdcall RtlCreateUserSecurityObject(ptr long ptr ptr long ptr ptr) @ stdcall -stub -version=0x600+ RtlCreateUserStack(long long long long long ptr) @ stdcall RtlCreateUserThread(long ptr long ptr long long ptr ptr ptr ptr) -@ stdcall -stub -version=0x600+ RtlCultureNameToLCID(ptr ptr) +@ stdcall -version=0x600+ RtlCultureNameToLCID(ptr ptr) @ stdcall RtlCustomCPToUnicodeN(ptr wstr long ptr str long) @ stdcall RtlCutoverTimeToSystemTime(ptr ptr ptr long) @ stdcall -stub -version=0x600+ RtlDeCommitDebugInfo(long long long) ; doesn't exist in win11 @@ -999,8 +999,8 @@ @ stdcall RtlIsThreadWithinLoaderCallout() @ stdcall RtlIsValidHandle(ptr ptr) @ stdcall RtlIsValidIndexHandle(ptr long ptr) -@ stdcall -stub -version=0x600+ RtlIsValidLocaleName(ptr long) -@ stdcall -stub -version=0x600+ RtlLCIDToCultureName(long long) +@ stdcall -version=0x600+ RtlIsValidLocaleName(wstr long) +@ stdcall -version=0x600+ RtlLCIDToCultureName(long ptr) @ stdcall -arch=win32 -ret64 RtlLargeIntegerAdd(double double) @ stdcall -arch=win32 -ret64 RtlLargeIntegerArithmeticShift(double long) @ stdcall -arch=win32 -ret64 RtlLargeIntegerDivide(double double ptr) @@ -1009,13 +1009,13 @@ @ stdcall -arch=win32 -ret64 RtlLargeIntegerShiftRight(double long) @ stdcall -arch=win32 -ret64 RtlLargeIntegerSubtract(double double) @ stdcall RtlLargeIntegerToChar(ptr long long ptr) -@ stdcall -stub -version=0x600+ RtlLcidToLocaleName(long long long long) +@ stdcall -version=0x600+ RtlLcidToLocaleName(long ptr long long) @ stdcall RtlLeaveCriticalSection(ptr) @ stdcall RtlLengthRequiredSid(long) @ stdcall RtlLengthSecurityDescriptor(ptr) @ stdcall RtlLengthSid(ptr) @ stdcall RtlLocalTimeToSystemTime(ptr ptr) -@ stdcall -stub -version=0x600+ RtlLocaleNameToLcid(wstr ptr long) +@ stdcall -version=0x600+ RtlLocaleNameToLcid(wstr ptr long) @ stdcall RtlLockBootStatusData(ptr) @ stdcall -stub -version=0x600+ RtlLockCurrentThread() @ stdcall RtlLockHeap(long) diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c index 64831f660dd..bd4bf157c63 100644 --- a/dll/ntdll/ldr/ldrinit.c +++ b/dll/ntdll/ldr/ldrinit.c @@ -86,6 +86,7 @@ ULONG LdrpActiveUnloadCount; VOID NTAPI RtlpInitializeVectoredExceptionHandling(VOID); VOID NTAPI RtlpInitDeferredCriticalSection(VOID); VOID NTAPI RtlInitializeHeapManager(VOID); +NTSTATUS NTAPI RtlpInitializeLocaleTable(VOID); ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c ULONG RtlpShutdownProcessFlags; // TODO: Use it @@ -2031,6 +2032,13 @@ LdrpInitializeProcess(IN PCONTEXT Context, return STATUS_NO_MEMORY; } + Status = RtlpInitializeLocaleTable(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to initialize locale table\n"); + return Status; + } + /* Allocate an Activation Context Stack */ Status = RtlAllocateActivationContextStack(&Teb->ActivationContextStackPointer); if (!NT_SUCCESS(Status)) return Status;