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

João Diogo Ferreira devilj at outlook.pt
Tue Oct 29 23:30:57 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>
---
Supersedes: 171984
---
 dlls/kernel32/locale.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index abb3ecd773..e9d46949d1 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -4090,6 +4090,19 @@ 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)
 {
@@ -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