wine-staging/patches/windows.globalization-dll/0002-windows.globalization-Implement-IGlobalizationPrefer.patch

308 lines
11 KiB
Diff
Raw Normal View History

From a5fb434c28607cd124e463eed2b4ef6c4e856983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Tue, 13 Oct 2020 18:11:35 +0200
Subject: [PATCH 2/5] windows.globalization: Implement
IGlobalizationPreferencesStatics stubs.
---
dlls/windows.globalization.dll/Makefile.in | 2 +-
.../windows.globalization_main.c | 133 ++++++++++++++++++
include/Makefile.in | 1 +
include/windows.globalization.idl | 20 ++-
include/windows.system.userprofile.idl | 56 ++++++++
5 files changed, 210 insertions(+), 2 deletions(-)
create mode 100644 include/windows.system.userprofile.idl
diff --git a/dlls/windows.globalization.dll/Makefile.in b/dlls/windows.globalization.dll/Makefile.in
index 25dc1cac3e6..7ddd97aef52 100644
--- a/dlls/windows.globalization.dll/Makefile.in
+++ b/dlls/windows.globalization.dll/Makefile.in
@@ -1,5 +1,5 @@
MODULE = windows.globalization.dll
-IMPORTS = combase
+IMPORTS = combase uuid
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
windows.globalization_main.c
diff --git a/dlls/windows.globalization.dll/windows.globalization_main.c b/dlls/windows.globalization.dll/windows.globalization_main.c
index 840ce08c0c5..97afc941219 100644
--- a/dlls/windows.globalization.dll/windows.globalization_main.c
+++ b/dlls/windows.globalization.dll/windows.globalization_main.c
@@ -10,6 +10,9 @@
#include "initguid.h"
#include "activation.h"
+#define WIDL_USING_IVECTORVIEW_1_HSTRING
+#define WIDL_USING_WINDOWS_GLOBALIZATION_DAYOFWEEK
+#define WIDL_USING_WINDOWS_SYSTEM_USERPROFILE_IGLOBALIZATIONPREFERENCESSTATICS
#include "windows.foundation.h"
#include "windows.globalization.h"
#include "windows.system.userprofile.h"
@@ -28,6 +31,7 @@ static const char *debugstr_hstring(HSTRING hstr)
struct windows_globalization
{
IActivationFactory IActivationFactory_iface;
+ IGlobalizationPreferencesStatics IGlobalizationPreferencesStatics_iface;
LONG ref;
};
@@ -36,6 +40,127 @@ 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 globalization_preferences_QueryInterface(
+ IGlobalizationPreferencesStatics *iface, REFIID iid, void **object)
+{
+ FIXME("iface %p, iid %s, object %p stub!\n", iface, debugstr_guid(iid), object);
+
+ if (IsEqualGUID(iid, &IID_IAgileObject))
+ {
+ IUnknown_AddRef(iface);
+ *object = iface;
+ return S_OK;
+ }
+
+ WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
+ *object = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE globalization_preferences_AddRef(
+ IGlobalizationPreferencesStatics *iface)
+{
+ struct windows_globalization *impl = impl_from_IGlobalizationPreferencesStatics(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ FIXME("iface %p -> ref %u.\n", iface, ref);
+ return ref;
+}
+
+static ULONG STDMETHODCALLTYPE globalization_preferences_Release(
+ IGlobalizationPreferencesStatics *iface)
+{
+ struct windows_globalization *impl = impl_from_IGlobalizationPreferencesStatics(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ FIXME("iface %p -> ref %u.\n", iface, ref);
+ return ref;
+}
+
+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 **value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Clocks(IGlobalizationPreferencesStatics *iface,
+ IVectorView_HSTRING **value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Currencies(IGlobalizationPreferencesStatics *iface,
+ IVectorView_HSTRING **value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE globalization_preferences_get_Languages(IGlobalizationPreferencesStatics *iface,
+ IVectorView_HSTRING **value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE globalization_preferences_get_HomeGeographicRegion(IGlobalizationPreferencesStatics *iface,
+ HSTRING* value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE globalization_preferences_get_WeekStartsOn(IGlobalizationPreferencesStatics *iface,
+ enum DayOfWeek* value)
+{
+ FIXME("iface %p, value %p stub!\n", iface, value);
+ 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 HRESULT STDMETHODCALLTYPE windows_globalization_QueryInterface(
IActivationFactory *iface, REFIID iid, void **out)
{
@@ -51,6 +176,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;
@@ -118,6 +250,7 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl =
static struct windows_globalization windows_globalization =
{
{&activation_factory_vtbl},
+ {&globalization_preferences_vtbl},
0
};
diff --git a/include/Makefile.in b/include/Makefile.in
index 74eeff2d830..258813f7f15 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -739,6 +739,7 @@ SOURCES = \
windows.gaming.input.idl \
windows.gaming.input.forcefeedback.idl \
windows.globalization.idl \
+ windows.system.userprofile.idl \
windows.media.speechsynthesis.idl \
windows.system.idl \
windows.h \
diff --git a/include/windows.globalization.idl b/include/windows.globalization.idl
index c3f80999af5..ac76455b847 100644
--- a/include/windows.globalization.idl
+++ b/include/windows.globalization.idl
@@ -20,8 +20,26 @@
#pragma winrt ns_prefix
#endif
-import "inspectable.idl";
import "windows.foundation.idl";
namespace Windows {
+ namespace Globalization {
+ typedef enum DayOfWeek DayOfWeek;
+ }
+}
+
+namespace Windows {
+ namespace Globalization {
+ [contract(Windows.Foundation.UniversalApiContract, 1.0)]
+ enum DayOfWeek
+ {
+ Sunday = 0,
+ Monday = 1,
+ Tuesday = 2,
+ Wednesday = 3,
+ Thursday = 4,
+ Friday = 5,
+ Saturday = 6
+ };
+ }
}
diff --git a/include/windows.system.userprofile.idl b/include/windows.system.userprofile.idl
new file mode 100644
index 00000000000..e2676f9dd89
--- /dev/null
+++ b/include/windows.system.userprofile.idl
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2020 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
+ */
+
+#ifdef __WIDL__
+#pragma winrt ns_prefix
+#endif
+
+import "windows.foundation.idl";
+import "windows.globalization.idl";
+
+namespace Windows {
+ namespace System {
+ namespace UserProfile {
+ interface IGlobalizationPreferencesStatics;
+ runtimeclass GlobalizationPreferences;
+ }
+ }
+}
+
+namespace Windows {
+ namespace System {
+ namespace UserProfile {
+
+ [
+ contract(Windows.Foundation.UniversalApiContract, 1.0),
+ exclusiveto(Windows.System.UserProfile.GlobalizationPreferences),
+ uuid(01bf4326-ed37-4e96-b0e9-c1340d1ea158)
+ ]
+ interface IGlobalizationPreferencesStatics : IInspectable
+ {
+ [propget] HRESULT Calendars([out, retval] Windows.Foundation.Collections.IVectorView<HSTRING>** value);
+ [propget] HRESULT Clocks([out, retval] Windows.Foundation.Collections.IVectorView<HSTRING>** value);
+ [propget] HRESULT Currencies([out, retval] Windows.Foundation.Collections.IVectorView<HSTRING>** value);
+ [propget] HRESULT Languages([out, retval] Windows.Foundation.Collections.IVectorView<HSTRING>** value);
+ [propget] HRESULT HomeGeographicRegion([out, retval] HSTRING* value);
+ [propget] HRESULT WeekStartsOn([out, retval] Windows.Globalization.DayOfWeek* value);
+ }
+
+ }
+ }
+}
--
2.28.0