ole32/composite: Fix argument handling in ComposeWith().

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-27 15:31:40 +03:00 committed by Alexandre Julliard
parent 068ddc5b1b
commit 281021d820
2 changed files with 23 additions and 19 deletions

View file

@ -485,28 +485,14 @@ CompositeMonikerImpl_Reduce(IMoniker* iface, IBindCtx* pbc, DWORD dwReduceHowFar
}
}
/******************************************************************************
* CompositeMoniker_ComposeWith
******************************************************************************/
static HRESULT WINAPI
CompositeMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite)
static HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right,
BOOL only_if_not_generic, IMoniker **composite)
{
TRACE("(%p,%p,%d,%p)\n",iface,pmkRight,fOnlyIfNotGeneric,ppmkComposite);
TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, composite);
if ((ppmkComposite==NULL)||(pmkRight==NULL))
return E_POINTER;
*composite = NULL;
*ppmkComposite=0;
/* If fOnlyIfNotGeneric is TRUE, this method sets *pmkComposite to NULL and returns MK_E_NEEDGENERIC; */
/* otherwise, the method returns the result of combining the two monikers by calling the */
/* CreateGenericComposite function */
if (fOnlyIfNotGeneric)
return MK_E_NEEDGENERIC;
return CreateGenericComposite(iface,pmkRight,ppmkComposite);
return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, composite);
}
static void composite_get_components(IMoniker *moniker, IMoniker **components, unsigned int *index)

View file

@ -3359,6 +3359,24 @@ todo_wine
IMoniker_Release(moniker2);
IMoniker_Release(moniker1);
/* ComposeWith() */
hr = create_moniker_from_desc("CI1I2", &moniker1);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = create_moniker_from_desc("I3", &moniker2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMoniker_ComposeWith(moniker1, NULL, FALSE, &moniker);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(moniker == moniker1, "Unexpected pointer.\n");
IMoniker_Release(moniker);
hr = IMoniker_ComposeWith(moniker1, NULL, TRUE, &moniker);
ok(hr == MK_E_NEEDGENERIC, "Unexpected hr %#x.\n", hr);
ok(!moniker, "Unexpected pointer.\n");
IMoniker_Release(moniker2);
IMoniker_Release(moniker1);
IBindCtx_Release(bindctx);
}