Dmitry Timoshkov : shlwapi: Fix IStream::Read() return value for partial reads.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 26 10:33:42 CDT 2016


Module: wine
Branch: master
Commit: 860f5562c70520a0acfe0cec6261dc8e96bfc619
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=860f5562c70520a0acfe0cec6261dc8e96bfc619

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Mon Apr 25 22:39:04 2016 +0200

shlwapi: Fix IStream::Read() return value for partial reads.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shlwapi/istream.c       |  2 +-
 dlls/shlwapi/tests/istream.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c
index e641995..946d2c8 100644
--- a/dlls/shlwapi/istream.c
+++ b/dlls/shlwapi/istream.c
@@ -130,7 +130,7 @@ static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG*
   }
   if (pcbRead)
     *pcbRead = dwRead;
-  return S_OK;
+  return dwRead == cb ? S_OK : S_FALSE;
 }
 
 /**************************************************************************
diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c
index 48a292a..c9cf62f 100644
--- a/dlls/shlwapi/tests/istream.c
+++ b/dlls/shlwapi/tests/istream.c
@@ -247,11 +247,24 @@ static void test_stream_read_write(IStream *stream, DWORD mode)
     }
     else
     {
-todo_wine
         ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
         ok(count == 0, "expected 0, got %u\n", count);
     }
 
+    ret = stream->lpVtbl->Seek(stream, start, STREAM_SEEK_SET, NULL);
+    ok(ret == S_OK, "Seek error %#x\n", ret);
+
+    count = 0xdeadbeaf;
+    ret = stream->lpVtbl->Read(stream, buf, 0, &count);
+    ok(ret == S_OK, "IStream_Read error %#x (access %#x, written %u)\n", ret, mode, written);
+    ok(count == 0, "expected 0, got %u\n", count);
+
+    count = 0xdeadbeaf;
+    ret = stream->lpVtbl->Read(stream, buf, sizeof(buf), &count);
+    ok(ret == S_FALSE, "expected S_FALSE, got %#x (access %#x, written %u)\n", ret, mode, written);
+    ok(count == written, "expected %u, got %u\n", written, count);
+    if (count)
+        ok(buf[0] == 0x5e && buf[1] == 0xa7, "expected 5ea7, got %02x%02x\n", buf[0], buf[1]);
 }
 
 static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)




More information about the wine-cvs mailing list