From 45dd850029e2af574c2e4dd5a79aff3b2698d95b Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 25 Nov 2009 15:07:57 -0600 Subject: [PATCH 5/5] ole32: Add an internal vtable to StorageBaseImpl objects. --- dlls/ole32/storage32.c | 16 +++++++++++++--- dlls/ole32/storage32.h | 16 ++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 8f9683f..384722d 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -378,7 +378,7 @@ static ULONG WINAPI StorageBaseImpl_Release( * destructor of the appropriate derived class. To do this, we are * using virtual functions to implement the destructor. */ - This->v_destructor(This); + StorageBaseImpl_Destroy(This); } return ref; @@ -2219,6 +2219,11 @@ static const IStorageVtbl Storage32Impl_Vtbl = StorageBaseImpl_Stat }; +static const StorageBaseImplVtbl StorageImpl_BaseVtbl = +{ + StorageImpl_Destroy +}; + static HRESULT StorageImpl_Construct( HANDLE hFile, LPCOLESTR pwcsName, @@ -2249,7 +2254,7 @@ static HRESULT StorageImpl_Construct( This->base.lpVtbl = &Storage32Impl_Vtbl; This->base.pssVtbl = &IPropertySetStorage_Vtbl; - This->base.v_destructor = StorageImpl_Destroy; + This->base.baseVtbl = &StorageImpl_BaseVtbl; This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.ref = 1; This->base.create = create; @@ -4074,6 +4079,11 @@ static const IStorageVtbl Storage32InternalImpl_Vtbl = StorageBaseImpl_Stat }; +static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl = +{ + StorageInternalImpl_Destroy +}; + /****************************************************************************** ** Storage32InternalImpl implementation */ @@ -4097,7 +4107,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct( * Initialize the virtual function table. */ newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; - newStorage->base.v_destructor = StorageInternalImpl_Destroy; + newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl; newStorage->base.openFlags = (openFlags & ~STGM_CREATE); /* diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 20de0eb..c97a2b7 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -114,6 +114,7 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF; * module. */ typedef struct StorageBaseImpl StorageBaseImpl; +typedef struct StorageBaseImplVtbl StorageBaseImplVtbl; typedef struct StorageImpl StorageImpl; typedef struct BlockChainStream BlockChainStream; typedef struct SmallBlockChainStream SmallBlockChainStream; @@ -179,6 +180,7 @@ HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset, void OLECONVERT_CreateOleStream(LPSTORAGE pStorage); HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName); + /**************************************************************************** * Storage32BaseImpl definitions. * @@ -222,9 +224,9 @@ struct StorageBaseImpl DirRef storageDirEntry; /* - * virtual Destructor method. + * virtual methods. */ - void (*v_destructor)(StorageBaseImpl*); + const StorageBaseImplVtbl *baseVtbl; /* * flags that this storage was opened or created with @@ -243,6 +245,16 @@ struct StorageBaseImpl The behaviour of STGM_SIMPLE depends on this */ }; +/* virtual methods for StorageBaseImpl objects */ +struct StorageBaseImplVtbl { + void (*Destroy)(StorageBaseImpl*); +}; + +static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This) +{ + This->baseVtbl->Destroy(This); +} + /**************************************************************************** * StorageBaseImpl stream list handlers */ -- 1.6.3.3