From 51e1a08893384183b8fda9d44a5b3d0e473a4d2a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 3 Feb 2017 18:58:43 +0100 Subject: [PATCH] inetcomm: Return S_FALSE if no data is returned in IInternetProtocol::Read. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/inetcomm/protocol.c | 10 +++++++++- dlls/inetcomm/tests/mimeole.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/inetcomm/protocol.c b/dlls/inetcomm/protocol.c index 0b289306ed9..c77cf268590 100644 --- a/dlls/inetcomm/protocol.c +++ b/dlls/inetcomm/protocol.c @@ -564,10 +564,18 @@ static HRESULT WINAPI MimeHtmlProtocol_Resume(IInternetProtocol *iface) static HRESULT WINAPI MimeHtmlProtocol_Read(IInternetProtocol *iface, void* pv, ULONG cb, ULONG* pcbRead) { MimeHtmlProtocol *This = impl_from_IInternetProtocol(iface); + ULONG read = 0; + HRESULT hres; TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); - return IStream_Read(This->stream, pv, cb, pcbRead); + hres = IStream_Read(This->stream, pv, cb, &read); + if(pcbRead) + *pcbRead = read; + if(hres != S_OK) + return hres; + + return read ? S_OK : S_FALSE; } static HRESULT WINAPI MimeHtmlProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c index fbee6e12f0c..5701af601c9 100644 --- a/dlls/inetcomm/tests/mimeole.c +++ b/dlls/inetcomm/tests/mimeole.c @@ -1368,6 +1368,8 @@ static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWOR buf[read] = 0; ok(!strcmp(buf, current_binding_test->data), "unexpected data: %s\n", buf); + hres = IInternetProtocol_Read(current_binding_protocol, buf, sizeof(buf), &read); + ok(hres == S_FALSE, "Read failed: %08x\n", hres); return S_OK; }