From: Shaun Ren <sren@codeweavers.com> Some non-conforming IStream implementations, such as SharpDX, do not handle a NULL pcbRead for Read(). This causes the game "Surviving Deponia Playtest" to display a black main menu. Fixes: 2a167eb4ea844a090ca0247cf233633f697e3a85 --- dlls/windowscodecs/wincodecs_common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/dlls/windowscodecs/wincodecs_common.c b/dlls/windowscodecs/wincodecs_common.c index 8da1bfed20c..a60e4b70d98 100644 --- a/dlls/windowscodecs/wincodecs_common.c +++ b/dlls/windowscodecs/wincodecs_common.c @@ -188,7 +188,18 @@ HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size) HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read) { - return IStream_Read(stream, buffer, read, bytes_read); + 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. */ + if (!bytes_read) + bytes_read = &nread; + + hr = IStream_Read(stream, buffer, read, bytes_read); + if (SUCCEEDED(hr) && *bytes_read != read) + return S_FALSE; + return hr; } HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11730