2003-07-22 00:10:14 +02:00
|
|
|
/* DirectMusicLoader Main
|
|
|
|
*
|
2004-01-20 01:21:40 +01:00
|
|
|
* Copyright (C) 2003-2004 Rok Mandeljc
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02: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-22 00:10:14 +02: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 12:54:07 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2003-07-22 00:10:14 +02:00
|
|
|
*
|
2007-05-30 12:54:07 +02: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-22 00:10:14 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "dmloader_private.h"
|
2010-12-03 12:36:54 +01:00
|
|
|
#include "rpcproxy.h"
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2003-08-23 01:53:27 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
|
2003-07-22 00:10:14 +02:00
|
|
|
|
2010-12-03 12:36:54 +01:00
|
|
|
static HINSTANCE instance;
|
2005-07-05 13:02:54 +02:00
|
|
|
LONG dwDirectMusicContainer = 0;
|
|
|
|
LONG dwDirectMusicLoader = 0;
|
2003-07-22 00:10:14 +02:00
|
|
|
|
|
|
|
/******************************************************************
|
|
|
|
* DllMain
|
|
|
|
*/
|
2004-05-13 02:00:22 +02:00
|
|
|
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
2004-01-20 01:21:40 +01:00
|
|
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
2010-12-03 12:36:54 +01:00
|
|
|
instance = hinstDLL;
|
2004-05-13 02:00:22 +02:00
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
2003-07-22 00:10:14 +02:00
|
|
|
/* FIXME: Initialisation */
|
2004-05-13 02:00:22 +02:00
|
|
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
2003-07-22 00:10:14 +02:00
|
|
|
/* FIXME: Cleanup */
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
2005-08-10 16:45:58 +02:00
|
|
|
* DllCanUnloadNow (DMLOADER.@)
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllCanUnloadNow (void)
|
|
|
|
{
|
2004-05-13 02:00:22 +02:00
|
|
|
TRACE("(void)\n");
|
|
|
|
/* if there are no instances left, it's safe to release */
|
|
|
|
if (!dwDirectMusicContainer && !dwDirectMusicLoader)
|
|
|
|
return S_OK;
|
|
|
|
else
|
|
|
|
return S_FALSE;
|
2003-07-22 00:10:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************
|
2005-08-10 11:53:47 +02:00
|
|
|
* DllGetClassObject (DMLOADER.@)
|
2003-07-22 00:10:14 +02:00
|
|
|
*/
|
2005-08-08 19:35:28 +02:00
|
|
|
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
|
|
|
{
|
2004-02-25 02:30:03 +01:00
|
|
|
TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
|
2003-08-23 01:53:27 +02:00
|
|
|
if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
|
2004-05-13 02:00:22 +02:00
|
|
|
return DMUSIC_CreateDirectMusicLoaderCF (riid, ppv, NULL);
|
2003-08-23 01:53:27 +02:00
|
|
|
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) {
|
2004-05-13 02:00:22 +02:00
|
|
|
return DMUSIC_CreateDirectMusicContainerCF (riid, ppv, NULL);
|
2003-08-23 01:53:27 +02:00
|
|
|
}
|
|
|
|
|
2004-05-13 02:00:22 +02:00
|
|
|
WARN(": no class found\n");
|
2003-07-22 00:10:14 +02:00
|
|
|
return CLASS_E_CLASSNOTAVAILABLE;
|
|
|
|
}
|
2010-12-03 12:36:54 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllRegisterServer (DMLOADER.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllRegisterServer(void)
|
|
|
|
{
|
|
|
|
return __wine_register_resources( instance, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* DllUnregisterServer (DMLOADER.@)
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI DllUnregisterServer(void)
|
|
|
|
{
|
|
|
|
return __wine_unregister_resources( instance, NULL );
|
|
|
|
}
|