2003-07-21 22:10:14 +00:00
|
|
|
/* DirectMusicBand Main
|
|
|
|
*
|
2004-01-20 00:21:40 +00:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-21 22:10:14 +00:00
|
|
|
*
|
2007-05-30 10:54:07 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2003-07-21 22:10:14 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2007-05-30 10:54:07 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-07-21 22:10:14 +00:00
|
|
|
*
|
2007-05-30 10:54:07 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-07-21 22:10:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmband_private.h"
|
|
|
|
|
2003-08-22 23:53:27 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmband);
|
2003-07-21 22:10:14 +00:00
|
|
|
|
2005-01-31 20:40:26 +00:00
|
|
|
LONG DMBAND_refCount = 0;
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
typedef struct {
|
2005-05-30 10:01:08 +00:00
|
|
|
const IClassFactoryVtbl *lpVtbl;
|
2003-07-21 22:10:14 +00:00
|
|
|
} IClassFactoryImpl;
|
|
|
|
|
2003-08-22 23:53:27 +00:00
|
|
|
/******************************************************************
|
|
|
|
* DirectMusicBand ClassFactory
|
|
|
|
*/
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2005-01-31 20:40:26 +00:00
|
|
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
|
|
|
|
|
|
|
if (ppobj == NULL) return E_POINTER;
|
|
|
|
|
2003-07-21 22:10:14 +00:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) {
|
2005-01-31 20:40:26 +00:00
|
|
|
DMBAND_LockModule();
|
|
|
|
|
|
|
|
return 2; /* non-heap based object */
|
2003-07-21 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) {
|
2005-01-31 20:40:26 +00:00
|
|
|
DMBAND_UnlockModule();
|
|
|
|
|
|
|
|
return 1; /* non-heap based object */
|
2003-07-21 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
2005-01-31 20:40:26 +00:00
|
|
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
return DMUSIC_CreateDirectMusicBandImpl (riid, ppobj, pOuter);
|
2003-08-22 23:53:27 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2005-01-31 20:40:26 +00:00
|
|
|
TRACE("(%d)\n", dolock);
|
|
|
|
|
|
|
|
if (dolock)
|
|
|
|
DMBAND_LockModule();
|
|
|
|
else
|
|
|
|
DMBAND_UnlockModule();
|
|
|
|
|
2003-08-22 23:53:27 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
2003-07-21 22:10:14 +00:00
|
|
|
|
2005-05-30 10:01:08 +00:00
|
|
|
static const IClassFactoryVtbl BandCF_Vtbl = {
|
2003-08-22 23:53:27 +00:00
|
|
|
BandCF_QueryInterface,
|
|
|
|
BandCF_AddRef,
|
|
|
|
BandCF_Release,
|
|
|
|
BandCF_CreateInstance,
|
|
|
|
BandCF_LockServer
|
|
|
|
};
|
|
|
|
|
2005-01-31 20:40:26 +00:00
|
|
|
static IClassFactoryImpl Band_CF = {&BandCF_Vtbl};
|
2003-08-22 23:53:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DirectMusicBandTrack ClassFactory
|
|
|
|
*/
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
|
2005-01-31 20:40:26 +00:00
|
|
|
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
|
|
|
|
|
|
|
|
if (ppobj == NULL) return E_POINTER;
|
|
|
|
|
2003-08-22 23:53:27 +00:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) {
|
2005-01-31 20:40:26 +00:00
|
|
|
DMBAND_LockModule();
|
|
|
|
|
|
|
|
return 2; /* non-heap based object */
|
2003-08-22 23:53:27 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) {
|
2005-01-31 20:40:26 +00:00
|
|
|
DMBAND_UnlockModule();
|
|
|
|
|
|
|
|
return 1; /* non-heap based object */
|
2003-08-22 23:53:27 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
|
2005-01-31 20:40:26 +00:00
|
|
|
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
return DMUSIC_CreateDirectMusicBandTrack (riid, ppobj, pOuter);
|
2003-07-21 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
2004-01-20 00:21:40 +00:00
|
|
|
static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
|
2005-01-31 20:40:26 +00:00
|
|
|
TRACE("(%d)\n", dolock);
|
|
|
|
|
|
|
|
if (dolock)
|
|
|
|
DMBAND_LockModule();
|
|
|
|
else
|
|
|
|
DMBAND_UnlockModule();
|
|
|
|
|
2003-07-21 22:10:14 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-05-30 10:01:08 +00:00
|
|
|
static const IClassFactoryVtbl BandTrackCF_Vtbl = {
|
2003-08-22 23:53:27 +00:00
|
|
|
BandTrackCF_QueryInterface,
|
|
|
|
BandTrackCF_AddRef,
|
|
|
|
BandTrackCF_Release,
|
|
|
|
BandTrackCF_CreateInstance,
|
|
|
|
BandTrackCF_LockServer
|
2003-07-21 22:10:14 +00:00
|
|
|
};
|
|
|
|
|
2005-01-31 20:40:26 +00:00
|
|
|
static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl};
|
2003-07-21 22:10:14 +00:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllMain
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2004-01-20 00:21:40 +00:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
2003-07-21 22:10:14 +00:00
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
|
|
|
/* FIXME: Initialisation */
|
2004-01-20 00:21:40 +00:00
|
|
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
2003-07-21 22:10:14 +00:00
|
|
|
/* FIXME: Cleanup */
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
2005-08-10 14:45:58 +00:00
|
|
|
* DllCanUnloadNow (DMBAND.@)
|
2003-07-21 22:10:14 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2005-08-08 17:35:28 +00:00
|
|
|
HRESULT WINAPI DllCanUnloadNow(void)
|
|
|
|
{
|
2005-01-31 20:40:26 +00:00
|
|
|
return DMBAND_refCount != 0 ? S_FALSE : S_OK;
|
2003-07-21 22:10:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
2005-08-10 09:53:47 +00:00
|
|
|
* DllGetClassObject (DMBAND.@)
|
2003-07-21 22:10:14 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2005-08-08 17:35:28 +00:00
|
|
|
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2004-02-25 01:30:03 +00:00
|
|
|
TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
|
2003-08-22 23:53:27 +00:00
|
|
|
|
|
|
|
if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBand) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &Band_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
|
|
|
|
*ppv = (LPVOID) &BandTrack_CF;
|
|
|
|
IClassFactory_AddRef((IClassFactory*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2004-02-25 01:30:03 +00:00
|
|
|
WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
|
2003-07-21 22:10:14 +00:00
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|