Nikolay Sivov (@nsivov) commented about dlls/windowscodecs/wincodecs_common.c:
+ if (bytes_read) + { + return IStream_Read(stream, buffer, read, bytes_read); + } + else + { + ULONG nread; + HRESULT hr; + + /* Ensure that we always pass a non-NULL bytes_read pointer, as some + * implementations (e.g. SharpDX) can't handle it being NULL. */ + hr = IStream_Read(stream, buffer, read, &nread); + if (SUCCEEDED(hr) && nread != read) + return E_FAIL; + return hr; + } If we do this, it should be consistent between two cases. Now for first path it won't return error code, and for second one it will. IMO it's more natural to keep whatever stream method returns.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/11730#note_149725