wine-staging/patches/windows.globalization-dll/0003-windows.globalization-Implement-IGlobalizationPrefer.patch
2020-10-14 18:24:09 +11:00

44 lines
1.8 KiB
Diff

From 26dc75ab2eb7ac9f8c21da1d0f2be70fe2430460 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 18:19:17 +0200
Subject: [PATCH 3/5] 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 97afc941219..6d17317677e 100644
--- a/dlls/windows.globalization.dll/windows.globalization_main.c
+++ b/dlls/windows.globalization.dll/windows.globalization_main.c
@@ -132,8 +132,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.28.0