Vincent Povirk : ole32: Don't fail if the file ends during a big block.

Alexandre Julliard julliard at winehq.org
Wed Sep 8 13:32:11 CDT 2010


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Tue Sep  7 19:17:43 2010 -0500

ole32: Don't fail if the file ends during a big block.

Apparently, it's valid for the last block in a file to be incomplete.

---

 dlls/ole32/storage32.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 8b6a3af..5c58201 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3875,13 +3875,20 @@ static BOOL StorageImpl_ReadBigBlock(
   void*          buffer)
 {
   ULARGE_INTEGER ulOffset;
-  DWORD  read;
+  DWORD  read=0;
 
   ulOffset.u.HighPart = 0;
   ulOffset.u.LowPart = StorageImpl_GetBigBlockOffset(This, blockIndex);
 
   StorageImpl_ReadAt(This, ulOffset, buffer, This->bigBlockSize, &read);
-  return (read == This->bigBlockSize);
+
+  if (read && read < This->bigBlockSize)
+  {
+    /* File ends during this block; fill the rest with 0's. */
+    memset((LPBYTE)buffer+read, 0, This->bigBlockSize-read);
+  }
+
+  return (read != 0);
 }
 
 static BOOL StorageImpl_ReadDWordFromBigBlock(




More information about the wine-cvs mailing list