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

João Diogo Ferreira devilj at outlook.pt
Thu Nov 7 08:05:01 CST 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 yet, it now returns 39070,
which is the ID for the very neutral "World" region.

This behaviour matches Windows 10 v1709-v1909 and also
prevents at least one game from crashing.

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: 172517
V5: (no changes.)
---
 dlls/kernel32/locale.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 8c7099e99e..7a6d05c968 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -4097,10 +4097,14 @@ static inline const struct geoinfo_t *get_geoinfoptr_by_name(const WCHAR *name)
  * RETURNS
  *   SUCCESS: The ID of the specified geographic class.
  *   FAILURE: GEOID_NOT_AVAILABLE.
+ *
+ * NOTES
+ *   This function only fails if the specified geoclass is invalid;
+ *   otherwise, a valid GeoID will always be returned.
  */
 GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
 {
-    GEOID ret = GEOID_NOT_AVAILABLE;
+    GEOID ret = 39070; /* World */
     static const WCHAR geoW[] = {'G','e','o',0};
     static const WCHAR nationW[] = {'N','a','t','i','o','n',0};
     static const WCHAR regionW[] = {'R','e','g','i','o','n',0};
@@ -4124,7 +4128,7 @@ GEOID WINAPI GetUserGeoID(GEOCLASS geoclass)
     else
     {
         WARN("Unknown geoclass %d\n", geoclass);
-        return ret;
+        return GEOID_NOT_AVAILABLE;
     }
 
     if (!(hkey = create_registry_key())) return ret;
-- 
2.23.0



More information about the wine-devel mailing list