Commit cdf727eb authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

dmloader: Use dump_DMUS_OBJECTDESC to dump data to avoid truncation in TRACE.

parent a39e423f
......@@ -420,7 +420,9 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_ParseDescript
}
}
TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC(pDesc));
TRACE(": returning descriptor:\n");
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(pDesc);
return S_OK;
}
......
......@@ -22,6 +22,8 @@
#include "dmloader_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmloader);
/* figures out whether given FOURCC is valid DirectMusic form ID */
BOOL IS_VALID_DMFORM (FOURCC chunkID) {
if ((chunkID == DMUS_FOURCC_AUDIOPATH_FORM) || (chunkID == DMUS_FOURCC_BAND_FORM) || (chunkID == DMUS_FOURCC_CHORDMAP_FORM)
......@@ -479,28 +481,22 @@ static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
}
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
if (pDesc) {
char buffer[1024], *ptr = buffer;
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):", pDesc);
ptr += sprintf(ptr, "\n - dwSize = 0x%08X", pDesc->dwSize);
ptr += sprintf(ptr, "\n - dwValidData = 0x%08X (%s)", pDesc->dwValidData, debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, "\n - guidClass = %s", debugstr_dmguid(&pDesc->guidClass));
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, "\n - guidObject = %s", debugstr_guid(&pDesc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, "\n - ftDate = %s", debugstr_filetime (&pDesc->ftDate));
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s", debugstr_dmversion(&pDesc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, "\n - wszName = %s", debugstr_w(pDesc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, "\n - wszCategory = %s", debugstr_w(pDesc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, "\n - wszFileName = %s", debugstr_w(pDesc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, "\n - llMemLength = 0x%s\n - pbMemData = %p",
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, "\n - pStream = %p", pDesc->pStream);
return wine_dbg_sprintf("%s", buffer);
} else {
return wine_dbg_sprintf("(NULL)");
}
/* Dump whole DMUS_OBJECTDESC struct */
void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
{
TRACE("DMUS_OBJECTDESC (%p):\n", desc);
TRACE(" - dwSize = %d\n", desc->dwSize);
TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData));
if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = %s\n", debugstr_filetime (&desc->ftDate));
if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion));
if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName));
if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream);
}
const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) {
......
......@@ -57,7 +57,7 @@ extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
extern const char *debugstr_dmreturn (DWORD code) DECLSPEC_HIDDEN;
/* dump whole DMUS_OBJECTDESC struct */
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN;
extern void dump_DMUS_OBJECTDESC(DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
extern const char *debugstr_DMUS_IO_CONTAINER_HEADER (LPDMUS_IO_CONTAINER_HEADER pHeader) DECLSPEC_HIDDEN;
extern const char *debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER (LPDMUS_IO_CONTAINED_OBJECT_HEADER pHeader) DECLSPEC_HIDDEN;
......
/* IDirectMusicLoaderImpl
/*
* IDirectMusicLoaderImpl
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
......@@ -32,7 +33,9 @@ static HRESULT DMUSIC_SetLoaderSettings(IDirectMusicLoader8 *iface, REFGUID clas
static HRESULT DMUSIC_CopyDescriptor(DMUS_OBJECTDESC *pDst, DMUS_OBJECTDESC *pSrc)
{
TRACE(": copy\n%s\n", debugstr_DMUS_OBJECTDESC(pSrc));
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(pSrc);
/* copy field by field */
if (pSrc->dwValidData & DMUS_OBJ_CLASS) pDst->guidClass = pSrc->guidClass;
if (pSrc->dwValidData & DMUS_OBJ_OBJECT) pDst->guidObject = pSrc->guidObject;
......@@ -135,7 +138,10 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_GetObject(IDirectMusicLoader8 *ifac
DMUS_OBJECTDESC GotDesc;
BOOL bCache;
TRACE("(%p, %p, %s, %p): pDesc:\n%s\n", This, pDesc, debugstr_dmguid(riid), ppv, debugstr_DMUS_OBJECTDESC(pDesc));
TRACE("(%p)->(%p, %s, %p)\n", This, pDesc, debugstr_dmguid(riid), ppv);
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(pDesc);
/* sometimes it happens that guidClass is missing... which is a BadThingTM */
if (!(pDesc->dwValidData & DMUS_OBJ_CLASS)) {
......@@ -385,7 +391,10 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetObject(IDirectMusicLoader8 *ifac
LPWINE_LOADER_ENTRY pObjectEntry, pNewEntry;
HRESULT hr;
TRACE("(%p, %p): pDesc:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC(pDesc));
TRACE("(%p)->(%p)\n", This, pDesc);
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(pDesc);
/* create stream and load additional info from it */
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) {
......@@ -488,7 +497,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_SetObject(IDirectMusicLoader8 *ifac
}
/* add new entry */
TRACE(": adding alias entry with following info:\n%s\n", debugstr_DMUS_OBJECTDESC(pDesc));
TRACE(": adding alias entry with following info:\n");
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(pDesc);
pNewEntry = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(WINE_LOADER_ENTRY));
/* use this function instead of pure memcpy due to streams (memcpy just copies pointer),
which is basically used further by app that called SetDescriptor... better safety than exception */
......@@ -671,7 +682,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_ReleaseObject(IDirectMusicLoader8 *
if ((Desc.dwValidData & DMUS_OBJ_OBJECT) &&
(pObjectEntry->Desc.dwValidData & (DMUS_OBJ_OBJECT | DMUS_OBJ_LOADED)) &&
IsEqualGUID (&Desc.guidObject, &pObjectEntry->Desc.guidObject)) {
TRACE(": found it by object GUID\n%s\n", debugstr_DMUS_OBJECTDESC(&pObjectEntry->Desc));
TRACE(": found it by object GUID\n");
if (TRACE_ON(dmloader))
dump_DMUS_OBJECTDESC(&pObjectEntry->Desc);
result = S_OK;
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment