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"
26 WINE_DEFAULT_DEBUG_CHANNEL(dmscript
);
28 static HINSTANCE instance
;
29 LONG DMSCRIPT_refCount
= 0;
32 const IClassFactoryVtbl
*lpVtbl
;
35 /******************************************************************
36 * DirectMusicScriptAutoImplSegment ClassFactory
38 static HRESULT WINAPI
ScriptAutoImplSegmentCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
39 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
41 if (ppobj
== NULL
) return E_POINTER
;
46 static ULONG WINAPI
ScriptAutoImplSegmentCF_AddRef(LPCLASSFACTORY iface
) {
47 DMSCRIPT_LockModule();
49 return 2; /* non-heap based object */
52 static ULONG WINAPI
ScriptAutoImplSegmentCF_Release(LPCLASSFACTORY iface
) {
53 DMSCRIPT_UnlockModule();
55 return 1; /* non-heap based object */
58 static HRESULT WINAPI
ScriptAutoImplSegmentCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
59 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
61 if (ppobj
== NULL
) return E_POINTER
;
66 static HRESULT WINAPI
ScriptAutoImplSegmentCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
67 TRACE("(%d)\n", dolock
);
70 DMSCRIPT_LockModule();
72 DMSCRIPT_UnlockModule();
77 static const IClassFactoryVtbl ScriptAutoImplSegmentCF_Vtbl
= {
78 ScriptAutoImplSegmentCF_QueryInterface
,
79 ScriptAutoImplSegmentCF_AddRef
,
80 ScriptAutoImplSegmentCF_Release
,
81 ScriptAutoImplSegmentCF_CreateInstance
,
82 ScriptAutoImplSegmentCF_LockServer
85 static IClassFactoryImpl ScriptAutoImplSegment_CF
= {&ScriptAutoImplSegmentCF_Vtbl
};
87 /******************************************************************
88 * DirectMusicScriptTrack ClassFactory
90 static HRESULT WINAPI
ScriptTrackCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
91 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
93 if (ppobj
== NULL
) return E_POINTER
;
98 static ULONG WINAPI
ScriptTrackCF_AddRef(LPCLASSFACTORY iface
) {
99 DMSCRIPT_LockModule();
101 return 2; /* non-heap based object */
104 static ULONG WINAPI
ScriptTrackCF_Release(LPCLASSFACTORY iface
) {
105 DMSCRIPT_UnlockModule();
107 return 1; /* non-heap based object */
110 static HRESULT WINAPI
ScriptTrackCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
111 TRACE ("(%p, %s, %p)\n", pOuter
, debugstr_dmguid(riid
), ppobj
);
112 return DMUSIC_CreateDirectMusicScriptTrack (riid
, ppobj
, pOuter
);
115 static HRESULT WINAPI
ScriptTrackCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
116 TRACE("(%d)\n", dolock
);
119 DMSCRIPT_LockModule();
121 DMSCRIPT_UnlockModule();
126 static const IClassFactoryVtbl ScriptTrackCF_Vtbl
= {
127 ScriptTrackCF_QueryInterface
,
128 ScriptTrackCF_AddRef
,
129 ScriptTrackCF_Release
,
130 ScriptTrackCF_CreateInstance
,
131 ScriptTrackCF_LockServer
134 static IClassFactoryImpl ScriptTrack_CF
= {&ScriptTrackCF_Vtbl
};
136 /******************************************************************
137 * DirectMusicAudioVBScript ClassFactory
139 static HRESULT WINAPI
AudioVBScriptCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
140 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
142 if (ppobj
== NULL
) return E_POINTER
;
144 return E_NOINTERFACE
;
147 static ULONG WINAPI
AudioVBScriptCF_AddRef(LPCLASSFACTORY iface
) {
148 DMSCRIPT_LockModule();
150 return 2; /* non-heap based object */
153 static ULONG WINAPI
AudioVBScriptCF_Release(LPCLASSFACTORY iface
) {
154 DMSCRIPT_UnlockModule();
156 return 1; /* non-heap based object */
159 static HRESULT WINAPI
AudioVBScriptCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
160 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
162 if (ppobj
== NULL
) return E_POINTER
;
164 return E_NOINTERFACE
;
167 static HRESULT WINAPI
AudioVBScriptCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
168 TRACE("(%d)\n", dolock
);
171 DMSCRIPT_LockModule();
173 DMSCRIPT_UnlockModule();
178 static const IClassFactoryVtbl AudioVBScriptCF_Vtbl
= {
179 AudioVBScriptCF_QueryInterface
,
180 AudioVBScriptCF_AddRef
,
181 AudioVBScriptCF_Release
,
182 AudioVBScriptCF_CreateInstance
,
183 AudioVBScriptCF_LockServer
186 static IClassFactoryImpl AudioVBScript_CF
= {&AudioVBScriptCF_Vtbl
};
188 /******************************************************************
189 * DirectMusicScript ClassFactory
191 static HRESULT WINAPI
ScriptCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
192 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
194 if (ppobj
== NULL
) return E_POINTER
;
196 return E_NOINTERFACE
;
199 static ULONG WINAPI
ScriptCF_AddRef(LPCLASSFACTORY iface
) {
200 DMSCRIPT_LockModule();
202 return 2; /* non-heap based object */
205 static ULONG WINAPI
ScriptCF_Release(LPCLASSFACTORY iface
) {
206 DMSCRIPT_UnlockModule();
208 return 1; /* non-heap based object */
211 static HRESULT WINAPI
ScriptCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
212 TRACE ("(%p, %s, %p)\n", pOuter
, debugstr_dmguid(riid
), ppobj
);
214 return DMUSIC_CreateDirectMusicScriptImpl (riid
, ppobj
, pOuter
);
217 static HRESULT WINAPI
ScriptCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
218 TRACE("(%d)\n", dolock
);
221 DMSCRIPT_LockModule();
223 DMSCRIPT_UnlockModule();
228 static const IClassFactoryVtbl ScriptCF_Vtbl
= {
229 ScriptCF_QueryInterface
,
232 ScriptCF_CreateInstance
,
236 static IClassFactoryImpl Script_CF
= {&ScriptCF_Vtbl
};
238 /******************************************************************
239 * DirectMusicScriptAutoImplPerformance ClassFactory
241 static HRESULT WINAPI
ScriptAutoImplPerformanceCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
242 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
244 if (ppobj
== NULL
) return E_POINTER
;
246 return E_NOINTERFACE
;
249 static ULONG WINAPI
ScriptAutoImplPerformanceCF_AddRef(LPCLASSFACTORY iface
) {
250 DMSCRIPT_LockModule();
252 return 2; /* non-heap based object */
255 static ULONG WINAPI
ScriptAutoImplPerformanceCF_Release(LPCLASSFACTORY iface
) {
256 DMSCRIPT_UnlockModule();
258 return 1; /* non-heap based object */
261 static HRESULT WINAPI
ScriptAutoImplPerformanceCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
262 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
264 if (ppobj
== NULL
) return E_POINTER
;
266 return E_NOINTERFACE
;
269 static HRESULT WINAPI
ScriptAutoImplPerformanceCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
270 TRACE("(%d)\n", dolock
);
273 DMSCRIPT_LockModule();
275 DMSCRIPT_UnlockModule();
280 static const IClassFactoryVtbl ScriptAutoImplPerformanceCF_Vtbl
= {
281 ScriptAutoImplPerformanceCF_QueryInterface
,
282 ScriptAutoImplPerformanceCF_AddRef
,
283 ScriptAutoImplPerformanceCF_Release
,
284 ScriptAutoImplPerformanceCF_CreateInstance
,
285 ScriptAutoImplPerformanceCF_LockServer
288 static IClassFactoryImpl ScriptAutoImplPerformance_CF
= {&ScriptAutoImplPerformanceCF_Vtbl
};
290 /******************************************************************
291 * DirectMusicScriptSourceCodeLoader ClassFactory
293 static HRESULT WINAPI
ScriptSourceCodeLoaderCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
294 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
296 if (ppobj
== NULL
) return E_POINTER
;
298 return E_NOINTERFACE
;
301 static ULONG WINAPI
ScriptSourceCodeLoaderCF_AddRef(LPCLASSFACTORY iface
) {
302 DMSCRIPT_LockModule();
304 return 2; /* non-heap based object */
307 static ULONG WINAPI
ScriptSourceCodeLoaderCF_Release(LPCLASSFACTORY iface
) {
308 DMSCRIPT_UnlockModule();
310 return 1; /* non-heap based object */
313 static HRESULT WINAPI
ScriptSourceCodeLoaderCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
314 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
316 if (ppobj
== NULL
) return E_POINTER
;
318 return E_NOINTERFACE
;
321 static HRESULT WINAPI
ScriptSourceCodeLoaderCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
322 TRACE("(%d)\n", dolock
);
325 DMSCRIPT_LockModule();
327 DMSCRIPT_UnlockModule();
332 static const IClassFactoryVtbl ScriptSourceCodeLoaderCF_Vtbl
= {
333 ScriptSourceCodeLoaderCF_QueryInterface
,
334 ScriptSourceCodeLoaderCF_AddRef
,
335 ScriptSourceCodeLoaderCF_Release
,
336 ScriptSourceCodeLoaderCF_CreateInstance
,
337 ScriptSourceCodeLoaderCF_LockServer
340 static IClassFactoryImpl ScriptSourceCodeLoader_CF
= {&ScriptSourceCodeLoaderCF_Vtbl
};
342 /******************************************************************
343 * DirectMusicScriptAutoImplSegmentState ClassFactory
345 static HRESULT WINAPI
ScriptAutoImplSegmentStateCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
346 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
348 if (ppobj
== NULL
) return E_POINTER
;
350 return E_NOINTERFACE
;
353 static ULONG WINAPI
ScriptAutoImplSegmentStateCF_AddRef(LPCLASSFACTORY iface
) {
354 DMSCRIPT_LockModule();
356 return 2; /* non-heap based object */
359 static ULONG WINAPI
ScriptAutoImplSegmentStateCF_Release(LPCLASSFACTORY iface
) {
360 DMSCRIPT_UnlockModule();
362 return 1; /* non-heap based object */
365 static HRESULT WINAPI
ScriptAutoImplSegmentStateCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
366 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
368 if (ppobj
== NULL
) return E_POINTER
;
370 return E_NOINTERFACE
;
373 static HRESULT WINAPI
ScriptAutoImplSegmentStateCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
374 TRACE("(%d)\n", dolock
);
377 DMSCRIPT_LockModule();
379 DMSCRIPT_UnlockModule();
384 static const IClassFactoryVtbl ScriptAutoImplSegmentStateCF_Vtbl
= {
385 ScriptAutoImplSegmentStateCF_QueryInterface
,
386 ScriptAutoImplSegmentStateCF_AddRef
,
387 ScriptAutoImplSegmentStateCF_Release
,
388 ScriptAutoImplSegmentStateCF_CreateInstance
,
389 ScriptAutoImplSegmentStateCF_LockServer
392 static IClassFactoryImpl ScriptAutoImplSegmentState_CF
= {&ScriptAutoImplSegmentStateCF_Vtbl
};
394 /******************************************************************
395 * DirectMusicScriptAutoImplAudioPathConfig ClassFactory
397 static HRESULT WINAPI
ScriptAutoImplAudioPathConfigCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
398 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
400 if (ppobj
== NULL
) return E_POINTER
;
402 return E_NOINTERFACE
;
405 static ULONG WINAPI
ScriptAutoImplAudioPathConfigCF_AddRef(LPCLASSFACTORY iface
) {
406 DMSCRIPT_LockModule();
408 return 2; /* non-heap based object */
411 static ULONG WINAPI
ScriptAutoImplAudioPathConfigCF_Release(LPCLASSFACTORY iface
) {
412 DMSCRIPT_UnlockModule();
414 return 1; /* non-heap based object */
417 static HRESULT WINAPI
ScriptAutoImplAudioPathConfigCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
418 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
420 if (ppobj
== NULL
) return E_POINTER
;
422 return E_NOINTERFACE
;
425 static HRESULT WINAPI
ScriptAutoImplAudioPathConfigCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
426 TRACE("(%d)\n", dolock
);
429 DMSCRIPT_LockModule();
431 DMSCRIPT_UnlockModule();
436 static const IClassFactoryVtbl ScriptAutoImplAudioPathConfigCF_Vtbl
= {
437 ScriptAutoImplAudioPathConfigCF_QueryInterface
,
438 ScriptAutoImplAudioPathConfigCF_AddRef
,
439 ScriptAutoImplAudioPathConfigCF_Release
,
440 ScriptAutoImplAudioPathConfigCF_CreateInstance
,
441 ScriptAutoImplAudioPathConfigCF_LockServer
444 static IClassFactoryImpl ScriptAutoImplAudioPathConfig_CF
= {&ScriptAutoImplAudioPathConfigCF_Vtbl
};
446 /******************************************************************
447 * DirectMusicScriptAutoImplAudioPath ClassFactory
449 static HRESULT WINAPI
ScriptAutoImplAudioPathCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
450 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
452 if (ppobj
== NULL
) return E_POINTER
;
454 return E_NOINTERFACE
;
457 static ULONG WINAPI
ScriptAutoImplAudioPathCF_AddRef(LPCLASSFACTORY iface
) {
458 DMSCRIPT_LockModule();
460 return 2; /* non-heap based object */
463 static ULONG WINAPI
ScriptAutoImplAudioPathCF_Release(LPCLASSFACTORY iface
) {
464 DMSCRIPT_UnlockModule();
466 return 1; /* non-heap based object */
469 static HRESULT WINAPI
ScriptAutoImplAudioPathCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
470 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
472 if (ppobj
== NULL
) return E_POINTER
;
474 return E_NOINTERFACE
;
477 static HRESULT WINAPI
ScriptAutoImplAudioPathCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
478 TRACE("(%d)\n", dolock
);
481 DMSCRIPT_LockModule();
483 DMSCRIPT_UnlockModule();
488 static const IClassFactoryVtbl ScriptAutoImplAudioPathCF_Vtbl
= {
489 ScriptAutoImplAudioPathCF_QueryInterface
,
490 ScriptAutoImplAudioPathCF_AddRef
,
491 ScriptAutoImplAudioPathCF_Release
,
492 ScriptAutoImplAudioPathCF_CreateInstance
,
493 ScriptAutoImplAudioPathCF_LockServer
496 static IClassFactoryImpl ScriptAutoImplAudioPath_CF
= {&ScriptAutoImplAudioPathCF_Vtbl
};
498 /******************************************************************
499 * DirectMusicScriptAutoImplSong ClassFactory
501 static HRESULT WINAPI
ScriptAutoImplSongCF_QueryInterface(LPCLASSFACTORY iface
,REFIID riid
,LPVOID
*ppobj
) {
502 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
504 if (ppobj
== NULL
) return E_POINTER
;
506 return E_NOINTERFACE
;
509 static ULONG WINAPI
ScriptAutoImplSongCF_AddRef(LPCLASSFACTORY iface
) {
510 DMSCRIPT_LockModule();
512 return 2; /* non-heap based */
515 static ULONG WINAPI
ScriptAutoImplSongCF_Release(LPCLASSFACTORY iface
) {
516 DMSCRIPT_UnlockModule();
518 return 1; /* non-heap based object */
521 static HRESULT WINAPI
ScriptAutoImplSongCF_CreateInstance(LPCLASSFACTORY iface
, LPUNKNOWN pOuter
, REFIID riid
, LPVOID
*ppobj
) {
522 FIXME("- no interface IID: %s\n", debugstr_guid(riid
));
524 if (ppobj
== NULL
) return E_POINTER
;
526 return E_NOINTERFACE
;
529 static HRESULT WINAPI
ScriptAutoImplSongCF_LockServer(LPCLASSFACTORY iface
,BOOL dolock
) {
530 TRACE("(%d)\n", dolock
);
533 DMSCRIPT_LockModule();
535 DMSCRIPT_UnlockModule();
540 static const IClassFactoryVtbl ScriptAutoImplSongCF_Vtbl
= {
541 ScriptAutoImplSongCF_QueryInterface
,
542 ScriptAutoImplSongCF_AddRef
,
543 ScriptAutoImplSongCF_Release
,
544 ScriptAutoImplSongCF_CreateInstance
,
545 ScriptAutoImplSongCF_LockServer
548 static IClassFactoryImpl ScriptAutoImplSong_CF
= {&ScriptAutoImplSongCF_Vtbl
};
550 /******************************************************************
555 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
) {
556 if (fdwReason
== DLL_PROCESS_ATTACH
) {
558 DisableThreadLibraryCalls(hinstDLL
);
559 /* FIXME: Initialisation */
560 } else if (fdwReason
== DLL_PROCESS_DETACH
) {
568 /******************************************************************
569 * DllCanUnloadNow (DMSCRIPT.@)
573 HRESULT WINAPI
DllCanUnloadNow(void)
575 return DMSCRIPT_refCount
!= 0 ? S_FALSE
: S_OK
;
579 /******************************************************************
580 * DllGetClassObject (DMSCRIPT.@)
584 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
586 TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
587 if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpSegment
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
588 *ppv
= &ScriptAutoImplSegment_CF
;
589 IClassFactory_AddRef((IClassFactory
*)*ppv
);
591 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptTrack
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
592 *ppv
= &ScriptTrack_CF
;
593 IClassFactory_AddRef((IClassFactory
*)*ppv
);
595 } else if (IsEqualCLSID (rclsid
, &CLSID_AudioVBScript
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
596 *ppv
= &AudioVBScript_CF
;
597 IClassFactory_AddRef((IClassFactory
*)*ppv
);
599 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScript
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
601 IClassFactory_AddRef((IClassFactory
*)*ppv
);
603 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpPerformance
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
604 *ppv
= &ScriptAutoImplPerformance_CF
;
605 IClassFactory_AddRef((IClassFactory
*)*ppv
);
607 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptSourceCodeLoader
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
608 *ppv
= &ScriptSourceCodeLoader_CF
;
609 IClassFactory_AddRef((IClassFactory
*)*ppv
);
611 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpSegmentState
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
612 *ppv
= &ScriptAutoImplSegmentState_CF
;
613 IClassFactory_AddRef((IClassFactory
*)*ppv
);
615 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpAudioPathConfig
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
616 *ppv
= &ScriptAutoImplAudioPathConfig_CF
;
617 IClassFactory_AddRef((IClassFactory
*)*ppv
);
619 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpAudioPath
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
620 *ppv
= &ScriptAutoImplAudioPath_CF
;
621 IClassFactory_AddRef((IClassFactory
*)*ppv
);
623 } else if (IsEqualCLSID (rclsid
, &CLSID_DirectMusicScriptAutoImpSong
) && IsEqualIID (riid
, &IID_IClassFactory
)) {
624 *ppv
= &ScriptAutoImplSong_CF
;
625 IClassFactory_AddRef((IClassFactory
*)*ppv
);
629 WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid
), debugstr_dmguid(riid
), ppv
);
630 return CLASS_E_CLASSNOTAVAILABLE
;
634 /***********************************************************************
635 * DllRegisterServer (DMSCRIPT.@)
637 HRESULT WINAPI
DllRegisterServer(void)
639 return __wine_register_resources( instance
, NULL
);
642 /***********************************************************************
643 * DllUnregisterServer (DMSCRIPT.@)
645 HRESULT WINAPI
DllUnregisterServer(void)
647 return __wine_unregister_resources( instance
, NULL
);
650 /******************************************************************
656 /* FOURCC to string conversion for debug messages */
657 const char *debugstr_fourcc (DWORD fourcc
) {
658 if (!fourcc
) return "'null'";
659 return wine_dbg_sprintf ("\'%c%c%c%c\'",
660 (char)(fourcc
), (char)(fourcc
>> 8),
661 (char)(fourcc
>> 16), (char)(fourcc
>> 24));
664 /* DMUS_VERSION struct to string conversion for debug messages */
665 static const char *debugstr_dmversion (const DMUS_VERSION
*version
) {
666 if (!version
) return "'null'";
667 return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
668 (int)((version
->dwVersionMS
& 0xFFFF0000) >> 8), (int)(version
->dwVersionMS
& 0x0000FFFF),
669 (int)((version
->dwVersionLS
& 0xFFFF0000) >> 8), (int)(version
->dwVersionLS
& 0x0000FFFF));
672 /* returns name of given GUID */
673 const char *debugstr_dmguid (const GUID
*id
) {
674 static const guid_info guids
[] = {
676 GE(CLSID_AudioVBScript
),
677 GE(CLSID_DirectMusic
),
678 GE(CLSID_DirectMusicAudioPath
),
679 GE(CLSID_DirectMusicAudioPathConfig
),
680 GE(CLSID_DirectMusicAuditionTrack
),
681 GE(CLSID_DirectMusicBand
),
682 GE(CLSID_DirectMusicBandTrack
),
683 GE(CLSID_DirectMusicChordMapTrack
),
684 GE(CLSID_DirectMusicChordMap
),
685 GE(CLSID_DirectMusicChordTrack
),
686 GE(CLSID_DirectMusicCollection
),
687 GE(CLSID_DirectMusicCommandTrack
),
688 GE(CLSID_DirectMusicComposer
),
689 GE(CLSID_DirectMusicContainer
),
690 GE(CLSID_DirectMusicGraph
),
691 GE(CLSID_DirectMusicLoader
),
692 GE(CLSID_DirectMusicLyricsTrack
),
693 GE(CLSID_DirectMusicMarkerTrack
),
694 GE(CLSID_DirectMusicMelodyFormulationTrack
),
695 GE(CLSID_DirectMusicMotifTrack
),
696 GE(CLSID_DirectMusicMuteTrack
),
697 GE(CLSID_DirectMusicParamControlTrack
),
698 GE(CLSID_DirectMusicPatternTrack
),
699 GE(CLSID_DirectMusicPerformance
),
700 GE(CLSID_DirectMusicScript
),
701 GE(CLSID_DirectMusicScriptAutoImpSegment
),
702 GE(CLSID_DirectMusicScriptAutoImpPerformance
),
703 GE(CLSID_DirectMusicScriptAutoImpSegmentState
),
704 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig
),
705 GE(CLSID_DirectMusicScriptAutoImpAudioPath
),
706 GE(CLSID_DirectMusicScriptAutoImpSong
),
707 GE(CLSID_DirectMusicScriptSourceCodeLoader
),
708 GE(CLSID_DirectMusicScriptTrack
),
709 GE(CLSID_DirectMusicSection
),
710 GE(CLSID_DirectMusicSegment
),
711 GE(CLSID_DirectMusicSegmentState
),
712 GE(CLSID_DirectMusicSegmentTriggerTrack
),
713 GE(CLSID_DirectMusicSegTriggerTrack
),
714 GE(CLSID_DirectMusicSeqTrack
),
715 GE(CLSID_DirectMusicSignPostTrack
),
716 GE(CLSID_DirectMusicSong
),
717 GE(CLSID_DirectMusicStyle
),
718 GE(CLSID_DirectMusicStyleTrack
),
719 GE(CLSID_DirectMusicSynth
),
720 GE(CLSID_DirectMusicSynthSink
),
721 GE(CLSID_DirectMusicSysExTrack
),
722 GE(CLSID_DirectMusicTemplate
),
723 GE(CLSID_DirectMusicTempoTrack
),
724 GE(CLSID_DirectMusicTimeSigTrack
),
725 GE(CLSID_DirectMusicWaveTrack
),
726 GE(CLSID_DirectSoundWave
),
728 GE(IID_IDirectMusic
),
729 GE(IID_IDirectMusic2
),
730 GE(IID_IDirectMusic8
),
731 GE(IID_IDirectMusicAudioPath
),
732 GE(IID_IDirectMusicBand
),
733 GE(IID_IDirectMusicBuffer
),
734 GE(IID_IDirectMusicChordMap
),
735 GE(IID_IDirectMusicCollection
),
736 GE(IID_IDirectMusicComposer
),
737 GE(IID_IDirectMusicContainer
),
738 GE(IID_IDirectMusicDownload
),
739 GE(IID_IDirectMusicDownloadedInstrument
),
740 GE(IID_IDirectMusicGetLoader
),
741 GE(IID_IDirectMusicGraph
),
742 GE(IID_IDirectMusicInstrument
),
743 GE(IID_IDirectMusicLoader
),
744 GE(IID_IDirectMusicLoader8
),
745 GE(IID_IDirectMusicObject
),
746 GE(IID_IDirectMusicPatternTrack
),
747 GE(IID_IDirectMusicPerformance
),
748 GE(IID_IDirectMusicPerformance2
),
749 GE(IID_IDirectMusicPerformance8
),
750 GE(IID_IDirectMusicPort
),
751 GE(IID_IDirectMusicPortDownload
),
752 GE(IID_IDirectMusicScript
),
753 GE(IID_IDirectMusicSegment
),
754 GE(IID_IDirectMusicSegment2
),
755 GE(IID_IDirectMusicSegment8
),
756 GE(IID_IDirectMusicSegmentState
),
757 GE(IID_IDirectMusicSegmentState8
),
758 GE(IID_IDirectMusicStyle
),
759 GE(IID_IDirectMusicStyle8
),
760 GE(IID_IDirectMusicSynth
),
761 GE(IID_IDirectMusicSynth8
),
762 GE(IID_IDirectMusicSynthSink
),
763 GE(IID_IDirectMusicThru
),
764 GE(IID_IDirectMusicTool
),
765 GE(IID_IDirectMusicTool8
),
766 GE(IID_IDirectMusicTrack
),
767 GE(IID_IDirectMusicTrack8
),
769 GE(IID_IPersistStream
),
771 GE(IID_IClassFactory
),
773 GE(GUID_DirectMusicAllTypes
),
774 GE(GUID_NOTIFICATION_CHORD
),
775 GE(GUID_NOTIFICATION_COMMAND
),
776 GE(GUID_NOTIFICATION_MEASUREANDBEAT
),
777 GE(GUID_NOTIFICATION_PERFORMANCE
),
778 GE(GUID_NOTIFICATION_RECOMPOSE
),
779 GE(GUID_NOTIFICATION_SEGMENT
),
782 GE(GUID_CommandParam
),
783 GE(GUID_CommandParam2
),
784 GE(GUID_CommandParamNext
),
785 GE(GUID_IDirectMusicBand
),
786 GE(GUID_IDirectMusicChordMap
),
787 GE(GUID_IDirectMusicStyle
),
789 GE(GUID_Play_Marker
),
790 GE(GUID_RhythmParam
),
792 GE(GUID_TimeSignature
),
793 GE(GUID_Valid_Start_Time
),
794 GE(GUID_Clear_All_Bands
),
795 GE(GUID_ConnectToDLSCollection
),
796 GE(GUID_Disable_Auto_Download
),
797 GE(GUID_DisableTempo
),
798 GE(GUID_DisableTimeSig
),
800 GE(GUID_DownloadToAudioPath
),
801 GE(GUID_Enable_Auto_Download
),
802 GE(GUID_EnableTempo
),
803 GE(GUID_EnableTimeSig
),
804 GE(GUID_IgnoreBankSelectForGM
),
805 GE(GUID_SeedVariations
),
806 GE(GUID_StandardMIDIFile
),
808 GE(GUID_UnloadFromAudioPath
),
810 GE(GUID_PerfMasterTempo
),
811 GE(GUID_PerfMasterVolume
),
812 GE(GUID_PerfMasterGrooveLevel
),
813 GE(GUID_PerfAutoDownload
),
814 GE(GUID_DefaultGMCollection
),
815 GE(GUID_Synth_Default
),
816 GE(GUID_Buffer_Reverb
),
817 GE(GUID_Buffer_EnvReverb
),
818 GE(GUID_Buffer_Stereo
),
819 GE(GUID_Buffer_3D_Dry
),
820 GE(GUID_Buffer_Mono
),
821 GE(GUID_DMUS_PROP_GM_Hardware
),
822 GE(GUID_DMUS_PROP_GS_Capable
),
823 GE(GUID_DMUS_PROP_GS_Hardware
),
824 GE(GUID_DMUS_PROP_DLS1
),
825 GE(GUID_DMUS_PROP_DLS2
),
826 GE(GUID_DMUS_PROP_Effects
),
827 GE(GUID_DMUS_PROP_INSTRUMENT2
),
828 GE(GUID_DMUS_PROP_LegacyCaps
),
829 GE(GUID_DMUS_PROP_MemorySize
),
830 GE(GUID_DMUS_PROP_SampleMemorySize
),
831 GE(GUID_DMUS_PROP_SamplePlaybackRate
),
832 GE(GUID_DMUS_PROP_SetSynthSink
),
833 GE(GUID_DMUS_PROP_SinkUsesDSound
),
834 GE(GUID_DMUS_PROP_SynthSink_DSOUND
),
835 GE(GUID_DMUS_PROP_SynthSink_WAVE
),
836 GE(GUID_DMUS_PROP_Volume
),
837 GE(GUID_DMUS_PROP_WavesReverb
),
838 GE(GUID_DMUS_PROP_WriteLatency
),
839 GE(GUID_DMUS_PROP_WritePeriod
),
840 GE(GUID_DMUS_PROP_XG_Capable
),
841 GE(GUID_DMUS_PROP_XG_Hardware
)
846 if (!id
) return "(null)";
848 for (i
= 0; i
< sizeof(guids
)/sizeof(guids
[0]); i
++) {
849 if (IsEqualGUID(id
, guids
[i
].guid
))
850 return guids
[i
].name
;
852 /* if we didn't find it, act like standard debugstr_guid */
853 return debugstr_guid(id
);
856 /* generic flag-dumping function */
857 static const char* debugstr_flags (DWORD flags
, const flag_info
* names
, size_t num_names
){
858 char buffer
[128] = "", *ptr
= &buffer
[0];
860 int size
= sizeof(buffer
);
862 for (i
=0; i
< num_names
; i
++)
864 if ((flags
& names
[i
].val
) || /* standard flag*/
865 ((!flags
) && (!names
[i
].val
))) { /* zero value only */
866 int cnt
= snprintf(ptr
, size
, "%s ", names
[i
].name
);
867 if (cnt
< 0 || cnt
>= size
) break;
873 return wine_dbg_sprintf("%s", buffer
);
876 /* dump DMUS_OBJ flags */
877 static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask
) {
878 static const flag_info flags
[] = {
882 FE(DMUS_OBJ_CATEGORY
),
883 FE(DMUS_OBJ_FILENAME
),
884 FE(DMUS_OBJ_FULLPATH
),
886 FE(DMUS_OBJ_VERSION
),
892 return debugstr_flags (flagmask
, flags
, sizeof(flags
)/sizeof(flags
[0]));
895 /* dump whole DMUS_OBJECTDESC struct */
896 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc
) {
898 char buffer
[1024] = "", *ptr
= &buffer
[0];
900 ptr
+= sprintf(ptr
, "DMUS_OBJECTDESC (%p):\n", pDesc
);
901 ptr
+= sprintf(ptr
, " - dwSize = %d\n", pDesc
->dwSize
);
902 ptr
+= sprintf(ptr
, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc
->dwValidData
));
903 if (pDesc
->dwValidData
& DMUS_OBJ_CLASS
) ptr
+= sprintf(ptr
, " - guidClass = %s\n", debugstr_dmguid(&pDesc
->guidClass
));
904 if (pDesc
->dwValidData
& DMUS_OBJ_OBJECT
) ptr
+= sprintf(ptr
, " - guidObject = %s\n", debugstr_guid(&pDesc
->guidObject
));
905 if (pDesc
->dwValidData
& DMUS_OBJ_DATE
) ptr
+= sprintf(ptr
, " - ftDate = FIXME\n");
906 if (pDesc
->dwValidData
& DMUS_OBJ_VERSION
) ptr
+= sprintf(ptr
, " - vVersion = %s\n", debugstr_dmversion(&pDesc
->vVersion
));
907 if (pDesc
->dwValidData
& DMUS_OBJ_NAME
) ptr
+= sprintf(ptr
, " - wszName = %s\n", debugstr_w(pDesc
->wszName
));
908 if (pDesc
->dwValidData
& DMUS_OBJ_CATEGORY
) ptr
+= sprintf(ptr
, " - wszCategory = %s\n", debugstr_w(pDesc
->wszCategory
));
909 if (pDesc
->dwValidData
& DMUS_OBJ_FILENAME
) ptr
+= sprintf(ptr
, " - wszFileName = %s\n", debugstr_w(pDesc
->wszFileName
));
910 if (pDesc
->dwValidData
& DMUS_OBJ_MEMORY
) ptr
+= sprintf(ptr
, " - llMemLength = 0x%s\n - pbMemData = %p\n",
911 wine_dbgstr_longlong(pDesc
->llMemLength
), pDesc
->pbMemData
);
912 if (pDesc
->dwValidData
& DMUS_OBJ_STREAM
) ptr
+= sprintf(ptr
, " - pStream = %p", pDesc
->pStream
);
914 return wine_dbg_sprintf("%s", buffer
);
916 return wine_dbg_sprintf("(NULL)");