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.
55 lines
1.4 KiB
55 lines
1.4 KiB
#include "CUnknown.h"
|
|
#include "CFactory.h"
|
|
|
|
long CUnknown::s_cActiveComponents = 0 ;
|
|
|
|
CUnknown::CUnknown()
|
|
: m_cRef(1)
|
|
{
|
|
::InterlockedIncrement(&s_cActiveComponents) ;
|
|
}
|
|
|
|
CUnknown::~CUnknown()
|
|
{
|
|
::InterlockedDecrement(&s_cActiveComponents) ;
|
|
|
|
// If this is an EXE server, shut it down.
|
|
CFactory::CloseExe() ;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// AddRef
|
|
// ---------------------------------------------------------------------------
|
|
DWORD CUnknown::AddRef()
|
|
{
|
|
return InterlockedIncrement ((LONG*) &m_cRef);
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Release
|
|
// ---------------------------------------------------------------------------
|
|
DWORD CUnknown::Release()
|
|
{
|
|
ULONG lRet = InterlockedDecrement ((LONG*) &m_cRef);
|
|
if (!lRet)
|
|
delete this;
|
|
return lRet;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Release
|
|
// ---------------------------------------------------------------------------
|
|
DWORD CUnknown::ActiveComponents()
|
|
{
|
|
return s_cActiveComponents;
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// FinishQI
|
|
// ---------------------------------------------------------------------------
|
|
HRESULT CUnknown::FinishQI(IUnknown* pI, void** ppv)
|
|
{
|
|
*ppv = pI ;
|
|
pI->AddRef() ;
|
|
return S_OK ;
|
|
}
|