/****************************************************************************** * FileMoniker_IsRunning */ static HRESULT WINAPI FileMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning) { IRunningObjectTable* rot; HRESULT res; TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); if ( (pmkNewlyRunning!=NULL) && (IMoniker_IsEqual(pmkNewlyRunning,iface)==S_OK) ) return S_OK; if (pbc==NULL) return E_POINTER; res=IBindCtx_GetRunningObjectTable(pbc,&rot); if (FAILED(res)) return res; res = IRunningObjectTable_IsRunning(rot,iface); IRunningObjectTable_Release(rot); return res; }
/****************************************************************************** * ClassMoniker_CommonPrefixWith ******************************************************************************/ static HRESULT WINAPI ClassMoniker_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) { DWORD mkSys; TRACE("(%p, %p)\n", pmkOther, ppmkPrefix); *ppmkPrefix = NULL; IMoniker_IsSystemMoniker(pmkOther, &mkSys); /* If the other moniker is an class moniker that is equal to this moniker, this method sets *ppmkPrefix */ /* to this moniker and returns MK_S_US */ if (mkSys == MKSYS_CLASSMONIKER) { if (IMoniker_IsEqual(iface, pmkOther) == S_OK) { *ppmkPrefix = iface; IMoniker_AddRef(iface); return MK_S_US; } else return MK_E_NOPREFIX; } else /* otherwise, the method calls the MonikerCommonPrefixWith function. This function correctly handles */ /* the case where the other moniker is a generic composite. */ return MonikerCommonPrefixWith(iface, pmkOther, ppmkPrefix); }
/****************************************************************************** * ItemMoniker_IsRunning ******************************************************************************/ static HRESULT WINAPI ItemMonikerImpl_IsRunning(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning) { ItemMonikerImpl *This = impl_from_IMoniker(iface); IRunningObjectTable* rot; HRESULT res; IOleItemContainer *poic=0; TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,pmkNewlyRunning); /* If pmkToLeft is NULL, this method returns TRUE if pmkNewlyRunning is non-NULL and is equal to this */ /* moniker. Otherwise, the method checks the ROT to see whether this moniker is running. */ if (pmkToLeft==NULL) if ((pmkNewlyRunning!=NULL)&&(IMoniker_IsEqual(pmkNewlyRunning,iface)==S_OK)) return S_OK; else { if (pbc==NULL) return E_INVALIDARG; res=IBindCtx_GetRunningObjectTable(pbc,&rot); if (FAILED(res)) return res; res = IRunningObjectTable_IsRunning(rot,iface); IRunningObjectTable_Release(rot); } else{ /* If pmkToLeft is non-NULL, the method calls IMoniker::BindToObject on the pmkToLeft parameter, */ /* requesting an IOleItemContainer interface pointer. The method then calls IOleItemContainer::IsRunning,*/ /* passing the string contained within this moniker. */ res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); if (SUCCEEDED(res)){ res=IOleItemContainer_IsRunning(poic,This->itemName); IOleItemContainer_Release(poic); } } return res; }