Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/classmoniker.c | 78 ++++++--------------------------------- 1 file changed, 11 insertions(+), 67 deletions(-)
diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index 03c7f773e29..8fe60c6ba71 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -298,79 +298,23 @@ static HRESULT WINAPI ClassMoniker_Reduce(IMoniker* iface,
return MK_S_REDUCED_TO_SELF; } -/****************************************************************************** - * ClassMoniker_ComposeWith - ******************************************************************************/ -static HRESULT WINAPI ClassMoniker_ComposeWith(IMoniker* iface, - IMoniker* pmkRight, - BOOL fOnlyIfNotGeneric, - IMoniker** ppmkComposite) -{ - HRESULT res=S_OK; - DWORD mkSys,mkSys2; - IEnumMoniker* penumMk=0; - IMoniker *pmostLeftMk=0; - IMoniker* tempMkComposite=0; - - TRACE("(%p,%d,%p)\n", pmkRight, fOnlyIfNotGeneric, ppmkComposite); - - if ((ppmkComposite==NULL)||(pmkRight==NULL)) - return E_POINTER; - - *ppmkComposite=0; - - IMoniker_IsSystemMoniker(pmkRight,&mkSys); - - /* If pmkRight is an anti-moniker, the returned moniker is NULL */ - if(mkSys==MKSYS_ANTIMONIKER) - return res; - - else - /* if pmkRight is a composite whose leftmost component is an anti-moniker, */ - /* the returned moniker is the composite after the leftmost anti-moniker is removed. */
- if(mkSys==MKSYS_GENERICCOMPOSITE){ - - res=IMoniker_Enum(pmkRight,TRUE,&penumMk); - - if (FAILED(res)) - return res; - - res=IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL); - - IMoniker_IsSystemMoniker(pmostLeftMk,&mkSys2); - - if(mkSys2==MKSYS_ANTIMONIKER){ - - IMoniker_Release(pmostLeftMk); - - tempMkComposite=iface; - IMoniker_AddRef(iface); +static HRESULT WINAPI ClassMoniker_ComposeWith(IMoniker *iface, IMoniker *right, + BOOL only_if_not_generic, IMoniker **result) +{ + DWORD order;
- while(IEnumMoniker_Next(penumMk,1,&pmostLeftMk,NULL)==S_OK){ + TRACE("%p, %p, %d, %p.\n", iface, right, only_if_not_generic, result);
- res=CreateGenericComposite(tempMkComposite,pmostLeftMk,ppmkComposite); + if (!result || !right) + return E_POINTER;
- IMoniker_Release(tempMkComposite); - IMoniker_Release(pmostLeftMk); + *result = NULL;
- tempMkComposite=*ppmkComposite; - IMoniker_AddRef(tempMkComposite); - } - return res; - } - else - return CreateGenericComposite(iface,pmkRight,ppmkComposite); - } - /* If pmkRight is not an anti-moniker, the method combines the two monikers into a generic - composite if fOnlyIfNotGeneric is FALSE; if fOnlyIfNotGeneric is TRUE, the method returns - a NULL moniker and a return value of MK_E_NEEDGENERIC */ - else - if (!fOnlyIfNotGeneric) - return CreateGenericComposite(iface,pmkRight,ppmkComposite); + if (is_anti_moniker(right, &order)) + return S_OK;
- else - return MK_E_NEEDGENERIC; + return only_if_not_generic ? MK_E_NEEDGENERIC : CreateGenericComposite(iface, right, result); }
/******************************************************************************