2003-03-21 01:42:38 +01:00
|
|
|
/* DirectMusic Main
|
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-03-21 01:42:38 +01:00
|
|
|
*
|
|
|
|
* 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 "dmusic_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
typedef struct {
|
2003-03-21 01:42:38 +01:00
|
|
|
/* IUnknown fields */
|
|
|
|
ICOM_VFIELD(IClassFactory);
|
|
|
|
DWORD ref;
|
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
/******************************************************************
|
|
|
|
* DirectMusic ClassFactory
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
/* static class, won't be freed */
|
|
|
|
return --(This->ref);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
2003-06-13 20:59:51 +02:00
|
|
|
TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
2004-01-20 01:21:40 +01:00
|
|
|
return DMUSIC_CreateDirectMusicImpl (riid, (LPVOID*) ppobj, pOuter);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2003-08-23 01:53:27 +02:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
FIXME("(%p)->(%d),stub!\n", This, dolock);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ICOM_VTABLE(IClassFactory) DirectMusicCF_Vtbl = {
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
|
|
|
DirectMusicCF_QueryInterface,
|
|
|
|
DirectMusicCF_AddRef,
|
|
|
|
DirectMusicCF_Release,
|
|
|
|
DirectMusicCF_CreateInstance,
|
|
|
|
DirectMusicCF_LockServer
|
|
|
|
};
|
|
|
|
|
|
|
|
static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl, 1 };
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DirectMusicCollection ClassFactory
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2003-08-23 01:53:27 +02:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) {
|
2003-08-23 01:53:27 +02:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
return ++(This->ref);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) {
|
2003-08-23 01:53:27 +02:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
/* static class, won't be freed */
|
|
|
|
return --(This->ref);
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
2003-08-23 01:53:27 +02:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
|
|
|
TRACE ("(%p)->(%p,%s,%p)\n", This, pOuter, debugstr_guid(riid), ppobj);
|
2004-01-20 01:21:40 +01:00
|
|
|
return DMUSIC_CreateDirectMusicCollectionImpl (riid, ppobj, pOuter);
|
2003-03-21 01:42:38 +01:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:21:40 +01:00
|
|
|
static HRESULT WINAPI CollectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_THIS(IClassFactoryImpl,iface);
|
2003-06-13 20:59:51 +02:00
|
|
|
FIXME("(%p)->(%d),stub!\n", This, dolock);
|
2003-03-21 01:42:38 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static ICOM_VTABLE(IClassFactory) CollectionCF_Vtbl = {
|
2003-03-21 01:42:38 +01:00
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
2003-08-23 01:53:27 +02:00
|
|
|
CollectionCF_QueryInterface,
|
|
|
|
CollectionCF_AddRef,
|
|
|
|
CollectionCF_Release,
|
|
|
|
CollectionCF_CreateInstance,
|
|
|
|
CollectionCF_LockServer
|
2003-03-21 01:42:38 +01:00
|
|
|
};
|
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl, 1 };
|
2003-03-21 01:42:38 +01:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllMain
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
2003-06-30 22:53:48 +02:00
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
2003-03-21 01:42:38 +01:00
|
|
|
/* FIXME: Initialisation */
|
2004-01-20 01:21:40 +01:00
|
|
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
2003-03-21 01:42:38 +01:00
|
|
|
/* FIXME: Cleanup */
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllCanUnloadNow (DMUSIC.1)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
HRESULT WINAPI DMUSIC_DllCanUnloadNow(void) {
|
2003-03-21 01:42:38 +01:00
|
|
|
FIXME("(void): stub\n");
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllGetClassObject (DMUSIC.2)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2004-01-20 01:21:40 +01:00
|
|
|
HRESULT WINAPI DMUSIC_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
|
2003-08-23 01:53:27 +02:00
|
|
|
TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
if (IsEqualCLSID (rclsid, &CLSID_DirectMusic) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &DirectMusic_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCollection) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &Collection_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2003-03-21 01:42:38 +01:00
|
|
|
WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|