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@outlook.pt --- Supersedes: 172370 V4: Use NLS_RegOpenKey(); slightly change documentation. V3: Actually do what's advertised. --- 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 4dcad37c72..7d481a2a48 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;