ole32/composite: Always go through running object table in GetTimeOfLastChange().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f5ea1df261
commit
6fb0f321fe
|
@ -702,67 +702,61 @@ CompositeMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
static HRESULT compose_with(IMoniker *left, IMoniker *right, IMoniker **c)
|
||||||
* CompositeMoniker_GetTimeOfLastChange
|
|
||||||
******************************************************************************/
|
|
||||||
static HRESULT WINAPI
|
|
||||||
CompositeMonikerImpl_GetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc,
|
|
||||||
IMoniker* pmkToLeft, FILETIME* pCompositeTime)
|
|
||||||
{
|
{
|
||||||
HRESULT res;
|
HRESULT hr = IMoniker_ComposeWith(left, right, TRUE, c);
|
||||||
IMoniker *tempMk,*antiMk,*rightMostMk,*leftMk;
|
if (FAILED(hr) && hr != MK_E_NEEDGENERIC) return hr;
|
||||||
IEnumMoniker *enumMoniker;
|
return CreateGenericComposite(left, right, c);
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pCompositeTime);
|
static HRESULT WINAPI CompositeMonikerImpl_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc,
|
||||||
|
IMoniker *toleft, FILETIME *changetime)
|
||||||
|
{
|
||||||
|
CompositeMonikerImpl *moniker = impl_from_IMoniker(iface);
|
||||||
|
IMoniker *left, *rightmost, *composed_left = NULL, *running = NULL;
|
||||||
|
IRunningObjectTable *rot;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
if (pCompositeTime==NULL)
|
TRACE("%p, %p, %p, %p.\n", iface, pbc, toleft, changetime);
|
||||||
|
|
||||||
|
if (!changetime || !pbc)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
/* This method creates a composite of pmkToLeft (if non-NULL) and this moniker and uses the ROT to */
|
if (FAILED(hr = composite_get_rightmost(moniker, &left, &rightmost)))
|
||||||
/* retrieve the time of last change. If the object is not in the ROT, the method recursively calls */
|
return hr;
|
||||||
/* IMoniker::GetTimeOfLastChange on the rightmost component of the composite, passing the remainder */
|
|
||||||
/* of the composite as the pmkToLeft parameter for that call. */
|
if (toleft)
|
||||||
if (pmkToLeft)
|
|
||||||
{
|
{
|
||||||
IRunningObjectTable* rot;
|
/* Compose (toleft, left) and check that against rightmost */
|
||||||
|
if (SUCCEEDED(hr = compose_with(toleft, left, &composed_left)) && composed_left)
|
||||||
res = IMoniker_ComposeWith(pmkToLeft, iface, FALSE, &leftMk);
|
hr = compose_with(composed_left, rightmost, &running);
|
||||||
if (FAILED(res))
|
|
||||||
return res;
|
|
||||||
|
|
||||||
res = IBindCtx_GetRunningObjectTable(pbc,&rot);
|
|
||||||
if (FAILED(res))
|
|
||||||
{
|
|
||||||
IMoniker_Release(leftMk);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IRunningObjectTable_GetTimeOfLastChange(rot,leftMk,pCompositeTime)==S_OK)
|
|
||||||
{
|
|
||||||
IMoniker_Release(leftMk);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
leftMk = iface;
|
{
|
||||||
|
composed_left = left;
|
||||||
|
IMoniker_AddRef(composed_left);
|
||||||
|
running = iface;
|
||||||
|
IMoniker_AddRef(running);
|
||||||
|
}
|
||||||
|
|
||||||
IMoniker_Enum(iface, FALSE, &enumMoniker);
|
if (SUCCEEDED(hr))
|
||||||
IEnumMoniker_Next(enumMoniker, 1, &rightMostMk, NULL);
|
{
|
||||||
IEnumMoniker_Release(enumMoniker);
|
if (SUCCEEDED(hr = IBindCtx_GetRunningObjectTable(pbc, &rot)))
|
||||||
|
{
|
||||||
|
if (IRunningObjectTable_GetTimeOfLastChange(rot, running, changetime) != S_OK)
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(rightmost, pbc, composed_left, changetime);
|
||||||
|
IRunningObjectTable_Release(rot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res = CreateAntiMoniker(&antiMk);
|
if (composed_left)
|
||||||
res = IMoniker_ComposeWith(leftMk, antiMk, 0, &tempMk);
|
IMoniker_Release(composed_left);
|
||||||
IMoniker_Release(antiMk);
|
if (running)
|
||||||
|
IMoniker_Release(running);
|
||||||
|
IMoniker_Release(rightmost);
|
||||||
|
IMoniker_Release(left);
|
||||||
|
|
||||||
res = IMoniker_GetTimeOfLastChange(rightMostMk, pbc, tempMk, pCompositeTime);
|
return hr;
|
||||||
|
|
||||||
IMoniker_Release(tempMk);
|
|
||||||
IMoniker_Release(rightMostMk);
|
|
||||||
|
|
||||||
if (pmkToLeft)
|
|
||||||
IMoniker_Release(leftMk);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -2954,6 +2954,7 @@ static void test_generic_composite_moniker(void)
|
||||||
IMoniker *moniker, *inverse, *moniker1, *moniker2;
|
IMoniker *moniker, *inverse, *moniker1, *moniker2;
|
||||||
IEnumMoniker *enummoniker;
|
IEnumMoniker *enummoniker;
|
||||||
IRunningObjectTable *rot;
|
IRunningObjectTable *rot;
|
||||||
|
unsigned int eaten, i;
|
||||||
DWORD hash, cookie;
|
DWORD hash, cookie;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IBindCtx *bindctx;
|
IBindCtx *bindctx;
|
||||||
|
@ -2962,7 +2963,7 @@ static void test_generic_composite_moniker(void)
|
||||||
IROTData *rotdata;
|
IROTData *rotdata;
|
||||||
IMarshal *marshal;
|
IMarshal *marshal;
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
unsigned int i;
|
FILETIME ft;
|
||||||
WCHAR *str;
|
WCHAR *str;
|
||||||
ULONG len;
|
ULONG len;
|
||||||
|
|
||||||
|
@ -3142,6 +3143,54 @@ todo_wine
|
||||||
|
|
||||||
IMoniker_Release(moniker);
|
IMoniker_Release(moniker);
|
||||||
|
|
||||||
|
/* GetTimeOfLastChange() */
|
||||||
|
eaten = 0;
|
||||||
|
hr = create_moniker_from_desc("CI1I2", &eaten, &moniker);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
eaten = 0;
|
||||||
|
hr = create_moniker_from_desc("I1", &eaten, &moniker1);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* See if non-generic composition is possible */
|
||||||
|
hr = IMoniker_ComposeWith(moniker1, moniker, TRUE, &moniker2);
|
||||||
|
todo_wine
|
||||||
|
ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IBindCtx_GetRunningObjectTable(bindctx, &rot);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
|
||||||
|
ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
|
||||||
|
ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, NULL);
|
||||||
|
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, NULL, NULL, &ft);
|
||||||
|
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IRunningObjectTable_Register(rot, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown *)moniker,
|
||||||
|
moniker, &cookie);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, NULL, &ft);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IMoniker_GetTimeOfLastChange(moniker, bindctx, moniker1, &ft);
|
||||||
|
todo_wine
|
||||||
|
ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IRunningObjectTable_Revoke(rot, cookie);
|
||||||
|
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IRunningObjectTable_Release(rot);
|
||||||
|
|
||||||
|
IMoniker_Release(moniker);
|
||||||
|
IMoniker_Release(moniker1);
|
||||||
|
|
||||||
IBindCtx_Release(bindctx);
|
IBindCtx_Release(bindctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue