From 6714664dee64634e98a9a5cc76a1338c9dec6f2d Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 31 Mar 2005 15:26:30 +0000 Subject: [PATCH] Eliminate forward declarations, make functions static. --- dlls/ole32/stg_prop.c | 6 +- dlls/ole32/stg_stream.c | 207 ++++++++++++------------ dlls/ole32/storage32.c | 339 +++++++++++++++++++--------------------- dlls/ole32/storage32.h | 218 -------------------------- 4 files changed, 268 insertions(+), 502 deletions(-) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index b422c0bc79..37d14204ea 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -1251,7 +1251,7 @@ static HRESULT WINAPI IPropertySetStorage_fnQueryInterface( void** ppvObject) { _ICOM_THIS_From_IPropertySetStorage(StorageImpl, ppstg); - return StorageBaseImpl_QueryInterface( (IStorage*)This, riid, ppvObject ); + return IStorage_QueryInterface( (IStorage*)This, riid, ppvObject ); } /************************************************************************ @@ -1263,7 +1263,7 @@ static ULONG WINAPI IPropertySetStorage_fnAddRef( IPropertySetStorage *ppstg) { _ICOM_THIS_From_IPropertySetStorage(StorageImpl, ppstg); - return StorageBaseImpl_AddRef( (IStorage*)This ); + return IStorage_AddRef( (IStorage*)This ); } /************************************************************************ @@ -1275,7 +1275,7 @@ static ULONG WINAPI IPropertySetStorage_fnRelease( IPropertySetStorage *ppstg) { _ICOM_THIS_From_IPropertySetStorage(StorageImpl, ppstg); - return StorageBaseImpl_Release( (IStorage*)This ); + return IStorage_Release( (IStorage*)This ); } /************************************************************************ diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index de96688518..9fa28dae9c 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -45,89 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage); -/* - * Virtual function table for the StgStreamImpl class. - */ -static IStreamVtbl StgStreamImpl_Vtbl = -{ - StgStreamImpl_QueryInterface, - StgStreamImpl_AddRef, - StgStreamImpl_Release, - StgStreamImpl_Read, - StgStreamImpl_Write, - StgStreamImpl_Seek, - StgStreamImpl_SetSize, - StgStreamImpl_CopyTo, - StgStreamImpl_Commit, - StgStreamImpl_Revert, - StgStreamImpl_LockRegion, - StgStreamImpl_UnlockRegion, - StgStreamImpl_Stat, - StgStreamImpl_Clone -}; - -/****************************************************************************** -** StgStreamImpl implementation -*/ - -/*** - * This is the constructor for the StgStreamImpl class. - * - * Params: - * parentStorage - Pointer to the storage that contains the stream to open - * ownerProperty - Index of the property that points to this stream. - */ -StgStreamImpl* StgStreamImpl_Construct( - StorageBaseImpl* parentStorage, - DWORD grfMode, - ULONG ownerProperty) -{ - StgStreamImpl* newStream; - - newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl)); - - if (newStream!=0) - { - /* - * Set-up the virtual function table and reference count. - */ - newStream->lpVtbl = &StgStreamImpl_Vtbl; - newStream->ref = 0; - - /* - * We want to nail-down the reference to the storage in case the - * stream out-lives the storage in the client application. - */ - newStream->parentStorage = parentStorage; - IStorage_AddRef((IStorage*)newStream->parentStorage); - - newStream->grfMode = grfMode; - newStream->ownerProperty = ownerProperty; - - /* - * Start the stream at the beginning. - */ - newStream->currentPosition.u.HighPart = 0; - newStream->currentPosition.u.LowPart = 0; - - /* - * Initialize the rest of the data. - */ - newStream->streamSize.u.HighPart = 0; - newStream->streamSize.u.LowPart = 0; - newStream->bigBlockChain = 0; - newStream->smallBlockChain = 0; - - /* - * Read the size from the property and determine if the blocks forming - * this stream are large or small. - */ - StgStreamImpl_OpenBlockChain(newStream); - } - - return newStream; -} - /*** * This is the destructor of the StgStreamImpl class. * @@ -135,7 +52,7 @@ StgStreamImpl* StgStreamImpl_Construct( * class. The pointer passed-in to this function will be freed and will not * be valid anymore. */ -void StgStreamImpl_Destroy(StgStreamImpl* This) +static void StgStreamImpl_Destroy(StgStreamImpl* This) { TRACE("(%p)\n", This); @@ -170,7 +87,7 @@ void StgStreamImpl_Destroy(StgStreamImpl* This) * This implements the IUnknown method QueryInterface for this * class */ -HRESULT WINAPI StgStreamImpl_QueryInterface( +static HRESULT WINAPI StgStreamImpl_QueryInterface( IStream* iface, REFIID riid, /* [in] */ void** ppvObject) /* [iid_is][out] */ @@ -191,11 +108,8 @@ HRESULT WINAPI StgStreamImpl_QueryInterface( /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) - { - *ppvObject = (IStream*)This; - } - else if (memcmp(&IID_IStream, riid, sizeof(IID_IStream)) == 0) + if (IsEqualGUID(&IID_IUnknown, riid)|| + IsEqualGUID(&IID_IStream, riid)) { *ppvObject = (IStream*)This; } @@ -210,7 +124,7 @@ HRESULT WINAPI StgStreamImpl_QueryInterface( * Query Interface always increases the reference count by one when it is * successful */ - StgStreamImpl_AddRef(iface); + IStream_AddRef(iface); return S_OK; } @@ -219,7 +133,7 @@ HRESULT WINAPI StgStreamImpl_QueryInterface( * This implements the IUnknown method AddRef for this * class */ -ULONG WINAPI StgStreamImpl_AddRef( +static ULONG WINAPI StgStreamImpl_AddRef( IStream* iface) { StgStreamImpl* const This=(StgStreamImpl*)iface; @@ -230,7 +144,7 @@ ULONG WINAPI StgStreamImpl_AddRef( * This implements the IUnknown method Release for this * class */ -ULONG WINAPI StgStreamImpl_Release( +static ULONG WINAPI StgStreamImpl_Release( IStream* iface) { StgStreamImpl* const This=(StgStreamImpl*)iface; @@ -255,7 +169,7 @@ ULONG WINAPI StgStreamImpl_Release( * that describes the stream. * If the stream's size is null, no chain is opened. */ -void StgStreamImpl_OpenBlockChain( +static void StgStreamImpl_OpenBlockChain( StgStreamImpl* This) { StgProperty curProperty; @@ -325,7 +239,7 @@ void StgStreamImpl_OpenBlockChain( * * See the documentation of ISequentialStream for more info. */ -HRESULT WINAPI StgStreamImpl_Read( +static HRESULT WINAPI StgStreamImpl_Read( IStream* iface, void* pv, /* [length_is][size_is][out] */ ULONG cb, /* [in] */ @@ -426,7 +340,7 @@ end: * * See the documentation of ISequentialStream for more info. */ -HRESULT WINAPI StgStreamImpl_Write( +static HRESULT WINAPI StgStreamImpl_Write( IStream* iface, const void* pv, /* [size_is][in] */ ULONG cb, /* [in] */ @@ -526,7 +440,7 @@ HRESULT WINAPI StgStreamImpl_Write( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_Seek( +static HRESULT WINAPI StgStreamImpl_Seek( IStream* iface, LARGE_INTEGER dlibMove, /* [in] */ DWORD dwOrigin, /* [in] */ @@ -588,7 +502,7 @@ HRESULT WINAPI StgStreamImpl_Seek( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_SetSize( +static HRESULT WINAPI StgStreamImpl_SetSize( IStream* iface, ULARGE_INTEGER libNewSize) /* [in] */ { @@ -695,7 +609,7 @@ HRESULT WINAPI StgStreamImpl_SetSize( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_CopyTo( +static HRESULT WINAPI StgStreamImpl_CopyTo( IStream* iface, IStream* pstm, /* [unique][in] */ ULARGE_INTEGER cb, /* [in] */ @@ -780,7 +694,7 @@ HRESULT WINAPI StgStreamImpl_CopyTo( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_Commit( +static HRESULT WINAPI StgStreamImpl_Commit( IStream* iface, DWORD grfCommitFlags) /* [in] */ { @@ -795,13 +709,13 @@ HRESULT WINAPI StgStreamImpl_Commit( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_Revert( +static HRESULT WINAPI StgStreamImpl_Revert( IStream* iface) { return S_OK; } -HRESULT WINAPI StgStreamImpl_LockRegion( +static HRESULT WINAPI StgStreamImpl_LockRegion( IStream* iface, ULARGE_INTEGER libOffset, /* [in] */ ULARGE_INTEGER cb, /* [in] */ @@ -811,7 +725,7 @@ HRESULT WINAPI StgStreamImpl_LockRegion( return E_NOTIMPL; } -HRESULT WINAPI StgStreamImpl_UnlockRegion( +static HRESULT WINAPI StgStreamImpl_UnlockRegion( IStream* iface, ULARGE_INTEGER libOffset, /* [in] */ ULARGE_INTEGER cb, /* [in] */ @@ -829,7 +743,7 @@ HRESULT WINAPI StgStreamImpl_UnlockRegion( * * See the documentation of IStream for more info. */ -HRESULT WINAPI StgStreamImpl_Stat( +static HRESULT WINAPI StgStreamImpl_Stat( IStream* iface, STATSTG* pstatstg, /* [out] */ DWORD grfStatFlag) /* [in] */ @@ -872,7 +786,7 @@ HRESULT WINAPI StgStreamImpl_Stat( * should be basically as simple as creating a new stream with the same * parent etc and positioning its seek cursor. */ -HRESULT WINAPI StgStreamImpl_Clone( +static HRESULT WINAPI StgStreamImpl_Clone( IStream* iface, IStream** ppstm) /* [out] */ { @@ -901,3 +815,86 @@ HRESULT WINAPI StgStreamImpl_Clone( return S_OK; } + +/* + * Virtual function table for the StgStreamImpl class. + */ +static IStreamVtbl StgStreamImpl_Vtbl = +{ + StgStreamImpl_QueryInterface, + StgStreamImpl_AddRef, + StgStreamImpl_Release, + StgStreamImpl_Read, + StgStreamImpl_Write, + StgStreamImpl_Seek, + StgStreamImpl_SetSize, + StgStreamImpl_CopyTo, + StgStreamImpl_Commit, + StgStreamImpl_Revert, + StgStreamImpl_LockRegion, + StgStreamImpl_UnlockRegion, + StgStreamImpl_Stat, + StgStreamImpl_Clone +}; + +/****************************************************************************** +** StgStreamImpl implementation +*/ + +/*** + * This is the constructor for the StgStreamImpl class. + * + * Params: + * parentStorage - Pointer to the storage that contains the stream to open + * ownerProperty - Index of the property that points to this stream. + */ +StgStreamImpl* StgStreamImpl_Construct( + StorageBaseImpl* parentStorage, + DWORD grfMode, + ULONG ownerProperty) +{ + StgStreamImpl* newStream; + + newStream = HeapAlloc(GetProcessHeap(), 0, sizeof(StgStreamImpl)); + + if (newStream!=0) + { + /* + * Set-up the virtual function table and reference count. + */ + newStream->lpVtbl = &StgStreamImpl_Vtbl; + newStream->ref = 0; + + /* + * We want to nail-down the reference to the storage in case the + * stream out-lives the storage in the client application. + */ + newStream->parentStorage = parentStorage; + IStorage_AddRef((IStorage*)newStream->parentStorage); + + newStream->grfMode = grfMode; + newStream->ownerProperty = ownerProperty; + + /* + * Start the stream at the beginning. + */ + newStream->currentPosition.u.HighPart = 0; + newStream->currentPosition.u.LowPart = 0; + + /* + * Initialize the rest of the data. + */ + newStream->streamSize.u.HighPart = 0; + newStream->streamSize.u.LowPart = 0; + newStream->bigBlockChain = 0; + newStream->smallBlockChain = 0; + + /* + * Read the size from the property and determine if the blocks forming + * this stream are large or small. + */ + StgStreamImpl_OpenBlockChain(newStream); + } + + return newStream; +} diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 5a91b0b3d8..4d2bcfc13e 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -157,70 +157,6 @@ static DWORD GetShareModeFromSTGM(DWORD stgm); static DWORD GetAccessModeFromSTGM(DWORD stgm); static DWORD GetCreationModeFromSTGM(DWORD stgm); -/* - * Virtual function table for the IStorage32Impl class. - */ -static IStorageVtbl Storage32Impl_Vtbl = -{ - StorageBaseImpl_QueryInterface, - StorageBaseImpl_AddRef, - StorageBaseImpl_Release, - StorageBaseImpl_CreateStream, - StorageBaseImpl_OpenStream, - StorageImpl_CreateStorage, - StorageBaseImpl_OpenStorage, - StorageImpl_CopyTo, - StorageImpl_MoveElementTo, - StorageImpl_Commit, - StorageImpl_Revert, - StorageBaseImpl_EnumElements, - StorageImpl_DestroyElement, - StorageBaseImpl_RenameElement, - StorageImpl_SetElementTimes, - StorageBaseImpl_SetClass, - StorageImpl_SetStateBits, - StorageImpl_Stat -}; - -/* - * Virtual function table for the Storage32InternalImpl class. - */ -static IStorageVtbl Storage32InternalImpl_Vtbl = - { - StorageBaseImpl_QueryInterface, - StorageBaseImpl_AddRef, - StorageBaseImpl_Release, - StorageBaseImpl_CreateStream, - StorageBaseImpl_OpenStream, - StorageImpl_CreateStorage, - StorageBaseImpl_OpenStorage, - StorageImpl_CopyTo, - StorageImpl_MoveElementTo, - StorageInternalImpl_Commit, - StorageInternalImpl_Revert, - StorageBaseImpl_EnumElements, - StorageImpl_DestroyElement, - StorageBaseImpl_RenameElement, - StorageImpl_SetElementTimes, - StorageBaseImpl_SetClass, - StorageImpl_SetStateBits, - StorageBaseImpl_Stat -}; - -/* - * Virtual function table for the IEnumSTATSTGImpl class. - */ -static IEnumSTATSTGVtbl IEnumSTATSTGImpl_Vtbl = -{ - IEnumSTATSTGImpl_QueryInterface, - IEnumSTATSTGImpl_AddRef, - IEnumSTATSTGImpl_Release, - IEnumSTATSTGImpl_Next, - IEnumSTATSTGImpl_Skip, - IEnumSTATSTGImpl_Reset, - IEnumSTATSTGImpl_Clone -}; - extern IPropertySetStorageVtbl IPropertySetStorage_Vtbl; @@ -280,7 +216,7 @@ HRESULT WINAPI StorageBaseImpl_QueryInterface( * Query Interface always increases the reference count by one when it is * successful */ - StorageBaseImpl_AddRef(iface); + IStorage_AddRef(iface); return S_OK; } @@ -435,7 +371,7 @@ HRESULT WINAPI StorageBaseImpl_OpenStream( * Since we are returning a pointer to the interface, we have to * nail down the reference. */ - StgStreamImpl_AddRef(*ppstm); + IStream_AddRef(*ppstm); res = S_OK; goto end; @@ -622,7 +558,7 @@ HRESULT WINAPI StorageBaseImpl_EnumElements( * Don't forget to nail down a reference to the new object before * returning it. */ - IEnumSTATSTGImpl_AddRef(*ppenum); + IEnumSTATSTG_AddRef(*ppenum); return S_OK; } @@ -735,7 +671,7 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( return STG_E_FILEALREADYEXISTS; } - IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)propertyEnumeration); + IEnumSTATSTG_Reset((IEnumSTATSTG*)propertyEnumeration); /* * Search the enumeration for the old property name @@ -834,7 +770,7 @@ HRESULT WINAPI StorageBaseImpl_RenameElement( * Invoke Destroy to get rid of the ole property and automatically redo * the linking of it's previous and next members... */ - StorageImpl_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); + IStorage_DestroyElement((IStorage*)This->ancestorStorage, pwcsOldName); } else @@ -996,7 +932,7 @@ HRESULT WINAPI StorageBaseImpl_CreateStream( * Since we are returning a pointer to the interface, we have to nail down * the reference. */ - StgStreamImpl_AddRef(*ppstm); + IStream_AddRef(*ppstm); } else { @@ -2200,6 +2136,31 @@ HRESULT WINAPI StorageImpl_SetStateBits( return E_NOTIMPL; } +/* + * Virtual function table for the IStorage32Impl class. + */ +static IStorageVtbl Storage32Impl_Vtbl = +{ + StorageBaseImpl_QueryInterface, + StorageBaseImpl_AddRef, + StorageBaseImpl_Release, + StorageBaseImpl_CreateStream, + StorageBaseImpl_OpenStream, + StorageImpl_CreateStorage, + StorageBaseImpl_OpenStorage, + StorageImpl_CopyTo, + StorageImpl_MoveElementTo, + StorageImpl_Commit, + StorageImpl_Revert, + StorageBaseImpl_EnumElements, + StorageImpl_DestroyElement, + StorageBaseImpl_RenameElement, + StorageImpl_SetElementTimes, + StorageBaseImpl_SetClass, + StorageImpl_SetStateBits, + StorageImpl_Stat +}; + HRESULT StorageImpl_Construct( StorageImpl* This, HANDLE hFile, @@ -3472,48 +3433,6 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks( return bigBlockChain; } -/****************************************************************************** -** Storage32InternalImpl implementation -*/ - -StorageInternalImpl* StorageInternalImpl_Construct( - StorageImpl* ancestorStorage, - ULONG rootPropertyIndex) -{ - StorageInternalImpl* newStorage; - - /* - * Allocate space for the new storage object - */ - newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageInternalImpl)); - - if (newStorage!=0) - { - memset(newStorage, 0, sizeof(StorageInternalImpl)); - - /* - * Initialize the virtual function table. - */ - newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; - newStorage->base.v_destructor = &StorageInternalImpl_Destroy; - - /* - * Keep the ancestor storage pointer and nail a reference to it. - */ - newStorage->base.ancestorStorage = ancestorStorage; - StorageBaseImpl_AddRef((IStorage*)(newStorage->base.ancestorStorage)); - - /* - * Keep the index of the root property set for this storage, - */ - newStorage->base.rootPropertySetIndex = rootPropertyIndex; - - return newStorage; - } - - return 0; -} - void StorageInternalImpl_Destroy( StorageBaseImpl *iface) { StorageInternalImpl* This = (StorageInternalImpl*) iface; @@ -3549,52 +3468,6 @@ HRESULT WINAPI StorageInternalImpl_Revert( return S_OK; } -/****************************************************************************** -** IEnumSTATSTGImpl implementation -*/ - -IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct( - StorageImpl* parentStorage, - ULONG firstPropertyNode) -{ - IEnumSTATSTGImpl* newEnumeration; - - newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl)); - - if (newEnumeration!=0) - { - /* - * Set-up the virtual function table and reference count. - */ - newEnumeration->lpVtbl = &IEnumSTATSTGImpl_Vtbl; - newEnumeration->ref = 0; - - /* - * We want to nail-down the reference to the storage in case the - * enumeration out-lives the storage in the client application. - */ - newEnumeration->parentStorage = parentStorage; - IStorage_AddRef((IStorage*)newEnumeration->parentStorage); - - newEnumeration->firstPropertyNode = firstPropertyNode; - - /* - * Initialize the search stack - */ - newEnumeration->stackSize = 0; - newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT; - newEnumeration->stackToVisit = - HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT); - - /* - * Make sure the current node of the iterator is the first one. - */ - IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration); - } - - return newEnumeration; -} - void IEnumSTATSTGImpl_Destroy(IEnumSTATSTGImpl* This) { IStorage_Release((IStorage*)This->parentStorage); @@ -3623,28 +3496,15 @@ HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface( /* * Compare the riid with the interface IDs implemented by this object. */ - if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0) - { - *ppvObject = (IEnumSTATSTG*)This; - } - else if (memcmp(&IID_IStorage, riid, sizeof(IID_IEnumSTATSTG)) == 0) + if (IsEqualGUID(&IID_IUnknown, riid) || + IsEqualGUID(&IID_IStorage, riid)) { *ppvObject = (IEnumSTATSTG*)This; + IEnumSTATSTG_AddRef((IEnumSTATSTG*)This); + return S_OK; } - /* - * Check that we obtained an interface. - */ - if ((*ppvObject)==0) - return E_NOINTERFACE; - - /* - * Query Interface always increases the reference count by one when it is - * successful - */ - IEnumSTATSTGImpl_AddRef((IEnumSTATSTG*)This); - - return S_OK; + return E_NOINTERFACE; } ULONG WINAPI IEnumSTATSTGImpl_AddRef( @@ -4062,6 +3922,133 @@ ULONG IEnumSTATSTGImpl_PopSearchNode( return topNode; } +/* + * Virtual function table for the IEnumSTATSTGImpl class. + */ +static IEnumSTATSTGVtbl IEnumSTATSTGImpl_Vtbl = +{ + IEnumSTATSTGImpl_QueryInterface, + IEnumSTATSTGImpl_AddRef, + IEnumSTATSTGImpl_Release, + IEnumSTATSTGImpl_Next, + IEnumSTATSTGImpl_Skip, + IEnumSTATSTGImpl_Reset, + IEnumSTATSTGImpl_Clone +}; + +/****************************************************************************** +** IEnumSTATSTGImpl implementation +*/ + +IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct( + StorageImpl* parentStorage, + ULONG firstPropertyNode) +{ + IEnumSTATSTGImpl* newEnumeration; + + newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl)); + + if (newEnumeration!=0) + { + /* + * Set-up the virtual function table and reference count. + */ + newEnumeration->lpVtbl = &IEnumSTATSTGImpl_Vtbl; + newEnumeration->ref = 0; + + /* + * We want to nail-down the reference to the storage in case the + * enumeration out-lives the storage in the client application. + */ + newEnumeration->parentStorage = parentStorage; + IStorage_AddRef((IStorage*)newEnumeration->parentStorage); + + newEnumeration->firstPropertyNode = firstPropertyNode; + + /* + * Initialize the search stack + */ + newEnumeration->stackSize = 0; + newEnumeration->stackMaxSize = ENUMSTATSGT_SIZE_INCREMENT; + newEnumeration->stackToVisit = + HeapAlloc(GetProcessHeap(), 0, sizeof(ULONG)*ENUMSTATSGT_SIZE_INCREMENT); + + /* + * Make sure the current node of the iterator is the first one. + */ + IEnumSTATSTGImpl_Reset((IEnumSTATSTG*)newEnumeration); + } + + return newEnumeration; +} + +/* + * Virtual function table for the Storage32InternalImpl class. + */ +static IStorageVtbl Storage32InternalImpl_Vtbl = +{ + StorageBaseImpl_QueryInterface, + StorageBaseImpl_AddRef, + StorageBaseImpl_Release, + StorageBaseImpl_CreateStream, + StorageBaseImpl_OpenStream, + StorageImpl_CreateStorage, + StorageBaseImpl_OpenStorage, + StorageImpl_CopyTo, + StorageImpl_MoveElementTo, + StorageInternalImpl_Commit, + StorageInternalImpl_Revert, + StorageBaseImpl_EnumElements, + StorageImpl_DestroyElement, + StorageBaseImpl_RenameElement, + StorageImpl_SetElementTimes, + StorageBaseImpl_SetClass, + StorageImpl_SetStateBits, + StorageBaseImpl_Stat +}; + +/****************************************************************************** +** Storage32InternalImpl implementation +*/ + +StorageInternalImpl* StorageInternalImpl_Construct( + StorageImpl* ancestorStorage, + ULONG rootPropertyIndex) +{ + StorageInternalImpl* newStorage; + + /* + * Allocate space for the new storage object + */ + newStorage = HeapAlloc(GetProcessHeap(), 0, sizeof(StorageInternalImpl)); + + if (newStorage!=0) + { + memset(newStorage, 0, sizeof(StorageInternalImpl)); + + /* + * Initialize the virtual function table. + */ + newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; + newStorage->base.v_destructor = &StorageInternalImpl_Destroy; + + /* + * Keep the ancestor storage pointer and nail a reference to it. + */ + newStorage->base.ancestorStorage = ancestorStorage; + StorageBaseImpl_AddRef((IStorage*)(newStorage->base.ancestorStorage)); + + /* + * Keep the index of the root property set for this storage, + */ + newStorage->base.rootPropertySetIndex = rootPropertyIndex; + + return newStorage; + } + + return 0; +} + /****************************************************************************** ** StorageUtl implementation * FIXME: these should read and write in little-endian order on all diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 834afe7280..f27284ef9a 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -240,66 +240,6 @@ struct StorageBaseImpl }; -/* - * Prototypes for the methods of the Storage32BaseImpl class. - */ -HRESULT WINAPI StorageBaseImpl_QueryInterface( - IStorage* iface, - REFIID riid, - void** ppvObject); - -ULONG WINAPI StorageBaseImpl_AddRef( - IStorage* iface); - -ULONG WINAPI StorageBaseImpl_Release( - IStorage* iface); - -HRESULT WINAPI StorageBaseImpl_OpenStream( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - void* reserved1, /* [unique][in] */ - DWORD grfMode, /* [in] */ - DWORD reserved2, /* [in] */ - IStream** ppstm); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_OpenStorage( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][unique][in] */ - IStorage* pstgPriority, /* [unique][in] */ - DWORD grfMode, /* [in] */ - SNB snbExclude, /* [unique][in] */ - DWORD reserved, /* [in] */ - IStorage** ppstg); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_EnumElements( - IStorage* iface, - DWORD reserved1, /* [in] */ - void* reserved2, /* [size_is][unique][in] */ - DWORD reserved3, /* [in] */ - IEnumSTATSTG** ppenum); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_Stat( - IStorage* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag); /* [in] */ - -HRESULT WINAPI StorageBaseImpl_RenameElement( - IStorage* iface, - const OLECHAR* pwcsOldName, /* [string][in] */ - const OLECHAR* pwcsNewName); /* [string][in] */ - -HRESULT WINAPI StorageBaseImpl_CreateStream( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - DWORD grfMode, /* [in] */ - DWORD reserved1, /* [in] */ - DWORD reserved2, /* [in] */ - IStream** ppstm); /* [out] */ - -HRESULT WINAPI StorageBaseImpl_SetClass( - IStorage* iface, - REFCLSID clsid); /* [in] */ - /**************************************************************************** * Storage32Impl definitions. * @@ -351,59 +291,6 @@ struct StorageImpl BigBlockFile* bigBlockFile; }; -/* - * Method declaration for the Storage32Impl class - */ - -HRESULT WINAPI StorageImpl_CreateStorage( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - DWORD grfMode, /* [in] */ - DWORD dwStgFmt, /* [in] */ - DWORD reserved2, /* [in] */ - IStorage** ppstg); /* [out] */ - -HRESULT WINAPI StorageImpl_CopyTo( - IStorage* iface, - DWORD ciidExclude, /* [in] */ - const IID* rgiidExclude, /* [size_is][unique][in] */ - SNB snbExclude, /* [unique][in] */ - IStorage* pstgDest); /* [unique][in] */ - -HRESULT WINAPI StorageImpl_MoveElementTo( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - IStorage* pstgDest, /* [unique][in] */ - const OLECHAR* pwcsNewName, /* [string][in] */ - DWORD grfFlags); /* [in] */ - -HRESULT WINAPI StorageImpl_Commit( - IStorage* iface, - DWORD grfCommitFlags); /* [in] */ - -HRESULT WINAPI StorageImpl_Revert( - IStorage* iface); - -HRESULT WINAPI StorageImpl_DestroyElement( - IStorage* iface, - const OLECHAR* pwcsName); /* [string][in] */ - -HRESULT WINAPI StorageImpl_SetElementTimes( - IStorage* iface, - const OLECHAR* pwcsName, /* [string][in] */ - const FILETIME* pctime, /* [in] */ - const FILETIME* patime, /* [in] */ - const FILETIME* pmtime); /* [in] */ - -HRESULT WINAPI StorageImpl_SetStateBits( - IStorage* iface, - DWORD grfStateBits, /* [in] */ - DWORD grfMask); /* [in] */ - -HRESULT WINAPI StorageImpl_Stat(IStorage* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag); /* [in] */ - void StorageImpl_Destroy( StorageBaseImpl* This); @@ -551,37 +438,6 @@ struct IEnumSTATSTGImpl #define ENUMSTATSGT_SIZE_INCREMENT 10 }; -/* - * Method definitions for the IEnumSTATSTGImpl class. - */ -HRESULT WINAPI IEnumSTATSTGImpl_QueryInterface( - IEnumSTATSTG* iface, - REFIID riid, - void** ppvObject); - -ULONG WINAPI IEnumSTATSTGImpl_AddRef( - IEnumSTATSTG* iface); - -ULONG WINAPI IEnumSTATSTGImpl_Release( - IEnumSTATSTG* iface); - -HRESULT WINAPI IEnumSTATSTGImpl_Next( - IEnumSTATSTG* iface, - ULONG celt, - STATSTG* rgelt, - ULONG* pceltFetched); - -HRESULT WINAPI IEnumSTATSTGImpl_Skip( - IEnumSTATSTG* iface, - ULONG celt); - -HRESULT WINAPI IEnumSTATSTGImpl_Reset( - IEnumSTATSTG* iface); - -HRESULT WINAPI IEnumSTATSTGImpl_Clone( - IEnumSTATSTG* iface, - IEnumSTATSTG** ppenum); - IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct( StorageImpl* This, ULONG firstPropertyNode); @@ -667,80 +523,6 @@ StgStreamImpl* StgStreamImpl_Construct( DWORD grfMode, ULONG ownerProperty); -void StgStreamImpl_Destroy( - StgStreamImpl* This); - -void StgStreamImpl_OpenBlockChain( - StgStreamImpl* This); - -HRESULT WINAPI StgStreamImpl_QueryInterface( - IStream* iface, - REFIID riid, /* [in] */ - void** ppvObject); /* [iid_is][out] */ - -ULONG WINAPI StgStreamImpl_AddRef( - IStream* iface); - -ULONG WINAPI StgStreamImpl_Release( - IStream* iface); - -HRESULT WINAPI StgStreamImpl_Read( - IStream* iface, - void* pv, /* [length_is][size_is][out] */ - ULONG cb, /* [in] */ - ULONG* pcbRead); /* [out] */ - -HRESULT WINAPI StgStreamImpl_Write( - IStream* iface, - const void* pv, /* [size_is][in] */ - ULONG cb, /* [in] */ - ULONG* pcbWritten); /* [out] */ - -HRESULT WINAPI StgStreamImpl_Seek( - IStream* iface, - LARGE_INTEGER dlibMove, /* [in] */ - DWORD dwOrigin, /* [in] */ - ULARGE_INTEGER* plibNewPosition); /* [out] */ - -HRESULT WINAPI StgStreamImpl_SetSize( - IStream* iface, - ULARGE_INTEGER libNewSize); /* [in] */ - -HRESULT WINAPI StgStreamImpl_CopyTo( - IStream* iface, - IStream* pstm, /* [unique][in] */ - ULARGE_INTEGER cb, /* [in] */ - ULARGE_INTEGER* pcbRead, /* [out] */ - ULARGE_INTEGER* pcbWritten); /* [out] */ - -HRESULT WINAPI StgStreamImpl_Commit( - IStream* iface, - DWORD grfCommitFlags); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Revert( - IStream* iface); - -HRESULT WINAPI StgStreamImpl_LockRegion( - IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType); /* [in] */ - -HRESULT WINAPI StgStreamImpl_UnlockRegion( - IStream* iface, - ULARGE_INTEGER libOffset, /* [in] */ - ULARGE_INTEGER cb, /* [in] */ - DWORD dwLockType); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Stat( - IStream* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag); /* [in] */ - -HRESULT WINAPI StgStreamImpl_Clone( - IStream* iface, - IStream** ppstm); /* [out] */ - /******************************************************************************** * The StorageUtl_ functions are miscelaneous utility functions. Most of which are