From 42142200d531e1563d73539e14fde6df9c72bf67 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Fri, 4 Dec 2009 15:49:31 -0600 Subject: [PATCH] ole32: Add Invalidate to the storage vtable. --- dlls/ole32/storage32.c | 25 +++++++++++++++++++------ dlls/ole32/storage32.h | 6 ++++++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index f9f8e87a9e4..e16b9f8c975 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -91,6 +91,7 @@ typedef struct StorageInternalImpl StorageInternalImpl; static StorageInternalImpl* StorageInternalImpl_Construct(StorageBaseImpl* parentStorage, DWORD openFlags, DirRef storageDirEntry); static void StorageImpl_Destroy(StorageBaseImpl* iface); +static void StorageImpl_Invalidate(StorageBaseImpl* iface); static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer); static BOOL StorageImpl_WriteBigBlock(StorageImpl* This, ULONG blockIndex, const void* buffer); static void StorageImpl_SetNextBlockInChain(StorageImpl* This, ULONG blockIndex, ULONG nextBlock); @@ -116,7 +117,6 @@ static BOOL StorageImpl_ReadDWordFromBigBlock( StorageImpl* This, static BOOL StorageBaseImpl_IsStreamOpen(StorageBaseImpl * stg, DirRef streamEntry); static BOOL StorageBaseImpl_IsStorageOpen(StorageBaseImpl * stg, DirRef storageEntry); -static void StorageInternalImpl_Invalidate( StorageInternalImpl *This ); /* OLESTREAM memory structure to use for Get and Put Routines */ /* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */ @@ -1884,7 +1884,7 @@ static void StorageBaseImpl_DeleteAll(StorageBaseImpl * stg) LIST_FOR_EACH_SAFE(cur, cur2, &stg->storageHead) { childstg = LIST_ENTRY(cur,StorageInternalImpl,ParentListEntry); - StorageInternalImpl_Invalidate( childstg ); + StorageBaseImpl_Invalidate( &childstg->base ); } } @@ -1913,7 +1913,7 @@ static HRESULT deleteStorageContents( { if (stg->base.storageDirEntry == indexToDelete) { - StorageInternalImpl_Invalidate(stg); + StorageBaseImpl_Invalidate(&stg->base); } } @@ -2413,6 +2413,7 @@ static const IStorageVtbl Storage32Impl_Vtbl = static const StorageBaseImplVtbl StorageImpl_BaseVtbl = { StorageImpl_Destroy, + StorageImpl_Invalidate, StorageImpl_CreateDirEntry, StorageImpl_BaseWriteDirEntry, StorageImpl_BaseReadDirEntry, @@ -2652,12 +2653,21 @@ end: return hr; } +static void StorageImpl_Invalidate(StorageBaseImpl* iface) +{ + StorageImpl *This = (StorageImpl*) iface; + + StorageBaseImpl_DeleteAll(&This->base); + + This->base.reverted = 1; +} + static void StorageImpl_Destroy(StorageBaseImpl* iface) { StorageImpl *This = (StorageImpl*) iface; TRACE("(%p)\n", This); - StorageBaseImpl_DeleteAll(&This->base); + StorageImpl_Invalidate(iface); HeapFree(GetProcessHeap(), 0, This->pwcsName); @@ -3812,8 +3822,10 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks( return SmallBlockChainStream_Construct(This, NULL, streamEntryRef); } -static void StorageInternalImpl_Invalidate( StorageInternalImpl *This ) +static void StorageInternalImpl_Invalidate( StorageBaseImpl *base ) { + StorageInternalImpl* This = (StorageInternalImpl*) base; + if (!This->base.reverted) { TRACE("Storage invalidated (stg=%p)\n", This); @@ -3832,7 +3844,7 @@ static void StorageInternalImpl_Destroy( StorageBaseImpl *iface) { StorageInternalImpl* This = (StorageInternalImpl*) iface; - StorageInternalImpl_Invalidate(This); + StorageInternalImpl_Invalidate(&This->base); HeapFree(GetProcessHeap(), 0, This); } @@ -4343,6 +4355,7 @@ static const IStorageVtbl Storage32InternalImpl_Vtbl = static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl = { StorageInternalImpl_Destroy, + StorageInternalImpl_Invalidate, StorageInternalImpl_CreateDirEntry, StorageInternalImpl_WriteDirEntry, StorageInternalImpl_ReadDirEntry, diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index c68c6ea80d4..dcd460cc19b 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -248,6 +248,7 @@ struct StorageBaseImpl /* virtual methods for StorageBaseImpl objects */ struct StorageBaseImplVtbl { void (*Destroy)(StorageBaseImpl*); + void (*Invalidate)(StorageBaseImpl*); HRESULT (*CreateDirEntry)(StorageBaseImpl*,const DirEntry*,DirRef*); HRESULT (*WriteDirEntry)(StorageBaseImpl*,DirRef,const DirEntry*); HRESULT (*ReadDirEntry)(StorageBaseImpl*,DirRef,DirEntry*); @@ -262,6 +263,11 @@ static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This) This->baseVtbl->Destroy(This); } +static inline void StorageBaseImpl_Invalidate(StorageBaseImpl *This) +{ + This->baseVtbl->Invalidate(This); +} + static inline HRESULT StorageBaseImpl_CreateDirEntry(StorageBaseImpl *This, const DirEntry *newData, DirRef *index) { -- 2.11.4.GIT