Commit 281021d8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent 068ddc5b
......@@ -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);
if ((ppmkComposite==NULL)||(pmkRight==NULL))
return E_POINTER;
*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 */
TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, composite);
if (fOnlyIfNotGeneric)
return MK_E_NEEDGENERIC;
*composite = NULL;
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)
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment