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
20 #include "wmp_private.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
)
33 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
34 TRACE("(%p)->(IID_IUnknown %p)\n", iface
, ppv
);
36 }else if(IsEqualGUID(&IID_IClassFactory
, riid
)) {
37 TRACE("(%p)->(IID_IClassFactory %p)\n", iface
, ppv
);
42 IUnknown_AddRef((IUnknown
*)*ppv
);
46 FIXME("(%p)->(%s %p)\n", iface
, debugstr_guid(riid
), ppv
);
50 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
52 TRACE("(%p)\n", iface
);
56 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
58 TRACE("(%p)\n", iface
);
62 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
64 TRACE("(%p)->(%x)\n", iface
, fLock
);
68 static const IClassFactoryVtbl WMPFactoryVtbl
= {
69 ClassFactory_QueryInterface
,
72 WMPFactory_CreateInstance
,
73 ClassFactory_LockServer
76 static IClassFactory WMPFactory
= { &WMPFactoryVtbl
};
78 /******************************************************************
81 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
83 TRACE("(%p %d %p)\n", hInstDLL
, fdwReason
, lpv
);
86 case DLL_WINE_PREATTACH
:
87 return FALSE
; /* prefer native version */
88 case DLL_PROCESS_ATTACH
:
89 DisableThreadLibraryCalls(hInstDLL
);
90 wmp_instance
= hInstDLL
;
92 case DLL_PROCESS_DETACH
:
93 unregister_wmp_class();
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)
123 /***********************************************************************
124 * DllRegisterServer (wmp.@)
126 HRESULT WINAPI
DllRegisterServer(void)
129 return __wine_register_resources(wmp_instance
);
132 /***********************************************************************
133 * DllUnregisterServer (wmp.@)
135 HRESULT WINAPI
DllUnregisterServer(void)
138 return __wine_unregister_resources(wmp_instance
);