Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/dmband/band.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/dmband/band.c b/dlls/dmband/band.c index 4338791971b..b6c22186cce 100644 --- a/dlls/dmband/band.c +++ b/dlls/dmband/band.c @@ -171,6 +171,10 @@ static const IDirectMusicObjectVtbl dmobject_vtbl = { band_IDirectMusicObject_ParseDescriptor };
+#define CCSIZEOF_STRUCT(type,field) ((INT_PTR)&(((type *)0)->field) + sizeof(((type*)0)->field)) + +#define DMUS_IO_INSTRUMENT_DX7_SIZE CCSIZEOF_STRUCT(DMUS_IO_INSTRUMENT, dwChannelPriority) + /* IDirectMusicBandImpl IPersistStream part: */ static HRESULT parse_instrument(IDirectMusicBandImpl *This, DMUS_PRIVATE_CHUNK *pChunk, IStream *pStm) @@ -199,8 +203,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]);