Commit 4cbca9ac authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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

parent af2c3496
...@@ -651,6 +651,7 @@ static void test_CoRegisterClassObject(void) ...@@ -651,6 +651,7 @@ static void test_CoRegisterClassObject(void)
}; /* 5201163f-8164-4fd0-a1a2-5d5a3654d3bd */ }; /* 5201163f-8164-4fd0-a1a2-5d5a3654d3bd */
DWORD cookie; DWORD cookie;
HRESULT hr; HRESULT hr;
IClassFactory *pcf;
pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED); pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
...@@ -699,6 +700,22 @@ static void test_CoRegisterClassObject(void) ...@@ -699,6 +700,22 @@ static void test_CoRegisterClassObject(void)
hr = CoRevokeClassObject(cookie); hr = CoRevokeClassObject(cookie);
ok_ole_success(hr, "CoRevokeClassObject"); 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(); CoUninitialize();
} }
......
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