From: Michael Stefaniuc mstefani@winehq.org
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53941 --- dlls/dmstyle/styletrack.c | 124 +++++++------------------------------- 1 file changed, 22 insertions(+), 102 deletions(-)
diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c index bdc665fe302..b6a5ce22e44 100644 --- a/dlls/dmstyle/styletrack.c +++ b/dlls/dmstyle/styletrack.c @@ -303,8 +303,7 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { style_track_Join };
-static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk, - IStream *pStm) +static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DWORD size, IStream *pStm) { DMUS_PRIVATE_CHUNK Chunk; DWORD ListSize[3], ListCount[3]; @@ -314,12 +313,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK IDirectMusicObject* pObject = NULL; LPDMUS_PRIVATE_STYLE_ITEM pNewItem = NULL;
- if (pChunk->fccID != DMUS_FOURCC_STYLE_REF_LIST) { - ERR_(dmfile)(": %s chunk should be a STYLE list\n", debugstr_fourcc (pChunk->fccID)); - return E_FAIL; - } - - ListSize[0] = pChunk->dwSize - sizeof(FOURCC); + ListSize[0] = size - sizeof(FOURCC); ListCount[0] = 0;
do { @@ -387,107 +381,33 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK return S_OK; }
-static HRESULT parse_styletrack_list(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk, - IStream *pStm) -{ - DMUS_PRIVATE_CHUNK Chunk; - DWORD ListSize[3], ListCount[3]; - LARGE_INTEGER liMove; /* used when skipping chunks */ - HRESULT hr; - - if (pChunk->fccID != DMUS_FOURCC_STYLE_TRACK_LIST) { - ERR_(dmfile)(": %s chunk should be a STYLETRACK list\n", debugstr_fourcc (pChunk->fccID)); - return E_FAIL; - } - - ListSize[0] = pChunk->dwSize - sizeof(FOURCC); - ListCount[0] = 0; - - do { - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case FOURCC_LIST: { - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID)); - ListSize[1] = Chunk.dwSize - sizeof(FOURCC); - ListCount[1] = 0; - switch (Chunk.fccID) { - case DMUS_FOURCC_STYLE_REF_LIST: { - TRACE_(dmfile)(": STYLE_REF list\n"); - hr = parse_style_ref(This, &Chunk, pStm); - if (FAILED(hr)) return hr; - break; - } - default: { - TRACE_(dmfile)(": unknown (skipping)\n"); - liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC); - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - break; - } - default: { - TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); - } while (ListCount[0] < ListSize[0]); - - return S_OK; -} - static inline IDirectMusicStyleTrack *impl_from_IPersistStream(IPersistStream *iface) { return CONTAINING_RECORD(iface, IDirectMusicStyleTrack, dmobj.IPersistStream_iface); }
-static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm) +static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream) { - IDirectMusicStyleTrack *This = impl_from_IPersistStream(iface); - DMUS_PRIVATE_CHUNK Chunk; - LARGE_INTEGER liMove; - HRESULT hr; - - FIXME("(%p, %p): Loading not fully implemented yet\n", This, pStm); - - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case FOURCC_LIST: { - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case DMUS_FOURCC_STYLE_TRACK_LIST: { - TRACE_(dmfile)(": Chord track list\n"); - hr = parse_styletrack_list(This, &Chunk, pStm); - if (FAILED(hr)) return hr; - break; - } - default: { - TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - return E_FAIL; - } - } - TRACE_(dmfile)(": reading finished\n"); - break; - } - default: { - TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */ - return E_FAIL; - } - } + IDirectMusicStyleTrack *This = impl_from_IPersistStream(iface); + struct chunk_entry track = {0}; + struct chunk_entry chunk = {.parent = &track}; + HRESULT hr;
- return S_OK; + TRACE("(%p, %p): Loading\n", This, stream); + + if (!stream) + return E_POINTER; + + if (stream_get_chunk(stream, &track) != S_OK || track.id != FOURCC_LIST || + track.type != DMUS_FOURCC_STYLE_TRACK_LIST) + return DMUS_E_TRACK_NOT_FOUND; + + while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) + if (chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_STYLE_REF_LIST) + if (FAILED(hr = parse_style_ref(This, chunk.size, stream))) + break; + + return SUCCEEDED(hr) ? S_OK : hr; }
static const IPersistStreamVtbl persiststream_vtbl = {
From: Michael Stefaniuc mstefani@winehq.org
Avoids adding an invalid style reference to the list with subsequent crash on release.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53941 --- dlls/dmstyle/dmstyle_private.h | 2 +- dlls/dmstyle/styletrack.c | 120 +++++++++++---------------------- 2 files changed, 42 insertions(+), 80 deletions(-)
diff --git a/dlls/dmstyle/dmstyle_private.h b/dlls/dmstyle/dmstyle_private.h index 4c8dd091536..fbe635e4388 100644 --- a/dlls/dmstyle/dmstyle_private.h +++ b/dlls/dmstyle/dmstyle_private.h @@ -57,7 +57,7 @@ extern HRESULT create_dmstyletrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDE */ typedef struct _DMUS_PRIVATE_STYLE_ITEM { struct list entry; /* for listing elements */ - DWORD dwTimeStamp; + DWORD timestamp; IDirectMusicStyle8* pObject; } DMUS_PRIVATE_STYLE_ITEM, *LPDMUS_PRIVATE_STYLE_ITEM;
diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c index b6a5ce22e44..822072bdb27 100644 --- a/dlls/dmstyle/styletrack.c +++ b/dlls/dmstyle/styletrack.c @@ -23,7 +23,6 @@ #include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); -WINE_DECLARE_DEBUG_CHANNEL(dmfile);
/***************************************************************************** * IDirectMusicStyleTrack implementation @@ -90,7 +89,7 @@ static ULONG WINAPI style_track_Release(IDirectMusicTrack8 *iface) list_remove(cursor);
IDirectMusicStyle8_Release(item->pObject); - heap_free(item); + free(item); }
heap_free(This); @@ -146,12 +145,10 @@ static HRESULT WINAPI style_track_GetParam(IDirectMusicTrack8 *iface, REFGUID ty if (IsEqualGUID(&GUID_IDirectMusicStyle, type)) { LIST_FOR_EACH (item, &This->Items) { DMUS_PRIVATE_STYLE_ITEM *style = LIST_ENTRY(item, DMUS_PRIVATE_STYLE_ITEM, entry); - if (style->pObject) { - IDirectMusicStyle8_AddRef(style->pObject); - *((IDirectMusicStyle8**)param) = style->pObject; + IDirectMusicStyle8_AddRef(style->pObject); + *((IDirectMusicStyle8 **)param) = style->pObject;
- return S_OK; - } + return S_OK; }
return DMUS_E_NOT_FOUND; @@ -303,82 +300,47 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = { style_track_Join };
-static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DWORD size, IStream *pStm) +static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, IStream *stream, const struct chunk_entry *strf) { - DMUS_PRIVATE_CHUNK Chunk; - DWORD ListSize[3], ListCount[3]; - LARGE_INTEGER liMove; /* used when skipping chunks */ - HRESULT hr; - - IDirectMusicObject* pObject = NULL; - LPDMUS_PRIVATE_STYLE_ITEM pNewItem = NULL; - - ListSize[0] = size - sizeof(FOURCC); - ListCount[0] = 0; - - do { - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; - TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - switch (Chunk.fccID) { - case DMUS_FOURCC_TIME_STAMP_CHUNK: { - TRACE_(dmfile)(": Time Stamp chunk\n"); - pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_ITEM)); - if (NULL == pNewItem) { - ERR(": no more memory\n"); - return E_OUTOFMEMORY; - } - IStream_Read (pStm, &pNewItem->dwTimeStamp, sizeof(DWORD), NULL); - TRACE_(dmfile)(" - dwTimeStamp: %lu\n", pNewItem->dwTimeStamp); - list_add_tail (&This->Items, &pNewItem->entry); - break; - } - case FOURCC_LIST: { - IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL); - TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID)); - ListSize[1] = Chunk.dwSize - sizeof(FOURCC); - ListCount[1] = 0; - switch (Chunk.fccID) { - /** - * should be a DMRF (DirectMusic Reference) list @TODO - */ - case DMUS_FOURCC_REF_LIST: { - FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n"); - hr = IDirectMusicUtils_IPersistStream_ParseReference(&This->dmobj.IPersistStream_iface, - &Chunk, pStm, &pObject); - if (FAILED(hr)) { - ERR(": could not load Reference\n"); - return hr; - } - hr = IDirectMusicObject_QueryInterface(pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pNewItem->pObject); - if (FAILED(hr)) { - ERR(": Reference not an IDirectMusicStyle, exiting\n"); - exit(-1); - return hr; - } - IDirectMusicObject_Release(pObject); - break; - } - default: { - TRACE_(dmfile)(": unknown (skipping)\n"); - liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC); - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - break; + struct chunk_entry chunk = {.parent = strf}; + IDirectMusicObject *dmobj; + DMUS_PRIVATE_STYLE_ITEM *item; + HRESULT hr; + + /* First chunk is a timestamp */ + if (stream_get_chunk(stream, &chunk) != S_OK || chunk.id != DMUS_FOURCC_TIME_STAMP_CHUNK) + return DMUS_E_CHUNKNOTFOUND; + if (!(item = malloc(sizeof(*item)))) + return E_OUTOFMEMORY; + hr = stream_chunk_get_data(stream, &chunk, &item->timestamp, sizeof(item->timestamp)); + if (FAILED(hr)) + goto error; + + /* Second chunk is a reference list */ + if (stream_next_chunk(stream, &chunk) != S_OK || chunk.id != FOURCC_LIST || + chunk.type != DMUS_FOURCC_REF_LIST) { + hr = DMUS_E_INVALID_SEGMENTTRIGGERTRACK; + goto error; } - default: { - TRACE_(dmfile)(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; + if (FAILED(hr = dmobj_parsereference(stream, &chunk, &dmobj))) { + WARN("Failed to load reference: %#lx\n", hr); + goto error; } + hr = IDirectMusicObject_QueryInterface(dmobj, &IID_IDirectMusicStyle8, (void **)&item->pObject); + if (FAILED(hr)) { + WARN("Reference not an IDirectMusicStyle8\n"); + IDirectMusicObject_Release(dmobj); + goto error; } - TRACE_(dmfile)(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); - } while (ListCount[0] < ListSize[0]);
- return S_OK; + list_add_tail(&This->Items, &item->entry); + TRACE("Found reference to style %p with timestamp %lu\n", item->pObject, item->timestamp); + + return S_OK; + +error: + free(item); + return hr; }
static inline IDirectMusicStyleTrack *impl_from_IPersistStream(IPersistStream *iface) @@ -404,7 +366,7 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *st
while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) if (chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_STYLE_REF_LIST) - if (FAILED(hr = parse_style_ref(This, chunk.size, stream))) + if (FAILED(hr = parse_style_ref(This, stream, &chunk))) break;
return SUCCEEDED(hr) ? S_OK : hr;
From: Michael Stefaniuc mstefani@winehq.org
--- dlls/dmstyle/dmutils.c | 72 ------------------------------------------ dlls/dmstyle/dmutils.h | 1 - 2 files changed, 73 deletions(-)
diff --git a/dlls/dmstyle/dmutils.c b/dlls/dmstyle/dmutils.c index 58a1c40622a..4b9101e675a 100644 --- a/dlls/dmstyle/dmutils.c +++ b/dlls/dmstyle/dmutils.c @@ -143,75 +143,3 @@ HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* p
return S_OK; } - -HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, IDirectMusicObject** ppObject) { - DMUS_PRIVATE_CHUNK Chunk; - DWORD ListSize[3], ListCount[3]; - LARGE_INTEGER liMove; /* used when skipping chunks */ - HRESULT hr; - - DMUS_IO_REFERENCE ref; - DMUS_OBJECTDESC ref_desc; - - memset(&ref, 0, sizeof(ref)); - memset(&ref_desc, 0, sizeof(ref_desc)); - - if (pChunk->fccID != DMUS_FOURCC_REF_LIST) { - ERR(": %s chunk should be a REF list\n", debugstr_fourcc (pChunk->fccID)); - return E_FAIL; - } - - ListSize[0] = pChunk->dwSize - sizeof(FOURCC); - ListCount[0] = 0; - - do { - IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); - ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; - TRACE(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - - hr = IDirectMusicUtils_IPersistStream_ParseDescGeneric(&Chunk, pStm, &ref_desc); - if (FAILED(hr)) return hr; - - if (hr == S_FALSE) { - switch (Chunk.fccID) { - case DMUS_FOURCC_REF_CHUNK: { - TRACE(": Reference chunk\n"); - if (Chunk.dwSize != sizeof(DMUS_IO_REFERENCE)) return E_FAIL; - IStream_Read (pStm, &ref, sizeof(DMUS_IO_REFERENCE), NULL); - TRACE(" - guidClassID: %s\n", debugstr_dmguid(&ref.guidClassID)); - TRACE(" - dwValidData: %lu\n", ref.dwValidData); - break; - } - default: { - TRACE(": unknown chunk (irrelevant & skipping)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - break; - } - } - } - TRACE(": ListCount[0] = %ld < ListSize[0] = %ld\n", ListCount[0], ListSize[0]); - } while (ListCount[0] < ListSize[0]); - - ref_desc.dwValidData |= DMUS_OBJ_CLASS; - ref_desc.guidClass = ref.guidClassID; - - TRACE("** DM Reference Begin of Load ***\n"); - TRACE("With Desc:\n"); - dump_DMUS_OBJECTDESC(&ref_desc); - - { - LPDIRECTMUSICGETLOADER pGetLoader = NULL; - LPDIRECTMUSICLOADER pLoader = NULL; - - IStream_QueryInterface (pStm, &IID_IDirectMusicGetLoader, (LPVOID*)&pGetLoader); - IDirectMusicGetLoader_GetLoader (pGetLoader, &pLoader); - IDirectMusicGetLoader_Release (pGetLoader); - - hr = IDirectMusicLoader_GetObject (pLoader, &ref_desc, &IID_IDirectMusicObject, (LPVOID*)ppObject); - IDirectMusicLoader_Release (pLoader); /* release loader */ - } - TRACE("** DM Reference End of Load ***\n"); - - return hr; -} diff --git a/dlls/dmstyle/dmutils.h b/dlls/dmstyle/dmutils.h index 2f13c4b1f44..dbeb7a2a978 100644 --- a/dlls/dmstyle/dmutils.h +++ b/dlls/dmstyle/dmutils.h @@ -32,6 +32,5 @@ typedef struct _DMUS_PRIVATE_CHUNK { */ extern HRESULT IDirectMusicUtils_IPersistStream_ParseDescGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN; extern HRESULT IDirectMusicUtils_IPersistStream_ParseUNFOGeneric (DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, LPDMUS_OBJECTDESC pDesc) DECLSPEC_HIDDEN; -extern HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm, IDirectMusicObject** ppObject) DECLSPEC_HIDDEN;
#endif /* __WINE_DMUTILS_H */
From: Michael Stefaniuc mstefani@winehq.org
And get rid of the typedef for that struct. --- dlls/dmstyle/dmstyle_private.h | 7 ------- dlls/dmstyle/styletrack.c | 32 +++++++++++++++++--------------- 2 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/dlls/dmstyle/dmstyle_private.h b/dlls/dmstyle/dmstyle_private.h index fbe635e4388..0d7ede7f00d 100644 --- a/dlls/dmstyle/dmstyle_private.h +++ b/dlls/dmstyle/dmstyle_private.h @@ -55,13 +55,6 @@ extern HRESULT create_dmstyletrack(REFIID riid, void **ret_iface) DECLSPEC_HIDDE /***************************************************************************** * Auxiliary definitions */ -typedef struct _DMUS_PRIVATE_STYLE_ITEM { - struct list entry; /* for listing elements */ - DWORD timestamp; - IDirectMusicStyle8* pObject; -} DMUS_PRIVATE_STYLE_ITEM, *LPDMUS_PRIVATE_STYLE_ITEM; - - typedef struct _DMUS_PRIVATE_COMMAND { struct list entry; /* for listing elements */ DMUS_IO_COMMAND pCommand; diff --git a/dlls/dmstyle/styletrack.c b/dlls/dmstyle/styletrack.c index 822072bdb27..83b03807ddf 100644 --- a/dlls/dmstyle/styletrack.c +++ b/dlls/dmstyle/styletrack.c @@ -27,6 +27,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); /***************************************************************************** * IDirectMusicStyleTrack implementation */ +struct style_item { + struct list entry; + DWORD timestamp; + IDirectMusicStyle8 *dmstyle; +}; + typedef struct IDirectMusicStyleTrack { IDirectMusicTrack8 IDirectMusicTrack8_iface; struct dmobject dmobj; /* IPersistStream only */ @@ -81,14 +87,11 @@ static ULONG WINAPI style_track_Release(IDirectMusicTrack8 *iface) TRACE("(%p) ref=%ld\n", This, ref);
if (!ref) { - struct list *cursor, *cursor2; - DMUS_PRIVATE_STYLE_ITEM *item; - - LIST_FOR_EACH_SAFE(cursor, cursor2, &This->Items) { - item = LIST_ENTRY(cursor, DMUS_PRIVATE_STYLE_ITEM, entry); - list_remove(cursor); + struct style_item *item, *item2;
- IDirectMusicStyle8_Release(item->pObject); + LIST_FOR_EACH_ENTRY_SAFE(item, item2, &This->Items, struct style_item, entry) { + list_remove(&item->entry); + IDirectMusicStyle8_Release(item->dmstyle); free(item); }
@@ -135,7 +138,7 @@ static HRESULT WINAPI style_track_GetParam(IDirectMusicTrack8 *iface, REFGUID ty MUSIC_TIME time, MUSIC_TIME *next, void *param) { IDirectMusicStyleTrack *This = impl_from_IDirectMusicTrack8(iface); - struct list *item = NULL; + struct style_item *item;
TRACE("(%p, %s, %ld, %p, %p):\n", This, debugstr_dmguid(type), time, next, param);
@@ -143,10 +146,9 @@ static HRESULT WINAPI style_track_GetParam(IDirectMusicTrack8 *iface, REFGUID ty return E_POINTER;
if (IsEqualGUID(&GUID_IDirectMusicStyle, type)) { - LIST_FOR_EACH (item, &This->Items) { - DMUS_PRIVATE_STYLE_ITEM *style = LIST_ENTRY(item, DMUS_PRIVATE_STYLE_ITEM, entry); - IDirectMusicStyle8_AddRef(style->pObject); - *((IDirectMusicStyle8 **)param) = style->pObject; + LIST_FOR_EACH_ENTRY(item, &This->Items, struct style_item, entry) { + IDirectMusicStyle8_AddRef(item->dmstyle); + *((IDirectMusicStyle8 **)param) = item->dmstyle;
return S_OK; } @@ -304,7 +306,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, IStream *stream, co { struct chunk_entry chunk = {.parent = strf}; IDirectMusicObject *dmobj; - DMUS_PRIVATE_STYLE_ITEM *item; + struct style_item *item; HRESULT hr;
/* First chunk is a timestamp */ @@ -326,7 +328,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, IStream *stream, co WARN("Failed to load reference: %#lx\n", hr); goto error; } - hr = IDirectMusicObject_QueryInterface(dmobj, &IID_IDirectMusicStyle8, (void **)&item->pObject); + hr = IDirectMusicObject_QueryInterface(dmobj, &IID_IDirectMusicStyle8, (void **)&item->dmstyle); if (FAILED(hr)) { WARN("Reference not an IDirectMusicStyle8\n"); IDirectMusicObject_Release(dmobj); @@ -334,7 +336,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, IStream *stream, co }
list_add_tail(&This->Items, &item->entry); - TRACE("Found reference to style %p with timestamp %lu\n", item->pObject, item->timestamp); + TRACE("Found reference to style %p with timestamp %lu\n", item->dmstyle, item->timestamp);
return S_OK;