Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- configure.ac | 2 + dlls/windows.globalization/Makefile.in | 9 + dlls/windows.globalization/classes.idl | 23 ++ dlls/windows.globalization/main.c | 159 ++++++++++++++ dlls/windows.globalization/tests/Makefile.in | 5 + .../tests/globalization.c | 197 ++++++++++++++++++ .../windows.globalization.spec | 3 + 7 files changed, 398 insertions(+) create mode 100644 dlls/windows.globalization/Makefile.in create mode 100644 dlls/windows.globalization/classes.idl create mode 100644 dlls/windows.globalization/main.c create mode 100644 dlls/windows.globalization/tests/Makefile.in create mode 100644 dlls/windows.globalization/tests/globalization.c create mode 100644 dlls/windows.globalization/windows.globalization.spec
diff --git a/configure.ac b/configure.ac index 6c2e9fa57ad..afd46b353ea 100644 --- a/configure.ac +++ b/configure.ac @@ -3803,6 +3803,8 @@ WINE_CONFIG_MAKEFILE(dlls/winaspi.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/windebug.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/windows.gaming.input) WINE_CONFIG_MAKEFILE(dlls/windows.gaming.input/tests) +WINE_CONFIG_MAKEFILE(dlls/windows.globalization) +WINE_CONFIG_MAKEFILE(dlls/windows.globalization/tests) WINE_CONFIG_MAKEFILE(dlls/windows.media.speech) WINE_CONFIG_MAKEFILE(dlls/windows.media.speech/tests) WINE_CONFIG_MAKEFILE(dlls/windowscodecs) diff --git a/dlls/windows.globalization/Makefile.in b/dlls/windows.globalization/Makefile.in new file mode 100644 index 00000000000..4dfc49c4bf0 --- /dev/null +++ b/dlls/windows.globalization/Makefile.in @@ -0,0 +1,9 @@ +MODULE = windows.globalization.dll +IMPORTS = combase uuid + +EXTRADLLFLAGS = -mno-cygwin + +C_SRCS = \ + main.c + +IDL_SRCS = classes.idl diff --git a/dlls/windows.globalization/classes.idl b/dlls/windows.globalization/classes.idl new file mode 100644 index 00000000000..94fc53c0dd5 --- /dev/null +++ b/dlls/windows.globalization/classes.idl @@ -0,0 +1,23 @@ +/* + * Runtime Classes for windows.globalization.dll + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep register + +#include "windows.system.userprofile.idl" diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c new file mode 100644 index 00000000000..5e46cc0811b --- /dev/null +++ b/dlls/windows.globalization/main.c @@ -0,0 +1,159 @@ +/* WinRT Windows.Globalization implementation + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "wine/debug.h" +#include "objbase.h" + +#include "initguid.h" +#include "activation.h" + +#include "windows.foundation.h" + +WINE_DEFAULT_DEBUG_CHANNEL(locale); + +static const char *debugstr_hstring(HSTRING hstr) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer(hstr, &len); + return wine_dbgstr_wn(str, len); +} + +struct windows_globalization +{ + IActivationFactory IActivationFactory_iface; + LONG ref; +}; + +static inline struct windows_globalization *impl_from_IActivationFactory(IActivationFactory *iface) +{ + return CONTAINING_RECORD(iface, struct windows_globalization, IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE windows_globalization_QueryInterface( + IActivationFactory *iface, REFIID iid, void **out) +{ + struct windows_globalization *impl = impl_from_IActivationFactory(iface); + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IActivationFactory)) + { + IUnknown_AddRef(iface); + *out = &impl->IActivationFactory_iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE windows_globalization_AddRef( + IActivationFactory *iface) +{ + struct windows_globalization *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE windows_globalization_Release( + IActivationFactory *iface) +{ + struct windows_globalization *impl = impl_from_IActivationFactory(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE windows_globalization_GetIids( + IActivationFactory *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE windows_globalization_GetRuntimeClassName( + IActivationFactory *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE windows_globalization_GetTrustLevel( + IActivationFactory *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE windows_globalization_ActivateInstance( + IActivationFactory *iface, IInspectable **instance) +{ + FIXME("iface %p, instance %p stub!\n", iface, instance); + return E_NOTIMPL; +} + +static const struct IActivationFactoryVtbl activation_factory_vtbl = +{ + windows_globalization_QueryInterface, + windows_globalization_AddRef, + windows_globalization_Release, + /* IInspectable methods */ + windows_globalization_GetIids, + windows_globalization_GetRuntimeClassName, + windows_globalization_GetTrustLevel, + /* IActivationFactory methods */ + windows_globalization_ActivateInstance, +}; + +static struct windows_globalization windows_globalization = +{ + {&activation_factory_vtbl}, + 0 +}; + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_FALSE; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) +{ + FIXME("clsid %s, riid %s, out %p stub!\n", debugstr_guid(clsid), debugstr_guid(riid), out); + return CLASS_E_CLASSNOTAVAILABLE; +} + +HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **factory) +{ + TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory); + *factory = &windows_globalization.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; +} diff --git a/dlls/windows.globalization/tests/Makefile.in b/dlls/windows.globalization/tests/Makefile.in new file mode 100644 index 00000000000..d928414c6ea --- /dev/null +++ b/dlls/windows.globalization/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = windows.globalization.dll +IMPORTS = uuid + +C_SRCS = \ + globalization.c diff --git a/dlls/windows.globalization/tests/globalization.c b/dlls/windows.globalization/tests/globalization.c new file mode 100644 index 00000000000..7dad2e612bd --- /dev/null +++ b/dlls/windows.globalization/tests/globalization.c @@ -0,0 +1,197 @@ +/* + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#define COBJMACROS +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winstring.h" + +#include "initguid.h" +#include "roapi.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_System_UserProfile +#include "windows.system.userprofile.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pRoActivateInstance)(HSTRING, IInspectable **); +static HRESULT (WINAPI *pRoGetActivationFactory)(HSTRING, REFIID, void **); +static HRESULT (WINAPI *pRoInitialize)(RO_INIT_TYPE); +static void (WINAPI *pRoUninitialize)(void); +static HRESULT (WINAPI *pWindowsCreateString)(LPCWSTR, UINT32, HSTRING *); +static HRESULT (WINAPI *pWindowsDeleteString)(HSTRING); +static WCHAR *(WINAPI *pWindowsGetStringRawBuffer)(HSTRING, UINT32 *); + +static void test_GlobalizationPreferences(void) +{ + static const WCHAR *class_name = L"Windows.System.UserProfile.GlobalizationPreferences"; + + IGlobalizationPreferencesStatics *preferences_statics = NULL; + IVectorView_HSTRING *languages = NULL; + IActivationFactory *factory = NULL; + IInspectable *inspectable = NULL, *tmp_inspectable = NULL; + IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; + HSTRING str, tmp_str; + BOOLEAN found; + HRESULT hr; + UINT32 len; + WCHAR *buf, locale[LOCALE_NAME_MAX_LENGTH], *country, *tmp; + UINT32 i, size; + + GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH); + if ((tmp = wcsrchr(locale, '_'))) *tmp = 0; + if (!(tmp = wcschr(locale, '-')) || (wcslen(tmp) > 3 && !(tmp = wcschr(tmp + 1, '-')))) country = wcsdup(L"US"); + else country = wcsdup(tmp + 1); + GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH); + + hr = pRoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr); + + hr = pWindowsCreateString(class_name, wcslen(class_name), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr); + + hr = pRoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG), "RoGetActivationFactory failed, hr %#x\n", hr); + if (hr == REGDB_E_CLASSNOTREG) + { + win_skip("%s runtimeclass not registered, skipping tests.\n", wine_dbgstr_w(class_name)); + pWindowsDeleteString(str); + pRoUninitialize(); + free(country); + return; + } + + hr = IActivationFactory_QueryInterface(factory, &IID_IInspectable, (void **)&inspectable); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_IAgileObject, (void **)&agile_object); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_IGlobalizationPreferencesStatics, (void **)&preferences_statics); + todo_wine ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGlobalizationPreferencesStatics failed, hr %#x\n", hr); + if (FAILED(hr)) goto done; + + hr = IGlobalizationPreferencesStatics_QueryInterface(preferences_statics, &IID_IInspectable, (void **)&tmp_inspectable); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_QueryInterface IID_IInspectable failed, hr %#x\n", hr); + ok(tmp_inspectable == inspectable, "IGlobalizationPreferencesStatics_QueryInterface IID_IInspectable returned %p, expected %p\n", tmp_inspectable, inspectable); + IInspectable_Release(tmp_inspectable); + + hr = IGlobalizationPreferencesStatics_QueryInterface(preferences_statics, &IID_IAgileObject, (void **)&tmp_agile_object); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_QueryInterface IID_IAgileObject failed, hr %#x\n", hr); + ok(tmp_agile_object == agile_object, "IGlobalizationPreferencesStatics_QueryInterface IID_IAgileObject returned %p, expected %p\n", tmp_agile_object, agile_object); + IAgileObject_Release(tmp_agile_object); + + hr = IGlobalizationPreferencesStatics_get_HomeGeographicRegion(preferences_statics, &tmp_str); + 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); + ok(wcslen(country) == len && !memcmp(buf, country, len), + "IGlobalizationPreferencesStatics_get_HomeGeographicRegion returned len %u, str %s, expected %s\n", + len, wine_dbgstr_w(buf), wine_dbgstr_w(country)); + + pWindowsDeleteString(tmp_str); + + hr = IGlobalizationPreferencesStatics_get_Languages(preferences_statics, &languages); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr); + + hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IInspectable, (void **)&tmp_inspectable); + ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr); + ok(tmp_inspectable != inspectable, "IVectorView_HSTRING_QueryInterface returned %p, expected %p\n", tmp_inspectable, inspectable); + IInspectable_Release(tmp_inspectable); + + hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IAgileObject, (void **)&tmp_agile_object); + ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr); + ok(tmp_agile_object != agile_object, "IVectorView_HSTRING_QueryInterface IID_IAgileObject returned agile_object\n"); + IAgileObject_Release(tmp_agile_object); + + size = 0xdeadbeef; + hr = IVectorView_HSTRING_get_Size(languages, &size); + ok(hr == S_OK, "IVectorView_HSTRING_get_Size failed, hr %#x\n", hr); + ok(size != 0 && size != 0xdeadbeef, "IVectorView_HSTRING_get_Size returned %u\n", size); + + hr = IVectorView_HSTRING_GetAt(languages, 0, &tmp_str); + ok(hr == S_OK, "IVectorView_HSTRING_GetAt failed, hr %#x\n", hr); + buf = pWindowsGetStringRawBuffer(tmp_str, &len); + ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len); + + ok(wcslen(locale) == len && !memcmp(buf, locale, len), + "IGlobalizationPreferencesStatics_get_Languages 0 returned len %u, str %s, expected %s\n", + len, wine_dbgstr_w(buf), wine_dbgstr_w(locale)); + + i = 0xdeadbeef; + found = FALSE; + hr = IVectorView_HSTRING_IndexOf(languages, tmp_str, &i, &found); + ok(hr == S_OK, "IVectorView_HSTRING_IndexOf failed, hr %#x\n", hr); + ok(i == 0 && found == TRUE, "IVectorView_HSTRING_IndexOf returned size %d, found %d\n", size, found); + + pWindowsDeleteString(tmp_str); + + tmp_str = (HSTRING)0xdeadbeef; + hr = IVectorView_HSTRING_GetAt(languages, size, &tmp_str); + ok(hr == E_BOUNDS, "IVectorView_HSTRING_GetAt failed, hr %#x\n", hr); + ok(tmp_str == NULL, "IVectorView_HSTRING_GetAt returned %p\n", tmp_str); + + IVectorView_HSTRING_Release(languages); + + IGlobalizationPreferencesStatics_Release(preferences_statics); + +done: + IAgileObject_Release(agile_object); + IInspectable_Release(inspectable); + IActivationFactory_Release(factory); + + pWindowsDeleteString(str); + + pRoUninitialize(); + free(country); +} + +START_TEST(globalization) +{ + HMODULE combase; + + if (!(combase = LoadLibraryW(L"combase.dll"))) + { + win_skip("Failed to load combase.dll, skipping tests\n"); + return; + } + +#define LOAD_FUNCPTR(x) \ + if (!(p##x = (void*)GetProcAddress(combase, #x))) \ + { \ + win_skip("Failed to find %s in combase.dll, skipping tests.\n", #x); \ + return; \ + } + + LOAD_FUNCPTR(RoActivateInstance); + LOAD_FUNCPTR(RoGetActivationFactory); + LOAD_FUNCPTR(RoInitialize); + LOAD_FUNCPTR(RoUninitialize); + LOAD_FUNCPTR(WindowsCreateString); + LOAD_FUNCPTR(WindowsDeleteString); + LOAD_FUNCPTR(WindowsGetStringRawBuffer); +#undef LOAD_FUNCPTR + + test_GlobalizationPreferences(); +} diff --git a/dlls/windows.globalization/windows.globalization.spec b/dlls/windows.globalization/windows.globalization.spec new file mode 100644 index 00000000000..721493229c2 --- /dev/null +++ b/dlls/windows.globalization/windows.globalization.spec @@ -0,0 +1,3 @@ +1 stdcall -private DllCanUnloadNow() +2 stdcall -private DllGetActivationFactory(ptr ptr) +3 stdcall -private DllGetClassObject(ptr ptr ptr)
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.globalization/main.c | 122 ++++++++++++++++++ .../tests/globalization.c | 8 +- 2 files changed, 126 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index 5e46cc0811b..17bb49a1c4e 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -29,7 +29,13 @@ #include "initguid.h" #include "activation.h"
+#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_Globalization +#include "windows.globalization.h" +#define WIDL_using_Windows_System_UserProfile +#include "windows.system.userprofile.h"
WINE_DEFAULT_DEBUG_CHANNEL(locale);
@@ -45,6 +51,7 @@ static const char *debugstr_hstring(HSTRING hstr) struct windows_globalization { IActivationFactory IActivationFactory_iface; + IGlobalizationPreferencesStatics IGlobalizationPreferencesStatics_iface; LONG ref; };
@@ -53,6 +60,11 @@ static inline struct windows_globalization *impl_from_IActivationFactory(IActiva return CONTAINING_RECORD(iface, struct windows_globalization, IActivationFactory_iface); }
+static inline struct windows_globalization *impl_from_IGlobalizationPreferencesStatics(IGlobalizationPreferencesStatics *iface) +{ + return CONTAINING_RECORD(iface, struct windows_globalization, IGlobalizationPreferencesStatics_iface); +} + static HRESULT STDMETHODCALLTYPE windows_globalization_QueryInterface( IActivationFactory *iface, REFIID iid, void **out) { @@ -69,6 +81,13 @@ static HRESULT STDMETHODCALLTYPE windows_globalization_QueryInterface( return S_OK; }
+ if (IsEqualGUID(iid, &IID_IGlobalizationPreferencesStatics)) + { + IUnknown_AddRef(iface); + *out = &impl->IGlobalizationPreferencesStatics_iface; + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -133,9 +152,112 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl = windows_globalization_ActivateInstance, };
+static HRESULT STDMETHODCALLTYPE globalization_preferences_QueryInterface( + IGlobalizationPreferencesStatics *iface, REFIID iid, void **object) +{ + struct windows_globalization *impl = impl_from_IGlobalizationPreferencesStatics(iface); + return windows_globalization_QueryInterface(&impl->IActivationFactory_iface, iid, object); +} + +static ULONG STDMETHODCALLTYPE globalization_preferences_AddRef( + IGlobalizationPreferencesStatics *iface) +{ + struct windows_globalization *impl = impl_from_IGlobalizationPreferencesStatics(iface); + return windows_globalization_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE globalization_preferences_Release( + IGlobalizationPreferencesStatics *iface) +{ + struct windows_globalization *impl = impl_from_IGlobalizationPreferencesStatics(iface); + return windows_globalization_Release(&impl->IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_GetIids( + IGlobalizationPreferencesStatics *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_GetRuntimeClassName( + IGlobalizationPreferencesStatics *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_GetTrustLevel( + IGlobalizationPreferencesStatics *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Calendars( + IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Clocks( + IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Currencies( + IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages( + IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion( + IGlobalizationPreferencesStatics *iface, HSTRING* out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn( + IGlobalizationPreferencesStatics *iface, enum DayOfWeek* out) +{ + FIXME("iface %p, out %p stub!\n", iface, out); + return E_NOTIMPL; +} + +static const struct IGlobalizationPreferencesStaticsVtbl globalization_preferences_vtbl = +{ + globalization_preferences_QueryInterface, + globalization_preferences_AddRef, + globalization_preferences_Release, + /* IInspectable methods */ + globalization_preferences_GetIids, + globalization_preferences_GetRuntimeClassName, + globalization_preferences_GetTrustLevel, + /* IGlobalizationPreferencesStatics methods */ + globalization_preferences_get_Calendars, + globalization_preferences_get_Clocks, + globalization_preferences_get_Currencies, + globalization_preferences_get_Languages, + globalization_preferences_get_HomeGeographicRegion, + globalization_preferences_get_WeekStartsOn, +}; + static struct windows_globalization windows_globalization = { {&activation_factory_vtbl}, + {&globalization_preferences_vtbl}, 0 };
diff --git a/dlls/windows.globalization/tests/globalization.c b/dlls/windows.globalization/tests/globalization.c index 7dad2e612bd..1918322b7a2 100644 --- a/dlls/windows.globalization/tests/globalization.c +++ b/dlls/windows.globalization/tests/globalization.c @@ -88,8 +88,7 @@ static void test_GlobalizationPreferences(void) ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IAgileObject failed, hr %#x\n", hr);
hr = IActivationFactory_QueryInterface(factory, &IID_IGlobalizationPreferencesStatics, (void **)&preferences_statics); - todo_wine ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGlobalizationPreferencesStatics failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_IGlobalizationPreferencesStatics failed, hr %#x\n", hr);
hr = IGlobalizationPreferencesStatics_QueryInterface(preferences_statics, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IGlobalizationPreferencesStatics_QueryInterface IID_IInspectable failed, hr %#x\n", hr); @@ -102,7 +101,8 @@ static void test_GlobalizationPreferences(void) IAgileObject_Release(tmp_agile_object);
hr = IGlobalizationPreferencesStatics_get_HomeGeographicRegion(preferences_statics, &tmp_str); - ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr); + todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_HomeGeographicRegion failed, hr %#x\n", hr); + if (FAILED(hr)) goto done;
buf = pWindowsGetStringRawBuffer(tmp_str, &len); ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len); @@ -154,9 +154,9 @@ static void test_GlobalizationPreferences(void)
IVectorView_HSTRING_Release(languages);
+done: IGlobalizationPreferencesStatics_Release(preferences_statics);
-done: IAgileObject_Release(agile_object); IInspectable_Release(inspectable); IActivationFactory_Release(factory);
Signed-off-by: Jacek Caban jacek@codeweavers.com
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);
On 24.03.2021 11:32, Rémi Bernon wrote:
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);
Shouldn't it use GetUserDefaultGeoName?
- 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;
country is uninitialized in else case.
Thanks,
Jacek
On 3/24/21 4:52 PM, Jacek Caban wrote:
On 24.03.2021 11:32, Rémi Bernon wrote:
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);
Shouldn't it use GetUserDefaultGeoName?
Ah maybe I didn't know there was a function to get that directly, thanks.
+ 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;
country is uninitialized in else case.
Hm, I'm not sure to see how? It's set to point to the char after the first '-', or the second '-' if the country code is longer than 2 chars. In we fail any of these, it defaults to "US".
Do you mean if GetUserDefaultLocaleName fails?
Thanks,
Jacek
On 3/24/21 6:39 PM, Rémi Bernon wrote:
Hm, I'm not sure to see how? It's set to point to the char after the first '-', or the second '-' if the country code is longer than 2 chars. In we fail any of these, it defaults to "US".
Do you mean if GetUserDefaultLocaleName fails?
Looking again, I'm not sure what I meant. Anyway, hopefully we don't need it at all.
Jacek
Returning user default language in a 1-element HSTRING vector.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.globalization/main.c | 189 +++++++++++++++++- .../tests/globalization.c | 33 ++- 2 files changed, 217 insertions(+), 5 deletions(-)
diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index 914fde0eff6..f96ea88b08d 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -48,6 +48,182 @@ static const char *debugstr_hstring(HSTRING hstr) return wine_dbgstr_wn(str, len); }
+struct hstring_vector +{ + IVectorView_HSTRING IVectorView_HSTRING_iface; + LONG ref; + + ULONG count; + HSTRING values[1]; +}; + +static inline struct hstring_vector *impl_from_IVectorView_HSTRING(IVectorView_HSTRING *iface) +{ + return CONTAINING_RECORD(iface, struct hstring_vector, IVectorView_HSTRING_iface); +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_QueryInterface(IVectorView_HSTRING *iface, + REFIID iid, void **out) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IAgileObject) || + IsEqualGUID(iid, &IID_IVectorView_HSTRING)) + { + IUnknown_AddRef(iface); + *out = &impl->IVectorView_HSTRING_iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE hstring_vector_AddRef(IVectorView_HSTRING *iface) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE hstring_vector_Release(IVectorView_HSTRING *iface) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + if (ref == 0) + { + while (impl->count--) WindowsDeleteString(impl->values[impl->count]); + free(impl); + } + return ref; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_GetIids(IVectorView_HSTRING *iface, + ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_GetRuntimeClassName(IVectorView_HSTRING *iface, + HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_GetTrustLevel(IVectorView_HSTRING *iface, + TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_GetAt(IVectorView_HSTRING *iface, + ULONG index, HSTRING *value) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + + TRACE("iface %p, index %#x, value %p.\n", iface, index, value); + + *value = NULL; + if (index >= impl->count) return E_BOUNDS; + return WindowsDuplicateString(impl->values[index], value); +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_get_Size(IVectorView_HSTRING *iface, + ULONG *value) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + + TRACE("iface %p, value %p.\n", iface, value); + + *value = impl->count; + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_IndexOf(IVectorView_HSTRING *iface, + HSTRING element, ULONG *index, BOOLEAN *found) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + INT32 i, order; + + TRACE("iface %p, element %p, index %p, found %p.\n", iface, element, index, found); + + for (i = 0; i < impl->count; ++i) + if (SUCCEEDED(WindowsCompareStringOrdinal(impl->values[i], element, &order)) && order == 0) + break; + + if (i < impl->count) + { + *found = TRUE; + *index = i; + } + else + { + *found = FALSE; + *index = 0; + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE hstring_vector_GetMany(IVectorView_HSTRING *iface, + ULONG start_index, ULONG items_size, HSTRING *items, UINT *count) +{ + struct hstring_vector *impl = impl_from_IVectorView_HSTRING(iface); + HRESULT hr; + ULONG i; + + TRACE("iface %p, start_index %#x, items %p, count %p.\n", iface, start_index, items, count); + + memset(items, 0, items_size * sizeof(HSTRING *)); + + for (i = start_index; i < impl->count && i < start_index + items_size; ++i) + if (FAILED(hr = WindowsDuplicateString(impl->values[i], items + i - start_index))) + return hr; + + *count = i - start_index; + return S_OK; +} + +static const struct IVectorView_HSTRINGVtbl hstring_vector_vtbl = +{ + hstring_vector_QueryInterface, + hstring_vector_AddRef, + hstring_vector_Release, + /* IInspectable methods */ + hstring_vector_GetIids, + hstring_vector_GetRuntimeClassName, + hstring_vector_GetTrustLevel, + /* IVectorView<HSTRING> methods */ + hstring_vector_GetAt, + hstring_vector_get_Size, + hstring_vector_IndexOf, + hstring_vector_GetMany, +}; + +static HRESULT hstring_vector_create(HSTRING *values, SIZE_T count, IVectorView_HSTRING **out) +{ + struct hstring_vector *impl; + + if (!(impl = malloc(offsetof(struct hstring_vector, values[count])))) return E_OUTOFMEMORY; + impl->ref = 1; + + impl->IVectorView_HSTRING_iface.lpVtbl = &hstring_vector_vtbl; + impl->count = count; + memcpy(impl->values, values, count * sizeof(HSTRING)); + + *out = &impl->IVectorView_HSTRING_iface; + return S_OK; +} + struct windows_globalization { IActivationFactory IActivationFactory_iface; @@ -218,8 +394,17 @@ static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Currencies( static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages( IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) { - FIXME("iface %p, out %p stub!\n", iface, out); - return E_NOTIMPL; + HSTRING hstring; + WCHAR locale[LOCALE_NAME_MAX_LENGTH]; + + TRACE("iface %p, out %p.\n", iface, out); + + GetUserDefaultLocaleName(locale, LOCALE_NAME_MAX_LENGTH); + + TRACE("returning language %s\n", debugstr_w(locale)); + + WindowsCreateString(locale, wcslen(locale), &hstring); + return hstring_vector_create(&hstring, 1, out); }
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion( diff --git a/dlls/windows.globalization/tests/globalization.c b/dlls/windows.globalization/tests/globalization.c index d6625183e3f..e471384869f 100644 --- a/dlls/windows.globalization/tests/globalization.c +++ b/dlls/windows.globalization/tests/globalization.c @@ -112,8 +112,7 @@ static void test_GlobalizationPreferences(void) pWindowsDeleteString(tmp_str);
hr = IGlobalizationPreferencesStatics_get_Languages(preferences_statics, &languages); - todo_wine ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr); - if (FAILED(hr)) goto done; + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Languages failed, hr %#x\n", hr);
hr = IVectorView_HSTRING_QueryInterface(languages, &IID_IInspectable, (void **)&tmp_inspectable); ok(hr == S_OK, "IVectorView_HSTRING_QueryInterface failed, hr %#x\n", hr); @@ -147,14 +146,42 @@ static void test_GlobalizationPreferences(void)
pWindowsDeleteString(tmp_str);
+ hr = pWindowsCreateString(L"deadbeef", 8, &tmp_str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr); + + i = 0xdeadbeef; + found = TRUE; + hr = IVectorView_HSTRING_IndexOf(languages, tmp_str, &i, &found); + ok(hr == S_OK, "IVectorView_HSTRING_IndexOf failed, hr %#x\n", hr); + ok(i == 0 && found == FALSE, "IVectorView_HSTRING_IndexOf returned size %d, found %d\n", size, found); + + pWindowsDeleteString(tmp_str); + tmp_str = (HSTRING)0xdeadbeef; hr = IVectorView_HSTRING_GetAt(languages, size, &tmp_str); ok(hr == E_BOUNDS, "IVectorView_HSTRING_GetAt failed, hr %#x\n", hr); ok(tmp_str == NULL, "IVectorView_HSTRING_GetAt returned %p\n", tmp_str);
+ tmp_str = (HSTRING)0xdeadbeef; + hr = IVectorView_HSTRING_GetMany(languages, size, 1, &tmp_str, &i); + ok(hr == S_OK, "IVectorView_HSTRING_GetAt failed, hr %#x\n", hr); + ok(i == 0 && tmp_str == NULL, "IVectorView_HSTRING_GetMany returned count %u, str %p\n", i, tmp_str); + + hr = IVectorView_HSTRING_GetMany(languages, 0, 1, &tmp_str, &i); + ok(hr == S_OK, "IVectorView_HSTRING_GetAt failed, hr %#x\n", hr); + ok(i == 1, "IVectorView_HSTRING_GetMany returned count %u, expected 1\n", i); + + buf = pWindowsGetStringRawBuffer(tmp_str, &len); + ok(buf != NULL && len > 0, "WindowsGetStringRawBuffer returned buf %p, len %u\n", buf, len); + + ok(wcslen(locale) == len && !memcmp(buf, locale, len), + "IGlobalizationPreferencesStatics_get_Languages 0 returned len %u, str %s, expected %s\n", + len, wine_dbgstr_w(buf), wine_dbgstr_w(locale)); + + pWindowsDeleteString(tmp_str); + IVectorView_HSTRING_Release(languages);
-done: IGlobalizationPreferencesStatics_Release(preferences_statics);
IAgileObject_Release(agile_object);
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windows.globalization/main.c | 6 ++-- .../tests/globalization.c | 36 ++++++++++++++++++- 2 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/dlls/windows.globalization/main.c b/dlls/windows.globalization/main.c index f96ea88b08d..afc1af2854e 100644 --- a/dlls/windows.globalization/main.c +++ b/dlls/windows.globalization/main.c @@ -374,21 +374,21 @@ static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Calendars( IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) { FIXME("iface %p, out %p stub!\n", iface, out); - return E_NOTIMPL; + return hstring_vector_create(NULL, 0, out); }
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Clocks( IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) { FIXME("iface %p, out %p stub!\n", iface, out); - return E_NOTIMPL; + return hstring_vector_create(NULL, 0, out); }
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Currencies( IGlobalizationPreferencesStatics *iface, IVectorView_HSTRING **out) { FIXME("iface %p, out %p stub!\n", iface, out); - return E_NOTIMPL; + return hstring_vector_create(NULL, 0, out); }
static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages( diff --git a/dlls/windows.globalization/tests/globalization.c b/dlls/windows.globalization/tests/globalization.c index e471384869f..f43982976ce 100644 --- a/dlls/windows.globalization/tests/globalization.c +++ b/dlls/windows.globalization/tests/globalization.c @@ -47,7 +47,7 @@ static void test_GlobalizationPreferences(void) static const WCHAR *class_name = L"Windows.System.UserProfile.GlobalizationPreferences";
IGlobalizationPreferencesStatics *preferences_statics = NULL; - IVectorView_HSTRING *languages = NULL; + IVectorView_HSTRING *languages = NULL, *calendars, *clocks, *currencies; IActivationFactory *factory = NULL; IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; @@ -182,6 +182,40 @@ static void test_GlobalizationPreferences(void)
IVectorView_HSTRING_Release(languages);
+ + hr = IGlobalizationPreferencesStatics_get_Calendars(preferences_statics, &calendars); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Calendars failed, hr %#x\n", hr); + + size = 0xdeadbeef; + hr = IVectorView_HSTRING_get_Size(calendars, &size); + ok(hr == S_OK, "IVectorView_HSTRING_get_Size failed, hr %#x\n", hr); + todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_HSTRING_get_Size returned %u\n", size); + + IVectorView_HSTRING_Release(calendars); + + + hr = IGlobalizationPreferencesStatics_get_Clocks(preferences_statics, &clocks); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Clocks failed, hr %#x\n", hr); + + size = 0xdeadbeef; + hr = IVectorView_HSTRING_get_Size(clocks, &size); + ok(hr == S_OK, "IVectorView_HSTRING_get_Size failed, hr %#x\n", hr); + todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_HSTRING_get_Size returned %u\n", size); + + IVectorView_HSTRING_Release(clocks); + + + hr = IGlobalizationPreferencesStatics_get_Currencies(preferences_statics, ¤cies); + ok(hr == S_OK, "IGlobalizationPreferencesStatics_get_Currencies failed, hr %#x\n", hr); + + size = 0xdeadbeef; + hr = IVectorView_HSTRING_get_Size(currencies, &size); + ok(hr == S_OK, "IVectorView_HSTRING_get_Size failed, hr %#x\n", hr); + todo_wine ok(size != 0 && size != 0xdeadbeef, "IVectorView_HSTRING_get_Size returned %u\n", size); + + IVectorView_HSTRING_Release(currencies); + + IGlobalizationPreferencesStatics_Release(preferences_statics);
IAgileObject_Release(agile_object);