Sinkutil.h
Sinkutil.h
//------------------------------------------------------------
//
// File: Sinkutil.h
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-------------------------------------------------------------
#include "windows.h"
#ifdef TRACE
#include "dbgtrace.h"
#define PCFunctEnterEx( lParam, sz ) \
char *__PCFuncName = sz; \
TraceFunctEnterEx( lParam, sz )
#define PCFunctEnter( sz ) PCFunctEnterEx( (LPARAM)0, sz)
#define PCFunctLeaveEx( lParam ) \
TraceFunctLeaveEx( lParam );
#define PCFunctLeave() PCFunctLeaveEx( (LPARAM)0 )
#define PCErrorTraceEx ErrorTrace
#define PCDebugTraceEx DebugTrace
//TRACE
#else
#define PCFunctEnterEx( lParam, sz )
#define PCFunctEnter( sz )
#define PCFunctLeaveEx( lParam )
#define PCFunctLeave()
#define PCErrorTraceEx 1 ? (void)0 : ShowAsyncTraceEx
#define PCDebugTraceEx 1 ? (void)0 : ShowAsyncTraceEx
__inline int ShowAsyncTraceEx( LPARAM lParam, LPCSTR szFormat, ... )
{
return( 1);
}
// TRACE
#endif
#define PC_REGKEY_PATH "Software\\Microsoft\\Exchange\\CatReader"
// Common Defines
#define CRLF TEXT("\r\n")
#define MAX_DOMAIN 250
#define MAX_LOGIN 64
#define MAX_EMAIL_LENGTH MAX_DOMAIN + MAX_LOGIN + 2 // @ + Null terminator
class CAttrEntry {
private:
TCHAR * m_pszAttrName;
GUID m_gGuid;
public:
CAttrEntry * m_pNext;
CAttrEntry()
{
m_pNext = NULL;
}
~CAttrEntry()
{
}
const TCHAR * GetAttrName()
{
return m_pszAttrName;
}
const GUID GetAttrGuid()
{
return m_gGuid;
}
void * operator new(size_t size, TCHAR * pszName, TCHAR * pszGuid);
void operator delete(void *p, size_t size);
};
class CAttrList {
private:
CAttrEntry * m_pHead;
CAttrEntry * m_pTail;
DWORD m_dwEntries;
public:
CAttrList()
{
m_pHead = NULL;
m_pTail = NULL;
m_dwEntries = 0;
}
~CAttrList()
{
CAttrEntry * pAttrTemp = m_pHead;
CAttrEntry * pAttr;
while (pAttrTemp != NULL) {
pAttr = pAttrTemp->m_pNext;
delete pAttrTemp;
pAttrTemp = pAttr;
}
m_pHead = NULL;
m_pTail = NULL;
m_dwEntries = 0;
}
CAttrEntry * GetHeadEntry()
{
return m_pHead;
}
CAttrEntry * GetNextEntry(CAttrEntry *pCurrent)
{
CAttrEntry *pCurrentTemp = NULL;
if (pCurrent != NULL)
pCurrentTemp = pCurrent->m_pNext;
return pCurrentTemp;
}
const TCHAR * GetAttrName(CAttrEntry *pCurrent)
{
TCHAR *pszName = NULL;
if (pCurrent != NULL)
pszName = (TCHAR *)pCurrent->GetAttrName();
return pszName;
}
const GUID GetAttrGuid(CAttrEntry *pCurrent)
{
GUID gGuid;
ZeroMemory(&gGuid, sizeof(GUID));
if (pCurrent != NULL)
gGuid = pCurrent->GetAttrGuid();
return gGuid;
}
DWORD ListCount() {
return m_dwEntries;
}
HRESULT AddEntry(TCHAR * pszName, TCHAR * pszGuid);
};
// Utility functions
BOOL ShowMessage(
LPTSTR szMessage, ...);
HRESULT ConvertStringtoCLSID(
LPSTR pszString,
LPGUID pguid);
HRESULT HrReadRegParams(CAttrList * pAttrList);