From 4508defd1c20893e534824ea07821912745175a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 13 Oct 2020 18:19:17 +0200 Subject: [PATCH] windows.globalization: Implement IGlobalizationPreferencesStatics::HomeGeographicRegion semi-stub. Returning the system default country. --- .../windows.globalization_main.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dlls/windows.globalization.dll/windows.globalization_main.c b/dlls/windows.globalization.dll/windows.globalization_main.c index 5bb0b46866d..83e269bead6 100644 --- a/dlls/windows.globalization.dll/windows.globalization_main.c +++ b/dlls/windows.globalization.dll/windows.globalization_main.c @@ -133,8 +133,22 @@ static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages(IGlobal static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion(IGlobalizationPreferencesStatics *iface, HSTRING* value) { - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; + UINT32 length; + WCHAR locale_w[LOCALE_NAME_MAX_LENGTH], *tmp; + const WCHAR *country; + + TRACE("iface %p, value %p stub!\n", iface, value); + + GetSystemDefaultLocaleName(locale_w, LOCALE_NAME_MAX_LENGTH); + + if ((tmp = wcsrchr(locale_w, '_'))) *tmp = 0; + if (!(tmp = wcschr(locale_w, '-')) || (wcslen(tmp) > 3 && !(tmp = wcschr(tmp + 1, '-')))) country = L"US"; + else country = tmp; + length = wcslen(country); + + TRACE("returning country %s\n", debugstr_w(country)); + + return WindowsCreateString(country, length, value); } static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn(IGlobalizationPreferencesStatics *iface, -- 2.20.1