combase: Check that process ID matches before searching the MTA for a stub manager.

Now that MTA objects across processes share a value of 0 in the Data2
field of the stub manager IPID, make sure that we only search the MTA
for stub managers that reside in the current process.

Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
This commit is contained in:
Connor McAdams 2023-05-05 14:20:13 -04:00 committed by Alexandre Julliard
parent 6f475608b2
commit 8d11327ecf

View file

@ -499,13 +499,13 @@ static HRESULT ipid_to_ifstub(const IPID *ipid, struct apartment **stub_apt,
/* FIXME: hack for IRemUnknown */
if (ipid->Data2 == 0xffff)
*stub_apt = apartment_findfromoxid(*(const OXID *)ipid->Data4);
else if (!ipid->Data2)
else if (!ipid->Data2 && (ipid->Data3 == (USHORT)GetCurrentProcessId()))
*stub_apt = apartment_get_mta();
else
*stub_apt = apartment_findfromtid(ipid->Data2);
if (!*stub_apt)
{
TRACE("Couldn't find apartment corresponding to TID 0x%04x\n", ipid->Data2);
TRACE("Couldn't find apartment corresponding to TID 0x%04x, PID 0x%04x\n", ipid->Data2, ipid->Data3);
return RPC_E_INVALID_OBJECT;
}
*stubmgr_ret = get_stub_manager_from_ipid(*stub_apt, ipid, ifstub);