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