d3dx9: Remove a couple of spurious assignments (LLVM/Clang).
[wine/wine-gecko.git] / dlls / dmband / dmband_main.c
blobb4863a328ed0823622e52f8a181ad8d7f0efafbe
1 /* DirectMusicBand Main
3 * Copyright (C) 2003-2004 Rok Mandeljc
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.
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.
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
20 #include "dmband_private.h"
21 #include "rpcproxy.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(dmband);
25 static HINSTANCE instance;
26 LONG DMBAND_refCount = 0;
28 typedef struct {
29 const IClassFactoryVtbl *lpVtbl;
30 } IClassFactoryImpl;
32 /******************************************************************
33 * DirectMusicBand ClassFactory
36 static HRESULT WINAPI BandCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
37 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
39 if (ppobj == NULL) return E_POINTER;
41 return E_NOINTERFACE;
44 static ULONG WINAPI BandCF_AddRef(LPCLASSFACTORY iface) {
45 DMBAND_LockModule();
47 return 2; /* non-heap based object */
50 static ULONG WINAPI BandCF_Release(LPCLASSFACTORY iface) {
51 DMBAND_UnlockModule();
53 return 1; /* non-heap based object */
56 static HRESULT WINAPI BandCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
57 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
59 return DMUSIC_CreateDirectMusicBandImpl (riid, ppobj, pOuter);
62 static HRESULT WINAPI BandCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
63 TRACE("(%d)\n", dolock);
65 if (dolock)
66 DMBAND_LockModule();
67 else
68 DMBAND_UnlockModule();
70 return S_OK;
73 static const IClassFactoryVtbl BandCF_Vtbl = {
74 BandCF_QueryInterface,
75 BandCF_AddRef,
76 BandCF_Release,
77 BandCF_CreateInstance,
78 BandCF_LockServer
81 static IClassFactoryImpl Band_CF = {&BandCF_Vtbl};
84 /******************************************************************
85 * DirectMusicBandTrack ClassFactory
88 static HRESULT WINAPI BandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
89 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
91 if (ppobj == NULL) return E_POINTER;
93 return E_NOINTERFACE;
96 static ULONG WINAPI BandTrackCF_AddRef(LPCLASSFACTORY iface) {
97 DMBAND_LockModule();
99 return 2; /* non-heap based object */
102 static ULONG WINAPI BandTrackCF_Release(LPCLASSFACTORY iface) {
103 DMBAND_UnlockModule();
105 return 1; /* non-heap based object */
108 static HRESULT WINAPI BandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
109 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
111 return DMUSIC_CreateDirectMusicBandTrack (riid, ppobj, pOuter);
114 static HRESULT WINAPI BandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
115 TRACE("(%d)\n", dolock);
117 if (dolock)
118 DMBAND_LockModule();
119 else
120 DMBAND_UnlockModule();
122 return S_OK;
125 static const IClassFactoryVtbl BandTrackCF_Vtbl = {
126 BandTrackCF_QueryInterface,
127 BandTrackCF_AddRef,
128 BandTrackCF_Release,
129 BandTrackCF_CreateInstance,
130 BandTrackCF_LockServer
133 static IClassFactoryImpl BandTrack_CF = {&BandTrackCF_Vtbl};
135 /******************************************************************
136 * DllMain
140 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
141 if (fdwReason == DLL_PROCESS_ATTACH) {
142 instance = hinstDLL;
143 DisableThreadLibraryCalls(hinstDLL);
144 /* FIXME: Initialisation */
145 } else if (fdwReason == DLL_PROCESS_DETACH) {
146 /* FIXME: Cleanup */
149 return TRUE;
153 /******************************************************************
154 * DllCanUnloadNow (DMBAND.@)
158 HRESULT WINAPI DllCanUnloadNow(void)
160 return DMBAND_refCount != 0 ? S_FALSE : S_OK;
164 /******************************************************************
165 * DllGetClassObject (DMBAND.@)
169 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
171 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
173 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBand) && IsEqualIID (riid, &IID_IClassFactory)) {
174 *ppv = &Band_CF;
175 IClassFactory_AddRef((IClassFactory*)*ppv);
176 return S_OK;
177 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicBandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
178 *ppv = &BandTrack_CF;
179 IClassFactory_AddRef((IClassFactory*)*ppv);
180 return S_OK;
183 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
184 return CLASS_E_CLASSNOTAVAILABLE;
187 /***********************************************************************
188 * DllRegisterServer (DMBAND.@)
190 HRESULT WINAPI DllRegisterServer(void)
192 return __wine_register_resources( instance, NULL );
195 /***********************************************************************
196 * DllUnregisterServer (DMBAND.@)
198 HRESULT WINAPI DllUnregisterServer(void)
200 return __wine_unregister_resources( instance, NULL );