Commit 5b79c5a5 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

ole32: Store the parent of internal storage objects.

parent 8518323e
...@@ -82,11 +82,13 @@ struct StorageInternalImpl ...@@ -82,11 +82,13 @@ struct StorageInternalImpl
* Entry in the parent's stream tracking list * Entry in the parent's stream tracking list
*/ */
struct list ParentListEntry; struct list ParentListEntry;
StorageBaseImpl *parentStorage;
}; };
typedef struct StorageInternalImpl StorageInternalImpl; typedef struct StorageInternalImpl StorageInternalImpl;
/* Method definitions for the Storage32InternalImpl class. */ /* Method definitions for the Storage32InternalImpl class. */
static StorageInternalImpl* StorageInternalImpl_Construct(StorageImpl* ancestorStorage, static StorageInternalImpl* StorageInternalImpl_Construct(StorageBaseImpl* parentStorage,
DWORD openFlags, DirRef storageDirEntry); DWORD openFlags, DirRef storageDirEntry);
static void StorageImpl_Destroy(StorageBaseImpl* iface); static void StorageImpl_Destroy(StorageBaseImpl* iface);
static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer); static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer);
...@@ -585,7 +587,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage( ...@@ -585,7 +587,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
} }
newStorage = StorageInternalImpl_Construct( newStorage = StorageInternalImpl_Construct(
This->ancestorStorage, This,
grfMode, grfMode,
storageEntryRef); storageEntryRef);
...@@ -3842,49 +3844,63 @@ static void StorageInternalImpl_Destroy( StorageBaseImpl *iface) ...@@ -3842,49 +3844,63 @@ static void StorageInternalImpl_Destroy( StorageBaseImpl *iface)
static HRESULT StorageInternalImpl_CreateDirEntry(StorageBaseImpl *base, static HRESULT StorageInternalImpl_CreateDirEntry(StorageBaseImpl *base,
const DirEntry *newData, DirRef *index) const DirEntry *newData, DirRef *index)
{ {
return StorageBaseImpl_CreateDirEntry(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_CreateDirEntry(This->parentStorage,
newData, index); newData, index);
} }
static HRESULT StorageInternalImpl_WriteDirEntry(StorageBaseImpl *base, static HRESULT StorageInternalImpl_WriteDirEntry(StorageBaseImpl *base,
DirRef index, const DirEntry *data) DirRef index, const DirEntry *data)
{ {
return StorageBaseImpl_WriteDirEntry(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_WriteDirEntry(This->parentStorage,
index, data); index, data);
} }
static HRESULT StorageInternalImpl_ReadDirEntry(StorageBaseImpl *base, static HRESULT StorageInternalImpl_ReadDirEntry(StorageBaseImpl *base,
DirRef index, DirEntry *data) DirRef index, DirEntry *data)
{ {
return StorageBaseImpl_ReadDirEntry(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_ReadDirEntry(This->parentStorage,
index, data); index, data);
} }
static HRESULT StorageInternalImpl_DestroyDirEntry(StorageBaseImpl *base, static HRESULT StorageInternalImpl_DestroyDirEntry(StorageBaseImpl *base,
DirRef index) DirRef index)
{ {
return StorageBaseImpl_DestroyDirEntry(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_DestroyDirEntry(This->parentStorage,
index); index);
} }
static HRESULT StorageInternalImpl_StreamReadAt(StorageBaseImpl *base, static HRESULT StorageInternalImpl_StreamReadAt(StorageBaseImpl *base,
DirRef index, ULARGE_INTEGER offset, ULONG size, void *buffer, ULONG *bytesRead) DirRef index, ULARGE_INTEGER offset, ULONG size, void *buffer, ULONG *bytesRead)
{ {
return StorageBaseImpl_StreamReadAt(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_StreamReadAt(This->parentStorage,
index, offset, size, buffer, bytesRead); index, offset, size, buffer, bytesRead);
} }
static HRESULT StorageInternalImpl_StreamWriteAt(StorageBaseImpl *base, static HRESULT StorageInternalImpl_StreamWriteAt(StorageBaseImpl *base,
DirRef index, ULARGE_INTEGER offset, ULONG size, const void *buffer, ULONG *bytesWritten) DirRef index, ULARGE_INTEGER offset, ULONG size, const void *buffer, ULONG *bytesWritten)
{ {
return StorageBaseImpl_StreamWriteAt(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_StreamWriteAt(This->parentStorage,
index, offset, size, buffer, bytesWritten); index, offset, size, buffer, bytesWritten);
} }
static HRESULT StorageInternalImpl_StreamSetSize(StorageBaseImpl *base, static HRESULT StorageInternalImpl_StreamSetSize(StorageBaseImpl *base,
DirRef index, ULARGE_INTEGER newsize) DirRef index, ULARGE_INTEGER newsize)
{ {
return StorageBaseImpl_StreamSetSize(&base->ancestorStorage->base, StorageInternalImpl* This = (StorageInternalImpl*) base;
return StorageBaseImpl_StreamSetSize(This->parentStorage,
index, newsize); index, newsize);
} }
...@@ -4345,7 +4361,7 @@ static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl = ...@@ -4345,7 +4361,7 @@ static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl =
*/ */
static StorageInternalImpl* StorageInternalImpl_Construct( static StorageInternalImpl* StorageInternalImpl_Construct(
StorageImpl* ancestorStorage, StorageBaseImpl* parentStorage,
DWORD openFlags, DWORD openFlags,
DirRef storageDirEntry) DirRef storageDirEntry)
{ {
...@@ -4369,7 +4385,9 @@ static StorageInternalImpl* StorageInternalImpl_Construct( ...@@ -4369,7 +4385,9 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
/* /*
* Keep the ancestor storage pointer but do not nail a reference to it. * Keep the ancestor storage pointer but do not nail a reference to it.
*/ */
newStorage->base.ancestorStorage = ancestorStorage; newStorage->base.ancestorStorage = parentStorage->ancestorStorage;
newStorage->parentStorage = parentStorage;
/* /*
* Keep a reference to the directory entry of this storage * Keep a reference to the directory entry of this storage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment