[PATCH 3/3] msmpeg2vdec: Implement DllGetClassObject.
Mohamad Al-Jaf
mohamadaljaf at gmail.com
Thu Apr 21 00:29:47 CDT 2022
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf at gmail.com>
---
dlls/msmpeg2vdec/Makefile.in | 3 +
dlls/msmpeg2vdec/main.c | 76 +++++++++++++++++++++++-
dlls/msmpeg2vdec/msmpeg2vdec_classes.idl | 21 +++++++
3 files changed, 99 insertions(+), 1 deletion(-)
create mode 100644 dlls/msmpeg2vdec/msmpeg2vdec_classes.idl
diff --git a/dlls/msmpeg2vdec/Makefile.in b/dlls/msmpeg2vdec/Makefile.in
index 54ada2f20c4..44377594b91 100644
--- a/dlls/msmpeg2vdec/Makefile.in
+++ b/dlls/msmpeg2vdec/Makefile.in
@@ -1,6 +1,9 @@
MODULE = msmpeg2vdec.dll
+IMPORTS = mfuuid uuid
EXTRADLLFLAGS = -Wb,--prefer-native
C_SRCS = \
main.c
+
+IDL_SRCS = msmpeg2vdec_classes.idl
diff --git a/dlls/msmpeg2vdec/main.c b/dlls/msmpeg2vdec/main.c
index 61ada37b2f6..7eede3d4b38 100644
--- a/dlls/msmpeg2vdec/main.c
+++ b/dlls/msmpeg2vdec/main.c
@@ -18,15 +18,89 @@
#include <stdarg.h>
+#define COBJMACROS
+
#include "windef.h"
#include "winbase.h"
+#include "mfidl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msmpeg2vdec);
+typedef struct {
+ IClassFactory IClassFactory_iface;
+ LONG ref;
+ HRESULT (*pfnCreateInstance)(IUnknown *outer, REFIID riid, void **out);
+} msmpeg2vdec_class_factory;
+
+static inline msmpeg2vdec_class_factory *impl_from_IClassFactory(IClassFactory *iface)
+{
+ return CONTAINING_RECORD(iface, msmpeg2vdec_class_factory, IClassFactory_iface);
+}
+
+static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ret_iface)
+{
+ TRACE("(%p, %s, %p)\n", iface, debugstr_guid(riid), ret_iface);
+
+ if (IsEqualGUID(&IID_IUnknown, riid) ||
+ IsEqualGUID(&IID_IClassFactory, riid))
+ {
+ IClassFactory_AddRef(iface);
+ *ret_iface = iface;
+ return S_OK;
+ }
+
+ *ret_iface = NULL;
+ WARN("no interface for %s\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI MSMPEGDecoderMFTFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj)
+{
+ msmpeg2vdec_class_factory *factory = impl_from_IClassFactory(iface);
+
+ TRACE("(iface %p, outer %p, riid %s, obj %p)\n",
+ iface, outer, debugstr_guid(riid), obj);
+
+ return factory->pfnCreateInstance(outer, riid, obj);
+}
+
+static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL lock)
+{
+ FIXME("(%d) stub\n", lock);
+ return S_OK;
+}
+
+static const IClassFactoryVtbl MSMPEGDecoderMFTFactoryVtbl =
+{
+ ClassFactory_QueryInterface,
+ ClassFactory_AddRef,
+ ClassFactory_Release,
+ MSMPEGDecoderMFTFactory_CreateInstance,
+ ClassFactory_LockServer,
+};
+
+static IClassFactory MSMPEGDecoderMFTFactory = { &MSMPEGDecoderMFTFactoryVtbl };
+
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppv)
{
- FIXME("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppv);
+ TRACE("(%s, %s, %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppv);
+
+ if (IsEqualGUID(clsid, &CLSID_MSMPEGDecoderMFT))
+ return ClassFactory_QueryInterface(&MSMPEGDecoderMFTFactory, riid, ppv);
+
+ WARN("Unsupported class %s.\n", debugstr_guid(clsid));
+ *ppv = NULL;
return CLASS_E_CLASSNOTAVAILABLE;
}
diff --git a/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl b/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl
new file mode 100644
index 00000000000..2df633a06dd
--- /dev/null
+++ b/dlls/msmpeg2vdec/msmpeg2vdec_classes.idl
@@ -0,0 +1,21 @@
+/*
+ * COM Classes for msmpeg2vdec
+ *
+ * Copyright 2022 Mohamad Al-Jaf
+ *
+ * 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
--
2.36.0
More information about the wine-devel
mailing list