From c13d88ba971c540c525ab9adbbd1d663cf6fc6d3 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 21 Mar 2022 11:52:22 +0100 Subject: [PATCH] ntdll: Implement RtlGetLocaleFileMappingAddress(). Signed-off-by: Alexandre Julliard --- dlls/ntdll/locale.c | 23 +++++++++++++++++++++++ dlls/ntdll/ntdll.spec | 1 + include/winternl.h | 1 + 3 files changed, 25 insertions(+) diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c index fe185d403f2..360496dd7e1 100644 --- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -701,6 +701,29 @@ void WINAPI RtlResetRtlTranslations( const NLSTABLEINFO *info ) } +/************************************************************************** + * RtlGetLocaleFileMappingAddress (NTDLL.@) + */ +NTSTATUS WINAPI RtlGetLocaleFileMappingAddress( void **ptr, LCID *lcid, LARGE_INTEGER *size ) +{ + static void *cached_ptr; + static LCID cached_lcid; + + if (!cached_ptr) + { + void *addr; + NTSTATUS status = NtInitializeNlsFiles( &addr, &cached_lcid, size ); + + if (status) return status; + if (InterlockedCompareExchangePointer( &cached_ptr, addr, NULL )) + NtUnmapViewOfSection( GetCurrentProcess(), addr ); + } + *ptr = cached_ptr; + *lcid = cached_lcid; + return STATUS_SUCCESS; +} + + /************************************************************************** * RtlAnsiCharToUnicodeChar (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 6d134770596..4c7b9be1d9f 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -726,6 +726,7 @@ # @ stub RtlGetLengthWithoutLastFullDosOrNtPathElement # Yes, Microsoft really misspelled this one! # @ stub RtlGetLengthWithoutTrailingPathSeperators +@ stdcall RtlGetLocaleFileMappingAddress(ptr ptr ptr) @ stdcall RtlGetLongestNtPathLength() @ stdcall -syscall -arch=win32 RtlGetNativeSystemInformation(long ptr long ptr) NtWow64GetNativeSystemInformation @ stdcall -syscall -arch=win64 RtlGetNativeSystemInformation(long ptr long ptr) NtQuerySystemInformation diff --git a/include/winternl.h b/include/winternl.h index 68c174d6086..3fa5fad9b46 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4346,6 +4346,7 @@ NTSYSAPI ULONG WINAPI RtlGetFullPathName_U(PCWSTR,ULONG,PWSTR,PWSTR*); NTSYSAPI NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN); NTSYSAPI NTSTATUS WINAPI RtlGetLastNtStatus(void); NTSYSAPI DWORD WINAPI RtlGetLastWin32Error(void); +NTSYSAPI NTSTATUS WINAPI RtlGetLocaleFileMappingAddress(void**,LCID*,LARGE_INTEGER*); NTSYSAPI DWORD WINAPI RtlGetLongestNtPathLength(void); NTSYSAPI ULONG WINAPI RtlGetNtGlobalFlags(void); NTSYSAPI BOOLEAN WINAPI RtlGetNtProductType(LPDWORD);