[PATCH v7 2/3] kernel32: Autoinitialize geographic values when launching any program.

João Diogo Ferreira devilj at outlook.pt
Sat Nov 16 01:23:23 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>
---
V7: (no changes.)
V6: Use LOCALE_IGEOID instead of geonames.
Yeah, turns out this works after all.
Supersedes: 173820
---
 dlls/kernel32/kernel_main.c    | 3 +++
 dlls/kernel32/kernel_private.h | 1 +
 dlls/kernel32/locale.c         | 9 +++++++++
 3 files changed, 13 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 cd6c63efa3..e9f5f51029 100644
--- a/dlls/kernel32/kernel_private.h
+++ b/dlls/kernel32/kernel_private.h
@@ -75,6 +75,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 0f91728e84..f1ff3fbaa7 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -845,6 +845,15 @@ void LOCALE_InitRegistry(void)
     NtClose( hkey );
 }
 
+/* Initialize the geographic information in the registry. */
+void LOCALE_InitGeo(void)
+{
+    GEOID id;
+
+    if (GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_IGEOID|LOCALE_RETURN_NUMBER,
+        (WCHAR *)&id, sizeof(id) / sizeof(WCHAR)))
+        SetUserGeoID(id);
+}
 
 #ifdef __APPLE__
 /***********************************************************************
-- 
2.24.0



More information about the wine-devel mailing list