setupapi: Added Hebrew translation.
[wine.git] / dlls / dmscript / dmscript_main.c
blob6c382ed5d4f1003b268837fad29fe752939412b5
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
20 #include "config.h"
21 #include "wine/port.h"
23 #include "dmscript_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(dmscript);
27 LONG DMSCRIPT_refCount = 0;
29 typedef struct {
30 const IClassFactoryVtbl *lpVtbl;
31 } IClassFactoryImpl;
33 /******************************************************************
34 * DirectMusicScriptAutoImplSegment ClassFactory
36 static HRESULT WINAPI ScriptAutoImplSegmentCF_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 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 IID: %s\n", debugstr_guid(riid));
59 if (ppobj == NULL) return E_POINTER;
61 return E_NOINTERFACE;
64 static HRESULT WINAPI ScriptAutoImplSegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
65 TRACE("(%d)\n", dolock);
67 if (dolock)
68 DMSCRIPT_LockModule();
69 else
70 DMSCRIPT_UnlockModule();
72 return S_OK;
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 IID: %s\n", debugstr_guid(riid));
91 if (ppobj == NULL) return E_POINTER;
93 return E_NOINTERFACE;
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);
116 if (dolock)
117 DMSCRIPT_LockModule();
118 else
119 DMSCRIPT_UnlockModule();
121 return S_OK;
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 IID: %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 IID: %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);
168 if (dolock)
169 DMSCRIPT_LockModule();
170 else
171 DMSCRIPT_UnlockModule();
173 return S_OK;
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 IID: %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);
218 if (dolock)
219 DMSCRIPT_LockModule();
220 else
221 DMSCRIPT_UnlockModule();
223 return S_OK;
226 static const IClassFactoryVtbl ScriptCF_Vtbl = {
227 ScriptCF_QueryInterface,
228 ScriptCF_AddRef,
229 ScriptCF_Release,
230 ScriptCF_CreateInstance,
231 ScriptCF_LockServer
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 IID: %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 IID: %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);
270 if (dolock)
271 DMSCRIPT_LockModule();
272 else
273 DMSCRIPT_UnlockModule();
275 return S_OK;
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 IID: %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 IID: %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);
322 if (dolock)
323 DMSCRIPT_LockModule();
324 else
325 DMSCRIPT_UnlockModule();
327 return S_OK;
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 IID: %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 IID: %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);
374 if (dolock)
375 DMSCRIPT_LockModule();
376 else
377 DMSCRIPT_UnlockModule();
379 return S_OK;
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 IID: %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 IID: %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);
426 if (dolock)
427 DMSCRIPT_LockModule();
428 else
429 DMSCRIPT_UnlockModule();
431 return S_OK;
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 IID: %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 IID: %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);
478 if (dolock)
479 DMSCRIPT_LockModule();
480 else
481 DMSCRIPT_UnlockModule();
483 return S_OK;
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 IID: %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 IID: %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);
530 if (dolock)
531 DMSCRIPT_LockModule();
532 else
533 DMSCRIPT_UnlockModule();
535 return S_OK;
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 /******************************************************************
549 * DllMain
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) {
558 /* FIXME: Cleanup */
561 return TRUE;
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 = &ScriptAutoImplSegment_CF;
586 IClassFactory_AddRef((IClassFactory*)*ppv);
587 return S_OK;
588 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
589 *ppv = &ScriptTrack_CF;
590 IClassFactory_AddRef((IClassFactory*)*ppv);
591 return S_OK;
592 } else if (IsEqualCLSID (rclsid, &CLSID_AudioVBScript) && IsEqualIID (riid, &IID_IClassFactory)) {
593 *ppv = &AudioVBScript_CF;
594 IClassFactory_AddRef((IClassFactory*)*ppv);
595 return S_OK;
596 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScript) && IsEqualIID (riid, &IID_IClassFactory)) {
597 *ppv = &Script_CF;
598 IClassFactory_AddRef((IClassFactory*)*ppv);
599 return S_OK;
600 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
601 *ppv = &ScriptAutoImplPerformance_CF;
602 IClassFactory_AddRef((IClassFactory*)*ppv);
603 return S_OK;
604 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptSourceCodeLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
605 *ppv = &ScriptSourceCodeLoader_CF;
606 IClassFactory_AddRef((IClassFactory*)*ppv);
607 return S_OK;
608 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
609 *ppv = &ScriptAutoImplSegmentState_CF;
610 IClassFactory_AddRef((IClassFactory*)*ppv);
611 return S_OK;
612 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPathConfig) && IsEqualIID (riid, &IID_IClassFactory)) {
613 *ppv = &ScriptAutoImplAudioPathConfig_CF;
614 IClassFactory_AddRef((IClassFactory*)*ppv);
615 return S_OK;
616 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
617 *ppv = &ScriptAutoImplAudioPath_CF;
618 IClassFactory_AddRef((IClassFactory*)*ppv);
619 return S_OK;
620 } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSong) && IsEqualIID (riid, &IID_IClassFactory)) {
621 *ppv = &ScriptAutoImplSong_CF;
622 IClassFactory_AddRef((IClassFactory*)*ppv);
623 return S_OK;
626 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
627 return CLASS_E_CLASSNOTAVAILABLE;
631 /******************************************************************
632 * Helper functions
637 /* FOURCC to string conversion for debug messages */
638 const char *debugstr_fourcc (DWORD fourcc) {
639 if (!fourcc) return "'null'";
640 return wine_dbg_sprintf ("\'%c%c%c%c\'",
641 (char)(fourcc), (char)(fourcc >> 8),
642 (char)(fourcc >> 16), (char)(fourcc >> 24));
645 /* DMUS_VERSION struct to string conversion for debug messages */
646 static const char *debugstr_dmversion (const DMUS_VERSION *version) {
647 if (!version) return "'null'";
648 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
649 (int)((version->dwVersionMS & 0xFFFF0000) >> 8), (int)(version->dwVersionMS & 0x0000FFFF),
650 (int)((version->dwVersionLS & 0xFFFF0000) >> 8), (int)(version->dwVersionLS & 0x0000FFFF));
653 /* returns name of given GUID */
654 const char *debugstr_dmguid (const GUID *id) {
655 static const guid_info guids[] = {
656 /* CLSIDs */
657 GE(CLSID_AudioVBScript),
658 GE(CLSID_DirectMusic),
659 GE(CLSID_DirectMusicAudioPath),
660 GE(CLSID_DirectMusicAudioPathConfig),
661 GE(CLSID_DirectMusicAuditionTrack),
662 GE(CLSID_DirectMusicBand),
663 GE(CLSID_DirectMusicBandTrack),
664 GE(CLSID_DirectMusicChordMapTrack),
665 GE(CLSID_DirectMusicChordMap),
666 GE(CLSID_DirectMusicChordTrack),
667 GE(CLSID_DirectMusicCollection),
668 GE(CLSID_DirectMusicCommandTrack),
669 GE(CLSID_DirectMusicComposer),
670 GE(CLSID_DirectMusicContainer),
671 GE(CLSID_DirectMusicGraph),
672 GE(CLSID_DirectMusicLoader),
673 GE(CLSID_DirectMusicLyricsTrack),
674 GE(CLSID_DirectMusicMarkerTrack),
675 GE(CLSID_DirectMusicMelodyFormulationTrack),
676 GE(CLSID_DirectMusicMotifTrack),
677 GE(CLSID_DirectMusicMuteTrack),
678 GE(CLSID_DirectMusicParamControlTrack),
679 GE(CLSID_DirectMusicPatternTrack),
680 GE(CLSID_DirectMusicPerformance),
681 GE(CLSID_DirectMusicScript),
682 GE(CLSID_DirectMusicScriptAutoImpSegment),
683 GE(CLSID_DirectMusicScriptAutoImpPerformance),
684 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
685 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
686 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
687 GE(CLSID_DirectMusicScriptAutoImpSong),
688 GE(CLSID_DirectMusicScriptSourceCodeLoader),
689 GE(CLSID_DirectMusicScriptTrack),
690 GE(CLSID_DirectMusicSection),
691 GE(CLSID_DirectMusicSegment),
692 GE(CLSID_DirectMusicSegmentState),
693 GE(CLSID_DirectMusicSegmentTriggerTrack),
694 GE(CLSID_DirectMusicSegTriggerTrack),
695 GE(CLSID_DirectMusicSeqTrack),
696 GE(CLSID_DirectMusicSignPostTrack),
697 GE(CLSID_DirectMusicSong),
698 GE(CLSID_DirectMusicStyle),
699 GE(CLSID_DirectMusicStyleTrack),
700 GE(CLSID_DirectMusicSynth),
701 GE(CLSID_DirectMusicSynthSink),
702 GE(CLSID_DirectMusicSysExTrack),
703 GE(CLSID_DirectMusicTemplate),
704 GE(CLSID_DirectMusicTempoTrack),
705 GE(CLSID_DirectMusicTimeSigTrack),
706 GE(CLSID_DirectMusicWaveTrack),
707 GE(CLSID_DirectSoundWave),
708 /* IIDs */
709 GE(IID_IDirectMusic),
710 GE(IID_IDirectMusic2),
711 GE(IID_IDirectMusic8),
712 GE(IID_IDirectMusicAudioPath),
713 GE(IID_IDirectMusicBand),
714 GE(IID_IDirectMusicBuffer),
715 GE(IID_IDirectMusicChordMap),
716 GE(IID_IDirectMusicCollection),
717 GE(IID_IDirectMusicComposer),
718 GE(IID_IDirectMusicContainer),
719 GE(IID_IDirectMusicDownload),
720 GE(IID_IDirectMusicDownloadedInstrument),
721 GE(IID_IDirectMusicGetLoader),
722 GE(IID_IDirectMusicGraph),
723 GE(IID_IDirectMusicInstrument),
724 GE(IID_IDirectMusicLoader),
725 GE(IID_IDirectMusicLoader8),
726 GE(IID_IDirectMusicObject),
727 GE(IID_IDirectMusicPatternTrack),
728 GE(IID_IDirectMusicPerformance),
729 GE(IID_IDirectMusicPerformance2),
730 GE(IID_IDirectMusicPerformance8),
731 GE(IID_IDirectMusicPort),
732 GE(IID_IDirectMusicPortDownload),
733 GE(IID_IDirectMusicScript),
734 GE(IID_IDirectMusicSegment),
735 GE(IID_IDirectMusicSegment2),
736 GE(IID_IDirectMusicSegment8),
737 GE(IID_IDirectMusicSegmentState),
738 GE(IID_IDirectMusicSegmentState8),
739 GE(IID_IDirectMusicStyle),
740 GE(IID_IDirectMusicStyle8),
741 GE(IID_IDirectMusicSynth),
742 GE(IID_IDirectMusicSynth8),
743 GE(IID_IDirectMusicSynthSink),
744 GE(IID_IDirectMusicThru),
745 GE(IID_IDirectMusicTool),
746 GE(IID_IDirectMusicTool8),
747 GE(IID_IDirectMusicTrack),
748 GE(IID_IDirectMusicTrack8),
749 GE(IID_IUnknown),
750 GE(IID_IPersistStream),
751 GE(IID_IStream),
752 GE(IID_IClassFactory),
753 /* GUIDs */
754 GE(GUID_DirectMusicAllTypes),
755 GE(GUID_NOTIFICATION_CHORD),
756 GE(GUID_NOTIFICATION_COMMAND),
757 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
758 GE(GUID_NOTIFICATION_PERFORMANCE),
759 GE(GUID_NOTIFICATION_RECOMPOSE),
760 GE(GUID_NOTIFICATION_SEGMENT),
761 GE(GUID_BandParam),
762 GE(GUID_ChordParam),
763 GE(GUID_CommandParam),
764 GE(GUID_CommandParam2),
765 GE(GUID_CommandParamNext),
766 GE(GUID_IDirectMusicBand),
767 GE(GUID_IDirectMusicChordMap),
768 GE(GUID_IDirectMusicStyle),
769 GE(GUID_MuteParam),
770 GE(GUID_Play_Marker),
771 GE(GUID_RhythmParam),
772 GE(GUID_TempoParam),
773 GE(GUID_TimeSignature),
774 GE(GUID_Valid_Start_Time),
775 GE(GUID_Clear_All_Bands),
776 GE(GUID_ConnectToDLSCollection),
777 GE(GUID_Disable_Auto_Download),
778 GE(GUID_DisableTempo),
779 GE(GUID_DisableTimeSig),
780 GE(GUID_Download),
781 GE(GUID_DownloadToAudioPath),
782 GE(GUID_Enable_Auto_Download),
783 GE(GUID_EnableTempo),
784 GE(GUID_EnableTimeSig),
785 GE(GUID_IgnoreBankSelectForGM),
786 GE(GUID_SeedVariations),
787 GE(GUID_StandardMIDIFile),
788 GE(GUID_Unload),
789 GE(GUID_UnloadFromAudioPath),
790 GE(GUID_Variations),
791 GE(GUID_PerfMasterTempo),
792 GE(GUID_PerfMasterVolume),
793 GE(GUID_PerfMasterGrooveLevel),
794 GE(GUID_PerfAutoDownload),
795 GE(GUID_DefaultGMCollection),
796 GE(GUID_Synth_Default),
797 GE(GUID_Buffer_Reverb),
798 GE(GUID_Buffer_EnvReverb),
799 GE(GUID_Buffer_Stereo),
800 GE(GUID_Buffer_3D_Dry),
801 GE(GUID_Buffer_Mono),
802 GE(GUID_DMUS_PROP_GM_Hardware),
803 GE(GUID_DMUS_PROP_GS_Capable),
804 GE(GUID_DMUS_PROP_GS_Hardware),
805 GE(GUID_DMUS_PROP_DLS1),
806 GE(GUID_DMUS_PROP_DLS2),
807 GE(GUID_DMUS_PROP_Effects),
808 GE(GUID_DMUS_PROP_INSTRUMENT2),
809 GE(GUID_DMUS_PROP_LegacyCaps),
810 GE(GUID_DMUS_PROP_MemorySize),
811 GE(GUID_DMUS_PROP_SampleMemorySize),
812 GE(GUID_DMUS_PROP_SamplePlaybackRate),
813 GE(GUID_DMUS_PROP_SetSynthSink),
814 GE(GUID_DMUS_PROP_SinkUsesDSound),
815 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
816 GE(GUID_DMUS_PROP_SynthSink_WAVE),
817 GE(GUID_DMUS_PROP_Volume),
818 GE(GUID_DMUS_PROP_WavesReverb),
819 GE(GUID_DMUS_PROP_WriteLatency),
820 GE(GUID_DMUS_PROP_WritePeriod),
821 GE(GUID_DMUS_PROP_XG_Capable),
822 GE(GUID_DMUS_PROP_XG_Hardware)
825 unsigned int i;
827 if (!id) return "(null)";
829 for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
830 if (IsEqualGUID(id, guids[i].guid))
831 return guids[i].name;
833 /* if we didn't find it, act like standard debugstr_guid */
834 return debugstr_guid(id);
837 /* generic flag-dumping function */
838 static const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
839 char buffer[128] = "", *ptr = &buffer[0];
840 unsigned int i;
841 int size = sizeof(buffer);
843 for (i=0; i < num_names; i++)
845 if ((flags & names[i].val) || /* standard flag*/
846 ((!flags) && (!names[i].val))) { /* zero value only */
847 int cnt = snprintf(ptr, size, "%s ", names[i].name);
848 if (cnt < 0 || cnt >= size) break;
849 size -= cnt;
850 ptr += cnt;
854 return wine_dbg_sprintf("%s", buffer);
857 /* dump DMUS_OBJ flags */
858 static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
859 static const flag_info flags[] = {
860 FE(DMUS_OBJ_OBJECT),
861 FE(DMUS_OBJ_CLASS),
862 FE(DMUS_OBJ_NAME),
863 FE(DMUS_OBJ_CATEGORY),
864 FE(DMUS_OBJ_FILENAME),
865 FE(DMUS_OBJ_FULLPATH),
866 FE(DMUS_OBJ_URL),
867 FE(DMUS_OBJ_VERSION),
868 FE(DMUS_OBJ_DATE),
869 FE(DMUS_OBJ_LOADED),
870 FE(DMUS_OBJ_MEMORY),
871 FE(DMUS_OBJ_STREAM)
873 return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
876 /* dump whole DMUS_OBJECTDESC struct */
877 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
878 if (pDesc) {
879 char buffer[1024] = "", *ptr = &buffer[0];
881 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
882 ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
883 ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
884 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
885 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
886 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
887 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
888 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
889 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
890 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
891 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
892 wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
893 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
895 return wine_dbg_sprintf("%s", buffer);
896 } else {
897 return wine_dbg_sprintf("(NULL)");