Vincent Povirk : ole32: Don' t treat the header as a big block in StorageImpl_SaveFileHeader.
Alexandre Julliard
julliard at winehq.org
Mon Mar 15 12:19:33 CDT 2010
Module: wine
Branch: master
Commit: f3db25fc2589cec8cc9aa64ba1adc3410e7d2384
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f3db25fc2589cec8cc9aa64ba1adc3410e7d2384
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed Mar 10 13:57:35 2010 -0600
ole32: Don't treat the header as a big block in StorageImpl_SaveFileHeader.
---
dlls/ole32/storage32.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 0d07aed..9f43264 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -3399,29 +3399,35 @@ static HRESULT StorageImpl_LoadFileHeader(
/******************************************************************************
* Storage32Impl_SaveFileHeader
*
- * This method will save to the file the header, i.e. big block -1.
+ * This method will save to the file the header
*/
static void StorageImpl_SaveFileHeader(
StorageImpl* This)
{
- BYTE headerBigBlock[BIG_BLOCK_SIZE];
+ BYTE headerBigBlock[HEADER_SIZE];
int index;
- BOOL success;
+ HRESULT hr;
+ ULARGE_INTEGER offset;
+ DWORD bytes_read, bytes_written;
/*
* 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;
/*
* If the block read failed, the file is probably new.
*/
- if (!success)
+ if (FAILED(hr))
{
/*
* Initialize for all unknown fields.
*/
- memset(headerBigBlock, 0, BIG_BLOCK_SIZE);
+ memset(headerBigBlock, 0, HEADER_SIZE);
/*
* Initialize the magic number.
@@ -3492,7 +3498,7 @@ static void StorageImpl_SaveFileHeader(
/*
* Write the big block back to the file.
*/
- StorageImpl_WriteBigBlock(This, -1, headerBigBlock);
+ StorageImpl_WriteAt(This, offset, headerBigBlock, HEADER_SIZE, &bytes_written);
}
/******************************************************************************
More information about the wine-cvs
mailing list