Rob Shearman : ole32: Add test for registered class becoming invalid when apartment is destroyed .

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 8 06:59:38 CDT 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Mon May  7 23:56:43 2007 +0100

ole32: Add test for registered class becoming invalid when apartment is destroyed.

---

 dlls/ole32/tests/compobj.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 43891e6..f07c95e 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -651,6 +651,7 @@ static void test_CoRegisterClassObject(void)
     }; /* 5201163f-8164-4fd0-a1a2-5d5a3654d3bd */
     DWORD cookie;
     HRESULT hr;
+    IClassFactory *pcf;
 
     pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
 
@@ -699,6 +700,22 @@ static void test_CoRegisterClassObject(void)
     hr = CoRevokeClassObject(cookie);
     ok_ole_success(hr, "CoRevokeClassObject");
 
+    /* test whether registered class becomes invalid when apartment is destroyed */
+    hr = CoRegisterClassObject(&CLSID_WineOOPTest, (IUnknown *)&Test_ClassFactory,
+                               CLSCTX_INPROC_SERVER, REGCLS_SINGLEUSE, &cookie);
+    ok_ole_success(hr, "CoRegisterClassObject");
+
+    CoUninitialize();
+    pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+
+    hr = CoGetClassObject(&CLSID_WineOOPTest, CLSCTX_INPROC_SERVER, NULL,
+                          &IID_IClassFactory, (void **)&pcf);
+    ok(hr == REGDB_E_CLASSNOTREG, "object registered in an apartment shouldn't accessible after it is destroyed\n");
+
+    /* crashes with at least win9x DCOM! */
+    if (0)
+        hr = CoRevokeClassObject(cookie);
+
     CoUninitialize();
 }
 




More information about the wine-cvs mailing list