We ask Wine for the country code of the current locale and then set it with SetUserGeoName().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196 Signed-off-by: João Diogo Craveiro Ferreira devilj@outlook.pt --- Supersedes: 172518 V5: Removed superfluous TRACE logs. V4: Removed opt-out mechanism. --- dlls/kernel32/kernel_main.c | 3 +++ dlls/kernel32/kernel_private.h | 1 + dlls/kernel32/locale.c | 14 ++++++++++++++ 3 files changed, 18 insertions(+)
diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index dfa66f0295..206972c210 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -88,6 +88,9 @@ static BOOL process_attach( HMODULE module ) /* Setup registry locale information */ LOCALE_InitRegistry();
+ /* Setup registry geographic information */ + LOCALE_InitGeo(); + /* Setup registry timezone information */ TIMEZONE_InitRegistry();
diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index af85bee84d..6b93add056 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -76,6 +76,7 @@ extern void COMPUTERNAME_Init(void) DECLSPEC_HIDDEN; /* locale.c */ extern void LOCALE_Init(void) DECLSPEC_HIDDEN; extern void LOCALE_InitRegistry(void) DECLSPEC_HIDDEN; +extern void LOCALE_InitGeo(void) DECLSPEC_HIDDEN;
/* time.c */ extern void TIMEZONE_InitRegistry(void) DECLSPEC_HIDDEN; diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index f4aaee25f9..20ba0f781a 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -846,6 +846,20 @@ void LOCALE_InitRegistry(void) NtClose( hkey ); }
+/* Initialize the geographic information in the registry. */ +void LOCALE_InitGeo(void) +{ + WCHAR name[4]; + static WCHAR fallback[] = {'0','0','1',0}; /* World */ + int result; + + if ((result = GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_SISO3166CTRYNAME, + name, ARRAY_SIZE(name)))) + result = SetUserGeoName(name); + + if (!result) + SetUserGeoName(fallback); +}
#ifdef __APPLE__ /***********************************************************************