Example #1
0
STDAPI GetInterface(LPUNKNOWN pUnk, void **ppv)
{
    CheckPointer(ppv, E_POINTER);
    *ppv = pUnk;
    pUnk->AddRef();
    return NOERROR;
}
Example #2
0
LPUNKNOWN CComObject::GetInterface(REFIID pIID, BOOL bAddRef)
{
	LPUNKNOWN pInterface = CCmdTarget::GetInterface( &pIID );

	if ( ! pInterface && pIID == IID_IDispatch )
	{
		if ( POSITION pos = m_pDispatchMap.GetStartPosition() )
		{
			const IID* pDispIID;
			m_pDispatchMap.GetNextAssoc( pos, pInterface, pDispIID );
		}
	}

	if ( pInterface && bAddRef ) pInterface->AddRef();
	return pInterface;
}
STDMETHODIMP
CShellExtension::QueryInterface(REFIID riid, LPVOID *ppObj)
{
	*ppObj = 0;
	if (IsEqualIID(riid, IID_IUnknown))
		*ppObj = this;
	else if (IsEqualIID(riid, IID_IShellExtInit))
		*ppObj = (IShellExtInit *)this;
	else if (IsEqualIID(riid, IID_IContextMenu))
		*ppObj = (IContextMenu *)this;

	if (*ppObj) {
		LPUNKNOWN pUnk = (LPUNKNOWN)(*ppObj);
		pUnk->AddRef();
		return S_OK;
	}

	return E_NOINTERFACE;
}
Example #4
0
void intrusive_ptr_add_ref(LPUNKNOWN com) {
  assert(com);
  com->AddRef();
}