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