From 7ed04aeba88ae4a009c0b45e378e8aa19b458d09 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 2 Dec 2009 11:37:54 -0600 Subject: [PATCH 3/5] ole32: Move the create attribute from StorageImpl to StorageBaseImpl. This is to avoid accessing the top-level StorageImpl directly. --- dlls/ole32/stg_stream.c | 2 +- dlls/ole32/storage32.c | 4 +++- dlls/ole32/storage32.h | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index 60cbb88..bf88c64 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -868,7 +868,7 @@ static HRESULT WINAPI StgStreamImpl_Stat( pstatstg->grfMode = This->grfMode; /* In simple create mode cbSize is the current pos */ - if((This->parentStorage->openFlags & STGM_SIMPLE) && root->create) + if((This->parentStorage->openFlags & STGM_SIMPLE) && This->parentStorage->create) pstatstg->cbSize = This->currentPosition; return S_OK; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index e7a8c73..971f44a 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -2276,7 +2276,7 @@ static HRESULT StorageImpl_Construct( This->base.v_destructor = StorageImpl_Destroy; This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.ref = 1; - This->create = create; + This->base.create = create; /* * This is the top-level storage so initialize the ancestor pointer @@ -4131,6 +4131,8 @@ static StorageInternalImpl* StorageInternalImpl_Construct( */ newStorage->base.storageDirEntry = storageDirEntry; + newStorage->base.create = 0; + return newStorage; } diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 508bd70..59a8fb9 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -235,6 +235,9 @@ struct StorageBaseImpl * State bits appear to only be preserved while running. No in the stream */ DWORD stateBits; + + BOOL create; /* Was the storage created or opened. + The behaviour of STGM_SIMPLE depends on this */ }; /**************************************************************************** @@ -260,8 +263,6 @@ struct StorageImpl */ HANDLE hFile; /* Physical support for the Docfile */ LPOLESTR pwcsName; /* Full path of the document file */ - BOOL create; /* Was the storage created or opened. - The behaviour of STGM_SIMPLE depends on this */ /* FIXME: should this be in Storage32BaseImpl ? */ WCHAR filename[DIRENTRY_NAME_BUFFER_LEN]; -- 1.6.3.3