1 /* DirectMusicScript 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
21 #include "wine/port.h"
23 #include "dmscript_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(dmscript);
27 LONG DMSCRIPT_refCount = 0;
30 const IClassFactoryVtbl *lpVtbl;
33 /******************************************************************
34 * DirectMusicScriptAutoImplSegment ClassFactory
36 static HRESULT WINAPI ScriptAutoImplSegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
37 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
39 if (ppobj == NULL) return E_POINTER;
44 static ULONG WINAPI ScriptAutoImplSegmentCF_AddRef(LPCLASSFACTORY iface) {
45 DMSCRIPT_LockModule();
47 return 2; /* non-heap based object */
50 static ULONG WINAPI ScriptAutoImplSegmentCF_Release(LPCLASSFACTORY iface) {
51 DMSCRIPT_UnlockModule();
53 return 1; /* non-heap based object */
56 static HRESULT WINAPI ScriptAutoImplSegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
57 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
59 if (ppobj == NULL) return E_POINTER;
64 static HRESULT WINAPI ScriptAutoImplSegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
65 TRACE("(%d)\n", dolock);
68 DMSCRIPT_LockModule();
70 DMSCRIPT_UnlockModule();
75 static const IClassFactoryVtbl ScriptAutoImplSegmentCF_Vtbl = {
76 ScriptAutoImplSegmentCF_QueryInterface,
77 ScriptAutoImplSegmentCF_AddRef,
78 ScriptAutoImplSegmentCF_Release,
79 ScriptAutoImplSegmentCF_CreateInstance,
80 ScriptAutoImplSegmentCF_LockServer
83 static IClassFactoryImpl ScriptAutoImplSegment_CF = {&ScriptAutoImplSegmentCF_Vtbl};
85 /******************************************************************
86 * DirectMusicScriptTrack ClassFactory
88 static HRESULT WINAPI ScriptTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
89 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
91 if (ppobj == NULL) return E_POINTER;
96 static ULONG WINAPI ScriptTrackCF_AddRef(LPCLASSFACTORY iface) {
97 DMSCRIPT_LockModule();
99 return 2; /* non-heap based object */
102 static ULONG WINAPI ScriptTrackCF_Release(LPCLASSFACTORY iface) {
103 DMSCRIPT_UnlockModule();
105 return 1; /* non-heap based object */
108 static HRESULT WINAPI ScriptTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
109 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
110 return DMUSIC_CreateDirectMusicScriptTrack (riid, ppobj, pOuter);
113 static HRESULT WINAPI ScriptTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
114 TRACE("(%d)\n", dolock);
117 DMSCRIPT_LockModule();
119 DMSCRIPT_UnlockModule();
124 static const IClassFactoryVtbl ScriptTrackCF_Vtbl = {
125 ScriptTrackCF_QueryInterface,
126 ScriptTrackCF_AddRef,
127 ScriptTrackCF_Release,
128 ScriptTrackCF_CreateInstance,
129 ScriptTrackCF_LockServer
132 static IClassFactoryImpl ScriptTrack_CF = {&ScriptTrackCF_Vtbl};
134 /******************************************************************
135 * DirectMusicAudioVBScript ClassFactory
137 static HRESULT WINAPI AudioVBScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
138 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
140 if (ppobj == NULL) return E_POINTER;
142 return E_NOINTERFACE;
145 static ULONG WINAPI AudioVBScriptCF_AddRef(LPCLASSFACTORY iface) {
146 DMSCRIPT_LockModule();
148 return 2; /* non-heap based object */
151 static ULONG WINAPI AudioVBScriptCF_Release(LPCLASSFACTORY iface) {
152 DMSCRIPT_UnlockModule();
154 return 1; /* non-heap based object */
157 static HRESULT WINAPI AudioVBScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
158 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
160 if (ppobj == NULL) return E_POINTER;
162 return E_NOINTERFACE;
165 static HRESULT WINAPI AudioVBScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
166 TRACE("(%d)\n", dolock);
169 DMSCRIPT_LockModule();
171 DMSCRIPT_UnlockModule();
176 static const IClassFactoryVtbl AudioVBScriptCF_Vtbl = {
177 AudioVBScriptCF_QueryInterface,
178 AudioVBScriptCF_AddRef,
179 AudioVBScriptCF_Release,
180 AudioVBScriptCF_CreateInstance,
181 AudioVBScriptCF_LockServer
184 static IClassFactoryImpl AudioVBScript_CF = {&AudioVBScriptCF_Vtbl};
186 /******************************************************************
187 * DirectMusicScript ClassFactory
189 static HRESULT WINAPI ScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
190 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
192 if (ppobj == NULL) return E_POINTER;
194 return E_NOINTERFACE;
197 static ULONG WINAPI ScriptCF_AddRef(LPCLASSFACTORY iface) {
198 DMSCRIPT_LockModule();
200 return 2; /* non-heap based object */
203 static ULONG WINAPI ScriptCF_Release(LPCLASSFACTORY iface) {
204 DMSCRIPT_UnlockModule();
206 return 1; /* non-heap based object */
209 static HRESULT WINAPI ScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
210 TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
212 return DMUSIC_CreateDirectMusicScriptImpl (riid, ppobj, pOuter);
215 static HRESULT WINAPI ScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
216 TRACE("(%d)\n", dolock);
219 DMSCRIPT_LockModule();
221 DMSCRIPT_UnlockModule();
226 static const IClassFactoryVtbl ScriptCF_Vtbl = {
227 ScriptCF_QueryInterface,
230 ScriptCF_CreateInstance,
234 static IClassFactoryImpl Script_CF = {&ScriptCF_Vtbl};
236 /******************************************************************
237 * DirectMusicScriptAutoImplPerformance ClassFactory
239 static HRESULT WINAPI ScriptAutoImplPerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
240 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
242 if (ppobj == NULL) return E_POINTER;
244 return E_NOINTERFACE;
247 static ULONG WINAPI ScriptAutoImplPerformanceCF_AddRef(LPCLASSFACTORY iface) {
248 DMSCRIPT_LockModule();
250 return 2; /* non-heap based object */
253 static ULONG WINAPI ScriptAutoImplPerformanceCF_Release(LPCLASSFACTORY iface) {
254 DMSCRIPT_UnlockModule();
256 return 1; /* non-heap based object */
259 static HRESULT WINAPI ScriptAutoImplPerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
260 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
262 if (ppobj == NULL) return E_POINTER;
264 return E_NOINTERFACE;
267 static HRESULT WINAPI ScriptAutoImplPerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
268 TRACE("(%d)\n", dolock);
271 DMSCRIPT_LockModule();
273 DMSCRIPT_UnlockModule();
278 static const IClassFactoryVtbl ScriptAutoImplPerformanceCF_Vtbl = {
279 ScriptAutoImplPerformanceCF_QueryInterface,
280 ScriptAutoImplPerformanceCF_AddRef,
281 ScriptAutoImplPerformanceCF_Release,
282 ScriptAutoImplPerformanceCF_CreateInstance,
283 ScriptAutoImplPerformanceCF_LockServer
286 static IClassFactoryImpl ScriptAutoImplPerformance_CF = {&ScriptAutoImplPerformanceCF_Vtbl};
288 /******************************************************************
289 * DirectMusicScriptSourceCodeLoader ClassFactory
291 static HRESULT WINAPI ScriptSourceCodeLoaderCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
292 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
294 if (ppobj == NULL) return E_POINTER;
296 return E_NOINTERFACE;
299 static ULONG WINAPI ScriptSourceCodeLoaderCF_AddRef(LPCLASSFACTORY iface) {
300 DMSCRIPT_LockModule();
302 return 2; /* non-heap based object */
305 static ULONG WINAPI ScriptSourceCodeLoaderCF_Release(LPCLASSFACTORY iface) {
306 DMSCRIPT_UnlockModule();
308 return 1; /* non-heap based object */
311 static HRESULT WINAPI ScriptSourceCodeLoaderCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
312 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
314 if (ppobj == NULL) return E_POINTER;
316 return E_NOINTERFACE;
319 static HRESULT WINAPI ScriptSourceCodeLoaderCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
320 TRACE("(%d)\n", dolock);
323 DMSCRIPT_LockModule();
325 DMSCRIPT_UnlockModule();
330 static const IClassFactoryVtbl ScriptSourceCodeLoaderCF_Vtbl = {
331 ScriptSourceCodeLoaderCF_QueryInterface,
332 ScriptSourceCodeLoaderCF_AddRef,
333 ScriptSourceCodeLoaderCF_Release,
334 ScriptSourceCodeLoaderCF_CreateInstance,
335 ScriptSourceCodeLoaderCF_LockServer
338 static IClassFactoryImpl ScriptSourceCodeLoader_CF = {&ScriptSourceCodeLoaderCF_Vtbl};
340 /******************************************************************
341 * DirectMusicScriptAutoImplSegmentState ClassFactory
343 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
344 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
346 if (ppobj == NULL) return E_POINTER;
348 return E_NOINTERFACE;
351 static ULONG WINAPI ScriptAutoImplSegmentStateCF_AddRef(LPCLASSFACTORY iface) {
352 DMSCRIPT_LockModule();
354 return 2; /* non-heap based object */
357 static ULONG WINAPI ScriptAutoImplSegmentStateCF_Release(LPCLASSFACTORY iface) {
358 DMSCRIPT_UnlockModule();
360 return 1; /* non-heap based object */
363 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
364 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
366 if (ppobj == NULL) return E_POINTER;
368 return E_NOINTERFACE;
371 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
372 TRACE("(%d)\n", dolock);
375 DMSCRIPT_LockModule();
377 DMSCRIPT_UnlockModule();
382 static const IClassFactoryVtbl ScriptAutoImplSegmentStateCF_Vtbl = {
383 ScriptAutoImplSegmentStateCF_QueryInterface,
384 ScriptAutoImplSegmentStateCF_AddRef,
385 ScriptAutoImplSegmentStateCF_Release,
386 ScriptAutoImplSegmentStateCF_CreateInstance,
387 ScriptAutoImplSegmentStateCF_LockServer
390 static IClassFactoryImpl ScriptAutoImplSegmentState_CF = {&ScriptAutoImplSegmentStateCF_Vtbl};
392 /******************************************************************
393 * DirectMusicScriptAutoImplAudioPathConfig ClassFactory
395 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
396 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
398 if (ppobj == NULL) return E_POINTER;
400 return E_NOINTERFACE;
403 static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_AddRef(LPCLASSFACTORY iface) {
404 DMSCRIPT_LockModule();
406 return 2; /* non-heap based object */
409 static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_Release(LPCLASSFACTORY iface) {
410 DMSCRIPT_UnlockModule();
412 return 1; /* non-heap based object */
415 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
416 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
418 if (ppobj == NULL) return E_POINTER;
420 return E_NOINTERFACE;
423 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
424 TRACE("(%d)\n", dolock);
427 DMSCRIPT_LockModule();
429 DMSCRIPT_UnlockModule();
434 static const IClassFactoryVtbl ScriptAutoImplAudioPathConfigCF_Vtbl = {
435 ScriptAutoImplAudioPathConfigCF_QueryInterface,
436 ScriptAutoImplAudioPathConfigCF_AddRef,
437 ScriptAutoImplAudioPathConfigCF_Release,
438 ScriptAutoImplAudioPathConfigCF_CreateInstance,
439 ScriptAutoImplAudioPathConfigCF_LockServer
442 static IClassFactoryImpl ScriptAutoImplAudioPathConfig_CF = {&ScriptAutoImplAudioPathConfigCF_Vtbl};
444 /******************************************************************
445 * DirectMusicScriptAutoImplAudioPath ClassFactory
447 static HRESULT WINAPI ScriptAutoImplAudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
448 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
450 if (ppobj == NULL) return E_POINTER;
452 return E_NOINTERFACE;
455 static ULONG WINAPI ScriptAutoImplAudioPathCF_AddRef(LPCLASSFACTORY iface) {
456 DMSCRIPT_LockModule();
458 return 2; /* non-heap based object */
461 static ULONG WINAPI ScriptAutoImplAudioPathCF_Release(LPCLASSFACTORY iface) {
462 DMSCRIPT_UnlockModule();
464 return 1; /* non-heap based object */
467 static HRESULT WINAPI ScriptAutoImplAudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
468 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
470 if (ppobj == NULL) return E_POINTER;
472 return E_NOINTERFACE;
475 static HRESULT WINAPI ScriptAutoImplAudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
476 TRACE("(%d)\n", dolock);
479 DMSCRIPT_LockModule();
481 DMSCRIPT_UnlockModule();
486 static const IClassFactoryVtbl ScriptAutoImplAudioPathCF_Vtbl = {
487 ScriptAutoImplAudioPathCF_QueryInterface,
488 ScriptAutoImplAudioPathCF_AddRef,
489 ScriptAutoImplAudioPathCF_Release,
490 ScriptAutoImplAudioPathCF_CreateInstance,
491 ScriptAutoImplAudioPathCF_LockServer
494 static IClassFactoryImpl ScriptAutoImplAudioPath_CF = {&ScriptAutoImplAudioPathCF_Vtbl};
496 /******************************************************************
497 * DirectMusicScriptAutoImplSong ClassFactory
499 static HRESULT WINAPI ScriptAutoImplSongCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
500 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
502 if (ppobj == NULL) return E_POINTER;
504 return E_NOINTERFACE;
507 static ULONG WINAPI ScriptAutoImplSongCF_AddRef(LPCLASSFACTORY iface) {
508 DMSCRIPT_LockModule();
510 return 2; /* non-heap based */
513 static ULONG WINAPI ScriptAutoImplSongCF_Release(LPCLASSFACTORY iface) {
514 DMSCRIPT_UnlockModule();
516 return 1; /* non-heap based object */
519 static HRESULT WINAPI ScriptAutoImplSongCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
520 FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
522 if (ppobj == NULL) return E_POINTER;
524 return E_NOINTERFACE;
527 static HRESULT WINAPI ScriptAutoImplSongCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
528 TRACE("(%d)\n", dolock);
531 DMSCRIPT_LockModule();
533 DMSCRIPT_UnlockModule();
538 static const IClassFactoryVtbl ScriptAutoImplSongCF_Vtbl = {
539 ScriptAutoImplSongCF_QueryInterface,
540 ScriptAutoImplSongCF_AddRef,
541 ScriptAutoImplSongCF_Release,
542 ScriptAutoImplSongCF_CreateInstance,
543 ScriptAutoImplSongCF_LockServer
546 static IClassFactoryImpl ScriptAutoImplSong_CF = {&ScriptAutoImplSongCF_Vtbl};
548 /******************************************************************
553 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
554 if (fdwReason == DLL_PROCESS_ATTACH) {
555 DisableThreadLibraryCalls(hinstDLL);
556 /* FIXME: Initialisation */
557 } else if (fdwReason == DLL_PROCESS_DETACH) {
565 /******************************************************************
566 * DllCanUnloadNow (DMSCRIPT.@)
570 HRESULT WINAPI DllCanUnloadNow(void)
572 return DMSCRIPT_refCount != 0 ? S_FALSE : S_OK;
576 /******************************************************************
577 * DllGetClassObject (DMSCRIPT.@)
581 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
583 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
584 if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
585 *ppv = (LPVOID) &ScriptAutoImplSegment_CF;
586 IClassFactory_AddRef((IClassFactory*)*ppv);
588 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
589 *ppv = (LPVOID) &ScriptTrack_CF;
590 IClassFactory_AddRef((IClassFactory*)*ppv);
592 } else if (IsEqualCLSID (rclsid, &CLSID_AudioVBScript) && IsEqualIID (riid, &IID_IClassFactory)) {
593 *ppv = (LPVOID) &AudioVBScript_CF;
594 IClassFactory_AddRef((IClassFactory*)*ppv);
596 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScript) && IsEqualIID (riid, &IID_IClassFactory)) {
597 *ppv = (LPVOID) &Script_CF;
598 IClassFactory_AddRef((IClassFactory*)*ppv);
600 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
601 *ppv = (LPVOID) &ScriptAutoImplPerformance_CF;
602 IClassFactory_AddRef((IClassFactory*)*ppv);
604 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptSourceCodeLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
605 *ppv = (LPVOID) &ScriptSourceCodeLoader_CF;
606 IClassFactory_AddRef((IClassFactory*)*ppv);
608 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
609 *ppv = (LPVOID) &ScriptAutoImplSegmentState_CF;
610 IClassFactory_AddRef((IClassFactory*)*ppv);
612 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPathConfig) && IsEqualIID (riid, &IID_IClassFactory)) {
613 *ppv = (LPVOID) &ScriptAutoImplAudioPathConfig_CF;
614 IClassFactory_AddRef((IClassFactory*)*ppv);
616 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
617 *ppv = (LPVOID) &ScriptAutoImplAudioPath_CF;
618 IClassFactory_AddRef((IClassFactory*)*ppv);
620 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSong) && IsEqualIID (riid, &IID_IClassFactory)) {
621 *ppv = (LPVOID) &ScriptAutoImplSong_CF;
622 IClassFactory_AddRef((IClassFactory*)*ppv);
626 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
627 return CLASS_E_CLASSNOTAVAILABLE;
631 /******************************************************************
636 /* check whether the given DWORD is even (return 0) or odd (return 1) */
637 int even_or_odd (DWORD number) {
638 return (number & 0x1); /* basically, check if bit 0 is set ;) */
641 /* FOURCC to string conversion for debug messages */
642 const char *debugstr_fourcc (DWORD fourcc) {
643 if (!fourcc) return "'null'";
644 return wine_dbg_sprintf ("\'%c%c%c%c\'",
645 (char)(fourcc), (char)(fourcc >> 8),
646 (char)(fourcc >> 16), (char)(fourcc >> 24));
649 /* DMUS_VERSION struct to string conversion for debug messages */
650 const char *debugstr_dmversion (const DMUS_VERSION *version) {
651 if (!version) return "'null'";
652 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
653 (int)((version->dwVersionMS & 0xFFFF0000) >> 8), (int)(version->dwVersionMS & 0x0000FFFF),
654 (int)((version->dwVersionLS & 0xFFFF0000) >> 8), (int)(version->dwVersionLS & 0x0000FFFF));
657 /* returns name of given GUID */
658 const char *debugstr_dmguid (const GUID *id) {
659 static const guid_info guids[] = {
661 GE(CLSID_AudioVBScript),
662 GE(CLSID_DirectMusic),
663 GE(CLSID_DirectMusicAudioPath),
664 GE(CLSID_DirectMusicAudioPathConfig),
665 GE(CLSID_DirectMusicAuditionTrack),
666 GE(CLSID_DirectMusicBand),
667 GE(CLSID_DirectMusicBandTrack),
668 GE(CLSID_DirectMusicChordMapTrack),
669 GE(CLSID_DirectMusicChordMap),
670 GE(CLSID_DirectMusicChordTrack),
671 GE(CLSID_DirectMusicCollection),
672 GE(CLSID_DirectMusicCommandTrack),
673 GE(CLSID_DirectMusicComposer),
674 GE(CLSID_DirectMusicContainer),
675 GE(CLSID_DirectMusicGraph),
676 GE(CLSID_DirectMusicLoader),
677 GE(CLSID_DirectMusicLyricsTrack),
678 GE(CLSID_DirectMusicMarkerTrack),
679 GE(CLSID_DirectMusicMelodyFormulationTrack),
680 GE(CLSID_DirectMusicMotifTrack),
681 GE(CLSID_DirectMusicMuteTrack),
682 GE(CLSID_DirectMusicParamControlTrack),
683 GE(CLSID_DirectMusicPatternTrack),
684 GE(CLSID_DirectMusicPerformance),
685 GE(CLSID_DirectMusicScript),
686 GE(CLSID_DirectMusicScriptAutoImpSegment),
687 GE(CLSID_DirectMusicScriptAutoImpPerformance),
688 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
689 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
690 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
691 GE(CLSID_DirectMusicScriptAutoImpSong),
692 GE(CLSID_DirectMusicScriptSourceCodeLoader),
693 GE(CLSID_DirectMusicScriptTrack),
694 GE(CLSID_DirectMusicSection),
695 GE(CLSID_DirectMusicSegment),
696 GE(CLSID_DirectMusicSegmentState),
697 GE(CLSID_DirectMusicSegmentTriggerTrack),
698 GE(CLSID_DirectMusicSegTriggerTrack),
699 GE(CLSID_DirectMusicSeqTrack),
700 GE(CLSID_DirectMusicSignPostTrack),
701 GE(CLSID_DirectMusicSong),
702 GE(CLSID_DirectMusicStyle),
703 GE(CLSID_DirectMusicStyleTrack),
704 GE(CLSID_DirectMusicSynth),
705 GE(CLSID_DirectMusicSynthSink),
706 GE(CLSID_DirectMusicSysExTrack),
707 GE(CLSID_DirectMusicTemplate),
708 GE(CLSID_DirectMusicTempoTrack),
709 GE(CLSID_DirectMusicTimeSigTrack),
710 GE(CLSID_DirectMusicWaveTrack),
711 GE(CLSID_DirectSoundWave),
713 GE(IID_IDirectMusic),
714 GE(IID_IDirectMusic2),
715 GE(IID_IDirectMusic8),
716 GE(IID_IDirectMusicAudioPath),
717 GE(IID_IDirectMusicBand),
718 GE(IID_IDirectMusicBuffer),
719 GE(IID_IDirectMusicChordMap),
720 GE(IID_IDirectMusicCollection),
721 GE(IID_IDirectMusicComposer),
722 GE(IID_IDirectMusicContainer),
723 GE(IID_IDirectMusicDownload),
724 GE(IID_IDirectMusicDownloadedInstrument),
725 GE(IID_IDirectMusicGetLoader),
726 GE(IID_IDirectMusicGraph),
727 GE(IID_IDirectMusicInstrument),
728 GE(IID_IDirectMusicLoader),
729 GE(IID_IDirectMusicLoader8),
730 GE(IID_IDirectMusicObject),
731 GE(IID_IDirectMusicPatternTrack),
732 GE(IID_IDirectMusicPerformance),
733 GE(IID_IDirectMusicPerformance2),
734 GE(IID_IDirectMusicPerformance8),
735 GE(IID_IDirectMusicPort),
736 GE(IID_IDirectMusicPortDownload),
737 GE(IID_IDirectMusicScript),
738 GE(IID_IDirectMusicSegment),
739 GE(IID_IDirectMusicSegment2),
740 GE(IID_IDirectMusicSegment8),
741 GE(IID_IDirectMusicSegmentState),
742 GE(IID_IDirectMusicSegmentState8),
743 GE(IID_IDirectMusicStyle),
744 GE(IID_IDirectMusicStyle8),
745 GE(IID_IDirectMusicSynth),
746 GE(IID_IDirectMusicSynth8),
747 GE(IID_IDirectMusicSynthSink),
748 GE(IID_IDirectMusicThru),
749 GE(IID_IDirectMusicTool),
750 GE(IID_IDirectMusicTool8),
751 GE(IID_IDirectMusicTrack),
752 GE(IID_IDirectMusicTrack8),
754 GE(IID_IPersistStream),
756 GE(IID_IClassFactory),
758 GE(GUID_DirectMusicAllTypes),
759 GE(GUID_NOTIFICATION_CHORD),
760 GE(GUID_NOTIFICATION_COMMAND),
761 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
762 GE(GUID_NOTIFICATION_PERFORMANCE),
763 GE(GUID_NOTIFICATION_RECOMPOSE),
764 GE(GUID_NOTIFICATION_SEGMENT),
767 GE(GUID_CommandParam),
768 GE(GUID_CommandParam2),
769 GE(GUID_CommandParamNext),
770 GE(GUID_IDirectMusicBand),
771 GE(GUID_IDirectMusicChordMap),
772 GE(GUID_IDirectMusicStyle),
774 GE(GUID_Play_Marker),
775 GE(GUID_RhythmParam),
777 GE(GUID_TimeSignature),
778 GE(GUID_Valid_Start_Time),
779 GE(GUID_Clear_All_Bands),
780 GE(GUID_ConnectToDLSCollection),
781 GE(GUID_Disable_Auto_Download),
782 GE(GUID_DisableTempo),
783 GE(GUID_DisableTimeSig),
785 GE(GUID_DownloadToAudioPath),
786 GE(GUID_Enable_Auto_Download),
787 GE(GUID_EnableTempo),
788 GE(GUID_EnableTimeSig),
789 GE(GUID_IgnoreBankSelectForGM),
790 GE(GUID_SeedVariations),
791 GE(GUID_StandardMIDIFile),
793 GE(GUID_UnloadFromAudioPath),
795 GE(GUID_PerfMasterTempo),
796 GE(GUID_PerfMasterVolume),
797 GE(GUID_PerfMasterGrooveLevel),
798 GE(GUID_PerfAutoDownload),
799 GE(GUID_DefaultGMCollection),
800 GE(GUID_Synth_Default),
801 GE(GUID_Buffer_Reverb),
802 GE(GUID_Buffer_EnvReverb),
803 GE(GUID_Buffer_Stereo),
804 GE(GUID_Buffer_3D_Dry),
805 GE(GUID_Buffer_Mono),
806 GE(GUID_DMUS_PROP_GM_Hardware),
807 GE(GUID_DMUS_PROP_GS_Capable),
808 GE(GUID_DMUS_PROP_GS_Hardware),
809 GE(GUID_DMUS_PROP_DLS1),
810 GE(GUID_DMUS_PROP_DLS2),
811 GE(GUID_DMUS_PROP_Effects),
812 GE(GUID_DMUS_PROP_INSTRUMENT2),
813 GE(GUID_DMUS_PROP_LegacyCaps),
814 GE(GUID_DMUS_PROP_MemorySize),
815 GE(GUID_DMUS_PROP_SampleMemorySize),
816 GE(GUID_DMUS_PROP_SamplePlaybackRate),
817 GE(GUID_DMUS_PROP_SetSynthSink),
818 GE(GUID_DMUS_PROP_SinkUsesDSound),
819 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
820 GE(GUID_DMUS_PROP_SynthSink_WAVE),
821 GE(GUID_DMUS_PROP_Volume),
822 GE(GUID_DMUS_PROP_WavesReverb),
823 GE(GUID_DMUS_PROP_WriteLatency),
824 GE(GUID_DMUS_PROP_WritePeriod),
825 GE(GUID_DMUS_PROP_XG_Capable),
826 GE(GUID_DMUS_PROP_XG_Hardware)
831 if (!id) return "(null)";
833 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
834 if (IsEqualGUID(id, guids[i].guid))
835 return guids[i].name;
837 /* if we didn't find it, act like standard debugstr_guid */
838 return debugstr_guid(id);
841 /* returns name of given error code */
842 const char *debugstr_dmreturn (DWORD code) {
843 static const flag_info codes[] = {
846 FE(DMUS_S_PARTIALLOAD),
847 FE(DMUS_S_PARTIALDOWNLOAD),
851 FE(DMUS_S_STRING_TRUNCATED),
852 FE(DMUS_S_LAST_TOOL),
853 FE(DMUS_S_OVER_CHORD),
854 FE(DMUS_S_UP_OCTAVE),
855 FE(DMUS_S_DOWN_OCTAVE),
856 FE(DMUS_S_NOBUFFERCONTROL),
857 FE(DMUS_S_GARBAGE_COLLECTED),
858 FE(DMUS_E_DRIVER_FAILED),
859 FE(DMUS_E_PORTS_OPEN),
860 FE(DMUS_E_DEVICE_IN_USE),
861 FE(DMUS_E_INSUFFICIENTBUFFER),
862 FE(DMUS_E_BUFFERNOTSET),
863 FE(DMUS_E_BUFFERNOTAVAILABLE),
864 FE(DMUS_E_NOTADLSCOL),
865 FE(DMUS_E_INVALIDOFFSET),
866 FE(DMUS_E_ALREADY_LOADED),
867 FE(DMUS_E_INVALIDPOS),
868 FE(DMUS_E_INVALIDPATCH),
869 FE(DMUS_E_CANNOTSEEK),
870 FE(DMUS_E_CANNOTWRITE),
871 FE(DMUS_E_CHUNKNOTFOUND),
872 FE(DMUS_E_INVALID_DOWNLOADID),
873 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT),
874 FE(DMUS_E_ALREADY_DOWNLOADED),
875 FE(DMUS_E_UNKNOWN_PROPERTY),
876 FE(DMUS_E_SET_UNSUPPORTED),
877 FE(DMUS_E_GET_UNSUPPORTED),
879 FE(DMUS_E_BADARTICULATION),
880 FE(DMUS_E_BADINSTRUMENT),
881 FE(DMUS_E_BADWAVELINK),
882 FE(DMUS_E_NOARTICULATION),
885 FE(DMUS_E_BADOFFSETTABLE),
886 FE(DMUS_E_UNKNOWNDOWNLOAD),
887 FE(DMUS_E_NOSYNTHSINK),
888 FE(DMUS_E_ALREADYOPEN),
889 FE(DMUS_E_ALREADYCLOSED),
890 FE(DMUS_E_SYNTHNOTCONFIGURED),
891 FE(DMUS_E_SYNTHACTIVE),
892 FE(DMUS_E_CANNOTREAD),
893 FE(DMUS_E_DMUSIC_RELEASED),
894 FE(DMUS_E_BUFFER_EMPTY),
895 FE(DMUS_E_BUFFER_FULL),
896 FE(DMUS_E_PORT_NOT_CAPTURE),
897 FE(DMUS_E_PORT_NOT_RENDER),
898 FE(DMUS_E_DSOUND_NOT_SET),
899 FE(DMUS_E_ALREADY_ACTIVATED),
900 FE(DMUS_E_INVALIDBUFFER),
901 FE(DMUS_E_WAVEFORMATNOTSUPPORTED),
902 FE(DMUS_E_SYNTHINACTIVE),
903 FE(DMUS_E_DSOUND_ALREADY_SET),
904 FE(DMUS_E_INVALID_EVENT),
905 FE(DMUS_E_UNSUPPORTED_STREAM),
906 FE(DMUS_E_ALREADY_INITED),
907 FE(DMUS_E_INVALID_BAND),
908 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK),
909 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK),
910 FE(DMUS_E_INVALID_TRACK_HDR),
911 FE(DMUS_E_INVALID_TOOL_HDR),
912 FE(DMUS_E_ALL_TOOLS_FAILED),
913 FE(DMUS_E_ALL_TRACKS_FAILED),
914 FE(DMUS_E_NOT_FOUND),
916 FE(DMUS_E_TYPE_DISABLED),
917 FE(DMUS_E_TYPE_UNSUPPORTED),
918 FE(DMUS_E_TIME_PAST),
919 FE(DMUS_E_TRACK_NOT_FOUND),
920 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT),
921 FE(DMUS_E_NO_MASTER_CLOCK),
922 FE(DMUS_E_LOADER_NOCLASSID),
923 FE(DMUS_E_LOADER_BADPATH),
924 FE(DMUS_E_LOADER_FAILEDOPEN),
925 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED),
926 FE(DMUS_E_LOADER_FAILEDCREATE),
927 FE(DMUS_E_LOADER_OBJECTNOTFOUND),
928 FE(DMUS_E_LOADER_NOFILENAME),
929 FE(DMUS_E_INVALIDFILE),
930 FE(DMUS_E_ALREADY_EXISTS),
931 FE(DMUS_E_OUT_OF_RANGE),
932 FE(DMUS_E_SEGMENT_INIT_FAILED),
933 FE(DMUS_E_ALREADY_SENT),
934 FE(DMUS_E_CANNOT_FREE),
935 FE(DMUS_E_CANNOT_OPEN_PORT),
936 FE(DMUS_E_CANNOT_CONVERT),
937 FE(DMUS_E_DESCEND_CHUNK_FAIL),
938 FE(DMUS_E_NOT_LOADED),
939 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE),
940 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE),
941 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT),
942 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32),
943 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR),
944 FE(DMUS_E_SCRIPT_INVALID_FILE),
945 FE(DMUS_E_INVALID_SCRIPTTRACK),
946 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND),
947 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND),
948 FE(DMUS_E_SCRIPT_CONTENT_READONLY),
949 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE),
950 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED),
951 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK),
952 FE(DMUS_E_INVALID_LYRICSTRACK),
953 FE(DMUS_E_INVALID_PARAMCONTROLTRACK),
954 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR),
955 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR),
956 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE),
957 FE(DMUS_E_AUDIOPATHS_NOT_VALID),
958 FE(DMUS_E_AUDIOPATHS_IN_USE),
959 FE(DMUS_E_NO_AUDIOPATH_CONFIG),
960 FE(DMUS_E_AUDIOPATH_INACTIVE),
961 FE(DMUS_E_AUDIOPATH_NOBUFFER),
962 FE(DMUS_E_AUDIOPATH_NOPORT),
963 FE(DMUS_E_NO_AUDIOPATH),
964 FE(DMUS_E_INVALIDCHUNK),
965 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER),
966 FE(DMUS_E_INVALID_CONTAINER_OBJECT)
969 for (i = 0; i < sizeof(codes)/sizeof(codes[0]); i++) {
970 if (code == codes[i].val)
971 return codes[i].name;
973 /* if we didn't find it, return value */
974 return wine_dbg_sprintf("0x%08x", code);
977 /* generic flag-dumping function */
978 const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
979 char buffer[128] = "", *ptr = &buffer[0];
980 unsigned int i, size = sizeof(buffer);
982 for (i=0; i < num_names; i++)
984 if ((flags & names[i].val) || /* standard flag*/
985 ((!flags) && (!names[i].val))) { /* zero value only */
986 int cnt = snprintf(ptr, size, "%s ", names[i].name);
987 if (cnt < 0 || cnt >= size) break;
993 return wine_dbg_sprintf("%s", buffer);
996 /* dump DMUS_OBJ flags */
997 const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
998 static const flag_info flags[] = {
1002 FE(DMUS_OBJ_CATEGORY),
1003 FE(DMUS_OBJ_FILENAME),
1004 FE(DMUS_OBJ_FULLPATH),
1006 FE(DMUS_OBJ_VERSION),
1008 FE(DMUS_OBJ_LOADED),
1009 FE(DMUS_OBJ_MEMORY),
1012 return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
1015 /* dump whole DMUS_OBJECTDESC struct */
1016 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
1018 char buffer[1024] = "", *ptr = &buffer[0];
1020 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
1021 ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
1022 ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
1023 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
1024 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
1025 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
1026 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
1027 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
1028 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
1029 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
1030 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
1031 wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
1032 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
1034 return wine_dbg_sprintf("%s", buffer);
1036 return wine_dbg_sprintf("(NULL)");