From 91940d64942ab84e1ffb433b098f747afc15dbc1 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 10 Mar 2010 13:49:04 -0600 Subject: [PATCH 1/8] 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 837365b..02a91ec 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -3272,26 +3272,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 */ -- 1.6.3.3