Returning the user default country.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.globalization/main.c | 16 ++++++++++++++-- dlls/windows.globalization/tests/globalization.c | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index 17bb49a1c4e..914fde0eff6 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -225,8 +225,20 @@ static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages( static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion( IGlobalizationPreferencesStatics *iface, HSTRING* out) { - FIXME("iface %p, out %p stub!\n", iface, out); - return E_NOTIMPL; + WCHAR locale_w[LOCALE_NAME_MAX_LENGTH], *tmp; + const WCHAR *country; + + TRACE("iface %p, out %p.\n", iface, out); + + GetUserDefaultLocaleName(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 + 1; + + TRACE("returning country %s\n", debugstr_w(country)); + + return WindowsCreateString(country, wcslen(country), out); }
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn( diff --git a/dlls/windows.globalization/tests/globalization.c b/dlls/windows.globalization/tests/globalization.c index 1918322b7a2..d6625183e3f 100644 --- a/dlls/windows.globalization/tests/globalization.c +++ b/dlls/windows.globalization/tests/globalization.c @@ -101,8 +101,7 @@ static void test_GlobalizationPreferences(void) IAgileObject_Release(tmp_agile_object);
hr = IGlobalizationPreferencesStatics_get_HomeGeographicRegion(preferences_statics, &tmp_str); - todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr);
buf = pWindowsGetStringRawBuffer(tmp_str, &len); ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len); @@ -113,7 +112,8 @@ static void test_GlobalizationPreferences(void) pWindowsDeleteString(tmp_str);
hr = IGlobalizationPreferencesStatics_get_Languages(preferences_statics, &languages); - ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr); + todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr); + if (FAILED(hr)) goto done;
hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr);