From: Yuxuan Shui yshui@codeweavers.com
Read returns E_FAIL when the EOF is encountered, which was treated as a failure. --- dlls/dmime/midi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/dmime/midi.c b/dlls/dmime/midi.c index 57b6a3adf90..3f211e75a8c 100644 --- a/dlls/dmime/midi.c +++ b/dlls/dmime/midi.c @@ -339,7 +339,12 @@ static HRESULT midi_parser_parse(struct midi_parser *parser, IDirectMusicSegment struct midi_event event = {0};
TRACE("Start parsing track %u\n", i); - if ((hr = IStream_Read(parser->stream, magic, sizeof(magic), &read)) != S_OK) break; + hr = IStream_Read(parser->stream, magic, sizeof(magic), &read); + if (hr == E_FAIL || read < sizeof(magic)) { + hr = S_OK; + break; + } + if (FAILED(hr)) break; if (read < sizeof(magic)) break; if (memcmp(magic, "MTrk", 4) != 0) break;