1 /* DirectMusicStyle 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 "dmstyle_private.h"
22 WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
24 LONG DMSTYLE_refCount = 0;
27 const IClassFactoryVtbl *lpVtbl;
30 /******************************************************************
31 * DirectMusicSection ClassFactory
33 static HRESULT WINAPI SectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
34 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
36 if (ppobj == NULL) return E_POINTER;
41 static ULONG WINAPI SectionCF_AddRef(LPCLASSFACTORY iface) {
44 return 2; /* non-heap based object */
47 static ULONG WINAPI SectionCF_Release(LPCLASSFACTORY iface) {
48 DMSTYLE_UnlockModule();
50 return 1; /* non-heap based object */
53 static HRESULT WINAPI SectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
54 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
56 /* nothing here yet */
57 WARN("(%s, %p): not found\n", debugstr_dmguid(riid), ppobj);
62 static HRESULT WINAPI SectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
63 TRACE("(%d)\n", dolock);
68 DMSTYLE_UnlockModule();
73 static const IClassFactoryVtbl SectionCF_Vtbl = {
74 SectionCF_QueryInterface,
77 SectionCF_CreateInstance,
81 static IClassFactoryImpl Section_CF = {&SectionCF_Vtbl};
83 /******************************************************************
84 * DirectMusicStyle ClassFactory
86 static HRESULT WINAPI StyleCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
87 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
89 if (ppobj == NULL) return E_POINTER;
94 static ULONG WINAPI StyleCF_AddRef(LPCLASSFACTORY iface) {
97 return 2; /* non-heap based object */
100 static ULONG WINAPI StyleCF_Release(LPCLASSFACTORY iface) {
101 DMSTYLE_UnlockModule();
103 return 1; /* non-heap based object */
106 static HRESULT WINAPI StyleCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
107 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
109 return DMUSIC_CreateDirectMusicStyleImpl (riid, ppobj, pOuter);
112 static HRESULT WINAPI StyleCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
113 TRACE("(%d)\n", dolock);
116 DMSTYLE_LockModule();
118 DMSTYLE_UnlockModule();
123 static const IClassFactoryVtbl StyleCF_Vtbl = {
124 StyleCF_QueryInterface,
127 StyleCF_CreateInstance,
131 static IClassFactoryImpl Style_CF = {&StyleCF_Vtbl};
133 /******************************************************************
134 * DirectMusicChordTrack ClassFactory
136 static HRESULT WINAPI ChordTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
137 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
139 if (ppobj == NULL) return E_POINTER;
141 return E_NOINTERFACE;
144 static ULONG WINAPI ChordTrackCF_AddRef(LPCLASSFACTORY iface) {
145 DMSTYLE_LockModule();
147 return 2; /* non-heap based object */
150 static ULONG WINAPI ChordTrackCF_Release(LPCLASSFACTORY iface) {
151 DMSTYLE_UnlockModule();
153 return 1; /* non-heap based object */
156 static HRESULT WINAPI ChordTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
157 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
159 return DMUSIC_CreateDirectMusicChordTrack (riid, ppobj, pOuter);
162 static HRESULT WINAPI ChordTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
163 TRACE("(%d)\n", dolock);
166 DMSTYLE_LockModule();
168 DMSTYLE_UnlockModule();
173 static const IClassFactoryVtbl ChordTrackCF_Vtbl = {
174 ChordTrackCF_QueryInterface,
176 ChordTrackCF_Release,
177 ChordTrackCF_CreateInstance,
178 ChordTrackCF_LockServer
181 static IClassFactoryImpl ChordTrack_CF = {&ChordTrackCF_Vtbl};
183 /******************************************************************
184 * DirectMusicCommandTrack ClassFactory
186 static HRESULT WINAPI CommandTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
187 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
189 if (ppobj == NULL) return E_POINTER;
191 return E_NOINTERFACE;
194 static ULONG WINAPI CommandTrackCF_AddRef(LPCLASSFACTORY iface) {
195 DMSTYLE_LockModule();
197 return 2; /* non-heap based object */
200 static ULONG WINAPI CommandTrackCF_Release(LPCLASSFACTORY iface) {
201 DMSTYLE_UnlockModule();
203 return 1; /* non-heap based object */
206 static HRESULT WINAPI CommandTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
207 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
209 return DMUSIC_CreateDirectMusicCommandTrack (riid, ppobj, pOuter);
212 static HRESULT WINAPI CommandTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
213 TRACE("(%d)\n", dolock);
216 DMSTYLE_LockModule();
218 DMSTYLE_UnlockModule();
223 static const IClassFactoryVtbl CommandTrackCF_Vtbl = {
224 CommandTrackCF_QueryInterface,
225 CommandTrackCF_AddRef,
226 CommandTrackCF_Release,
227 CommandTrackCF_CreateInstance,
228 CommandTrackCF_LockServer
231 static IClassFactoryImpl CommandTrack_CF = {&CommandTrackCF_Vtbl};
233 /******************************************************************
234 * DirectMusicStyleTrack ClassFactory
236 static HRESULT WINAPI StyleTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
237 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
239 if (ppobj == NULL) return E_POINTER;
241 return E_NOINTERFACE;
244 static ULONG WINAPI StyleTrackCF_AddRef(LPCLASSFACTORY iface) {
245 DMSTYLE_LockModule();
247 return 2; /* non-heap based object */
250 static ULONG WINAPI StyleTrackCF_Release(LPCLASSFACTORY iface) {
251 DMSTYLE_UnlockModule();
253 return 1; /* non-heap based object */
256 static HRESULT WINAPI StyleTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
257 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
259 return DMUSIC_CreateDirectMusicStyleTrack (riid, ppobj, pOuter);
262 static HRESULT WINAPI StyleTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
263 TRACE("(%d)\n", dolock);
266 DMSTYLE_LockModule();
268 DMSTYLE_UnlockModule();
273 static const IClassFactoryVtbl StyleTrackCF_Vtbl = {
274 StyleTrackCF_QueryInterface,
276 StyleTrackCF_Release,
277 StyleTrackCF_CreateInstance,
278 StyleTrackCF_LockServer
281 static IClassFactoryImpl StyleTrack_CF = {&StyleTrackCF_Vtbl};
283 /******************************************************************
284 * DirectMusicMotifTrack ClassFactory
286 static HRESULT WINAPI MotifTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
287 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
289 if (ppobj == NULL) return E_POINTER;
291 return E_NOINTERFACE;
294 static ULONG WINAPI MotifTrackCF_AddRef(LPCLASSFACTORY iface) {
295 DMSTYLE_LockModule();
297 return 2; /* non-heap based object */
300 static ULONG WINAPI MotifTrackCF_Release(LPCLASSFACTORY iface) {
301 DMSTYLE_UnlockModule();
303 return 1; /* non-heap based object */
306 static HRESULT WINAPI MotifTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
307 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
309 return DMUSIC_CreateDirectMusicMotifTrack (riid, ppobj, pOuter);
312 static HRESULT WINAPI MotifTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
313 TRACE("(%d)\n", dolock);
316 DMSTYLE_LockModule();
318 DMSTYLE_UnlockModule();
323 static const IClassFactoryVtbl MotifTrackCF_Vtbl = {
324 MotifTrackCF_QueryInterface,
326 MotifTrackCF_Release,
327 MotifTrackCF_CreateInstance,
328 MotifTrackCF_LockServer
331 static IClassFactoryImpl MotifTrack_CF = {&MotifTrackCF_Vtbl};
333 /******************************************************************
334 * DirectMusicAuditionTrack ClassFactory
336 static HRESULT WINAPI AuditionTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
337 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
339 if (ppobj == NULL) return E_POINTER;
341 return E_NOINTERFACE;
344 static ULONG WINAPI AuditionTrackCF_AddRef(LPCLASSFACTORY iface) {
345 DMSTYLE_LockModule();
347 return 2; /* non-heap based object */
350 static ULONG WINAPI AuditionTrackCF_Release(LPCLASSFACTORY iface) {
351 DMSTYLE_UnlockModule();
353 return 1; /* non-heap based object */
356 static HRESULT WINAPI AuditionTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
357 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
359 return DMUSIC_CreateDirectMusicAuditionTrack (riid, ppobj, pOuter);
362 static HRESULT WINAPI AuditionTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
363 TRACE("(%d)\n", dolock);
366 DMSTYLE_LockModule();
368 DMSTYLE_UnlockModule();
373 static const IClassFactoryVtbl AuditionTrackCF_Vtbl = {
374 AuditionTrackCF_QueryInterface,
375 AuditionTrackCF_AddRef,
376 AuditionTrackCF_Release,
377 AuditionTrackCF_CreateInstance,
378 AuditionTrackCF_LockServer
381 static IClassFactoryImpl AuditionTrack_CF = {&AuditionTrackCF_Vtbl};
383 /******************************************************************
384 * DirectMusicMuteTrack ClassFactory
386 static HRESULT WINAPI MuteTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
387 FIXME("- no interface IID: %s\n", debugstr_guid(riid));
389 if (ppobj == NULL) return E_POINTER;
391 return E_NOINTERFACE;
394 static ULONG WINAPI MuteTrackCF_AddRef(LPCLASSFACTORY iface) {
395 DMSTYLE_LockModule();
397 return 2; /* non-heap based object */
400 static ULONG WINAPI MuteTrackCF_Release(LPCLASSFACTORY iface) {
401 DMSTYLE_UnlockModule();
403 return 1; /* non-heap based object */
406 static HRESULT WINAPI MuteTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
407 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
409 return DMUSIC_CreateDirectMusicMuteTrack (riid, ppobj, pOuter);
412 static HRESULT WINAPI MuteTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
413 TRACE("(%d)\n", dolock);
416 DMSTYLE_LockModule();
418 DMSTYLE_UnlockModule();
423 static const IClassFactoryVtbl MuteTrackCF_Vtbl = {
424 MuteTrackCF_QueryInterface,
427 MuteTrackCF_CreateInstance,
428 MuteTrackCF_LockServer
431 static IClassFactoryImpl MuteTrack_CF = {&MuteTrackCF_Vtbl};
433 /******************************************************************
438 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
439 if (fdwReason == DLL_PROCESS_ATTACH) {
440 DisableThreadLibraryCalls(hinstDLL);
441 /* FIXME: Initialisation */
442 } else if (fdwReason == DLL_PROCESS_DETACH) {
450 /******************************************************************
451 * DllCanUnloadNow (DMSTYLE.1)
455 HRESULT WINAPI DllCanUnloadNow(void) {
456 return DMSTYLE_refCount != 0 ? S_FALSE : S_OK;
460 /******************************************************************
461 * DllGetClassObject (DMSTYLE.@)
465 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
466 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
468 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicSection) && IsEqualIID (riid, &IID_IClassFactory)) {
470 IClassFactory_AddRef((IClassFactory*)*ppv);
472 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyle) && IsEqualIID (riid, &IID_IClassFactory)) {
474 IClassFactory_AddRef((IClassFactory*)*ppv);
476 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicChordTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
477 *ppv = &ChordTrack_CF;
478 IClassFactory_AddRef((IClassFactory*)*ppv);
480 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicCommandTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
481 *ppv = &CommandTrack_CF;
482 IClassFactory_AddRef((IClassFactory*)*ppv);
484 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicStyleTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
485 *ppv = &StyleTrack_CF;
486 IClassFactory_AddRef((IClassFactory*)*ppv);
488 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMotifTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
489 *ppv = &MotifTrack_CF;
490 IClassFactory_AddRef((IClassFactory*)*ppv);
492 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicAuditionTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
493 *ppv = &AuditionTrack_CF;
494 IClassFactory_AddRef((IClassFactory*)*ppv);
496 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicMuteTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
497 *ppv = &MuteTrack_CF;
498 IClassFactory_AddRef((IClassFactory*)*ppv);
502 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
503 return CLASS_E_CLASSNOTAVAILABLE;