diff --git a/dlls/ole32/antimoniker.c b/dlls/ole32/antimoniker.c index c0937a8d903..28c4dd91ac5 100644 --- a/dlls/ole32/antimoniker.c +++ b/dlls/ole32/antimoniker.c @@ -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; } diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 7f0b9ec5841..95e4b865467 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -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)