Alexandre Julliard : kernelbase: Set system/user locales by name if they have no LCID.
Alexandre Julliard
julliard at winehq.org
Fri Apr 1 16:04:27 CDT 2022
Module: wine
Branch: master
Commit: c0ff1a221be311534db72e9ff316287eb6b31351
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c0ff1a221be311534db72e9ff316287eb6b31351
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Apr 1 15:24:59 2022 +0200
kernelbase: Set system/user locales by name if they have no LCID.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/locale.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 997c7b6f4bc..4f0957ceff6 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -1547,12 +1547,32 @@ void init_locale( HMODULE module )
SIZE_T size;
HKEY hkey;
+ kernelbase_handle = module;
load_locale_nls();
+
NtQueryDefaultLocale( FALSE, &system_lcid );
NtQueryDefaultLocale( FALSE, &user_lcid );
- system_locale = get_locale_by_id( &system_lcid, 0 );
- user_locale = get_locale_by_id( &user_lcid, 0 );
- kernelbase_handle = module;
+ if (!(system_locale = get_locale_by_id( &system_lcid, 0 )))
+ {
+ if (GetEnvironmentVariableW( L"WINELOCALE", bufferW, ARRAY_SIZE(bufferW) ))
+ {
+ system_locale = get_locale_by_name( bufferW, &system_lcid );
+ if (system_lcid == LOCALE_CUSTOM_UNSPECIFIED) system_lcid = LOCALE_CUSTOM_DEFAULT;
+ }
+ }
+ if (!(user_locale = get_locale_by_id( &user_lcid, 0 )))
+ {
+ if (GetEnvironmentVariableW( L"WINEUSERLOCALE", bufferW, ARRAY_SIZE(bufferW) ))
+ {
+ user_locale = get_locale_by_name( bufferW, &user_lcid );
+ if (user_lcid == LOCALE_CUSTOM_UNSPECIFIED) user_lcid = LOCALE_CUSTOM_DEFAULT;
+ }
+ else
+ {
+ user_locale = system_locale;
+ user_lcid = system_lcid;
+ }
+ }
if (GetEnvironmentVariableW( L"WINEUNIXCP", bufferW, ARRAY_SIZE(bufferW) ))
unix_cp = wcstoul( bufferW, NULL, 10 );
More information about the wine-cvs
mailing list