João Diogo Ferreira : kernelbase: Update GeoID when locale has changed.

Alexandre Julliard julliard at winehq.org
Wed Dec 4 16:13:04 CST 2019


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

Author: João Diogo Ferreira <devilj at outlook.pt>
Date:   Mon Dec  2 21:39:54 2019 +0000

kernelbase: Update GeoID when locale has changed.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196
Signed-off-by: João Diogo Craveiro Ferreira <devilj at outlook.pt>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernelbase/locale.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c
index 9bc3cfe80e..d81da5195f 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -239,7 +239,8 @@ void init_locale(void)
     USHORT *ansi_ptr, *oem_ptr, *casemap_ptr;
     LCID lcid = GetUserDefaultLCID();
     WCHAR bufferW[80];
-    DWORD count, i;
+    GEOID geoid = GEOID_NOT_AVAILABLE;
+    DWORD count, dispos, i;
     SIZE_T size;
     HKEY hkey;
 
@@ -268,6 +269,17 @@ 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 );
 
+    if (!RegCreateKeyExW( intl_key, L"Geo", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, &dispos ))
+    {
+        if (dispos == REG_CREATED_NEW_KEY)
+        {
+            GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IGEOID | LOCALE_RETURN_NUMBER,
+                            (WCHAR *)&geoid, sizeof(geoid) / sizeof(WCHAR) );
+            SetUserGeoID( geoid );
+        }
+        RegCloseKey( hkey );
+    }
+
     /* Update registry contents if the user locale has changed.
      * This simulates the action of the Windows control panel. */
 
@@ -290,6 +302,13 @@ void init_locale(void)
                         (BYTE *)bufferW, (lstrlenW(bufferW) + 1) * sizeof(WCHAR) );
     }
 
+    if (geoid == GEOID_NOT_AVAILABLE)
+    {
+        GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IGEOID | LOCALE_RETURN_NUMBER,
+                        (WCHAR *)&geoid, sizeof(geoid) / sizeof(WCHAR) );
+        SetUserGeoID( geoid );
+    }
+
     if (!RegCreateKeyExW( nls_key, L"Codepage",
                           0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL ))
     {




More information about the wine-cvs mailing list