msacm32: Update Korean resource.
[wine] / dlls / dmloader / dmloader_main.c
1 /* DirectMusicLoader Main
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #include "dmloader_private.h"
21 #include "rpcproxy.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
24
25 static HINSTANCE instance;
26 LONG dwDirectMusicContainer = 0;
27 LONG dwDirectMusicLoader = 0;
28
29 /******************************************************************
30  *              DllMain
31  */
32 BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
33         if (fdwReason == DLL_PROCESS_ATTACH) {
34                 instance = hinstDLL;
35                 DisableThreadLibraryCalls(hinstDLL);
36                 /* FIXME: Initialisation */
37         } else if (fdwReason == DLL_PROCESS_DETACH) {
38                 /* FIXME: Cleanup */
39         }
40         return TRUE;
41 }
42
43
44 /******************************************************************
45  *              DllCanUnloadNow (DMLOADER.@)
46  */
47 HRESULT WINAPI DllCanUnloadNow (void)
48 {
49     TRACE("(void)\n");
50         /* if there are no instances left, it's safe to release */
51         if (!dwDirectMusicContainer && !dwDirectMusicLoader)
52                 return S_OK;
53         else
54         return S_FALSE;
55 }
56
57
58 /******************************************************************
59  *              DllGetClassObject (DMLOADER.@)
60  */
61 HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID *ppv)
62 {
63     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
64     if (IsEqualCLSID (rclsid, &CLSID_DirectMusicLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
65                 return DMUSIC_CreateDirectMusicLoaderCF (riid, ppv, NULL);
66         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicContainer) && IsEqualIID (riid, &IID_IClassFactory)) {
67                 return DMUSIC_CreateDirectMusicContainerCF (riid, ppv, NULL);           
68         }
69         
70     WARN(": no class found\n");
71     return CLASS_E_CLASSNOTAVAILABLE;
72 }
73
74 /***********************************************************************
75  *              DllRegisterServer (DMLOADER.@)
76  */
77 HRESULT WINAPI DllRegisterServer(void)
78 {
79     return __wine_register_resources( instance, NULL );
80 }
81
82 /***********************************************************************
83  *              DllUnregisterServer (DMLOADER.@)
84  */
85 HRESULT WINAPI DllUnregisterServer(void)
86 {
87     return __wine_unregister_resources( instance, NULL );
88 }