Gradual code migration to ATL and object-oriented approach:

- Configuration, user and session data are now internally stored as objects.
- Object wrappers for many structs and primitives added.
- Code partially rewritten to work with objects and benefit out-of-scope clean-up using object destructors.
- …And a lot more code internal changes.

Configuration, user and other data is now passed as compact BLOBs in inter-process communication greatly reducing communication payload.
This commit is contained in:
Simon Rozman
2015-04-09 08:50:24 +00:00
parent 8fcf315329
commit 45a741d7db
6 changed files with 331 additions and 13 deletions

View File

@@ -102,7 +102,7 @@ namespace ATL
//
// CCertContext
//
class CCertContext : public ATL::CObjectWithHandleT<PCCERT_CONTEXT>
class CCertContext : public ATL::CObjectWithHandleDuplT<PCCERT_CONTEXT>
{
public:
virtual ~CCertContext() throw()
@@ -126,6 +126,46 @@ namespace ATL
{
CertFreeCertificateContext(m_h);
}
virtual HANDLE InternalDuplicate(HANDLE h) const
{
return CertDuplicateCertificateContext(h);
}
};
//
// CCertChainContext
//
class CCertChainContext : public ATL::CObjectWithHandleDuplT<PCCERT_CHAIN_CONTEXT>
{
public:
virtual ~CCertChainContext() throw()
{
if (m_h)
CertFreeCertificateChain(m_h);
}
inline BOOL Create(__in_opt HCERTCHAINENGINE hChainEngine, __in PCCERT_CONTEXT pCertContext, __in_opt LPFILETIME pTime, __in_opt HCERTSTORE hAdditionalStore, __in PCERT_CHAIN_PARA pChainPara, __in DWORD dwFlags, __reserved LPVOID pvReserved) throw()
{
HANDLE h;
if (CertGetCertificateChain(hChainEngine, pCertContext, pTime, hAdditionalStore, pChainPara, dwFlags, pvReserved, &h)) {
Attach(h);
return TRUE;
} else
return FALSE;
}
protected:
virtual void InternalFree()
{
CertFreeCertificateChain(m_h);
}
virtual HANDLE InternalDuplicate(HANDLE h) const
{
return CertDuplicateCertificateChain(h);
}
};