Sweden-Number/dlls/dmloader/dmloader_main.c

89 lines
2.8 KiB
C
Raw Normal View History

2003-07-22 00:10:14 +02:00
/* DirectMusicLoader Main
*
* Copyright (C) 2003-2004 Rok Mandeljc
2003-07-22 00:10:14 +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
* 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
*
* 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"
#include "rpcproxy.h"
2003-07-22 00:10:14 +02:00
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
2003-07-22 00:10:14 +02: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
*/
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
2003-07-22 00:10:14 +02:00
/* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) {
2003-07-22 00:10:14 +02:00
/* FIXME: Cleanup */
}
return TRUE;
}
/******************************************************************
* DllCanUnloadNow (DMLOADER.@)
2003-07-22 00:10:14 +02:00
*/
HRESULT WINAPI DllCanUnloadNow (void)
{
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
}
/******************************************************************
* DllGetClassObject (DMLOADER.@)
2003-07-22 00:10:14 +02:00
*/
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
return DMUSIC_CreateDirectMusicLoaderCF (riid, ppv, NULL);
} else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) {
return DMUSIC_CreateDirectMusicContainerCF (riid, ppv, NULL);
}
WARN(": no class found\n");
2003-07-22 00:10:14 +02:00
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (DMLOADER.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance, NULL );
}
/***********************************************************************
* DllUnregisterServer (DMLOADER.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance, NULL );
}