wine-staging/patches/windows.gaming.input-dll/0001-windows.gaming.input-Add-stub-dll.patch
2021-01-21 12:00:14 +11:00

242 lines
8.0 KiB
Diff

From 57e813244a401d27959d8689942e787fafcaa15b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Fri, 9 Oct 2020 13:38:18 +0200
Subject: [PATCH] windows.gaming.input: Add stub dll.
---
configure.ac | 1 +
dlls/windows.gaming.input.dll/Makefile.in | 5 +
.../windows.gaming.input.spec | 3 +
.../windows.gaming.input_main.c | 140 ++++++++++++++++++
include/Makefile.in | 1 +
include/windows.gaming.input.idl | 24 +++
6 files changed, 174 insertions(+)
create mode 100644 dlls/windows.gaming.input.dll/Makefile.in
create mode 100644 dlls/windows.gaming.input.dll/windows.gaming.input.spec
create mode 100644 dlls/windows.gaming.input.dll/windows.gaming.input_main.c
create mode 100644 include/windows.gaming.input.idl
diff --git a/configure.ac b/configure.ac
index 6fbf7f2d4e5..bdcfe84f87d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3850,6 +3850,7 @@ WINE_CONFIG_MAKEFILE(dlls/win32s16.dll16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/win87em.dll16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/winaspi.dll16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/windebug.dll16,enable_win16)
+WINE_CONFIG_MAKEFILE(dlls/windows.gaming.input.dll)
WINE_CONFIG_MAKEFILE(dlls/windows.media.speech.dll)
WINE_CONFIG_MAKEFILE(dlls/windowscodecs)
WINE_CONFIG_MAKEFILE(dlls/windowscodecs/tests)
diff --git a/dlls/windows.gaming.input.dll/Makefile.in b/dlls/windows.gaming.input.dll/Makefile.in
new file mode 100644
index 00000000000..d9478342294
--- /dev/null
+++ b/dlls/windows.gaming.input.dll/Makefile.in
@@ -0,0 +1,5 @@
+MODULE = windows.gaming.input.dll
+IMPORTS = combase uuid
+EXTRADLLFLAGS = -mno-cygwin
+C_SRCS = \
+ windows.gaming.input_main.c
diff --git a/dlls/windows.gaming.input.dll/windows.gaming.input.spec b/dlls/windows.gaming.input.dll/windows.gaming.input.spec
new file mode 100644
index 00000000000..20a8bfa98ea
--- /dev/null
+++ b/dlls/windows.gaming.input.dll/windows.gaming.input.spec
@@ -0,0 +1,3 @@
+@ stdcall -private DllCanUnloadNow()
+@ stdcall -private DllGetActivationFactory(ptr ptr)
+@ stdcall -private DllGetClassObject(ptr ptr ptr)
diff --git a/dlls/windows.gaming.input.dll/windows.gaming.input_main.c b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c
new file mode 100644
index 00000000000..2b6abc4dd84
--- /dev/null
+++ b/dlls/windows.gaming.input.dll/windows.gaming.input_main.c
@@ -0,0 +1,140 @@
+#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"
+#include "windows.gaming.input.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(input);
+
+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_gaming_input
+{
+ IActivationFactory IActivationFactory_iface;
+ LONG ref;
+};
+
+static inline struct windows_gaming_input *impl_from_IActivationFactory(IActivationFactory *iface)
+{
+ return CONTAINING_RECORD(iface, struct windows_gaming_input, IActivationFactory_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE windows_gaming_input_QueryInterface(
+ IActivationFactory *iface, REFIID iid, void **out)
+{
+ struct windows_gaming_input *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_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_gaming_input_AddRef(
+ IActivationFactory *iface)
+{
+ struct windows_gaming_input *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedIncrement(&impl->ref);
+ TRACE("iface %p, ref %u.\n", iface, ref);
+ return ref;
+}
+
+static ULONG STDMETHODCALLTYPE windows_gaming_input_Release(
+ IActivationFactory *iface)
+{
+ struct windows_gaming_input *impl = impl_from_IActivationFactory(iface);
+ ULONG ref = InterlockedDecrement(&impl->ref);
+ TRACE("iface %p, ref %u.\n", iface, ref);
+ return ref;
+}
+
+static HRESULT STDMETHODCALLTYPE windows_gaming_input_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_gaming_input_GetRuntimeClassName(
+ IActivationFactory *iface, HSTRING *class_name)
+{
+ FIXME("iface %p, class_name %p stub!\n", iface, class_name);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE windows_gaming_input_GetTrustLevel(
+ IActivationFactory *iface, TrustLevel *trust_level)
+{
+ FIXME("iface %p, trust_level %p stub!\n", iface, trust_level);
+ return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE windows_gaming_input_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_gaming_input_QueryInterface,
+ windows_gaming_input_AddRef,
+ windows_gaming_input_Release,
+ /* IInspectable methods */
+ windows_gaming_input_GetIids,
+ windows_gaming_input_GetRuntimeClassName,
+ windows_gaming_input_GetTrustLevel,
+ /* IActivationFactory methods */
+ windows_gaming_input_ActivateInstance,
+};
+
+static struct windows_gaming_input windows_gaming_input =
+{
+ {&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_gaming_input.IActivationFactory_iface;
+ IUnknown_AddRef(*factory);
+ return S_OK;
+}
diff --git a/include/Makefile.in b/include/Makefile.in
index 466ac6fd5dc..24cc64a3407 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -753,6 +753,7 @@ SOURCES = \
windef.h \
windns.h \
windows.foundation.idl \
+ windows.gaming.input.idl \
windows.h \
windows.media.speechsynthesis.idl \
windowscontracts.idl \
diff --git a/include/windows.gaming.input.idl b/include/windows.gaming.input.idl
new file mode 100644
index 00000000000..575f34ccb58
--- /dev/null
+++ b/include/windows.gaming.input.idl
@@ -0,0 +1,24 @@
+/*
+ * 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 "inspectable.idl";
+import "windows.foundation.idl";
--
2.29.2