Avoid infinite loop when doing a typelib marshalled

IUnknown::QueryInterface by only doing an extra QI if requested IID is
not equal to marshalled IID.
This commit is contained in:
Mike Hearn 2005-02-21 18:35:07 +00:00 committed by Alexandre Julliard
parent 80380eaa32
commit 4d49d8ca36
1 changed files with 13 additions and 5 deletions

View File

@ -1416,11 +1416,19 @@ HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
if (hr == S_OK)
{
hr = IUnknown_QueryInterface(object, &iid, ppv);
if (hr)
ERR("Couldn't query for interface %s, hr = 0x%08lx\n",
debugstr_guid(riid), hr);
IUnknown_Release(object);
if (!IsEqualIID(riid, &iid))
{
TRACE("requested interface != marshalled interface, additional QI needed\n");
hr = IUnknown_QueryInterface(object, &iid, ppv);
if (hr)
ERR("Couldn't query for interface %s, hr = 0x%08lx\n",
debugstr_guid(riid), hr);
IUnknown_Release(object);
}
else
{
*ppv = object;
}
}
IMarshal_Release(pMarshal);