Vincent Povirk : ole32: Store the parent of internal storage objects.

Alexandre Julliard julliard at winehq.org
Wed Dec 9 10:46:25 CST 2009


Module: wine
Branch: master
Commit: 5b79c5a5e4b5409dfbf609572870898079f45767
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5b79c5a5e4b5409dfbf609572870898079f45767

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Nov 30 17:02:52 2009 -0600

ole32: Store the parent of internal storage objects.

---

 dlls/ole32/storage32.c |   40 +++++++++++++++++++++++++++++-----------
 1 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 9652077..c39915e 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -82,11 +82,13 @@ struct StorageInternalImpl
    * Entry in the parent's stream tracking list
    */
   struct list ParentListEntry;
+
+  StorageBaseImpl *parentStorage;
 };
 typedef struct StorageInternalImpl StorageInternalImpl;
 
 /* Method definitions for the Storage32InternalImpl class. */
-static StorageInternalImpl* StorageInternalImpl_Construct(StorageImpl* ancestorStorage,
+static StorageInternalImpl* StorageInternalImpl_Construct(StorageBaseImpl* parentStorage,
                                                           DWORD openFlags, DirRef storageDirEntry);
 static void StorageImpl_Destroy(StorageBaseImpl* iface);
 static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer);
@@ -585,7 +587,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
     }
 
     newStorage = StorageInternalImpl_Construct(
-                   This->ancestorStorage,
+                   This,
                    grfMode,
                    storageEntryRef);
 
@@ -3842,49 +3844,63 @@ static void StorageInternalImpl_Destroy( StorageBaseImpl *iface)
 static HRESULT StorageInternalImpl_CreateDirEntry(StorageBaseImpl *base,
   const DirEntry *newData, DirRef *index)
 {
-  return StorageBaseImpl_CreateDirEntry(&base->ancestorStorage->base,
+  StorageInternalImpl* This = (StorageInternalImpl*) base;
+
+  return StorageBaseImpl_CreateDirEntry(This->parentStorage,
     newData, index);
 }
 
 static HRESULT StorageInternalImpl_WriteDirEntry(StorageBaseImpl *base,
   DirRef index, const DirEntry *data)
 {
-  return StorageBaseImpl_WriteDirEntry(&base->ancestorStorage->base,
+  StorageInternalImpl* This = (StorageInternalImpl*) base;
+
+  return StorageBaseImpl_WriteDirEntry(This->parentStorage,
     index, data);
 }
 
 static HRESULT StorageInternalImpl_ReadDirEntry(StorageBaseImpl *base,
   DirRef index, DirEntry *data)
 {
-  return StorageBaseImpl_ReadDirEntry(&base->ancestorStorage->base,
+  StorageInternalImpl* This = (StorageInternalImpl*) base;
+
+  return StorageBaseImpl_ReadDirEntry(This->parentStorage,
     index, data);
 }
 
 static HRESULT StorageInternalImpl_DestroyDirEntry(StorageBaseImpl *base,
   DirRef index)
 {
-  return StorageBaseImpl_DestroyDirEntry(&base->ancestorStorage->base,
+  StorageInternalImpl* This = (StorageInternalImpl*) base;
+
+  return StorageBaseImpl_DestroyDirEntry(This->parentStorage,
     index);
 }
 
 static HRESULT StorageInternalImpl_StreamReadAt(StorageBaseImpl *base,
   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);
 }
 
 static HRESULT StorageInternalImpl_StreamWriteAt(StorageBaseImpl *base,
   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);
 }
 
 static HRESULT StorageInternalImpl_StreamSetSize(StorageBaseImpl *base,
   DirRef index, ULARGE_INTEGER newsize)
 {
-  return StorageBaseImpl_StreamSetSize(&base->ancestorStorage->base,
+  StorageInternalImpl* This = (StorageInternalImpl*) base;
+
+  return StorageBaseImpl_StreamSetSize(This->parentStorage,
     index, newsize);
 }
 
@@ -4345,7 +4361,7 @@ static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl =
 */
 
 static StorageInternalImpl* StorageInternalImpl_Construct(
-  StorageImpl* ancestorStorage,
+  StorageBaseImpl* parentStorage,
   DWORD        openFlags,
   DirRef       storageDirEntry)
 {
@@ -4369,7 +4385,9 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
     /*
      * 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




More information about the wine-cvs mailing list