Commit 96646d53 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

ole32: Fix infinite recursion in CompositeMonikerImpl_GetTimeOfLastChange by…

ole32: Fix infinite recursion in CompositeMonikerImpl_GetTimeOfLastChange by handling pmkToLeft properly. Fix a typo where CompositeMonikerImpl_GetTimeOfLastChange was called instead of the virtual implementation of it on mostRightMk.
parent 91afe981
...@@ -727,9 +727,8 @@ static HRESULT WINAPI ...@@ -727,9 +727,8 @@ static HRESULT WINAPI
CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc,
IMoniker* pmkToLeft, FILETIME* pCompositeTime) IMoniker* pmkToLeft, FILETIME* pCompositeTime)
{ {
IRunningObjectTable* rot;
HRESULT res; HRESULT res;
IMoniker *tempMk,*antiMk,*mostRigthMk; IMoniker *tempMk,*antiMk,*mostRigthMk,*leftMk;
IEnumMoniker *enumMoniker; IEnumMoniker *enumMoniker;
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime); TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime);
...@@ -741,36 +740,45 @@ CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, ...@@ -741,36 +740,45 @@ CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc,
/* retrieve the time of last change. If the object is not in the ROT, the method recursively calls */ /* retrieve the time of last change. If the object is not in the ROT, the method recursively calls */
/* IMoniker::GetTimeOfLastChange on the rightmost component of the composite, passing the remainder */ /* IMoniker::GetTimeOfLastChange on the rightmost component of the composite, passing the remainder */
/* of the composite as the pmkToLeft parameter for that call. */ /* of the composite as the pmkToLeft parameter for that call. */
if (pmkToLeft!=NULL){ if (pmkToLeft)
{
res=CreateGenericComposite(pmkToLeft,iface,&tempMk); IRunningObjectTable* rot;
res=IBindCtx_GetRunningObjectTable(pbc,&rot); res = IMoniker_ComposeWith(pmkToLeft, iface, FALSE, &leftMk);
res = IBindCtx_GetRunningObjectTable(pbc,&rot);
if (FAILED(res)) if (FAILED(res))
{
IMoniker_Release(leftMk);
return res; return res;
}
if (IRunningObjectTable_GetTimeOfLastChange(rot,tempMk,pCompositeTime)==S_OK) if (IRunningObjectTable_GetTimeOfLastChange(rot,leftMk,pCompositeTime)==S_OK)
{
IMoniker_Release(leftMk);
return res; return res;
else }
}
else
leftMk = iface;
IMoniker_Enum(iface,FALSE,&enumMoniker); IMoniker_Enum(iface, FALSE, &enumMoniker);
IEnumMoniker_Next(enumMoniker,1,&mostRigthMk,NULL); IEnumMoniker_Next(enumMoniker, 1, &mostRigthMk, NULL);
IEnumMoniker_Release(enumMoniker); IEnumMoniker_Release(enumMoniker);
res=CreateAntiMoniker(&antiMk); res = CreateAntiMoniker(&antiMk);
res=IMoniker_ComposeWith(iface,antiMk,0,&tempMk); res = IMoniker_ComposeWith(leftMk, antiMk, 0, &tempMk);
IMoniker_Release(antiMk); IMoniker_Release(antiMk);
res=CompositeMonikerImpl_GetTimeOfLastChange(mostRigthMk,pbc,tempMk,pCompositeTime); res = IMoniker_GetTimeOfLastChange(mostRigthMk, pbc, tempMk, pCompositeTime);
IMoniker_Release(tempMk); IMoniker_Release(tempMk);
IMoniker_Release(mostRigthMk); IMoniker_Release(mostRigthMk);
return res; if (pmkToLeft)
} IMoniker_Release(leftMk);
else
return IMoniker_GetTimeOfLastChange(iface,pbc,NULL,pCompositeTime); return res;
} }
/****************************************************************************** /******************************************************************************
......
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