2003-07-22 00:10:14 +02:00
|
|
|
/* DirectMusicLoader Main
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Rok Mandeljc
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmloader_private.h"
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
|
|
|
ICOM_VFIELD(IClassFactory);
|
|
|
|
DWORD ref;
|
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
/******************************************************************
|
|
|
|
* DirectMusicLoader ClassFactory
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI LoaderCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
2003-07-22 00:10:14 +02:00
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static ULONG WINAPI LoaderCF_AddRef(LPCLASSFACTORY iface)
|
2003-07-22 00:10:14 +02:00
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static ULONG WINAPI LoaderCF_Release(LPCLASSFACTORY iface)
|
2003-07-22 00:10:14 +02:00
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
/* static class, won't be freed */
|
|
|
|
return --(This->ref);
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static HRESULT WINAPI LoaderCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
|
2003-07-22 00:10:14 +02:00
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualIID (&IID_IDirectMusicLoader, riid) ||
|
|
|
|
IsEqualIID (&IID_IDirectMusicLoader8, riid)) {
|
2003-07-22 00:10:14 +02:00
|
|
|
return DMUSIC_CreateDirectMusicLoader(riid, (LPDIRECTMUSICLOADER8*) ppobj, pOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static HRESULT WINAPI LoaderCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
|
2003-07-22 00:10:14 +02:00
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
FIXME("(%p)->(%d),stub!\n", This, dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static ICOM_VTABLE(IClassFactory) LoaderCF_Vtbl = {
|
2003-07-22 00:10:14 +02:00
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
2003-08-23 01:53:27 +02:00
|
|
|
LoaderCF_QueryInterface,
|
|
|
|
LoaderCF_AddRef,
|
|
|
|
LoaderCF_Release,
|
|
|
|
LoaderCF_CreateInstance,
|
|
|
|
LoaderCF_LockServer
|
2003-07-22 00:10:14 +02:00
|
|
|
};
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static IClassFactoryImpl Loader_CF = {&LoaderCF_Vtbl, 1 };
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DirectMusicContainer ClassFactory
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI ContainerCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ContainerCF_AddRef(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ContainerCF_Release(LPCLASSFACTORY iface)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
/* static class, won't be freed */
|
|
|
|
return --(This->ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContainerCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
|
|
|
|
TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
|
|
|
if (IsEqualIID (riid, &IID_IDirectMusicContainer)) {
|
|
|
|
return DMUSIC_CreateDirectMusicContainer (riid, (LPDIRECTMUSICCONTAINER*) ppobj, pOuter);
|
|
|
|
} else if (IsEqualIID (riid, &IID_IDirectMusicObject)) {
|
|
|
|
return DMUSIC_CreateDirectMusicContainerObject (riid, (LPDIRECTMUSICOBJECT*) ppobj, pOuter);
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ContainerCF_LockServer(LPCLASSFACTORY iface,BOOL dolock)
|
|
|
|
{
|
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
FIXME("(%p)->(%d),stub!\n", This, dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IClassFactory) ContainerCF_Vtbl = {
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
ContainerCF_QueryInterface,
|
|
|
|
ContainerCF_AddRef,
|
|
|
|
ContainerCF_Release,
|
|
|
|
ContainerCF_CreateInstance,
|
|
|
|
ContainerCF_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactoryImpl Container_CF = {&ContainerCF_Vtbl, 1 };
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllMain
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH)
|
|
|
|
{
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
/* FIXME: Initialisation */
|
|
|
|
}
|
|
|
|
else if (fdwReason == DLL_PROCESS_DETACH)
|
|
|
|
{
|
|
|
|
/* FIXME: Cleanup */
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllCanUnloadNow (DMLOADER.1)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DMLOADER_DllCanUnloadNow(void)
|
|
|
|
{
|
|
|
|
FIXME("(void): stub\n");
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllGetClassObject (DMLOADER.2)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DMLOADER_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
|
|
|
TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &Loader_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &Container_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-07-22 00:10:14 +02:00
|
|
|
WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|