Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/itemmoniker.c | 13 +++++-------- dlls/ole32/tests/moniker.c | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/dlls/ole32/itemmoniker.c b/dlls/ole32/itemmoniker.c index 770b042aac7..1ab9c52dbfb 100644 --- a/dlls/ole32/itemmoniker.c +++ b/dlls/ole32/itemmoniker.c @@ -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; } diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 95e4b865467..a9660354b01 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -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)