Additional conformance tests for ole32/storage.c - triggers bug in Wine.

Dr J A Gow J.A.Gow at furrybubble.co.uk
Wed Feb 8 14:05:23 CST 2006


From: Dr J A Gow  (J.A.Gow at furrybubble.co.uk)

Patch: Adds two conformance tests to ole32/tests/storage32.c that have 
been found to be responsible for recent application failure in Wine. 
Tests run OK in WinXP but fail in Wine. Problem relates to reference 
counting in the destructor of storage objects.


Index: wine/dlls/ole32/tests/storage32.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/tests/storage32.c,v
retrieving revision 1.14
diff -u -p -r1.14 storage32.c
--- wine/dlls/ole32/tests/storage32.c	6 Oct 2005 11:38:45 -0000	1.14
+++ wine/dlls/ole32/tests/storage32.c	8 Feb 2006 19:34:26 -0000
@@ -448,6 +448,76 @@ static void test_open_storage(void)
          ok(r == 0, "wrong ref count\n");
      }

+	/*
+	* EASY-PC TESTS
+	*
+	* There are two bugs related to Wine and Easy-PC. This pair of tests
+	* triggers the first of the two.
+	*
+	* These tests trigger the same bug in Wine that Easy-PC does. They:
+	*
+	* 1) Open a storage file, write a stream to it, commit it and then close
+	*    the file. This is just so we have a storage file with a stream in
+	*	  it. This operation itself does not trigger the bug.
+	*
+	* 2) It then performs the action that triggers the bug. It opens the
+	*    storage file with a grfMode of 0x00010020
+	*    (STGM_TRANSACTED|STGM_READ|STGM_SHARE_DENY_WRITE). It then opens
+	*    a stream in the file with a grfMode of 
STGM_SHARE_EXCLUSIVE|STGM_READWRITE
+	*    This test works under Windows, but fails under Wine.
+	*/
+
+    /* Easy-PC bug test 1 - this Creates a stream within an object and 
should not fail*/
+
+    r = StgOpenStorage( filename, NULL, STGM_TRANSACTED | STGM_WRITE | 
STGM_SHARE_DENY_WRITE, NULL, 0, &stg);
+    ok(r==S_OK, "StgOpenStorage failed\n");
+    if(stg)
+    {
+        static const WCHAR stmname[] =  { 
'w','i','n','e','t','e','s','t',0};
+        IStream *stm = NULL;
+
+        r = IStorage_CreateStream( stg, stmname, STGM_WRITE | 
STGM_SHARE_EXCLUSIVE,
+                                   0, 0, &stm );
+        ok(r == S_OK, "CreateStream should succeed\n");
+
+		if(stm) {
+			r=IStorage_Commit(stg,STGC_DEFAULT);
+		    ok(r==S_OK, "StorageCommit failed\n");
+
+		}
+
+		/* Windows reference counting seems different.... */
+
+        r = IStorage_Release(stg);
+        ok(r == 0, "wrong ref count"); printf("- ref count = %lx\n",r);
+
+		if(r) {
+	        r = IStorage_Release(stg);
+    	    ok(r == 0, "wrong ref count"); printf(" - ref count = %lx\n",r);
+		}
+
+    }
+
+    /* Easy-PC test 2 - this looks for the OpenStream mode check. Fails 
under Wine */
+
+    r = StgOpenStorage( filename, NULL, 0x00010020, NULL, 0, &stg);
+    ok(r==S_OK, "StgOpenStorage failed\n");
+    if(stg)
+    {
+        static const WCHAR stmname[] =  { 
'w','i','n','e','t','e','s','t',0};
+        IStream *stm = NULL;
+
+        r = IStorage_OpenStream( stg, stmname, 0, 
STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm );
+        ok(r == S_OK, "OpenStream should succeed - "); printf("rc from 
OpenStream : %lx\n",r);
+
+        r = IStorage_Release(stg);
+        ok(r == 0, "wrong ref count\n");
+    }
+
+	/*
+	 * End of Easy-PC bug test.
+	*/
+
      r = DeleteFileW(filename);
      ok(r, "file didn't exist\n");
  }



More information about the wine-patches mailing list