📄 exadmin.h
字号:
// Use this to modify a string extension data property.
HRESULT HrModExtString(
IN ULONG iProp, // Index of property
IN LPCSTR lpszNew); // New data bytes.
// Use this to modify a long extension data property.
HRESULT HrModExtLong(
IN ULONG iProp, // Index of property
IN LONG lNew); // New long data value.
// Use this to modify a double word extension data property.
HRESULT HrModExtDWord(
IN ULONG iProp, // Index of property
IN DWORD dwNew) // New long data value.
{
return( HrModExtLong( iProp, (LONG) dwNew));
}
// Use this to modify a boolean extension data property.
HRESULT HrModExtBool(
IN ULONG iProp, // Index of property
IN BOOL bNew); // New boolean data value.
// Use this to modify a SysTime extension data property.
HRESULT HrModExtSysTime(
IN ULONG iProp, // Index of property
IN FILETIME ftNew); // New boolean data value.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Other miscellaneous functions that wrap administration functions.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Add service to be tracked by Server Monitor.
HRESULT HrAddService(
IN LPSTR lpszServiceName); // SHORT name of the service.
// Remove service to be tracked by Server Monitor.
HRESULT HrRemoveService(
IN LPSTR lpszServiceName); // SHORT name of the service.
// You MUST release the array with FreeNameList.
BOOL GetNameList(
OUT int* lpcNameList, // Ptr to number of WIDE strings in the array.
OUT LPWSTR** lppwszNameList); // Ptr to a ptr of WIDE string array.
BOOL SetNameList(
IN int cNameList, // Number of WIDE strings in the array.
IN LPWSTR* lpwszNameList); // Ptr to a WIDE string array.
// Free the name list that was received in a call to GetNameList.
void CAdminDialog::FreeNameList(
IN int cNameList, // Number of WIDE strings in the array.
IN LPWSTR* lpwszNameList) // Ptr to a WIDE string array.
{
m_pAdminFunctions->pfnFreeNameList( cNameList, lpwszNameList);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Functions to get other miscellaneous data that admin gave us.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Return the MAPI session interface pointer.
IMAPISession* GetMAPISession() { return( m_pMAPISession);}
// Return the MAPI address book interface pointer.
IAddrBook* GetAddrBook() { return( m_pAddrBook);}
// Return the MAPI address book container interface pointer.
IABContainer* GetABContainer() { return( m_pABContainer);}
// Return the name of computer on which the gateway runs, when applicable.
LPWSTR GetComputerName() { return( m_pAdminObjectInfo->szComputerName);}
// Return the distinguished name of the object administered.
LPWSTR GetDN() { return( m_pAdminObjectInfo->szDistinguishedName);}
// Return the distinguished name of the server running the home message database.
LPWSTR GetDNHomeMDB() { return( m_pAdminObjectInfo->szDNHomeMDB);}
// Return the distinguished name of the server running the home message transport agent.
LPWSTR GetDNHomeMTA() { return( m_pAdminObjectInfo->szDNHomeMTA);}
// Return the language id.
static LANGID GetLanguageId() { return( LANGIDFROMLCID(m_lcid));}
static void SetLcid(LCID lcid);
// Return font in use by Admin.
HFONT GetAdminFont() { return( m_pAdminObjectInfo->hfontDialog);}
// Return the object id. Compare this against one or more of the #defined
// constants that can be found in "adminext.h"
UINT GetObjectId() { return( m_pAdminObjectInfo->uObjectID);}
// Return a const ptr to the extension data properties.
const LPSPropValue GetExtProps() { return( m_lpExtProps);}
// Are we in read only mode?
static BOOL bIsReadOnly(){ return( m_bReadOnly);}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Your dialog need not be concerned with these members.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
protected:
// Load extension data into buffer contained in this object. This is called
// by the OnInitDialog() and OnChildActivate() functions of this class so
// you will probably not want to call this in your code.
HRESULT HrLoadExtData();
// Save extension data buffer that is contained in this object. This is called
// by the bCommitData function of this class so you will probably not want
// to call this in your code.
HRESULT HrSaveExtData();
public:
static VOID ADMIN_Initialize( ADMIN_AdministratorConnections*, ADMIN_AdministratorFunction*);
private:
UINT m_iddDialog; // The resource ID of your dialog.
UINT m_idsName; // The resource ID of the string containing the name
// used by admin for the tab of your property sheet.
LPWSTR m_lpwszBlobName;// Name of extension data blob (if there is one).
ULONG m_cExtData; // Count of extension data blob.
LPBYTE m_lpbExtData; // Extension data blob.
ULONG m_cExtProps; // Count of extension data properties.
LPSPropValue m_lpExtProps; // Ptr to extension data properties.
static CPtrList m_DlgList; // List of dialog instances derived from this class.
static IMAPISession* m_pMAPISession; // The MAPI session handle opened by admin.
static IAddrBook* m_pAddrBook; // The MAPI Address book opened by admin.
static IABContainer* m_pABContainer; // The MAPI Address Book Container opened by admin.
static ADMIN_SheetInfo* m_pSheetInfo; // Dynamic information used by admin.
static ADMIN_ObjectInfo* m_pAdminObjectInfo; // Admin server name and other useful DNs.
static ADMIN_AdministratorFunction* m_pAdminFunctions; // Admin functions available to you.
static BOOL m_bReadOnly; // Open property sheets in read only mode.
static LCID m_lcid; // LCID to be used
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Finds the CAdminDialog derived object using a handle to the dialog's window.
static CAdminDialog* FindDlg( HWND hDlg);
// Helper functions to access protected and private data.
static BOOL bInitSheet( ADMIN_ObjectInfo* poi, ULONG fFlags, ADMIN_SheetInfo** ppsi, UINT* pcsi, VOID** ppNotUsed);
static void DeinitSheet( IN VOID* pNotUsed);
// Called directly by the Exchange Administrator program.
friend BOOL PASCAL bInstallExtension(ADMIN_ObjectInfo* poi);
friend BOOL PASCAL bDeinstallExtension(ADMIN_ObjectInfo* poi);
friend BOOL PASCAL bInitSheet( ADMIN_ObjectInfo* poi, ULONG fFlags, ADMIN_SheetInfo** ppsi, UINT* pcsi, VOID** ppNotUsed);
friend BOOL PASCAL bShowPage( UINT iddAdminPage);
friend INT PASCAL iStartPage( void);
friend BOOL PASCAL bSaveData(VOID*, HWND);
friend BOOL PASCAL bCommitData(VOID*, HWND);
friend VOID PASCAL DeinitSheet(VOID*);
friend BOOL PASCAL bHasHelp(VOID*, HWND);
friend VOID PASCAL DoHelp(VOID*, HWND);
// -----------------------------------------------------------------------------
// Check function stuff
// -----------------------------------------------------------------------------
__inline HRESULT CHK_HrExtData(
ULONG iProp, // Index of property.
ULONG ulPropType) // Property type expected.
{
if( iProp >= m_cExtProps)
RETURN( E_INVALIDARG);
// Sanity check that should never fail.
if( !TEST_READ_PTR( m_lpExtProps, sizeof( SPropValue) * m_cExtProps))
RETURN( E_FAIL);
// Make sure we have the property type we are expecting.
if( PROP_TYPE( m_lpExtProps[ iProp].ulPropTag) != ulPropType)
RETURN( E_FAIL);
return( NOERROR);
}
// -----------------------------------------------------------------------------
__inline HRESULT CHK_HrModExtBin(
IN ULONG iProp, // Index of property
IN ULONG cb, // Count of new data bytes.
IN LPBYTE lpNew) // New data bytes.
{
HRESULT hr = CHK_HrExtData( iProp, PT_BINARY);
if( FAILED( hr))
return( hr);
if( cb == 0)
RETURN( E_INVALIDARG);
if( !TEST_READ_PTR( lpNew, cb))
RETURN( E_INVALIDARG);
return( NOERROR);
}
// -----------------------------------------------------------------------------
__inline HRESULT CHK_HrModExtString(
IN ULONG iProp, // Index of property
IN LPCSTR lpszNew) // New data string.
{
HRESULT hr = CHK_HrExtData( iProp, PT_STRING8);
if( FAILED( hr))
return( hr);
if( !TEST_STRING_PTR( lpszNew))
RETURN( E_INVALIDARG);
return( NOERROR);
}
// -----------------------------------------------------------------------------
__inline HRESULT CHK_HrSetExtProps(
ULONG cExtProps, // Count of extension data properties.
LPSPropValue lpExtProps) // Array of properties to set extension data to.
{
if( cExtProps == 0)
RETURN( E_INVALIDARG);
if( !TEST_READ_PTR( lpExtProps, sizeof( SPropValue) * cExtProps))
RETURN( E_INVALIDARG);
if( m_lpwszBlobName == NULL)
RETURN( E_FAIL); // There must be a blob name to use this function.
return( NOERROR);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Class wizard stuff.
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public:
//{{AFX_DATA(CAdminDialog)
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
protected:
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAdminDialog)
//}}AFX_VIRTUAL
// Generated message map functions
//{{AFX_MSG(CAdminDialog)
virtual BOOL OnInitDialog();
afx_msg LONG OnChildActivate( UINT, LONG);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
// -----------------------------------------------------------------------------
// Our dialog proc calls the MFC one.
// -----------------------------------------------------------------------------
LRESULT CALLBACK AdminDlgProc(HWND, UINT, WPARAM, LPARAM lParam); // Ours
BOOL CALLBACK AfxDlgProc(HWND, UINT, WPARAM, LPARAM lParam); // MFC
// -----------------------------------------------------------------------------
#ifdef _GLOBAL_OBJECTS_
#pragma message("Declaration of global objects for: " __FILE__)
// Instance of application initialization object.
CInitDLL InitDLL(_T("InitDLL.dll"));
// Intialize static member data.
CPtrList CAdminDialog::m_DlgList(2);
ADMIN_SheetInfo* CAdminDialog::m_pSheetInfo = NULL;
ADMIN_AdministratorFunction* CAdminDialog::m_pAdminFunctions = NULL;
ADMIN_ObjectInfo* CAdminDialog::m_pAdminObjectInfo = NULL;
IMAPISession* CAdminDialog::m_pMAPISession = NULL;
IAddrBook* CAdminDialog::m_pAddrBook = NULL;
IABContainer* CAdminDialog::m_pABContainer = NULL;
BOOL CAdminDialog::m_bReadOnly = FALSE;
LCID CAdminDialog::m_lcid = MAKELCID( MAKELANGID( LANG_ENGLISH, SUBLANG_NEUTRAL), SORT_DEFAULT);
#else // ! _GLOBAL_OBJECTS_
extern CInitDLL InitDLL;
#endif //_GLOBAL_OBJECTS_
// -----------------------------------------------------------------------------
#endif //_EXADMIN_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -