1 /* DirectMusicLoader Main
3 * Copyright (C) 2003-2004 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include "dmloader_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmloader
);
24 DWORD dwDirectMusicContainer
= 0;
25 DWORD dwDirectMusicLoader
= 0;
27 /******************************************************************
30 BOOL WINAPI
DllMain (HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
) {
31 if (fdwReason
== DLL_PROCESS_ATTACH
) {
32 DisableThreadLibraryCalls(hinstDLL
);
33 /* FIXME: Initialisation */
34 } else if (fdwReason
== DLL_PROCESS_DETACH
) {
41 /******************************************************************
42 * DllCanUnloadNow (DMLOADER.1)
44 HRESULT WINAPI
DMLOADER_DllCanUnloadNow (void) {
46 /* if there are no instances left, it's safe to release */
47 if (!dwDirectMusicContainer
&& !dwDirectMusicLoader
)
54 /******************************************************************
55 * DllGetClassObject (DMLOADER.2)
57 HRESULT WINAPI
DMLOADER_DllGetClassObject (REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
) {
58 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
59 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicLoader
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
60 return DMUSIC_CreateDirectMusicLoaderCF (riid
, ppv
, NULL
);
61 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicContainer
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
62 return DMUSIC_CreateDirectMusicContainerCF (riid
, ppv
, NULL
);
65 WARN(": no class found\n");
66 return CLASS_E_CLASSNOTAVAILABLE
;