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
} }
} }
/****************************************************************************** static HRESULT WINAPI CompositeMonikerImpl_ComposeWith(IMoniker *iface, IMoniker *right,
* CompositeMoniker_ComposeWith BOOL only_if_not_generic, IMoniker **composite)
******************************************************************************/
static HRESULT WINAPI
CompositeMonikerImpl_ComposeWith(IMoniker* iface, IMoniker* pmkRight,
BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite)
{ {
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)) *composite = NULL;
return E_POINTER;
*ppmkComposite=0; return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, composite);
/* 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);
} }
static void composite_get_components(IMoniker *moniker, IMoniker **components, unsigned int *index) 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(moniker2);
IMoniker_Release(moniker1); 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); IBindCtx_Release(bindctx);
} }