Alistair Leslie-Hughes : dmband: Handle the DirectX 7 version of DMUS_IO_INSTRUMENT structure.
Alexandre Julliard
julliard at winehq.org
Fri Nov 8 17:25:26 CST 2019
Module: wine
Branch: master
Commit: 070cfc358c8ed67ba08a49ae78c20205ab4e2d00
URL: https://source.winehq.org/git/wine.git/?a=commit;h=070cfc358c8ed67ba08a49ae78c20205ab4e2d00
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Nov 8 22:32:56 2019 +0100
dmband: Handle the DirectX 7 version of DMUS_IO_INSTRUMENT structure.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dmband/band.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/dmband/band.c b/dlls/dmband/band.c
index 4338791971..53f407c1a4 100644
--- a/dlls/dmband/band.c
+++ b/dlls/dmband/band.c
@@ -171,6 +171,8 @@ static const IDirectMusicObjectVtbl dmobject_vtbl = {
band_IDirectMusicObject_ParseDescriptor
};
+#define DMUS_IO_INSTRUMENT_DX7_SIZE offsetof(DMUS_IO_INSTRUMENT, nPitchBendRange)
+
/* IDirectMusicBandImpl IPersistStream part: */
static HRESULT parse_instrument(IDirectMusicBandImpl *This, DMUS_PRIVATE_CHUNK *pChunk,
IStream *pStm)
@@ -199,8 +201,14 @@ static HRESULT parse_instrument(IDirectMusicBandImpl *This, DMUS_PRIVATE_CHUNK *
switch (Chunk.fccID) {
case DMUS_FOURCC_INSTRUMENT_CHUNK: {
TRACE_(dmfile)(": Instrument chunk\n");
- if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT)) return E_FAIL;
- IStream_Read (pStm, &inst, sizeof(DMUS_IO_INSTRUMENT), NULL);
+ if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT) && Chunk.dwSize != DMUS_IO_INSTRUMENT_DX7_SIZE) {
+ ERR_(dmfile)("unexpected size %d\n", Chunk.dwSize);
+ return E_FAIL;
+ }
+ IStream_Read (pStm, &inst, Chunk.dwSize, NULL);
+ if (Chunk.dwSize != sizeof(DMUS_IO_INSTRUMENT))
+ inst.nPitchBendRange = 0;
+
TRACE_(dmfile)(" - dwPatch: %u\n", inst.dwPatch);
TRACE_(dmfile)(" - dwAssignPatch: %u\n", inst.dwAssignPatch);
TRACE_(dmfile)(" - dwNoteRanges[0]: %u\n", inst.dwNoteRanges[0]);
More information about the wine-cvs
mailing list