From 068a9daec7a27ec10478468297939f01e2404605 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 25 Jan 2014 18:21:57 +0100 Subject: [PATCH] wmp: Added WindowsMediaPlayer class factory. --- dlls/wmp/wmp_main.c | 67 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/dlls/wmp/wmp_main.c b/dlls/wmp/wmp_main.c index c0933f242de..ebce0a5324c 100644 --- a/dlls/wmp/wmp_main.c +++ b/dlls/wmp/wmp_main.c @@ -16,9 +16,13 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define COBJMACROS + +#include "initguid.h" #include "windows.h" #include "ole2.h" #include "rpcproxy.h" +#include "wmp.h" #include "wine/debug.h" @@ -26,6 +30,62 @@ WINE_DEFAULT_DEBUG_CHANNEL(wmp); static HINSTANCE wmp_instance; +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv); + *ppv = iface; + }else if(IsEqualGUID(&IID_IClassFactory, riid)) { + TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv); + *ppv = iface; + } + + if(*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + + FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + TRACE("(%p)\n", iface); + return 2; +} + +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + TRACE("(%p)\n", iface); + return 1; +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock) +{ + TRACE("(%p)->(%x)\n", iface, fLock); + return S_OK; +} + +static HRESULT WINAPI WMPFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, + REFIID riid, void **ppv) +{ + FIXME("(%p %s %p)\n", outer, debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +static const IClassFactoryVtbl WMPFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + WMPFactory_CreateInstance, + ClassFactory_LockServer +}; + +static IClassFactory WMPFactory = { &WMPFactoryVtbl }; + /****************************************************************** * DllMain (wmp.@) */ @@ -50,7 +110,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { - FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + if(IsEqualGUID(&CLSID_WindowsMediaPlayer, rclsid)) { + TRACE("(CLSID_WindowsMediaPlayer %s %p)\n", debugstr_guid(riid), ppv); + return IClassFactory_QueryInterface(&WMPFactory, riid, ppv); + } + + FIXME("Unknown object %s\n", debugstr_guid(rclsid)); return CLASS_E_CLASSNOTAVAILABLE; }