ole32/filemoniker: Fix argument handling in Reduce().

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:31 +03:00 committed by Alexandre Julliard
parent b7cab78974
commit 246b3002a4
2 changed files with 18 additions and 13 deletions

View File

@ -608,21 +608,16 @@ FileMonikerImpl_BindToStorage(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLef
return E_NOTIMPL;
}
/******************************************************************************
* FileMoniker_Reduce
******************************************************************************/
static HRESULT WINAPI
FileMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar,
IMoniker** ppmkToLeft, IMoniker** ppmkReduced)
static HRESULT WINAPI FileMonikerImpl_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD howfar,
IMoniker **toleft, IMoniker **reduced)
{
TRACE("(%p,%p,%d,%p,%p)\n",iface,pbc,dwReduceHowFar,ppmkToLeft,ppmkReduced);
TRACE("%p, %p, %d, %p, %p.\n", iface, pbc, howfar, toleft, reduced);
if (ppmkReduced==NULL)
return E_POINTER;
if (!pbc || !reduced)
return E_INVALIDARG;
IMoniker_AddRef(iface);
*ppmkReduced=iface;
*reduced = iface;
return MK_S_REDUCED_TO_SELF;
}

View File

@ -2098,7 +2098,7 @@ todo_wine
static void test_file_moniker(WCHAR* path)
{
IMoniker *moniker1 = NULL, *moniker2 = NULL, *inverse, *reduced, *anti;
IMoniker *moniker1 = NULL, *moniker2 = NULL, *m3, *inverse, *reduced, *anti;
IEnumMoniker *enummoniker;
IBindCtx *bind_ctx;
IStream *stream;
@ -2142,9 +2142,19 @@ static void test_file_moniker(WCHAR* path)
ok(hr == S_OK, "Failed to create bind context, hr %#x.\n", hr);
hr = IMoniker_Reduce(moniker1, NULL, MKRREDUCE_ALL, NULL, &reduced);
todo_wine
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
m3 = anti = create_antimoniker(1);
hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, &m3, &reduced);
ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
ok(reduced == moniker1, "Unexpected moniker.\n");
ok(m3 == anti, "Unexpected pointer.\n");
IMoniker_Release(reduced);
IMoniker_Release(anti);
hr = IMoniker_Reduce(moniker1, bind_ctx, MKRREDUCE_ALL, NULL, &reduced);
ok(hr == MK_S_REDUCED_TO_SELF, "Unexpected hr %#x.\n", hr);
ok(reduced == moniker1, "Unexpected moniker.\n");