Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

58 lines
1.1 KiB

#include "stock.h"
#pragma hdrstop
#include "cowsite.h"
HRESULT CObjectWithSite::SetSite(IUnknown *punkSite)
{
IUnknown_Set(&_punkSite, punkSite);
return S_OK;
}
HRESULT CObjectWithSite::GetSite(REFIID riid, void **ppvSite)
{
if (_punkSite)
return _punkSite->QueryInterface(riid, ppvSite);
*ppvSite = NULL;
return E_FAIL;
}
HRESULT CSafeServiceSite::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] = {
QITABENT(CSafeServiceSite, IServiceProvider),
{ 0 },
};
return QISearch(this, qit, riid, ppv);
}
ULONG CSafeServiceSite::AddRef()
{
return InterlockedIncrement(&_cRef);
}
ULONG CSafeServiceSite::Release()
{
if (InterlockedDecrement(&_cRef))
return _cRef;
delete this;
return 0;
}
HRESULT CSafeServiceSite::QueryService(REFGUID guidService, REFIID riid, void **ppvObj)
{
if (_psp)
return _psp->QueryService(guidService, riid, ppvObj);
*ppvObj = NULL;
return E_NOINTERFACE;
}
HRESULT CSafeServiceSite::SetProviderWeakRef(IServiceProvider *psp)
{
_psp = psp;
return S_OK;
}