Vincent Povirk : ole32: Add test for freeing the parent of a storage.

Alexandre Julliard julliard at winehq.org
Fri Nov 20 10:48:00 CST 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Nov 19 13:13:57 2009 -0600

ole32: Add test for freeing the parent of a storage.

---

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

diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c
index 75c0dae..2e80b6e 100644
--- a/dlls/ole32/tests/storage32.c
+++ b/dlls/ole32/tests/storage32.c
@@ -1290,12 +1290,13 @@ static void test_revert(void)
 
 static void test_parent_free(void)
 {
-    IStorage *stg = NULL, *stg2 = NULL;
+    IStorage *stg = NULL, *stg2 = NULL, *stg3 = NULL;
     HRESULT r;
     IStream *stm = NULL;
     static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 };
     static const WCHAR stgname[] = { 'P','E','R','M','S','T','G',0 };
     ULONG ref;
+    STATSTG statstg;
 
     DeleteFileA(filenameA);
 
@@ -1304,7 +1305,7 @@ static void test_parent_free(void)
                             STGM_READWRITE |STGM_TRANSACTED, 0, &stg);
     ok(r==S_OK, "StgCreateDocfile failed\n");
 
-    /* commit a new storage */
+    /* create a new storage */
     r = IStorage_CreateStorage(stg, stgname, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stg2);
     ok(r==S_OK, "IStorage->CreateStorage failed, hr=%08x\n", r);
 
@@ -1314,15 +1315,32 @@ static void test_parent_free(void)
         r = IStorage_CreateStream(stg2, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm );
         ok(r==S_OK, "IStorage->CreateStream failed\n");
 
+        if (r == S_OK)
+        {
+            /* create a storage inside the new storage */
+            r = IStorage_CreateStorage(stg2, stgname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stg3 );
+            ok(r==S_OK, "IStorage->CreateStorage failed\n");
+        }
+
+        /* free the parent */
         ref = IStorage_Release(stg2);
         ok(ref == 0, "IStorage still has %u references\n", ref);
 
+        /* child objects are invalid */
         if (r == S_OK)
         {
             r = IStream_Write(stm, "this should fail\n", 17, NULL);
             ok(r==STG_E_REVERTED, "IStream->Write sould fail, hr=%x\n", r);
 
             IStream_Release(stm);
+
+            r = IStorage_Stat(stg3, &statstg, STATFLAG_NONAME);
+            todo_wine ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+
+            r = IStorage_SetStateBits(stg3, 1, 1);
+            todo_wine ok(r==STG_E_REVERTED, "IStorage_Stat should fail %08x\n", r);
+
+            IStorage_Release(stg3);
         }
     }
 




More information about the wine-cvs mailing list