msi: Store the base URL of the MSI package if it is downloaded.
[wine] / dlls / dmscript / dmscript_main.c
1 /* DirectMusicScript Main
2  *
3  * Copyright (C) 2003-2004 Rok Mandeljc
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #include "dmscript_private.h"
21
22 WINE_DEFAULT_DEBUG_CHANNEL(dmscript);
23
24 LONG DMSCRIPT_refCount = 0;
25
26 typedef struct {
27     const IClassFactoryVtbl *lpVtbl;
28 } IClassFactoryImpl;
29
30 /******************************************************************
31  *              DirectMusicScriptAutoImplSegment ClassFactory
32  */
33 static HRESULT WINAPI ScriptAutoImplSegmentCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
34         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
35
36         if (ppobj == NULL) return E_POINTER;
37         
38         return E_NOINTERFACE;
39 }
40
41 static ULONG WINAPI ScriptAutoImplSegmentCF_AddRef(LPCLASSFACTORY iface) {
42         DMSCRIPT_LockModule();
43
44         return 2; /* non-heap based object */
45 }
46
47 static ULONG WINAPI ScriptAutoImplSegmentCF_Release(LPCLASSFACTORY iface) {
48         DMSCRIPT_UnlockModule();
49
50         return 1; /* non-heap based object */
51 }
52
53 static HRESULT WINAPI ScriptAutoImplSegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
54         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
55
56         if (ppobj == NULL) return E_POINTER;
57         
58         return E_NOINTERFACE;
59 }
60
61 static HRESULT WINAPI ScriptAutoImplSegmentCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
62         TRACE("(%d)\n", dolock);
63
64         if (dolock)
65                 DMSCRIPT_LockModule();
66         else
67                 DMSCRIPT_UnlockModule();
68         
69         return S_OK;
70 }
71
72 static const IClassFactoryVtbl ScriptAutoImplSegmentCF_Vtbl = {
73         ScriptAutoImplSegmentCF_QueryInterface,
74         ScriptAutoImplSegmentCF_AddRef,
75         ScriptAutoImplSegmentCF_Release,
76         ScriptAutoImplSegmentCF_CreateInstance,
77         ScriptAutoImplSegmentCF_LockServer
78 };
79
80 static IClassFactoryImpl ScriptAutoImplSegment_CF = {&ScriptAutoImplSegmentCF_Vtbl};
81
82 /******************************************************************
83  *              DirectMusicScriptTrack ClassFactory
84  */
85 static HRESULT WINAPI ScriptTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
86         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
87
88         if (ppobj == NULL) return E_POINTER;
89         
90         return E_NOINTERFACE;
91 }
92
93 static ULONG WINAPI ScriptTrackCF_AddRef(LPCLASSFACTORY iface) {
94         DMSCRIPT_LockModule();
95
96         return 2; /* non-heap based object */
97 }
98
99 static ULONG WINAPI ScriptTrackCF_Release(LPCLASSFACTORY iface) {
100         DMSCRIPT_UnlockModule();
101
102         return 1; /* non-heap based object */
103 }
104
105 static HRESULT WINAPI ScriptTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
106         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
107         return DMUSIC_CreateDirectMusicScriptTrack (riid, ppobj, pOuter);
108 }
109
110 static HRESULT WINAPI ScriptTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
111         TRACE("(%d)\n", dolock);
112
113         if (dolock)
114                 DMSCRIPT_LockModule();
115         else
116                 DMSCRIPT_UnlockModule();
117         
118         return S_OK;
119 }
120
121 static const IClassFactoryVtbl ScriptTrackCF_Vtbl = {
122         ScriptTrackCF_QueryInterface,
123         ScriptTrackCF_AddRef,
124         ScriptTrackCF_Release,
125         ScriptTrackCF_CreateInstance,
126         ScriptTrackCF_LockServer
127 };
128
129 static IClassFactoryImpl ScriptTrack_CF = {&ScriptTrackCF_Vtbl};
130
131 /******************************************************************
132  *              DirectMusicAudioVBScript ClassFactory
133  */
134 static HRESULT WINAPI AudioVBScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
135         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
136
137         if (ppobj == NULL) return E_POINTER;
138         
139         return E_NOINTERFACE;
140 }
141
142 static ULONG WINAPI AudioVBScriptCF_AddRef(LPCLASSFACTORY iface) {
143         DMSCRIPT_LockModule();
144
145         return 2; /* non-heap based object */
146 }
147
148 static ULONG WINAPI AudioVBScriptCF_Release(LPCLASSFACTORY iface) {
149         DMSCRIPT_UnlockModule();
150
151         return 1; /* non-heap based object */
152 }
153
154 static HRESULT WINAPI AudioVBScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
155         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
156
157         if (ppobj == NULL) return E_POINTER;
158         
159         return E_NOINTERFACE;
160 }
161
162 static HRESULT WINAPI AudioVBScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
163         TRACE("(%d)\n", dolock);
164
165         if (dolock)
166                 DMSCRIPT_LockModule();
167         else
168                 DMSCRIPT_UnlockModule();
169         
170         return S_OK;
171 }
172
173 static const IClassFactoryVtbl AudioVBScriptCF_Vtbl = {
174         AudioVBScriptCF_QueryInterface,
175         AudioVBScriptCF_AddRef,
176         AudioVBScriptCF_Release,
177         AudioVBScriptCF_CreateInstance,
178         AudioVBScriptCF_LockServer
179 };
180
181 static IClassFactoryImpl AudioVBScript_CF = {&AudioVBScriptCF_Vtbl};
182
183 /******************************************************************
184  *              DirectMusicScript ClassFactory
185  */
186 static HRESULT WINAPI ScriptCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
187         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
188
189         if (ppobj == NULL) return E_POINTER;
190         
191         return E_NOINTERFACE;
192 }
193
194 static ULONG WINAPI ScriptCF_AddRef(LPCLASSFACTORY iface) {
195         DMSCRIPT_LockModule();
196
197         return 2; /* non-heap based object */
198 }
199
200 static ULONG WINAPI ScriptCF_Release(LPCLASSFACTORY iface) {
201         DMSCRIPT_UnlockModule();
202
203         return 1; /* non-heap based object */
204 }
205
206 static HRESULT WINAPI ScriptCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
207         TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
208         
209         return DMUSIC_CreateDirectMusicScriptImpl (riid, ppobj, pOuter);
210 }
211
212 static HRESULT WINAPI ScriptCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
213         TRACE("(%d)\n", dolock);
214
215         if (dolock)
216                 DMSCRIPT_LockModule();
217         else
218                 DMSCRIPT_UnlockModule();
219         
220         return S_OK;
221 }
222
223 static const IClassFactoryVtbl ScriptCF_Vtbl = {
224         ScriptCF_QueryInterface,
225         ScriptCF_AddRef,
226         ScriptCF_Release,
227         ScriptCF_CreateInstance,
228         ScriptCF_LockServer
229 };
230
231 static IClassFactoryImpl Script_CF = {&ScriptCF_Vtbl};
232
233 /******************************************************************
234  *              DirectMusicScriptAutoImplPerformance ClassFactory
235  */
236 static HRESULT WINAPI ScriptAutoImplPerformanceCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
237         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
238
239         if (ppobj == NULL) return E_POINTER;
240         
241         return E_NOINTERFACE;
242 }
243
244 static ULONG WINAPI ScriptAutoImplPerformanceCF_AddRef(LPCLASSFACTORY iface) {
245         DMSCRIPT_LockModule();
246
247         return 2; /* non-heap based object */
248 }
249
250 static ULONG WINAPI ScriptAutoImplPerformanceCF_Release(LPCLASSFACTORY iface) {
251         DMSCRIPT_UnlockModule();
252
253         return 1; /* non-heap based object */
254 }
255
256 static HRESULT WINAPI ScriptAutoImplPerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
257         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
258
259         if (ppobj == NULL) return E_POINTER;
260         
261         return E_NOINTERFACE;
262 }
263
264 static HRESULT WINAPI ScriptAutoImplPerformanceCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
265         TRACE("(%d)\n", dolock);
266
267         if (dolock)
268                 DMSCRIPT_LockModule();
269         else
270                 DMSCRIPT_UnlockModule();
271         
272         return S_OK;
273 }
274
275 static const IClassFactoryVtbl ScriptAutoImplPerformanceCF_Vtbl = {
276         ScriptAutoImplPerformanceCF_QueryInterface,
277         ScriptAutoImplPerformanceCF_AddRef,
278         ScriptAutoImplPerformanceCF_Release,
279         ScriptAutoImplPerformanceCF_CreateInstance,
280         ScriptAutoImplPerformanceCF_LockServer
281 };
282
283 static IClassFactoryImpl ScriptAutoImplPerformance_CF = {&ScriptAutoImplPerformanceCF_Vtbl};
284
285 /******************************************************************
286  *              DirectMusicScriptSourceCodeLoader ClassFactory
287  */
288 static HRESULT WINAPI ScriptSourceCodeLoaderCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
289         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
290
291         if (ppobj == NULL) return E_POINTER;
292         
293         return E_NOINTERFACE;
294 }
295
296 static ULONG WINAPI ScriptSourceCodeLoaderCF_AddRef(LPCLASSFACTORY iface) {
297         DMSCRIPT_LockModule();
298
299         return 2; /* non-heap based object */
300 }
301
302 static ULONG WINAPI ScriptSourceCodeLoaderCF_Release(LPCLASSFACTORY iface) {
303         DMSCRIPT_UnlockModule();
304
305         return 1; /* non-heap based object */
306 }
307
308 static HRESULT WINAPI ScriptSourceCodeLoaderCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
309         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
310
311         if (ppobj == NULL) return E_POINTER;
312         
313         return E_NOINTERFACE;
314 }
315
316 static HRESULT WINAPI ScriptSourceCodeLoaderCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
317         TRACE("(%d)\n", dolock);
318
319         if (dolock)
320                 DMSCRIPT_LockModule();
321         else
322                 DMSCRIPT_UnlockModule();
323         
324         return S_OK;
325 }
326
327 static const IClassFactoryVtbl ScriptSourceCodeLoaderCF_Vtbl = {
328         ScriptSourceCodeLoaderCF_QueryInterface,
329         ScriptSourceCodeLoaderCF_AddRef,
330         ScriptSourceCodeLoaderCF_Release,
331         ScriptSourceCodeLoaderCF_CreateInstance,
332         ScriptSourceCodeLoaderCF_LockServer
333 };
334
335 static IClassFactoryImpl ScriptSourceCodeLoader_CF = {&ScriptSourceCodeLoaderCF_Vtbl};
336
337 /******************************************************************
338  *              DirectMusicScriptAutoImplSegmentState ClassFactory
339  */
340 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
341         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
342
343         if (ppobj == NULL) return E_POINTER;
344         
345         return E_NOINTERFACE;
346 }
347
348 static ULONG WINAPI ScriptAutoImplSegmentStateCF_AddRef(LPCLASSFACTORY iface) {
349         DMSCRIPT_LockModule();
350
351         return 2; /* non-heap based object */
352 }
353
354 static ULONG WINAPI ScriptAutoImplSegmentStateCF_Release(LPCLASSFACTORY iface) {
355         DMSCRIPT_UnlockModule();
356
357         return 1; /* non-heap based object */
358 }
359
360 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
361         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
362
363         if (ppobj == NULL) return E_POINTER;
364         
365         return E_NOINTERFACE;
366 }
367
368 static HRESULT WINAPI ScriptAutoImplSegmentStateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
369         TRACE("(%d)\n", dolock);
370
371         if (dolock)
372                 DMSCRIPT_LockModule();
373         else
374                 DMSCRIPT_UnlockModule();
375         
376         return S_OK;
377 }
378
379 static const IClassFactoryVtbl ScriptAutoImplSegmentStateCF_Vtbl = {
380         ScriptAutoImplSegmentStateCF_QueryInterface,
381         ScriptAutoImplSegmentStateCF_AddRef,
382         ScriptAutoImplSegmentStateCF_Release,
383         ScriptAutoImplSegmentStateCF_CreateInstance,
384         ScriptAutoImplSegmentStateCF_LockServer
385 };
386
387 static IClassFactoryImpl ScriptAutoImplSegmentState_CF = {&ScriptAutoImplSegmentStateCF_Vtbl};
388
389 /******************************************************************
390  *              DirectMusicScriptAutoImplAudioPathConfig ClassFactory
391  */
392 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
393         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
394
395         if (ppobj == NULL) return E_POINTER;
396         
397         return E_NOINTERFACE;
398 }
399
400 static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_AddRef(LPCLASSFACTORY iface) {
401         DMSCRIPT_LockModule();
402
403         return 2; /* non-heap based object */
404 }
405
406 static ULONG WINAPI ScriptAutoImplAudioPathConfigCF_Release(LPCLASSFACTORY iface) {
407         DMSCRIPT_UnlockModule();
408
409         return 1; /* non-heap based object */
410 }
411
412 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
413         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
414
415         if (ppobj == NULL) return E_POINTER;
416         
417         return E_NOINTERFACE;
418 }
419
420 static HRESULT WINAPI ScriptAutoImplAudioPathConfigCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
421         TRACE("(%d)\n", dolock);
422
423         if (dolock)
424                 DMSCRIPT_LockModule();
425         else
426                 DMSCRIPT_UnlockModule();
427         
428         return S_OK;
429 }
430
431 static const IClassFactoryVtbl ScriptAutoImplAudioPathConfigCF_Vtbl = {
432         ScriptAutoImplAudioPathConfigCF_QueryInterface,
433         ScriptAutoImplAudioPathConfigCF_AddRef,
434         ScriptAutoImplAudioPathConfigCF_Release,
435         ScriptAutoImplAudioPathConfigCF_CreateInstance,
436         ScriptAutoImplAudioPathConfigCF_LockServer
437 };
438
439 static IClassFactoryImpl ScriptAutoImplAudioPathConfig_CF = {&ScriptAutoImplAudioPathConfigCF_Vtbl};
440
441 /******************************************************************
442  *              DirectMusicScriptAutoImplAudioPath ClassFactory
443  */
444 static HRESULT WINAPI ScriptAutoImplAudioPathCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
445         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
446
447         if (ppobj == NULL) return E_POINTER;
448         
449         return E_NOINTERFACE;
450 }
451
452 static ULONG WINAPI ScriptAutoImplAudioPathCF_AddRef(LPCLASSFACTORY iface) {
453         DMSCRIPT_LockModule();
454
455         return 2; /* non-heap based object */
456 }
457
458 static ULONG WINAPI ScriptAutoImplAudioPathCF_Release(LPCLASSFACTORY iface) {
459         DMSCRIPT_UnlockModule();
460
461         return 1; /* non-heap based object */
462 }
463
464 static HRESULT WINAPI ScriptAutoImplAudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
465         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
466
467         if (ppobj == NULL) return E_POINTER;
468         
469         return E_NOINTERFACE;
470 }
471
472 static HRESULT WINAPI ScriptAutoImplAudioPathCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
473         TRACE("(%d)\n", dolock);
474
475         if (dolock)
476                 DMSCRIPT_LockModule();
477         else
478                 DMSCRIPT_UnlockModule();
479         
480         return S_OK;
481 }
482
483 static const IClassFactoryVtbl ScriptAutoImplAudioPathCF_Vtbl = {
484         ScriptAutoImplAudioPathCF_QueryInterface,
485         ScriptAutoImplAudioPathCF_AddRef,
486         ScriptAutoImplAudioPathCF_Release,
487         ScriptAutoImplAudioPathCF_CreateInstance,
488         ScriptAutoImplAudioPathCF_LockServer
489 };
490
491 static IClassFactoryImpl ScriptAutoImplAudioPath_CF = {&ScriptAutoImplAudioPathCF_Vtbl};
492
493 /******************************************************************
494  *              DirectMusicScriptAutoImplSong ClassFactory
495  */
496 static HRESULT WINAPI ScriptAutoImplSongCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
497         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
498
499         if (ppobj == NULL) return E_POINTER;
500         
501         return E_NOINTERFACE;
502 }
503
504 static ULONG WINAPI ScriptAutoImplSongCF_AddRef(LPCLASSFACTORY iface) {
505         DMSCRIPT_LockModule();
506
507         return 2; /* non-heap based */
508 }
509
510 static ULONG WINAPI ScriptAutoImplSongCF_Release(LPCLASSFACTORY iface) {
511         DMSCRIPT_UnlockModule();
512
513         return 1; /* non-heap based object */
514 }
515
516 static HRESULT WINAPI ScriptAutoImplSongCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
517         FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
518
519         if (ppobj == NULL) return E_POINTER;
520         
521         return E_NOINTERFACE;
522 }
523
524 static HRESULT WINAPI ScriptAutoImplSongCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
525         TRACE("(%d)\n", dolock);
526
527         if (dolock)
528                 DMSCRIPT_LockModule();
529         else
530                 DMSCRIPT_UnlockModule();
531         
532         return S_OK;
533 }
534
535 static const IClassFactoryVtbl ScriptAutoImplSongCF_Vtbl = {
536         ScriptAutoImplSongCF_QueryInterface,
537         ScriptAutoImplSongCF_AddRef,
538         ScriptAutoImplSongCF_Release,
539         ScriptAutoImplSongCF_CreateInstance,
540         ScriptAutoImplSongCF_LockServer
541 };
542
543 static IClassFactoryImpl ScriptAutoImplSong_CF = {&ScriptAutoImplSongCF_Vtbl};
544
545 /******************************************************************
546  *              DllMain
547  *
548  *
549  */
550 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
551         if (fdwReason == DLL_PROCESS_ATTACH) {
552             DisableThreadLibraryCalls(hinstDLL);
553                 /* FIXME: Initialisation */
554         } else if (fdwReason == DLL_PROCESS_DETACH) {
555                 /* FIXME: Cleanup */
556         }
557
558         return TRUE;
559 }
560
561
562 /******************************************************************
563  *              DllCanUnloadNow (DMSCRIPT.@)
564  *
565  *
566  */
567 HRESULT WINAPI DllCanUnloadNow(void)
568 {
569         return DMSCRIPT_refCount != 0 ? S_FALSE : S_OK;
570 }
571
572
573 /******************************************************************
574  *              DllGetClassObject (DMSCRIPT.@)
575  *
576  *
577  */
578 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
579 {
580     TRACE("(%s, %s, %p)\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
581     if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegment) && IsEqualIID (riid, &IID_IClassFactory)) {
582       *ppv = (LPVOID) &ScriptAutoImplSegment_CF;
583       IClassFactory_AddRef((IClassFactory*)*ppv);
584       return S_OK;
585         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptTrack) && IsEqualIID (riid, &IID_IClassFactory)) {
586       *ppv = (LPVOID) &ScriptTrack_CF;
587       IClassFactory_AddRef((IClassFactory*)*ppv);
588       return S_OK;
589         } else if (IsEqualCLSID (rclsid, &CLSID_AudioVBScript) && IsEqualIID (riid, &IID_IClassFactory)) {
590       *ppv = (LPVOID) &AudioVBScript_CF;
591       IClassFactory_AddRef((IClassFactory*)*ppv);
592       return S_OK;
593         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScript) && IsEqualIID (riid, &IID_IClassFactory)) {
594       *ppv = (LPVOID) &Script_CF;
595       IClassFactory_AddRef((IClassFactory*)*ppv);
596       return S_OK;
597         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpPerformance) && IsEqualIID (riid, &IID_IClassFactory)) {
598       *ppv = (LPVOID) &ScriptAutoImplPerformance_CF;
599       IClassFactory_AddRef((IClassFactory*)*ppv);
600       return S_OK;
601         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptSourceCodeLoader) && IsEqualIID (riid, &IID_IClassFactory)) {
602       *ppv = (LPVOID) &ScriptSourceCodeLoader_CF;
603       IClassFactory_AddRef((IClassFactory*)*ppv);
604       return S_OK;
605         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSegmentState) && IsEqualIID (riid, &IID_IClassFactory)) {
606       *ppv = (LPVOID) &ScriptAutoImplSegmentState_CF;
607       IClassFactory_AddRef((IClassFactory*)*ppv);
608       return S_OK;
609         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPathConfig) && IsEqualIID (riid, &IID_IClassFactory)) {
610       *ppv = (LPVOID) &ScriptAutoImplAudioPathConfig_CF;
611       IClassFactory_AddRef((IClassFactory*)*ppv);
612       return S_OK;
613         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpAudioPath) && IsEqualIID (riid, &IID_IClassFactory)) {
614       *ppv = (LPVOID) &ScriptAutoImplAudioPath_CF;
615       IClassFactory_AddRef((IClassFactory*)*ppv);
616       return S_OK;
617         } else if (IsEqualCLSID (rclsid, &CLSID_DirectMusicScriptAutoImpSong) && IsEqualIID (riid, &IID_IClassFactory)) {
618       *ppv = (LPVOID) &ScriptAutoImplSong_CF;
619       IClassFactory_AddRef((IClassFactory*)*ppv);
620       return S_OK;
621         }               
622
623     WARN("(%s, %s, %p): no interface found.\n", debugstr_dmguid(rclsid), debugstr_dmguid(riid), ppv);
624     return CLASS_E_CLASSNOTAVAILABLE;
625 }
626
627
628 /******************************************************************
629  *              Helper functions
630  *
631  *
632  */
633 /* check whether the given DWORD is even (return 0) or odd (return 1) */
634 int even_or_odd (DWORD number) {
635         return (number & 0x1); /* basically, check if bit 0 is set ;) */
636 }
637
638 /* FOURCC to string conversion for debug messages */
639 const char *debugstr_fourcc (DWORD fourcc) {
640     if (!fourcc) return "'null'";
641     return wine_dbg_sprintf ("\'%c%c%c%c\'",
642                 (char)(fourcc), (char)(fourcc >> 8),
643         (char)(fourcc >> 16), (char)(fourcc >> 24));
644 }
645
646 /* DMUS_VERSION struct to string conversion for debug messages */
647 const char *debugstr_dmversion (LPDMUS_VERSION version) {
648         if (!version) return "'null'";
649         return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
650                 (int)((version->dwVersionMS && 0xFFFF0000) >> 8), (int)(version->dwVersionMS && 0x0000FFFF), 
651                 (int)((version->dwVersionLS && 0xFFFF0000) >> 8), (int)(version->dwVersionLS && 0x0000FFFF));
652 }
653
654 /* returns name of given GUID */
655 const char *debugstr_dmguid (const GUID *id) {
656         static const guid_info guids[] = {
657                 /* CLSIDs */
658                 GE(CLSID_AudioVBScript),
659                 GE(CLSID_DirectMusic),
660                 GE(CLSID_DirectMusicAudioPath),
661                 GE(CLSID_DirectMusicAudioPathConfig),
662                 GE(CLSID_DirectMusicAuditionTrack),
663                 GE(CLSID_DirectMusicBand),
664                 GE(CLSID_DirectMusicBandTrack),
665                 GE(CLSID_DirectMusicChordMapTrack),
666                 GE(CLSID_DirectMusicChordMap),
667                 GE(CLSID_DirectMusicChordTrack),
668                 GE(CLSID_DirectMusicCollection),
669                 GE(CLSID_DirectMusicCommandTrack),
670                 GE(CLSID_DirectMusicComposer),
671                 GE(CLSID_DirectMusicContainer),
672                 GE(CLSID_DirectMusicGraph),
673                 GE(CLSID_DirectMusicLoader),
674                 GE(CLSID_DirectMusicLyricsTrack),
675                 GE(CLSID_DirectMusicMarkerTrack),
676                 GE(CLSID_DirectMusicMelodyFormulationTrack),
677                 GE(CLSID_DirectMusicMotifTrack),
678                 GE(CLSID_DirectMusicMuteTrack),
679                 GE(CLSID_DirectMusicParamControlTrack),
680                 GE(CLSID_DirectMusicPatternTrack),
681                 GE(CLSID_DirectMusicPerformance),
682                 GE(CLSID_DirectMusicScript),
683                 GE(CLSID_DirectMusicScriptAutoImpSegment),
684                 GE(CLSID_DirectMusicScriptAutoImpPerformance),
685                 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
686                 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
687                 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
688                 GE(CLSID_DirectMusicScriptAutoImpSong),
689                 GE(CLSID_DirectMusicScriptSourceCodeLoader),
690                 GE(CLSID_DirectMusicScriptTrack),
691                 GE(CLSID_DirectMusicSection),
692                 GE(CLSID_DirectMusicSegment),
693                 GE(CLSID_DirectMusicSegmentState),
694                 GE(CLSID_DirectMusicSegmentTriggerTrack),
695                 GE(CLSID_DirectMusicSegTriggerTrack),
696                 GE(CLSID_DirectMusicSeqTrack),
697                 GE(CLSID_DirectMusicSignPostTrack),
698                 GE(CLSID_DirectMusicSong),
699                 GE(CLSID_DirectMusicStyle),
700                 GE(CLSID_DirectMusicStyleTrack),
701                 GE(CLSID_DirectMusicSynth),
702                 GE(CLSID_DirectMusicSynthSink),
703                 GE(CLSID_DirectMusicSysExTrack),
704                 GE(CLSID_DirectMusicTemplate),
705                 GE(CLSID_DirectMusicTempoTrack),
706                 GE(CLSID_DirectMusicTimeSigTrack),
707                 GE(CLSID_DirectMusicWaveTrack),
708                 GE(CLSID_DirectSoundWave),
709                 /* IIDs */
710                 GE(IID_IDirectMusic),
711                 GE(IID_IDirectMusic2),
712                 GE(IID_IDirectMusic8),
713                 GE(IID_IDirectMusicAudioPath),
714                 GE(IID_IDirectMusicBand),
715                 GE(IID_IDirectMusicBuffer),
716                 GE(IID_IDirectMusicChordMap),
717                 GE(IID_IDirectMusicCollection),
718                 GE(IID_IDirectMusicComposer),
719                 GE(IID_IDirectMusicContainer),
720                 GE(IID_IDirectMusicDownload),
721                 GE(IID_IDirectMusicDownloadedInstrument),
722                 GE(IID_IDirectMusicGetLoader),
723                 GE(IID_IDirectMusicGraph),
724                 GE(IID_IDirectMusicInstrument),
725                 GE(IID_IDirectMusicLoader),
726                 GE(IID_IDirectMusicLoader8),
727                 GE(IID_IDirectMusicObject),
728                 GE(IID_IDirectMusicPatternTrack),
729                 GE(IID_IDirectMusicPerformance),
730                 GE(IID_IDirectMusicPerformance2),
731                 GE(IID_IDirectMusicPerformance8),
732                 GE(IID_IDirectMusicPort),
733                 GE(IID_IDirectMusicPortDownload),
734                 GE(IID_IDirectMusicScript),
735                 GE(IID_IDirectMusicSegment),
736                 GE(IID_IDirectMusicSegment2),
737                 GE(IID_IDirectMusicSegment8),
738                 GE(IID_IDirectMusicSegmentState),
739                 GE(IID_IDirectMusicSegmentState8),
740                 GE(IID_IDirectMusicStyle),
741                 GE(IID_IDirectMusicStyle8),
742                 GE(IID_IDirectMusicSynth),
743                 GE(IID_IDirectMusicSynth8),
744                 GE(IID_IDirectMusicSynthSink),
745                 GE(IID_IDirectMusicThru),
746                 GE(IID_IDirectMusicTool),
747                 GE(IID_IDirectMusicTool8),
748                 GE(IID_IDirectMusicTrack),
749                 GE(IID_IDirectMusicTrack8),
750                 GE(IID_IUnknown),
751                 GE(IID_IPersistStream),
752                 GE(IID_IStream),
753                 GE(IID_IClassFactory),
754                 /* GUIDs */
755                 GE(GUID_DirectMusicAllTypes),
756                 GE(GUID_NOTIFICATION_CHORD),
757                 GE(GUID_NOTIFICATION_COMMAND),
758                 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
759                 GE(GUID_NOTIFICATION_PERFORMANCE),
760                 GE(GUID_NOTIFICATION_RECOMPOSE),
761                 GE(GUID_NOTIFICATION_SEGMENT),
762                 GE(GUID_BandParam),
763                 GE(GUID_ChordParam),
764                 GE(GUID_CommandParam),
765                 GE(GUID_CommandParam2),
766                 GE(GUID_CommandParamNext),
767                 GE(GUID_IDirectMusicBand),
768                 GE(GUID_IDirectMusicChordMap),
769                 GE(GUID_IDirectMusicStyle),
770                 GE(GUID_MuteParam),
771                 GE(GUID_Play_Marker),
772                 GE(GUID_RhythmParam),
773                 GE(GUID_TempoParam),
774                 GE(GUID_TimeSignature),
775                 GE(GUID_Valid_Start_Time),
776                 GE(GUID_Clear_All_Bands),
777                 GE(GUID_ConnectToDLSCollection),
778                 GE(GUID_Disable_Auto_Download),
779                 GE(GUID_DisableTempo),
780                 GE(GUID_DisableTimeSig),
781                 GE(GUID_Download),
782                 GE(GUID_DownloadToAudioPath),
783                 GE(GUID_Enable_Auto_Download),
784                 GE(GUID_EnableTempo),
785                 GE(GUID_EnableTimeSig),
786                 GE(GUID_IgnoreBankSelectForGM),
787                 GE(GUID_SeedVariations),
788                 GE(GUID_StandardMIDIFile),
789                 GE(GUID_Unload),
790                 GE(GUID_UnloadFromAudioPath),
791                 GE(GUID_Variations),
792                 GE(GUID_PerfMasterTempo),
793                 GE(GUID_PerfMasterVolume),
794                 GE(GUID_PerfMasterGrooveLevel),
795                 GE(GUID_PerfAutoDownload),
796                 GE(GUID_DefaultGMCollection),
797                 GE(GUID_Synth_Default),
798                 GE(GUID_Buffer_Reverb),
799                 GE(GUID_Buffer_EnvReverb),
800                 GE(GUID_Buffer_Stereo),
801                 GE(GUID_Buffer_3D_Dry),
802                 GE(GUID_Buffer_Mono),
803                 GE(GUID_DMUS_PROP_GM_Hardware),
804                 GE(GUID_DMUS_PROP_GS_Capable),
805                 GE(GUID_DMUS_PROP_GS_Hardware),
806                 GE(GUID_DMUS_PROP_DLS1),
807                 GE(GUID_DMUS_PROP_DLS2),
808                 GE(GUID_DMUS_PROP_Effects),
809                 GE(GUID_DMUS_PROP_INSTRUMENT2),
810                 GE(GUID_DMUS_PROP_LegacyCaps),
811                 GE(GUID_DMUS_PROP_MemorySize),
812                 GE(GUID_DMUS_PROP_SampleMemorySize),
813                 GE(GUID_DMUS_PROP_SamplePlaybackRate),
814                 GE(GUID_DMUS_PROP_SetSynthSink),
815                 GE(GUID_DMUS_PROP_SinkUsesDSound),
816                 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
817                 GE(GUID_DMUS_PROP_SynthSink_WAVE),
818                 GE(GUID_DMUS_PROP_Volume),
819                 GE(GUID_DMUS_PROP_WavesReverb),
820                 GE(GUID_DMUS_PROP_WriteLatency),
821                 GE(GUID_DMUS_PROP_WritePeriod),
822                 GE(GUID_DMUS_PROP_XG_Capable),
823                 GE(GUID_DMUS_PROP_XG_Hardware)
824         };
825
826         unsigned int i;
827
828         if (!id) return "(null)";
829
830         for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
831                 if (IsEqualGUID(id, &guids[i].guid))
832                         return guids[i].name;
833         }
834         /* if we didn't find it, act like standard debugstr_guid */     
835         return debugstr_guid(id);
836 }       
837
838 /* returns name of given error code */
839 const char *debugstr_dmreturn (DWORD code) {
840         static const flag_info codes[] = {
841                 FE(S_OK),
842                 FE(S_FALSE),
843                 FE(DMUS_S_PARTIALLOAD),
844                 FE(DMUS_S_PARTIALDOWNLOAD),
845                 FE(DMUS_S_REQUEUE),
846                 FE(DMUS_S_FREE),
847                 FE(DMUS_S_END),
848                 FE(DMUS_S_STRING_TRUNCATED),
849                 FE(DMUS_S_LAST_TOOL),
850                 FE(DMUS_S_OVER_CHORD),
851                 FE(DMUS_S_UP_OCTAVE),
852                 FE(DMUS_S_DOWN_OCTAVE),
853                 FE(DMUS_S_NOBUFFERCONTROL),
854                 FE(DMUS_S_GARBAGE_COLLECTED),
855                 FE(DMUS_E_DRIVER_FAILED),
856                 FE(DMUS_E_PORTS_OPEN),
857                 FE(DMUS_E_DEVICE_IN_USE),
858                 FE(DMUS_E_INSUFFICIENTBUFFER),
859                 FE(DMUS_E_BUFFERNOTSET),
860                 FE(DMUS_E_BUFFERNOTAVAILABLE),
861                 FE(DMUS_E_NOTADLSCOL),
862                 FE(DMUS_E_INVALIDOFFSET),
863                 FE(DMUS_E_ALREADY_LOADED),
864                 FE(DMUS_E_INVALIDPOS),
865                 FE(DMUS_E_INVALIDPATCH),
866                 FE(DMUS_E_CANNOTSEEK),
867                 FE(DMUS_E_CANNOTWRITE),
868                 FE(DMUS_E_CHUNKNOTFOUND),
869                 FE(DMUS_E_INVALID_DOWNLOADID),
870                 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT),
871                 FE(DMUS_E_ALREADY_DOWNLOADED),
872                 FE(DMUS_E_UNKNOWN_PROPERTY),
873                 FE(DMUS_E_SET_UNSUPPORTED),
874                 FE(DMUS_E_GET_UNSUPPORTED),
875                 FE(DMUS_E_NOTMONO),
876                 FE(DMUS_E_BADARTICULATION),
877                 FE(DMUS_E_BADINSTRUMENT),
878                 FE(DMUS_E_BADWAVELINK),
879                 FE(DMUS_E_NOARTICULATION),
880                 FE(DMUS_E_NOTPCM),
881                 FE(DMUS_E_BADWAVE),
882                 FE(DMUS_E_BADOFFSETTABLE),
883                 FE(DMUS_E_UNKNOWNDOWNLOAD),
884                 FE(DMUS_E_NOSYNTHSINK),
885                 FE(DMUS_E_ALREADYOPEN),
886                 FE(DMUS_E_ALREADYCLOSED),
887                 FE(DMUS_E_SYNTHNOTCONFIGURED),
888                 FE(DMUS_E_SYNTHACTIVE),
889                 FE(DMUS_E_CANNOTREAD),
890                 FE(DMUS_E_DMUSIC_RELEASED),
891                 FE(DMUS_E_BUFFER_EMPTY),
892                 FE(DMUS_E_BUFFER_FULL),
893                 FE(DMUS_E_PORT_NOT_CAPTURE),
894                 FE(DMUS_E_PORT_NOT_RENDER),
895                 FE(DMUS_E_DSOUND_NOT_SET),
896                 FE(DMUS_E_ALREADY_ACTIVATED),
897                 FE(DMUS_E_INVALIDBUFFER),
898                 FE(DMUS_E_WAVEFORMATNOTSUPPORTED),
899                 FE(DMUS_E_SYNTHINACTIVE),
900                 FE(DMUS_E_DSOUND_ALREADY_SET),
901                 FE(DMUS_E_INVALID_EVENT),
902                 FE(DMUS_E_UNSUPPORTED_STREAM),
903                 FE(DMUS_E_ALREADY_INITED),
904                 FE(DMUS_E_INVALID_BAND),
905                 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK),
906                 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK),
907                 FE(DMUS_E_INVALID_TRACK_HDR),
908                 FE(DMUS_E_INVALID_TOOL_HDR),
909                 FE(DMUS_E_ALL_TOOLS_FAILED),
910                 FE(DMUS_E_ALL_TRACKS_FAILED),
911                 FE(DMUS_E_NOT_FOUND),
912                 FE(DMUS_E_NOT_INIT),
913                 FE(DMUS_E_TYPE_DISABLED),
914                 FE(DMUS_E_TYPE_UNSUPPORTED),
915                 FE(DMUS_E_TIME_PAST),
916                 FE(DMUS_E_TRACK_NOT_FOUND),
917                 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT),
918                 FE(DMUS_E_NO_MASTER_CLOCK),
919                 FE(DMUS_E_LOADER_NOCLASSID),
920                 FE(DMUS_E_LOADER_BADPATH),
921                 FE(DMUS_E_LOADER_FAILEDOPEN),
922                 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED),
923                 FE(DMUS_E_LOADER_FAILEDCREATE),
924                 FE(DMUS_E_LOADER_OBJECTNOTFOUND),
925                 FE(DMUS_E_LOADER_NOFILENAME),
926                 FE(DMUS_E_INVALIDFILE),
927                 FE(DMUS_E_ALREADY_EXISTS),
928                 FE(DMUS_E_OUT_OF_RANGE),
929                 FE(DMUS_E_SEGMENT_INIT_FAILED),
930                 FE(DMUS_E_ALREADY_SENT),
931                 FE(DMUS_E_CANNOT_FREE),
932                 FE(DMUS_E_CANNOT_OPEN_PORT),
933                 FE(DMUS_E_CANNOT_CONVERT),
934                 FE(DMUS_E_DESCEND_CHUNK_FAIL),
935                 FE(DMUS_E_NOT_LOADED),
936                 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE),
937                 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE),
938                 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT),
939                 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32),
940                 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR),
941                 FE(DMUS_E_SCRIPT_INVALID_FILE),
942                 FE(DMUS_E_INVALID_SCRIPTTRACK),
943                 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND),
944                 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND),
945                 FE(DMUS_E_SCRIPT_CONTENT_READONLY),
946                 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE),
947                 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED),
948                 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK),
949                 FE(DMUS_E_INVALID_LYRICSTRACK),
950                 FE(DMUS_E_INVALID_PARAMCONTROLTRACK),
951                 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR),
952                 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR),
953                 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE),
954                 FE(DMUS_E_AUDIOPATHS_NOT_VALID),
955                 FE(DMUS_E_AUDIOPATHS_IN_USE),
956                 FE(DMUS_E_NO_AUDIOPATH_CONFIG),
957                 FE(DMUS_E_AUDIOPATH_INACTIVE),
958                 FE(DMUS_E_AUDIOPATH_NOBUFFER),
959                 FE(DMUS_E_AUDIOPATH_NOPORT),
960                 FE(DMUS_E_NO_AUDIOPATH),
961                 FE(DMUS_E_INVALIDCHUNK),
962                 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER),
963                 FE(DMUS_E_INVALID_CONTAINER_OBJECT)
964         };
965         unsigned int i;
966         for (i = 0; i < sizeof(codes)/sizeof(codes[0]); i++) {
967                 if (code == codes[i].val)
968                         return codes[i].name;
969         }
970         /* if we didn't find it, return value */
971         return wine_dbg_sprintf("0x%08x", code);
972 }
973
974 /* generic flag-dumping function */
975 const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
976         char buffer[128] = "", *ptr = &buffer[0];
977         unsigned int i, size = sizeof(buffer);
978         
979         for (i=0; i < num_names; i++)
980         {
981                 if ((flags & names[i].val) ||   /* standard flag*/
982                         ((!flags) && (!names[i].val))) { /* zero value only */
983                                 int cnt = snprintf(ptr, size, "%s ", names[i].name);
984                                 if (cnt < 0 || cnt >= size) break;
985                                 size -= cnt;
986                                 ptr += cnt;
987                 }
988         }
989         
990         return wine_dbg_sprintf("%s", buffer);
991 }
992
993 /* dump DMUS_OBJ flags */
994 const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
995     static const flag_info flags[] = {
996             FE(DMUS_OBJ_OBJECT),
997             FE(DMUS_OBJ_CLASS),
998             FE(DMUS_OBJ_NAME),
999             FE(DMUS_OBJ_CATEGORY),
1000             FE(DMUS_OBJ_FILENAME),
1001             FE(DMUS_OBJ_FULLPATH),
1002             FE(DMUS_OBJ_URL),
1003             FE(DMUS_OBJ_VERSION),
1004             FE(DMUS_OBJ_DATE),
1005             FE(DMUS_OBJ_LOADED),
1006             FE(DMUS_OBJ_MEMORY),
1007             FE(DMUS_OBJ_STREAM)
1008         };
1009     return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
1010 }
1011
1012 /* dump whole DMUS_OBJECTDESC struct */
1013 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
1014         if (pDesc) {
1015                 char buffer[1024] = "", *ptr = &buffer[0];
1016                 
1017                 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
1018                 ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
1019                 ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
1020                 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
1021                 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
1022                 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
1023                 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
1024                 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
1025                 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
1026                 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
1027                 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n  - pbMemData = %p\n", 
1028                                                                      wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
1029                 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
1030
1031                 return wine_dbg_sprintf("%s", buffer);
1032         } else {
1033                 return wine_dbg_sprintf("(NULL)");
1034         }
1035 }