[PATCH v3 5/7] kernel32: Make GetUserGeoID() pretend we set a GeoID even if we didn't.

João Diogo Ferreira devilj at outlook.pt
Wed Oct 30 00:31:51 CDT 2019


In Windows 10, with the changes introduced in v1709, this function
now always returns a good GeoID if the provided geoclass is valid.
If that class didn't have a GeoID set, this will return 39070,
which is the ID for the very neutral "World" region.

This behaviour also helps prevent bugs with at least one app.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46196
(partial fix: game no longer crashes.)

Signed-off-by: João Diogo Craveiro Ferreira <devilj at outlook.pt>
---
V3: Actually do what's advertised.
Supersedes: 171984
---
 dlls/kernel32/locale.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index abb3ecd773..f061b893e1 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -4090,10 +4090,23 @@ static inline const struct geoinfo_t *get_geoinfoptr_by_name(const WCHAR *name)
 
 /******************************************************************************
  *           GetUserGeoID (KERNEL32.@)
+ *
+ * Retrieves the ID of the user's geographic nation or region.
+ *
+ * PARAMS
+ *   GeoClass [I] One of GEOCLASS_NATION or GEOCLASS_REGION (SYSGEOCLASS enum from "winnls.h").
+ *
+ * RETURNS
+ *   SUCCESS: The ID of the specified geographic class.
+ *   FAILURE: GEOID_NOT_AVAILABLE.
+ *
+ * NOTES
+ *   This function only fails if the geoclass specified is invalid;
+ *   otherwise, a valid GeoID is always returned.
  */
 GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
 {
-    GEOID ret = GEOID_NOT_AVAILABLE;
+    GEOID ret = 39070; /* World */
     static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
     static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
     WCHAR bufferW[40], *end;
@@ -4116,7 +4129,7 @@ GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
     else
     {
         WARN("Unknown geoclass %d\n", geoclass);
-        return ret;
+        return GEOID_NOT_AVAILABLE;
     }
 
     if (!(hkey = create_geo_regkey())) return ret;
-- 
2.23.0



More information about the wine-devel mailing list