diff --git a/dlls/ole32/compositemoniker.c b/dlls/ole32/compositemoniker.c index 60d11b3ba90..40889ae42b2 100644 --- a/dlls/ole32/compositemoniker.c +++ b/dlls/ole32/compositemoniker.c @@ -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) diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index 962ae6c269f..7d88c132d3d 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -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); }