Vincent Povirk : ole32: Make IEnumSTATSTG functions fail when the parent is invalid.

Alexandre Julliard julliard at winehq.org
Mon Dec 21 09:39:47 CST 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Fri Dec 18 19:16:02 2009 -0600

ole32: Make IEnumSTATSTG functions fail when the parent is invalid.

---

 dlls/ole32/storage32.c       |   12 ++++++++++++
 dlls/ole32/tests/storage32.c |    2 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 7d267b6..e21acf1 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4513,6 +4513,9 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Next(
   if ( (rgelt==0) || ( (celt!=1) && (pceltFetched==0) ) )
     return E_INVALIDARG;
 
+  if (This->parentStorage->reverted)
+    return STG_E_REVERTED;
+
   /*
    * To avoid the special case, get another pointer to a ULONG value if
    * the caller didn't supply one.
@@ -4588,6 +4591,9 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Skip(
   ULONG       objectFetched       = 0;
   DirRef      currentSearchNode;
 
+  if (This->parentStorage->reverted)
+    return STG_E_REVERTED;
+
   /*
    * Start with the node at the top of the stack.
    */
@@ -4638,6 +4644,9 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Reset(
   DirEntry  storageEntry;
   HRESULT   hr;
 
+  if (This->parentStorage->reverted)
+    return STG_E_REVERTED;
+
   /*
    * Re-initialize the search stack to an empty stack
    */
@@ -4672,6 +4681,9 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Clone(
 
   IEnumSTATSTGImpl* newClone;
 
+  if (This->parentStorage->reverted)
+    return STG_E_REVERTED;
+
   /*
    * Perform a sanity check on the parameters.
    */
diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 766c83c..f8a6134 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -2694,10 +2694,8 @@ static void test_substorage_enum(void)
     r = IStorage_DestroyElement(stg, stgname);
     ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
 
-if (0) { /* crashes on wine */
     r = IEnumSTATSTG_Reset(ee);
     ok(r==STG_E_REVERTED, "IEnumSTATSTG->Reset failed, hr=%08x\n", r);
-}
 
     IEnumSTATSTG_Release(ee);
 




More information about the wine-cvs mailing list