dmime: Finish the reindentation in CloseDown().
[wine.git] / dlls / wmp / wmp_main.c
blob29b096f7fd1e679f0de3d5d53129d2ecc187b746
1 /*
2 * Copyright 2014 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "initguid.h"
20 #include "wmp_private.h"
21 #include "rpcproxy.h"
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(wmp);
27 HINSTANCE wmp_instance;
29 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
31 *ppv = NULL;
33 if(IsEqualGUID(&IID_IUnknown, riid)) {
34 TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
35 *ppv = iface;
36 }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
37 TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
38 *ppv = iface;
41 if(*ppv) {
42 IUnknown_AddRef((IUnknown*)*ppv);
43 return S_OK;
46 FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
47 return E_NOINTERFACE;
50 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
52 TRACE("(%p)\n", iface);
53 return 2;
56 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
58 TRACE("(%p)\n", iface);
59 return 1;
62 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
64 TRACE("(%p)->(%x)\n", iface, fLock);
65 return S_OK;
68 static const IClassFactoryVtbl WMPFactoryVtbl = {
69 ClassFactory_QueryInterface,
70 ClassFactory_AddRef,
71 ClassFactory_Release,
72 WMPFactory_CreateInstance,
73 ClassFactory_LockServer
76 static IClassFactory WMPFactory = { &WMPFactoryVtbl };
78 /******************************************************************
79 * DllMain (wmp.@)
81 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
83 TRACE("(%p %d %p)\n", hInstDLL, fdwReason, lpv);
85 switch(fdwReason) {
86 case DLL_WINE_PREATTACH:
87 return FALSE; /* prefer native version */
88 case DLL_PROCESS_ATTACH:
89 DisableThreadLibraryCalls(hInstDLL);
90 wmp_instance = hInstDLL;
91 break;
92 case DLL_PROCESS_DETACH:
93 unregister_wmp_class();
94 break;
97 return TRUE;
100 /***********************************************************************
101 * DllGetClassObject (wmp.@)
103 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
105 if(IsEqualGUID(&CLSID_WindowsMediaPlayer, rclsid)) {
106 TRACE("(CLSID_WindowsMediaPlayer %s %p)\n", debugstr_guid(riid), ppv);
107 return IClassFactory_QueryInterface(&WMPFactory, riid, ppv);
110 FIXME("Unknown object %s\n", debugstr_guid(rclsid));
111 return CLASS_E_CLASSNOTAVAILABLE;
114 /***********************************************************************
115 * DllCanUnloadNow (wmp.@)
117 HRESULT WINAPI DllCanUnloadNow(void)
119 TRACE("\n");
120 return S_FALSE;
123 /***********************************************************************
124 * DllRegisterServer (wmp.@)
126 HRESULT WINAPI DllRegisterServer(void)
128 TRACE("()\n");
129 return __wine_register_resources(wmp_instance);
132 /***********************************************************************
133 * DllUnregisterServer (wmp.@)
135 HRESULT WINAPI DllUnregisterServer(void)
137 TRACE("()\n");
138 return __wine_unregister_resources(wmp_instance);