[PATCH v2 3/3] kernelbase: Autoset GeoID on process launch.
João Diogo Ferreira
devilj at outlook.pt
Mon Dec 2 15:39:54 CST 2019
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=46196
Signed-off-by: João Diogo Craveiro Ferreira <devilj at outlook.pt>
---
V2: Also set GeoID if it is currently unset regardless of LANG change.
Supersedes: 174357
---
dlls/kernelbase/locale.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 9bc3cfe80e..97f7a45b98 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -238,6 +238,8 @@ void init_locale(void)
UINT ansi_cp = 0, oem_cp = 0;
USHORT *ansi_ptr, *oem_ptr, *casemap_ptr;
LCID lcid = GetUserDefaultLCID();
+ GEOID geoid = GEOID_NOT_AVAILABLE;
+ GEOCLASS geoclass;
WCHAR bufferW[80];
DWORD count, i;
SIZE_T size;
@@ -268,6 +270,13 @@ void init_locale(void)
RegCreateKeyExW( HKEY_CURRENT_USER, L"Control Panel\\International",
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &intl_key, NULL );
+ GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IGEOID | LOCALE_RETURN_NUMBER,
+ (WCHAR *)&geoid, sizeof(geoid)/sizeof(WCHAR) );
+
+ geoclass = GetGeoInfoW(geoid, GEO_NATION, NULL, 0, 0) ? GEOCLASS_NATION : GEOCLASS_REGION;
+ if (GetUserGeoID(geoclass) == 39070)
+ SetUserGeoID(geoid);
+
/* Update registry contents if the user locale has changed.
* This simulates the action of the Windows control panel. */
@@ -290,6 +299,8 @@ void init_locale(void)
(BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR) );
}
+ SetUserGeoID(geoid);
+
if (!RegCreateKeyExW( nls_key, L"Codepage",
0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
{
--
2.24.0
More information about the wine-devel
mailing list