ole32: Add an internal vtable to StorageBaseImpl objects.

This commit is contained in:
Vincent Povirk 2009-11-25 15:07:57 -06:00 committed by Alexandre Julliard
parent f434ab1f2a
commit cc98619ca4
2 changed files with 27 additions and 5 deletions

View File

@ -378,7 +378,7 @@ static ULONG WINAPI StorageBaseImpl_Release(
* destructor of the appropriate derived class. To do this, we are * destructor of the appropriate derived class. To do this, we are
* using virtual functions to implement the destructor. * using virtual functions to implement the destructor.
*/ */
This->v_destructor(This); StorageBaseImpl_Destroy(This);
} }
return ref; return ref;
@ -2219,6 +2219,11 @@ static const IStorageVtbl Storage32Impl_Vtbl =
StorageBaseImpl_Stat StorageBaseImpl_Stat
}; };
static const StorageBaseImplVtbl StorageImpl_BaseVtbl =
{
StorageImpl_Destroy
};
static HRESULT StorageImpl_Construct( static HRESULT StorageImpl_Construct(
HANDLE hFile, HANDLE hFile,
LPCOLESTR pwcsName, LPCOLESTR pwcsName,
@ -2249,7 +2254,7 @@ static HRESULT StorageImpl_Construct(
This->base.lpVtbl = &Storage32Impl_Vtbl; This->base.lpVtbl = &Storage32Impl_Vtbl;
This->base.pssVtbl = &IPropertySetStorage_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.openFlags = (openFlags & ~STGM_CREATE);
This->base.ref = 1; This->base.ref = 1;
This->base.create = create; This->base.create = create;
@ -4074,6 +4079,11 @@ static const IStorageVtbl Storage32InternalImpl_Vtbl =
StorageBaseImpl_Stat StorageBaseImpl_Stat
}; };
static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl =
{
StorageInternalImpl_Destroy
};
/****************************************************************************** /******************************************************************************
** Storage32InternalImpl implementation ** Storage32InternalImpl implementation
*/ */
@ -4097,7 +4107,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
* Initialize the virtual function table. * Initialize the virtual function table.
*/ */
newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl;
newStorage->base.v_destructor = StorageInternalImpl_Destroy; newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE); newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
/* /*

View File

@ -114,6 +114,7 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF;
* module. * module.
*/ */
typedef struct StorageBaseImpl StorageBaseImpl; typedef struct StorageBaseImpl StorageBaseImpl;
typedef struct StorageBaseImplVtbl StorageBaseImplVtbl;
typedef struct StorageImpl StorageImpl; typedef struct StorageImpl StorageImpl;
typedef struct BlockChainStream BlockChainStream; typedef struct BlockChainStream BlockChainStream;
typedef struct SmallBlockChainStream SmallBlockChainStream; typedef struct SmallBlockChainStream SmallBlockChainStream;
@ -179,6 +180,7 @@ HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset,
void OLECONVERT_CreateOleStream(LPSTORAGE pStorage); void OLECONVERT_CreateOleStream(LPSTORAGE pStorage);
HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName); HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName);
/**************************************************************************** /****************************************************************************
* Storage32BaseImpl definitions. * Storage32BaseImpl definitions.
* *
@ -222,9 +224,9 @@ struct StorageBaseImpl
DirRef storageDirEntry; DirRef storageDirEntry;
/* /*
* virtual Destructor method. * virtual methods.
*/ */
void (*v_destructor)(StorageBaseImpl*); const StorageBaseImplVtbl *baseVtbl;
/* /*
* flags that this storage was opened or created with * flags that this storage was opened or created with
@ -243,6 +245,16 @@ struct StorageBaseImpl
The behaviour of STGM_SIMPLE depends on this */ 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 * StorageBaseImpl stream list handlers
*/ */