ole32/antimoniker: Fix argument handling in RelativePathTo().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-09-28 15:56:28 +03:00 committed by Alexandre Julliard
parent 558e846608
commit 63769f7e33
2 changed files with 35 additions and 11 deletions

View File

@ -438,20 +438,15 @@ static HRESULT WINAPI AntiMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker
return MonikerCommonPrefixWith(iface, other, prefix);
}
/******************************************************************************
* AntiMoniker_RelativePathTo
******************************************************************************/
static HRESULT WINAPI
AntiMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
static HRESULT WINAPI AntiMonikerImpl_RelativePathTo(IMoniker *iface, IMoniker *other, IMoniker **result)
{
TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);
TRACE("%p, %p, %p.\n", iface, other, result);
if (ppmkRelPath==NULL)
return E_POINTER;
if (!other || !result)
return E_INVALIDARG;
IMoniker_AddRef(pmOther);
*ppmkRelPath=pmOther;
IMoniker_AddRef(other);
*result = other;
return MK_S_HIM;
}

View File

@ -3026,6 +3026,35 @@ todo_wine
IBindCtx_Release(bindctx);
IMoniker_Release(moniker);
IMoniker_Release(moniker2);
/* RelativePathTo() */
moniker = create_antimoniker(1);
hr = create_moniker_from_desc("I1", &moniker2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_RelativePathTo(moniker, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_RelativePathTo(moniker, NULL, &moniker3);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_RelativePathTo(moniker, moniker2, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
ok(moniker3 == moniker2, "Unexpected object.\n");
IMoniker_Release(moniker3);
IMoniker_Release(moniker2);
moniker2 = create_antimoniker(2);
hr = IMoniker_RelativePathTo(moniker, moniker2, &moniker3);
ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
ok(moniker3 == moniker2, "Unexpected object.\n");
IMoniker_Release(moniker3);
hr = IMoniker_RelativePathTo(moniker2, moniker, &moniker3);
ok(hr == MK_S_HIM, "Unexpected hr %#x.\n", hr);
ok(moniker3 == moniker, "Unexpected object.\n");
IMoniker_Release(moniker3);
IMoniker_Release(moniker2);
IMoniker_Release(moniker);
}
static void test_generic_composite_moniker(void)