Update copyright info for the new year.
[wine] / dlls / dmloader / debug.c
1 /* Debug and Helper Functions
2  *
3  * Copyright (C) 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19  
20 #include "dmloader_private.h"
21
22 /* check whether the given DWORD is even (return 0) or odd (return 1) */
23 int even_or_odd (DWORD number) {
24         return (number & 0x1); /* basically, check if bit 0 is set ;) */
25 }
26
27 /* figures out whether given FOURCC is valid DirectMusic form ID */
28 BOOL IS_VALID_DMFORM (FOURCC chunkID) {
29         if ((chunkID == DMUS_FOURCC_AUDIOPATH_FORM) || (chunkID == DMUS_FOURCC_BAND_FORM) || (chunkID == DMUS_FOURCC_CHORDMAP_FORM)
30                 || (chunkID == DMUS_FOURCC_CONTAINER_FORM) || (chunkID == FOURCC_DLS) || (chunkID == DMUS_FOURCC_SCRIPT_FORM)
31                 || (chunkID == DMUS_FOURCC_SEGMENT_FORM) || (chunkID == DMUS_FOURCC_STYLE_FORM) || (chunkID == DMUS_FOURCC_TOOLGRAPH_FORM)
32                 || (chunkID == DMUS_FOURCC_TRACK_FORM) || (chunkID == mmioFOURCC('W','A','V','E')))  return TRUE;
33         else return FALSE;
34 }
35
36 /* translate STREAM_SEEK flag to string */
37 const char *resolve_STREAM_SEEK (DWORD flag) {
38         switch (flag) {
39                 case STREAM_SEEK_SET:
40                         return wine_dbg_sprintf ("STREAM_SEEK_SET");
41                 case STREAM_SEEK_CUR:
42                         return wine_dbg_sprintf ("STREAM_SEEK_CUR");
43                 case STREAM_SEEK_END:
44                         return wine_dbg_sprintf ("STREAM_SEEK_END");
45                 default:
46                         return wine_dbg_sprintf ("()");                 
47         }
48 }
49
50 /* FOURCC to string conversion for debug messages */
51 const char *debugstr_fourcc (DWORD fourcc) {
52     if (!fourcc) return "'null'";
53     return wine_dbg_sprintf ("\'%c%c%c%c\'",
54                 (char)(fourcc), (char)(fourcc >> 8),
55         (char)(fourcc >> 16), (char)(fourcc >> 24));
56 }
57
58 /* DMUS_VERSION struct to string conversion for debug messages */
59 const char *debugstr_dmversion (LPDMUS_VERSION version) {
60         if (!version) return "'null'";
61         return wine_dbg_sprintf ("\'%i,%i,%i,%i\'",
62                 HIWORD(version->dwVersionMS),LOWORD(version->dwVersionMS),
63                 HIWORD(version->dwVersionLS), LOWORD(version->dwVersionLS));
64 }
65
66 /* month number into month name (for debugstr_filetime) */
67 const char *debugstr_month (DWORD dwMonth) {
68         switch (dwMonth) {
69                 case 1: return "January";
70                 case 2: return "February";
71                 case 3: return "March";
72                 case 4: return "April";
73                 case 5: return "May";
74                 case 6: return "June";
75                 case 7: return "July";
76                 case 8: return "August";
77                 case 9: return "September";
78                 case 10: return "October";
79                 case 11: return "November";
80                 case 12: return "December";
81                 default: return "Invalid";
82         }
83 }
84
85 /* FILETIME struct to string conversion for debug messages */
86 const char *debugstr_filetime (LPFILETIME time) {
87         SYSTEMTIME sysTime;
88
89         if (!time) return "'null'";
90         
91         FileTimeToSystemTime (time, &sysTime);
92         
93         return wine_dbg_sprintf ("\'%02i. %s %04i %02i:%02i:%02i\'", \
94                 sysTime.wDay, debugstr_month(sysTime.wMonth), sysTime.wYear,
95                 sysTime.wHour, sysTime.wMinute, sysTime.wSecond);
96 }
97
98 /* returns name of given GUID */
99 const char *debugstr_dmguid (const GUID *id) {
100         static const guid_info guids[] = {
101                 /* CLSIDs */
102                 GE(CLSID_AudioVBScript),
103                 GE(CLSID_DirectMusic),
104                 GE(CLSID_DirectMusicAudioPath),
105                 GE(CLSID_DirectMusicAudioPathConfig),
106                 GE(CLSID_DirectMusicAuditionTrack),
107                 GE(CLSID_DirectMusicBand),
108                 GE(CLSID_DirectMusicBandTrack),
109                 GE(CLSID_DirectMusicChordMapTrack),
110                 GE(CLSID_DirectMusicChordMap),
111                 GE(CLSID_DirectMusicChordTrack),
112                 GE(CLSID_DirectMusicCollection),
113                 GE(CLSID_DirectMusicCommandTrack),
114                 GE(CLSID_DirectMusicComposer),
115                 GE(CLSID_DirectMusicContainer),
116                 GE(CLSID_DirectMusicGraph),
117                 GE(CLSID_DirectMusicLoader),
118                 GE(CLSID_DirectMusicLyricsTrack),
119                 GE(CLSID_DirectMusicMarkerTrack),
120                 GE(CLSID_DirectMusicMelodyFormulationTrack),
121                 GE(CLSID_DirectMusicMotifTrack),
122                 GE(CLSID_DirectMusicMuteTrack),
123                 GE(CLSID_DirectMusicParamControlTrack),
124                 GE(CLSID_DirectMusicPatternTrack),
125                 GE(CLSID_DirectMusicPerformance),
126                 GE(CLSID_DirectMusicScript),
127                 GE(CLSID_DirectMusicScriptAutoImpSegment),
128                 GE(CLSID_DirectMusicScriptAutoImpPerformance),
129                 GE(CLSID_DirectMusicScriptAutoImpSegmentState),
130                 GE(CLSID_DirectMusicScriptAutoImpAudioPathConfig),
131                 GE(CLSID_DirectMusicScriptAutoImpAudioPath),
132                 GE(CLSID_DirectMusicScriptAutoImpSong),
133                 GE(CLSID_DirectMusicScriptSourceCodeLoader),
134                 GE(CLSID_DirectMusicScriptTrack),
135                 GE(CLSID_DirectMusicSection),
136                 GE(CLSID_DirectMusicSegment),
137                 GE(CLSID_DirectMusicSegmentState),
138                 GE(CLSID_DirectMusicSegmentTriggerTrack),
139                 GE(CLSID_DirectMusicSegTriggerTrack),
140                 GE(CLSID_DirectMusicSeqTrack),
141                 GE(CLSID_DirectMusicSignPostTrack),
142                 GE(CLSID_DirectMusicSong),
143                 GE(CLSID_DirectMusicStyle),
144                 GE(CLSID_DirectMusicStyleTrack),
145                 GE(CLSID_DirectMusicSynth),
146                 GE(CLSID_DirectMusicSynthSink),
147                 GE(CLSID_DirectMusicSysExTrack),
148                 GE(CLSID_DirectMusicTemplate),
149                 GE(CLSID_DirectMusicTempoTrack),
150                 GE(CLSID_DirectMusicTimeSigTrack),
151                 GE(CLSID_DirectMusicWaveTrack),
152                 GE(CLSID_DirectSoundWave),
153                 /* IIDs */
154                 GE(IID_IDirectMusic),
155                 GE(IID_IDirectMusic2),
156                 GE(IID_IDirectMusic8),
157                 GE(IID_IDirectMusicAudioPath),
158                 GE(IID_IDirectMusicBand),
159                 GE(IID_IDirectMusicBuffer),
160                 GE(IID_IDirectMusicChordMap),
161                 GE(IID_IDirectMusicCollection),
162                 GE(IID_IDirectMusicComposer),
163                 GE(IID_IDirectMusicContainer),
164                 GE(IID_IDirectMusicDownload),
165                 GE(IID_IDirectMusicDownloadedInstrument),
166                 GE(IID_IDirectMusicGetLoader),
167                 GE(IID_IDirectMusicGraph),
168                 GE(IID_IDirectMusicInstrument),
169                 GE(IID_IDirectMusicLoader),
170                 GE(IID_IDirectMusicLoader8),
171                 GE(IID_IDirectMusicObject),
172                 GE(IID_IDirectMusicPatternTrack),
173                 GE(IID_IDirectMusicPerformance),
174                 GE(IID_IDirectMusicPerformance2),
175                 GE(IID_IDirectMusicPerformance8),
176                 GE(IID_IDirectMusicPort),
177                 GE(IID_IDirectMusicPortDownload),
178                 GE(IID_IDirectMusicScript),
179                 GE(IID_IDirectMusicSegment),
180                 GE(IID_IDirectMusicSegment2),
181                 GE(IID_IDirectMusicSegment8),
182                 GE(IID_IDirectMusicSegmentState),
183                 GE(IID_IDirectMusicSegmentState8),
184                 GE(IID_IDirectMusicStyle),
185                 GE(IID_IDirectMusicStyle8),
186                 GE(IID_IDirectMusicSynth),
187                 GE(IID_IDirectMusicSynth8),
188                 GE(IID_IDirectMusicSynthSink),
189                 GE(IID_IDirectMusicThru),
190                 GE(IID_IDirectMusicTool),
191                 GE(IID_IDirectMusicTool8),
192                 GE(IID_IDirectMusicTrack),
193                 GE(IID_IDirectMusicTrack8),
194                 GE(IID_IUnknown),
195                 GE(IID_IPersistStream),
196                 GE(IID_IStream),
197                 GE(IID_IClassFactory),
198                 /* GUIDs */
199                 GE(GUID_DirectMusicAllTypes),
200                 GE(GUID_NOTIFICATION_CHORD),
201                 GE(GUID_NOTIFICATION_COMMAND),
202                 GE(GUID_NOTIFICATION_MEASUREANDBEAT),
203                 GE(GUID_NOTIFICATION_PERFORMANCE),
204                 GE(GUID_NOTIFICATION_RECOMPOSE),
205                 GE(GUID_NOTIFICATION_SEGMENT),
206                 GE(GUID_BandParam),
207                 GE(GUID_ChordParam),
208                 GE(GUID_CommandParam),
209                 GE(GUID_CommandParam2),
210                 GE(GUID_CommandParamNext),
211                 GE(GUID_IDirectMusicBand),
212                 GE(GUID_IDirectMusicChordMap),
213                 GE(GUID_IDirectMusicStyle),
214                 GE(GUID_MuteParam),
215                 GE(GUID_Play_Marker),
216                 GE(GUID_RhythmParam),
217                 GE(GUID_TempoParam),
218                 GE(GUID_TimeSignature),
219                 GE(GUID_Valid_Start_Time),
220                 GE(GUID_Clear_All_Bands),
221                 GE(GUID_ConnectToDLSCollection),
222                 GE(GUID_Disable_Auto_Download),
223                 GE(GUID_DisableTempo),
224                 GE(GUID_DisableTimeSig),
225                 GE(GUID_Download),
226                 GE(GUID_DownloadToAudioPath),
227                 GE(GUID_Enable_Auto_Download),
228                 GE(GUID_EnableTempo),
229                 GE(GUID_EnableTimeSig),
230                 GE(GUID_IgnoreBankSelectForGM),
231                 GE(GUID_SeedVariations),
232                 GE(GUID_StandardMIDIFile),
233                 GE(GUID_Unload),
234                 GE(GUID_UnloadFromAudioPath),
235                 GE(GUID_Variations),
236                 GE(GUID_PerfMasterTempo),
237                 GE(GUID_PerfMasterVolume),
238                 GE(GUID_PerfMasterGrooveLevel),
239                 GE(GUID_PerfAutoDownload),
240                 GE(GUID_DefaultGMCollection),
241                 GE(GUID_Synth_Default),
242                 GE(GUID_Buffer_Reverb),
243                 GE(GUID_Buffer_EnvReverb),
244                 GE(GUID_Buffer_Stereo),
245                 GE(GUID_Buffer_3D_Dry),
246                 GE(GUID_Buffer_Mono),
247                 GE(GUID_DMUS_PROP_GM_Hardware),
248                 GE(GUID_DMUS_PROP_GS_Capable),
249                 GE(GUID_DMUS_PROP_GS_Hardware),
250                 GE(GUID_DMUS_PROP_DLS1),
251                 GE(GUID_DMUS_PROP_DLS2),
252                 GE(GUID_DMUS_PROP_Effects),
253                 GE(GUID_DMUS_PROP_INSTRUMENT2),
254                 GE(GUID_DMUS_PROP_LegacyCaps),
255                 GE(GUID_DMUS_PROP_MemorySize),
256                 GE(GUID_DMUS_PROP_SampleMemorySize),
257                 GE(GUID_DMUS_PROP_SamplePlaybackRate),
258                 GE(GUID_DMUS_PROP_SetSynthSink),
259                 GE(GUID_DMUS_PROP_SinkUsesDSound),
260                 GE(GUID_DMUS_PROP_SynthSink_DSOUND),
261                 GE(GUID_DMUS_PROP_SynthSink_WAVE),
262                 GE(GUID_DMUS_PROP_Volume),
263                 GE(GUID_DMUS_PROP_WavesReverb),
264                 GE(GUID_DMUS_PROP_WriteLatency),
265                 GE(GUID_DMUS_PROP_WritePeriod),
266                 GE(GUID_DMUS_PROP_XG_Capable),
267                 GE(GUID_DMUS_PROP_XG_Hardware)
268         };
269
270         unsigned int i;
271
272         if (!id) return "(null)";
273         for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
274                 if (IsEqualGUID(id, guids[i].guid))
275                         return guids[i].name;
276         }
277         
278         /* if we didn't find it, act like standard debugstr_guid */     
279         return debugstr_guid(id);
280 }       
281
282 /* returns name of given error code */
283 const char *debugstr_dmreturn (DWORD code) {
284         static const flag_info codes[] = {
285                 FE(S_OK),
286                 FE(S_FALSE),
287                 FE(DMUS_S_PARTIALLOAD),
288                 FE(DMUS_S_PARTIALDOWNLOAD),
289                 FE(DMUS_S_REQUEUE),
290                 FE(DMUS_S_FREE),
291                 FE(DMUS_S_END),
292                 FE(DMUS_S_STRING_TRUNCATED),
293                 FE(DMUS_S_LAST_TOOL),
294                 FE(DMUS_S_OVER_CHORD),
295                 FE(DMUS_S_UP_OCTAVE),
296                 FE(DMUS_S_DOWN_OCTAVE),
297                 FE(DMUS_S_NOBUFFERCONTROL),
298                 FE(DMUS_S_GARBAGE_COLLECTED),
299                 FE(E_NOTIMPL),
300                 FE(E_NOINTERFACE),
301                 FE(E_POINTER),
302                 FE(CLASS_E_NOAGGREGATION),
303                 FE(CLASS_E_CLASSNOTAVAILABLE),
304                 FE(REGDB_E_CLASSNOTREG),
305                 FE(E_OUTOFMEMORY),
306                 FE(E_FAIL),
307                 FE(E_INVALIDARG),
308                 FE(DMUS_E_DRIVER_FAILED),
309                 FE(DMUS_E_PORTS_OPEN),
310                 FE(DMUS_E_DEVICE_IN_USE),
311                 FE(DMUS_E_INSUFFICIENTBUFFER),
312                 FE(DMUS_E_BUFFERNOTSET),
313                 FE(DMUS_E_BUFFERNOTAVAILABLE),
314                 FE(DMUS_E_NOTADLSCOL),
315                 FE(DMUS_E_INVALIDOFFSET),
316                 FE(DMUS_E_ALREADY_LOADED),
317                 FE(DMUS_E_INVALIDPOS),
318                 FE(DMUS_E_INVALIDPATCH),
319                 FE(DMUS_E_CANNOTSEEK),
320                 FE(DMUS_E_CANNOTWRITE),
321                 FE(DMUS_E_CHUNKNOTFOUND),
322                 FE(DMUS_E_INVALID_DOWNLOADID),
323                 FE(DMUS_E_NOT_DOWNLOADED_TO_PORT),
324                 FE(DMUS_E_ALREADY_DOWNLOADED),
325                 FE(DMUS_E_UNKNOWN_PROPERTY),
326                 FE(DMUS_E_SET_UNSUPPORTED),
327                 FE(DMUS_E_GET_UNSUPPORTED),
328                 FE(DMUS_E_NOTMONO),
329                 FE(DMUS_E_BADARTICULATION),
330                 FE(DMUS_E_BADINSTRUMENT),
331                 FE(DMUS_E_BADWAVELINK),
332                 FE(DMUS_E_NOARTICULATION),
333                 FE(DMUS_E_NOTPCM),
334                 FE(DMUS_E_BADWAVE),
335                 FE(DMUS_E_BADOFFSETTABLE),
336                 FE(DMUS_E_UNKNOWNDOWNLOAD),
337                 FE(DMUS_E_NOSYNTHSINK),
338                 FE(DMUS_E_ALREADYOPEN),
339                 FE(DMUS_E_ALREADYCLOSED),
340                 FE(DMUS_E_SYNTHNOTCONFIGURED),
341                 FE(DMUS_E_SYNTHACTIVE),
342                 FE(DMUS_E_CANNOTREAD),
343                 FE(DMUS_E_DMUSIC_RELEASED),
344                 FE(DMUS_E_BUFFER_EMPTY),
345                 FE(DMUS_E_BUFFER_FULL),
346                 FE(DMUS_E_PORT_NOT_CAPTURE),
347                 FE(DMUS_E_PORT_NOT_RENDER),
348                 FE(DMUS_E_DSOUND_NOT_SET),
349                 FE(DMUS_E_ALREADY_ACTIVATED),
350                 FE(DMUS_E_INVALIDBUFFER),
351                 FE(DMUS_E_WAVEFORMATNOTSUPPORTED),
352                 FE(DMUS_E_SYNTHINACTIVE),
353                 FE(DMUS_E_DSOUND_ALREADY_SET),
354                 FE(DMUS_E_INVALID_EVENT),
355                 FE(DMUS_E_UNSUPPORTED_STREAM),
356                 FE(DMUS_E_ALREADY_INITED),
357                 FE(DMUS_E_INVALID_BAND),
358                 FE(DMUS_E_TRACK_HDR_NOT_FIRST_CK),
359                 FE(DMUS_E_TOOL_HDR_NOT_FIRST_CK),
360                 FE(DMUS_E_INVALID_TRACK_HDR),
361                 FE(DMUS_E_INVALID_TOOL_HDR),
362                 FE(DMUS_E_ALL_TOOLS_FAILED),
363                 FE(DMUS_E_ALL_TRACKS_FAILED),
364                 FE(DMUS_E_NOT_FOUND),
365                 FE(DMUS_E_NOT_INIT),
366                 FE(DMUS_E_TYPE_DISABLED),
367                 FE(DMUS_E_TYPE_UNSUPPORTED),
368                 FE(DMUS_E_TIME_PAST),
369                 FE(DMUS_E_TRACK_NOT_FOUND),
370                 FE(DMUS_E_TRACK_NO_CLOCKTIME_SUPPORT),
371                 FE(DMUS_E_NO_MASTER_CLOCK),
372                 FE(DMUS_E_LOADER_NOCLASSID),
373                 FE(DMUS_E_LOADER_BADPATH),
374                 FE(DMUS_E_LOADER_FAILEDOPEN),
375                 FE(DMUS_E_LOADER_FORMATNOTSUPPORTED),
376                 FE(DMUS_E_LOADER_FAILEDCREATE),
377                 FE(DMUS_E_LOADER_OBJECTNOTFOUND),
378                 FE(DMUS_E_LOADER_NOFILENAME),
379                 FE(DMUS_E_INVALIDFILE),
380                 FE(DMUS_E_ALREADY_EXISTS),
381                 FE(DMUS_E_OUT_OF_RANGE),
382                 FE(DMUS_E_SEGMENT_INIT_FAILED),
383                 FE(DMUS_E_ALREADY_SENT),
384                 FE(DMUS_E_CANNOT_FREE),
385                 FE(DMUS_E_CANNOT_OPEN_PORT),
386                 FE(DMUS_E_CANNOT_CONVERT),
387                 FE(DMUS_E_DESCEND_CHUNK_FAIL),
388                 FE(DMUS_E_NOT_LOADED),
389                 FE(DMUS_E_SCRIPT_LANGUAGE_INCOMPATIBLE),
390                 FE(DMUS_E_SCRIPT_UNSUPPORTED_VARTYPE),
391                 FE(DMUS_E_SCRIPT_ERROR_IN_SCRIPT),
392                 FE(DMUS_E_SCRIPT_CANTLOAD_OLEAUT32),
393                 FE(DMUS_E_SCRIPT_LOADSCRIPT_ERROR),
394                 FE(DMUS_E_SCRIPT_INVALID_FILE),
395                 FE(DMUS_E_INVALID_SCRIPTTRACK),
396                 FE(DMUS_E_SCRIPT_VARIABLE_NOT_FOUND),
397                 FE(DMUS_E_SCRIPT_ROUTINE_NOT_FOUND),
398                 FE(DMUS_E_SCRIPT_CONTENT_READONLY),
399                 FE(DMUS_E_SCRIPT_NOT_A_REFERENCE),
400                 FE(DMUS_E_SCRIPT_VALUE_NOT_SUPPORTED),
401                 FE(DMUS_E_INVALID_SEGMENTTRIGGERTRACK),
402                 FE(DMUS_E_INVALID_LYRICSTRACK),
403                 FE(DMUS_E_INVALID_PARAMCONTROLTRACK),
404                 FE(DMUS_E_AUDIOVBSCRIPT_SYNTAXERROR),
405                 FE(DMUS_E_AUDIOVBSCRIPT_RUNTIMEERROR),
406                 FE(DMUS_E_AUDIOVBSCRIPT_OPERATIONFAILURE),
407                 FE(DMUS_E_AUDIOPATHS_NOT_VALID),
408                 FE(DMUS_E_AUDIOPATHS_IN_USE),
409                 FE(DMUS_E_NO_AUDIOPATH_CONFIG),
410                 FE(DMUS_E_AUDIOPATH_INACTIVE),
411                 FE(DMUS_E_AUDIOPATH_NOBUFFER),
412                 FE(DMUS_E_AUDIOPATH_NOPORT),
413                 FE(DMUS_E_NO_AUDIOPATH),
414                 FE(DMUS_E_INVALIDCHUNK),
415                 FE(DMUS_E_AUDIOPATH_NOGLOBALFXBUFFER),
416                 FE(DMUS_E_INVALID_CONTAINER_OBJECT)
417         };
418         
419         unsigned int i;
420         for (i = 0; i < sizeof(codes)/sizeof(codes[0]); i++) {
421                 if (code == codes[i].val)
422                         return codes[i].name;
423         }
424         
425         /* if we didn't find it, return value */
426         return wine_dbg_sprintf("0x%08lX", code);
427 }
428
429
430 /* generic flag-dumping function */
431 const char* debugstr_flags (DWORD flags, const flag_info* names, size_t num_names){
432         static char buffer[128] = "", *ptr = &buffer[0];
433         unsigned int i, size = sizeof(buffer);
434                 
435         for (i=0; i < num_names; i++) {
436                 if ((flags & names[i].val)) {
437                         int cnt = snprintf(ptr, size, "%s ", names[i].name);
438                         if (cnt < 0 || cnt >= size) break;
439                         size -= cnt;
440                         ptr += cnt;
441                 }
442         }
443         
444         ptr = &buffer[0];
445         return ptr;
446 }
447
448 /* dump DMUS_OBJ flags */
449 const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
450     static const flag_info flags[] = {
451             FE(DMUS_OBJ_OBJECT),
452             FE(DMUS_OBJ_CLASS),
453             FE(DMUS_OBJ_NAME),
454             FE(DMUS_OBJ_CATEGORY),
455             FE(DMUS_OBJ_FILENAME),
456             FE(DMUS_OBJ_FULLPATH),
457             FE(DMUS_OBJ_URL),
458             FE(DMUS_OBJ_VERSION),
459             FE(DMUS_OBJ_DATE),
460             FE(DMUS_OBJ_LOADED),
461             FE(DMUS_OBJ_MEMORY),
462             FE(DMUS_OBJ_STREAM)
463         };
464     return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
465 }
466
467 /* dump DMUS_CONTAINER flags */
468 const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask) {
469     static const flag_info flags[] = {
470             FE(DMUS_CONTAINER_NOLOADS)
471         };
472     return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
473 }
474
475 /* dump DMUS_CONTAINED_OBJF flags */
476 const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
477     static const flag_info flags[] = {
478             FE(DMUS_CONTAINED_OBJF_KEEP)
479         };
480     return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
481 }
482
483 const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
484         if (pDesc) {
485                 char buffer[1024] = "", *ptr = &buffer[0];
486                 
487                 ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
488                 ptr += sprintf(ptr, " - dwSize = 0x%08lX\n", pDesc->dwSize);
489                 ptr += sprintf(ptr, " - dwValidData = 0x%08lX ( %s)\n", pDesc->dwValidData, debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
490                 if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
491                 if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
492                 if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = %s\n", debugstr_filetime (&pDesc->ftDate));
493                 if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
494                 if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
495                 if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
496                 if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
497                 if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = %lli\n  - pbMemData = %p\n", pDesc->llMemLength, pDesc->pbMemData);
498                 if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p\n", pDesc->pStream);
499                 
500                 ptr = &buffer[0];
501                 return ptr;
502         } else {
503                 return wine_dbg_sprintf("(NULL)");
504         }
505 }
506
507 const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) {
508         if (pHeader) {
509                 char buffer[1024] = "", *ptr = &buffer[0];
510                 
511                 ptr += sprintf(ptr, "DMUS_IO_CONTAINER_HEADER (%p):\n", pHeader);
512                 ptr += sprintf(ptr, " - dwFlags = %s\n", debugstr_DMUS_CONTAINER_FLAGS(pHeader->dwFlags));
513                 
514                 ptr = &buffer[0];
515                 return ptr;
516         } else {
517                 return wine_dbg_sprintf("(NULL)");
518         }
519 }
520
521 const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT_HEADER pHeader) {
522         if (pHeader) {
523                 char buffer[1024] = "", *ptr = &buffer[0];
524                 
525                 ptr += sprintf(ptr, "DMUS_IO_CONTAINED_OBJECT_HEADER (%p):\n", pHeader);
526                 ptr += sprintf(ptr, " - guidClassID = %s\n", debugstr_dmguid(&pHeader->guidClassID));
527                 ptr += sprintf(ptr, " - dwFlags = %s\n", debugstr_DMUS_CONTAINED_OBJF_FLAGS (pHeader->dwFlags));
528                 ptr += sprintf(ptr, " - ckid = %s\n", debugstr_fourcc (pHeader->ckid));
529                 ptr += sprintf(ptr, " - fccType = %s\n", debugstr_fourcc (pHeader->fccType));
530
531                 ptr = &buffer[0];
532                 return ptr;
533         } else {
534                 return wine_dbg_sprintf("(NULL)");
535         }
536 }