[PATCH v2 3/3] kernelbase: Autoset GeoID on process launch.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=46196 Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)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
Forgot the bug line. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196 (Full fix: fixes the country flags in the UI and would mostly fix the crashes, even without the previous patch.) A segunda-feira, 2 de dezembro de 2019 21:39:54 WET João Diogo Ferreira escreveu:
Wine-bug: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.winehq.org%2Fshow_bug.cgi%3Fid%3D46196&data=02%7C01%7C%7Cf17e08d514074dcb09df08d777702bfb%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637109195959423052&sdata=9YJEDgLA9OpVvXyTuI8LNMC0vofkguXcLs86%2FNdjW8w%3D&reserved=0 Signed-off-by: João Diogo Craveiro Ferreira <devilj(a)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
participants (1)
-
João Diogo Ferreira