ole32/itemmoniker: 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:29 +03:00 committed by Alexandre Julliard
parent 63769f7e33
commit 19df4c56c4
2 changed files with 26 additions and 9 deletions

View File

@ -714,17 +714,14 @@ static HRESULT WINAPI ItemMonikerImpl_CommonPrefixWith(IMoniker *iface, IMoniker
return MonikerCommonPrefixWith(iface, other, prefix);
}
/******************************************************************************
* ItemMoniker_RelativePathTo
******************************************************************************/
static HRESULT WINAPI ItemMonikerImpl_RelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath)
static HRESULT WINAPI ItemMonikerImpl_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;
*ppmkRelPath=0;
*result = NULL;
return MK_E_NOTBINDABLE;
}

View File

@ -2376,7 +2376,7 @@ static void test_item_moniker(void)
"Moniker_IsRunning",
NULL
};
IMoniker *moniker, *moniker2, *moniker3, *reduced, *anti, *inverse, *c;
IMoniker *moniker, *moniker1, *moniker2, *moniker3, *reduced, *anti, *inverse, *c;
DWORD i, hash, eaten, cookie;
HRESULT hr;
IBindCtx *bindctx;
@ -2757,6 +2757,26 @@ todo_wine
IMoniker_Release(moniker2);
IMoniker_Release(moniker);
/* RelativePathTo() */
hr = create_moniker_from_desc("I1", &moniker);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = create_moniker_from_desc("I2", &moniker1);
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, &moniker2);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_RelativePathTo(moniker, moniker1, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
moniker2 = (void *)0xdeadbeef;
hr = IMoniker_RelativePathTo(moniker, moniker1, &moniker2);
ok(hr == MK_E_NOTBINDABLE, "Unexpected hr %#x.\n", hr);
ok(!moniker2, "Unexpected pointer.\n");
IMoniker_Release(moniker1);
IMoniker_Release(moniker);
}
static void stream_write_dword(IStream *stream, DWORD value)