b7be37ac
by Sebastian Krzyszkowiak at 2024-10-21T16:38:16+02:00
mciseq: Don't seek to the end of the root chunk in RMID files.
Commit 9e1008f13735 added mmioSeek call that skips the whole data
portion of the RMID chunk, breaking the handling of RMID (RIFF-based
MIDI) files as it effectively skips the whole content of the RIFF file.
Since mmioDescend expects the file position to be somewhere within
the specified parent chunk, it's guaranteed to fail.
$ WINEDEBUG=+mcimidi wine wintest.exe mcishell
mci.c:178: Type your commands to the MCI, end with Ctrl-Z/^D
open BOSSNOVA.RMI
mci.c:188: command: open BOSSNOVA.RMI
0764:trace:mcimidi:MIDI_mciOpen (1, 00000200, 0051FB98)
0764:trace:mcimidi:MIDI_mciOpen wDevID=1 (lpParams->wDeviceID=1)
0764:trace:mcimidi:MIDI_mciOpen MCI_OPEN_ELEMENT L"bossnova.rmi"!
0764:trace:mcimidi:MIDI_mciOpen hFile=00000001
0764:trace:mcimidi:MIDI_mciOpen ParentChunk ckid=RIFF fccType=RMID cksize=000052DA
mci.c:191: Test failed: mci open BOSSNOVA.RMI error: 296(40 MCIERR_INVALID_FILE)
Its introduction seems unrelated to the rest of that commit and there's
no reason given for placing it there, so let's remove the mmioSeek call
to fix RMID file handling in MCI. Previous mmioDescend call will set
the position to just after the chunk's form type, which is exactly
where it should be when calling mmioDescend the second time to find
the data chunk. Other parts of Wine code that deal with RIFF files
don't seek in analogous situations either.
Fixes: 9e1008f13735 ("Removed fixed size array to store specific data")
Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>