Commit df0ef756 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

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

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