ole32: Fix CoRevokeClassObject to return RPC_E_WRONG_THREAD if it was called from a different apartment than the one that called CoRegisterClassObject.
This commit is contained in:
parent
23e43d886e
commit
7d7f9a59d0
|
@ -1809,9 +1809,17 @@ HRESULT WINAPI CoRevokeClassObject(
|
||||||
{
|
{
|
||||||
HRESULT hr = E_INVALIDARG;
|
HRESULT hr = E_INVALIDARG;
|
||||||
RegisteredClass *curClass;
|
RegisteredClass *curClass;
|
||||||
|
APARTMENT *apt;
|
||||||
|
|
||||||
TRACE("(%08x)\n",dwRegister);
|
TRACE("(%08x)\n",dwRegister);
|
||||||
|
|
||||||
|
apt = COM_CurrentApt();
|
||||||
|
if (!apt)
|
||||||
|
{
|
||||||
|
ERR("COM was not initialized\n");
|
||||||
|
return CO_E_NOTINITIALIZED;
|
||||||
|
}
|
||||||
|
|
||||||
EnterCriticalSection( &csRegisteredClassList );
|
EnterCriticalSection( &csRegisteredClassList );
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(curClass, &RegisteredClassList, RegisteredClass, entry)
|
LIST_FOR_EACH_ENTRY(curClass, &RegisteredClassList, RegisteredClass, entry)
|
||||||
|
@ -1820,9 +1828,18 @@ HRESULT WINAPI CoRevokeClassObject(
|
||||||
* Check if we have a match on the cookie.
|
* Check if we have a match on the cookie.
|
||||||
*/
|
*/
|
||||||
if (curClass->dwCookie == dwRegister)
|
if (curClass->dwCookie == dwRegister)
|
||||||
|
{
|
||||||
|
if (curClass->apartment_id == apt->oxid)
|
||||||
{
|
{
|
||||||
COM_RevokeRegisteredClassObject(curClass);
|
COM_RevokeRegisteredClassObject(curClass);
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ERR("called from wrong apartment, should be called from %s\n",
|
||||||
|
wine_dbgstr_longlong(curClass->apartment_id));
|
||||||
|
hr = RPC_E_WRONG_THREAD;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -847,7 +847,6 @@ static void test_registered_object_thread_affinity(void)
|
||||||
WaitForSingleObject(thread, INFINITE);
|
WaitForSingleObject(thread, INFINITE);
|
||||||
GetExitCodeThread(thread, &exitcode);
|
GetExitCodeThread(thread, &exitcode);
|
||||||
hr = exitcode;
|
hr = exitcode;
|
||||||
todo_wine
|
|
||||||
ok(hr == RPC_E_WRONG_THREAD, "CoRevokeClassObject called from different "
|
ok(hr == RPC_E_WRONG_THREAD, "CoRevokeClassObject called from different "
|
||||||
"thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08x\n", hr);
|
"thread to where registered should return RPC_E_WRONG_THREAD instead of 0x%08x\n", hr);
|
||||||
|
|
||||||
|
@ -860,7 +859,6 @@ static void test_registered_object_thread_affinity(void)
|
||||||
"thread should return S_OK instead of 0x%08x\n", hr);
|
"thread should return S_OK instead of 0x%08x\n", hr);
|
||||||
|
|
||||||
hr = CoRevokeClassObject(cookie);
|
hr = CoRevokeClassObject(cookie);
|
||||||
todo_wine
|
|
||||||
ok_ole_success(hr, "CoRevokeClassObject");
|
ok_ole_success(hr, "CoRevokeClassObject");
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
Loading…
Reference in New Issue