Vincent Povirk : ole32: Don' t treat the header as a big block in StorageImpl_LoadFileHeader.

Alexandre Julliard julliard at winehq.org
Mon Mar 15 12:19:33 CDT 2010


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Mar 10 13:49:04 2010 -0600

ole32: Don't treat the header as a big block in StorageImpl_LoadFileHeader.

The header is always 512 bytes, regardless of the big block size.

---

 dlls/ole32/storage32.c |   17 +++++++++++------
 dlls/ole32/storage32.h |    2 ++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index f1a98e1..0d07aed 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3290,26 +3290,31 @@ static void StorageImpl_SetNextBlockInChain(
 /******************************************************************************
  *      Storage32Impl_LoadFileHeader
  *
- * This method will read in the file header, i.e. big block index -1.
+ * This method will read in the file header
  */
 static HRESULT StorageImpl_LoadFileHeader(
           StorageImpl* This)
 {
-  HRESULT hr = STG_E_FILENOTFOUND;
-  BYTE    headerBigBlock[BIG_BLOCK_SIZE];
-  BOOL    success;
+  HRESULT hr;
+  BYTE    headerBigBlock[HEADER_SIZE];
   int     index;
+  ULARGE_INTEGER offset;
+  DWORD bytes_read;
 
   TRACE("\n");
   /*
    * Get a pointer to the big block of data containing the header.
    */
-  success = StorageImpl_ReadBigBlock(This, -1, headerBigBlock);
+  offset.u.HighPart = 0;
+  offset.u.LowPart = 0;
+  hr = StorageImpl_ReadAt(This, offset, headerBigBlock, HEADER_SIZE, &bytes_read);
+  if (SUCCEEDED(hr) && bytes_read != HEADER_SIZE)
+    hr = STG_E_FILENOTFOUND;
 
   /*
    * Extract the information from the header.
    */
-  if (success)
+  if (SUCCEEDED(hr))
   {
     /*
      * Check for the "magic number" signature and return an error if it is not
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index 03328b2..b1c835b 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -79,6 +79,8 @@ static const ULONG DIRENTRY_NULL             = 0xFFFFFFFF;
 
 #define RAW_DIRENTRY_SIZE 0x00000080
 
+#define HEADER_SIZE 512
+
 /*
  * Type of child entry link
  */




More information about the wine-cvs mailing list