Michael Stefaniuc (@mstefani) commented about dlls/dmime/midi.c:
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;
if (read < sizeof(magic)) break;
hr = IStream_Read(parser->stream, magic, sizeof(magic), &read);
if (hr == E_FAIL || read < sizeof(magic)) {
I'm confused about the EOF detection here.
`IStream_Read()` should give you the `E_FAIL` if the stream is already at EOF. But then the read is `0`.\ So the check should be more of a `hr == E_FAIL && !read`. Assuming that any other `E_FAIL` should be still passed on.
Also what should happen for an `E_FAIL` during the `i == 0` case? Aka no track read? Should that be still ignored?
The short read case `read < sizeof(magic)` is already handled by the comparison of `magic` with `"MTrk"`.