1 /* DirectMusicSynthesizer Main
3 * Copyright (C) 2003 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 "dmsynth_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmsynth
);
27 ICOM_VFIELD(IClassFactory
);
31 /******************************************************************
32 * DirectMusicSynth ClassFactory
34 static HRESULT WINAPI
SynthCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
36 ICOM_THIS(IClassFactoryImpl
,iface
);
38 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
42 static ULONG WINAPI
SynthCF_AddRef(LPCLASSFACTORY iface
)
44 ICOM_THIS(IClassFactoryImpl
,iface
);
48 static ULONG WINAPI
SynthCF_Release(LPCLASSFACTORY iface
)
50 ICOM_THIS(IClassFactoryImpl
,iface
);
51 /* static class, won't be freed */
55 static HRESULT WINAPI
SynthCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
57 ICOM_THIS(IClassFactoryImpl
,iface
);
59 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
60 if (IsEqualIID (riid
, &IID_IDirectMusicSynth
) ||
61 IsEqualIID (riid
, &IID_IDirectMusicSynth8
)) {
62 return DMUSIC_CreateDirectMusicSynth (riid
, (LPDIRECTMUSICSYNTH8
*)ppobj
, pOuter
);
65 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
69 static HRESULT WINAPI
SynthCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
71 ICOM_THIS(IClassFactoryImpl
,iface
);
72 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
76 static ICOM_VTABLE(IClassFactory
) SynthCF_Vtbl
= {
77 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
78 SynthCF_QueryInterface
,
81 SynthCF_CreateInstance
,
85 static IClassFactoryImpl Synth_CF
= {&SynthCF_Vtbl
, 1 };
87 /******************************************************************
88 * DirectMusicSynthSink ClassFactory
90 static HRESULT WINAPI
SynthSinkCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
)
92 ICOM_THIS(IClassFactoryImpl
,iface
);
94 FIXME("(%p)->(%s,%p),stub!\n",This
,debugstr_guid(riid
),ppobj
);
98 static ULONG WINAPI
SynthSinkCF_AddRef(LPCLASSFACTORY iface
)
100 ICOM_THIS(IClassFactoryImpl
,iface
);
101 return ++(This
->ref
);
104 static ULONG WINAPI
SynthSinkCF_Release(LPCLASSFACTORY iface
)
106 ICOM_THIS(IClassFactoryImpl
,iface
);
107 /* static class, won't be freed */
108 return --(This
->ref
);
111 static HRESULT WINAPI
SynthSinkCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
)
113 ICOM_THIS(IClassFactoryImpl
,iface
);
115 TRACE ("(%p)->(%p,%s,%p)\n", This
, pOuter
, debugstr_guid(riid
), ppobj
);
116 if (IsEqualIID (riid
, &IID_IDirectMusicSynthSink
)) {
117 return DMUSIC_CreateDirectMusicSynthSink (riid
, (LPDIRECTMUSICSYNTHSINK
*)ppobj
, pOuter
);
120 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
121 return E_NOINTERFACE
;
124 static HRESULT WINAPI
SynthSinkCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
)
126 ICOM_THIS(IClassFactoryImpl
,iface
);
127 FIXME("(%p)->(%d),stub!\n", This
, dolock
);
131 static ICOM_VTABLE(IClassFactory
) SynthSinkCF_Vtbl
= {
132 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
133 SynthSinkCF_QueryInterface
,
136 SynthSinkCF_CreateInstance
,
137 SynthSinkCF_LockServer
140 static IClassFactoryImpl SynthSink_CF
= {&SynthSinkCF_Vtbl
, 1 };
142 /******************************************************************
147 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
149 if (fdwReason
== DLL_PROCESS_ATTACH
)
151 DisableThreadLibraryCalls(hinstDLL
);
152 /* FIXME: Initialisation */
154 else if (fdwReason
== DLL_PROCESS_DETACH
)
163 /******************************************************************
164 * DllCanUnloadNow (DMSYNTH.1)
168 HRESULT WINAPI
DMSYNTH_DllCanUnloadNow(void)
170 FIXME("(void): stub\n");
176 /******************************************************************
177 * DllGetClassObject (DMSYNTH.2)
181 HRESULT WINAPI
DMSYNTH_DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
183 TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
184 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicSynth
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
185 *ppv
= (LPVOID
) &Synth_CF
;
186 IClassFactory_AddRef((IClassFactory
*)*ppv
);
188 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicSynth
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
189 *ppv
= (LPVOID
) &SynthSink_CF
;
190 IClassFactory_AddRef((IClassFactory
*)*ppv
);
194 WARN("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
195 return CLASS_E_CLASSNOTAVAILABLE
;