windows-nt/Source/XPSP1/NT/admin/services/drizzle/newjob/cunknown.h

47 lines
896 B
C
Raw Normal View History

2020-09-26 03:20:57 -05:00
template<SIZE_T Offset>
class TrackedClassObject
{
static LONG* GetCounter()
{
return reinterpret_cast<LONG*>( reinterpret_cast<char*>( g_GlobalInfo->m_StatSection ) + Offset );
}
protected:
TrackedClassObject()
{
InterlockedIncrement( GetCounter() );
}
~TrackedClassObject()
{
if (g_ServiceState == MANAGER_INACTIVE)
{
return;
}
InterlockedDecrement( GetCounter() );
}
};
//------------------------------------------------------------------------
template<class T>
class CSimpleExternalIUnknown : public T
{
public:
// IUnknown Methods
STDMETHOD(QueryInterface)(REFIID riid, void **ppvObject);
ULONG _stdcall AddRef(void);
ULONG _stdcall Release(void);
protected:
CSimpleExternalIUnknown();
virtual ~CSimpleExternalIUnknown();
long m_ServiceInstance;
LONG m_refs;
};