Vincent Povirk : ole32: Add an attribute to StorageBaseImpl to track its reverted status.

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


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

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

ole32: Add an attribute to StorageBaseImpl to track its reverted status.

---

 dlls/ole32/storage32.c |   28 ++++++++++++++++++----------
 dlls/ole32/storage32.h |    5 +++++
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index c39915e..266d677 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -425,7 +425,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStream(
     goto end;
   }
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
   {
     res = STG_E_REVERTED;
     goto end;
@@ -553,7 +553,7 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage(
     goto end;
   }
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   /*
@@ -638,7 +638,7 @@ static HRESULT WINAPI StorageBaseImpl_EnumElements(
   if ( (This==0) || (ppenum==0))
     return E_INVALIDARG;
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   newEnum = IEnumSTATSTGImpl_Construct(
@@ -682,7 +682,7 @@ static HRESULT WINAPI StorageBaseImpl_Stat(
     goto end;
   }
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
   {
     res = STG_E_REVERTED;
     goto end;
@@ -733,7 +733,7 @@ static HRESULT WINAPI StorageBaseImpl_RenameElement(
   TRACE("(%p, %s, %s)\n",
 	iface, debugstr_w(pwcsOldName), debugstr_w(pwcsNewName));
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   currentEntryRef = findElement(This->ancestorStorage,
@@ -830,7 +830,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
   if (STGM_SHARE_MODE(grfMode) != STGM_SHARE_EXCLUSIVE) 
     return STG_E_INVALIDFLAG;
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   /*
@@ -959,7 +959,7 @@ static HRESULT WINAPI StorageBaseImpl_SetClass(
 
   TRACE("(%p, %p)\n", iface, clsid);
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   hRes = StorageBaseImpl_ReadDirEntry(This,
@@ -1028,7 +1028,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage(
     return STG_E_INVALIDFLAG;
   }
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   /*
@@ -1772,7 +1772,7 @@ static HRESULT WINAPI StorageBaseImpl_DestroyElement(
   if (pwcsName==NULL)
     return STG_E_INVALIDPOINTER;
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   if ( STGM_ACCESS_MODE( This->openFlags ) == STGM_READ )
@@ -2173,7 +2173,7 @@ static HRESULT WINAPI StorageBaseImpl_SetStateBits(
 {
   StorageBaseImpl* const This = (StorageBaseImpl*)iface;
 
-  if (!This->ancestorStorage)
+  if (This->reverted)
     return STG_E_REVERTED;
 
   This->stateBits = (This->stateBits & ~grfMask) | (grfStateBits & grfMask);
@@ -2465,6 +2465,8 @@ static HRESULT StorageImpl_Construct(
    */
   This->base.ancestorStorage = This;
 
+  This->base.reverted = 0;
+
   This->hFile = hFile;
 
   if(pwcsName) {
@@ -3826,6 +3828,10 @@ static void StorageInternalImpl_Invalidate( StorageInternalImpl *This )
 
     This->base.ancestorStorage = NULL;
 
+    This->base.reverted = 1;
+
+    This->parentStorage = NULL;
+
     StorageBaseImpl_DeleteAll(&This->base);
 
     list_remove(&This->ParentListEntry);
@@ -4387,6 +4393,8 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
      */
     newStorage->base.ancestorStorage = parentStorage->ancestorStorage;
 
+    newStorage->base.reverted = 0;
+
     newStorage->parentStorage = parentStorage;
 
     /*
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index ba4288d..ff526bf 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -219,6 +219,11 @@ struct StorageBaseImpl
   StorageImpl* ancestorStorage;
 
   /*
+   * TRUE if this object has been invalidated
+   */
+  int reverted;
+
+  /*
    * Index of the directory entry of this storage
    */
   DirRef storageDirEntry;




More information about the wine-cvs mailing list