Commit 2ba39c89 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmstyle: Avoid cloning the IStream in parse_style_form().

It can be an application provided IStream with unimplemented Clone() method. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31562Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6dd84c53
...@@ -778,23 +778,21 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK ...@@ -778,23 +778,21 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK
ListCount[0] = 0; ListCount[0] = 0;
switch (Chunk.fccID) { switch (Chunk.fccID) {
case DMUS_FOURCC_BAND_FORM: { case DMUS_FOURCC_BAND_FORM: {
LPSTREAM pClonedStream = NULL; ULARGE_INTEGER save;
struct style_band *pNewBand; struct style_band *pNewBand;
TRACE_(dmfile)(": BAND RIFF\n"); TRACE_(dmfile)(": BAND RIFF\n");
IStream_Clone (pStm, &pClonedStream); /* Can be application provided IStream without Clone method */
liMove.QuadPart = 0; liMove.QuadPart = 0;
liMove.QuadPart -= sizeof(FOURCC) + (sizeof(FOURCC)+sizeof(DWORD)); liMove.QuadPart -= sizeof(FOURCC) + (sizeof(FOURCC)+sizeof(DWORD));
IStream_Seek (pClonedStream, liMove, STREAM_SEEK_CUR, NULL); IStream_Seek(pStm, liMove, STREAM_SEEK_CUR, &save);
hr = load_band(pClonedStream, &pBand); hr = load_band(pStm, &pBand);
if (FAILED(hr)) { if (FAILED(hr)) {
ERR(": could not load track\n"); ERR(": could not load track\n");
return hr; return hr;
} }
IStream_Release (pClonedStream);
pNewBand = heap_alloc_zero(sizeof(*pNewBand)); pNewBand = heap_alloc_zero(sizeof(*pNewBand));
if (NULL == pNewBand) { if (NULL == pNewBand) {
...@@ -808,9 +806,9 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK ...@@ -808,9 +806,9 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK
IDirectMusicTrack_Release(pBand); pBand = NULL; /* now we can release it as it's inserted */ IDirectMusicTrack_Release(pBand); pBand = NULL; /* now we can release it as it's inserted */
/** now safely move the cursor */ /** now safely move the cursor */
liMove.QuadPart = ListSize[0]; liMove.QuadPart = save.QuadPart - liMove.QuadPart + ListSize[0];
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); IStream_Seek(pStm, liMove, STREAM_SEEK_SET, NULL);
break; break;
} }
default: { default: {
......
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