Alexandre Julliard : ntdll: Fetch locale information from the Unix side in resource loading.

Alexandre Julliard julliard at winehq.org
Wed Mar 3 15:47:28 CST 2021


Module: wine
Branch: master
Commit: 46fd718ec7f330793a7f142f326eabe311c8d70b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=46fd718ec7f330793a7f142f326eabe311c8d70b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar  3 16:13:09 2021 +0100

ntdll: Fetch locale information from the Unix side in resource loading.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50769
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/locale.c     | 2 --
 dlls/ntdll/ntdll_misc.h | 3 ---
 dlls/ntdll/resource.c   | 4 ++++
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index 19626a48b72..b3a225a30c3 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -100,8 +100,6 @@ struct norm_table
     /* WORD[]       composition character sequences */
 };
 
-LCID user_lcid = 0, system_lcid = 0;
-
 static NLSTABLEINFO nls_info;
 static HMODULE kernel32_handle;
 static struct norm_table *norm_tables[16];
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 72340a171c9..b69ad762300 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -85,9 +85,6 @@ extern const struct unix_funcs *unix_funcs DECLSPEC_HIDDEN;
 
 extern struct _KUSER_SHARED_DATA *user_shared_data DECLSPEC_HIDDEN;
 
-/* locale */
-extern LCID user_lcid, system_lcid;
-
 extern int CDECL NTDLL__vsnprintf( char *str, SIZE_T len, const char *format, __ms_va_list args ) DECLSPEC_HIDDEN;
 extern int CDECL NTDLL__vsnwprintf( WCHAR *str, SIZE_T len, const WCHAR *format, __ms_va_list args ) DECLSPEC_HIDDEN;
 
diff --git a/dlls/ntdll/resource.c b/dlls/ntdll/resource.c
index 981c538a8e0..58a0fc7d2e2 100644
--- a/dlls/ntdll/resource.c
+++ b/dlls/ntdll/resource.c
@@ -175,6 +175,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_
 static NTSTATUS find_entry( HMODULE hmod, const LDR_RESOURCE_INFO *info,
                             ULONG level, const void **ret, int want_dir )
 {
+    static LCID user_lcid, system_lcid;
     ULONG size;
     const void *root;
     const IMAGE_RESOURCE_DIRECTORY *resdirptr;
@@ -212,6 +213,8 @@ static NTSTATUS find_entry( HMODULE hmod, const LDR_RESOURCE_INFO *info,
         /* user defaults, unless SYS_DEFAULT sublanguage specified  */
         if (SUBLANGID(info->Language) != SUBLANG_SYS_DEFAULT)
         {
+            if (!user_lcid) NtQueryDefaultLocale( TRUE, &user_lcid );
+
             /* 4. current thread locale language */
             pos = push_language( list, pos, LANGIDFROMLCID(NtCurrentTeb()->CurrentLocale) );
 
@@ -223,6 +226,7 @@ static NTSTATUS find_entry( HMODULE hmod, const LDR_RESOURCE_INFO *info,
         }
 
         /* now system defaults */
+        if (!system_lcid) NtQueryDefaultLocale( FALSE, &system_lcid );
 
         /* 7. system locale language */
         pos = push_language( list, pos, LANGIDFROMLCID( system_lcid ) );




More information about the wine-cvs mailing list