Commit 7a772ed8 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

dmusic: Replace debugstr_DMUS_OBJECTDESC by a specific dump function to avoid…

dmusic: Replace debugstr_DMUS_OBJECTDESC by a specific dump function to avoid debug buffer overflow.
parent d8822cf3
...@@ -189,9 +189,20 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescripto ...@@ -189,9 +189,20 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescripto
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
{
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface); ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc));
TRACE("(%p, %p)\n", iface, pDesc);
if (!pDesc)
return E_POINTER;
if (TRACE_ON(dmusic))
{
TRACE("Setting descriptor:\n");
dump_DMUS_OBJECTDESC(pDesc);
}
/* According to MSDN, we should copy only given values, not whole struct */ /* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
...@@ -223,7 +234,8 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescripto ...@@ -223,7 +234,8 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescripto
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) { static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor(LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc)
{
ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface); ICOM_THIS_MULTI(IDirectMusicCollectionImpl, ObjectVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk; DMUS_PRIVATE_CHUNK Chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
...@@ -384,10 +396,14 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip ...@@ -384,10 +396,14 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip
IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ IStream_Seek (pStream, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return DMUS_E_INVALIDFILE; return DMUS_E_INVALIDFILE;
} }
} }
TRACE(": returning descriptor:\n%s\n", debugstr_DMUS_OBJECTDESC (pDesc)); if (TRACE_ON(dmusic))
{
TRACE("Returning descriptor:\n");
dump_DMUS_OBJECTDESC(pDesc);
}
return S_OK; return S_OK;
} }
......
...@@ -446,27 +446,20 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) { ...@@ -446,27 +446,20 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
} }
/* dump whole DMUS_OBJECTDESC struct */ /* Dump whole DMUS_OBJECTDESC struct */
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) { void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
if (pDesc) { {
char buffer[1024] = "", *ptr = &buffer[0]; TRACE("DMUS_OBJECTDESC (%p):\n", desc);
TRACE(" - dwSize = %d\n", desc->dwSize);
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc); TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData));
ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize); if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData)); if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass)); if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject)); if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n"); if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion)); if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName)); if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory)); if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName)); wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n", if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream);
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
return wine_dbg_sprintf("%s", buffer);
} else {
return wine_dbg_sprintf("(NULL)");
}
} }
...@@ -274,7 +274,7 @@ extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN; ...@@ -274,7 +274,7 @@ extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN; extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
/* returns name of given GUID */ /* returns name of given GUID */
extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN; extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
/* dump whole DMUS_OBJECTDESC struct */ /* Dump whole DMUS_OBJECTDESC struct */
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN; extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
#endif /* __WINE_DMUSIC_PRIVATE_H */ #endif /* __WINE_DMUSIC_PRIVATE_H */
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