home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / exadmin.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  25.2 KB  |  586 lines

  1. // -----------------------------------------------------------------------------
  2. // ExAdmin.H: Declaration of the classes necessary to create an Exchange 
  3. //            Administration Extension DLL.
  4. //              
  5. // NOTE:      When we refer to "admin" we mean the Exchange Administration program.
  6. //
  7. // Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.
  8. // -----------------------------------------------------------------------------
  9.  
  10. #ifndef _EXADMIN_H_
  11. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  12. #define _EXADMIN_H_
  13.  
  14. // -----------------------------------------------------------------------------
  15.  
  16. #include <mapix.h>
  17. #include "retcode.h"
  18. #include "adminext.h"
  19.  
  20. // -----------------------------------------------------------------------------
  21. // NOTE: Your resource file MUST define these two control ids with these exact 
  22. //       numbers.  If you don't you will get a compile time error telling you 
  23. //       that you are redefining a macro.  Just go into your resource.h file and
  24. //       change those definitions to these values.
  25. // -----------------------------------------------------------------------------
  26.  
  27. #define IDC_ADMINICON                   1000
  28. #define IDC_TITLE                       1001
  29.  
  30. // -----------------------------------------------------------------------------
  31. // The following macros and the SInitPropValue structure give the user the 
  32. // ability to easily create a property value array.  This is intended to make
  33. // it easier to use the CAdminDialog::HrSetExtProps() function.
  34. //
  35. // See usage example that follows.
  36. // -----------------------------------------------------------------------------
  37.  
  38. #define MAKE_PROP_VALUE( cnt, ptr) ((LONGLONG) ((((LONGLONG) ((ULONG) (ptr))) << 32) + ((LONGLONG) ((ULONG) (cnt)))))
  39. #define BINARY_PROP_VALUE( bin)  MAKE_PROP_VALUE( sizeof( bin), &bin)
  40. #define MULTI_VALUE_PROP( array) MAKE_PROP_VALUE( ARRAY_CNT( array), array)
  41.  
  42. typedef struct
  43. {
  44.     ULONG    ulPropTag;
  45.     ULONG    dwAlignPad;
  46.     LONGLONG ll;    
  47. } SInitPropValue, *LPSInitPropValue;
  48.  
  49. //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  50. // Usage example:
  51. //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  52. #ifdef  _USAGE_EXAMPLE_
  53. #ifndef _USAGE_EXAMPLE_
  54.     // Example of a binary structure that could be used by the property value array.
  55.     typedef struct
  56.     {
  57.         CHAR    ch[20];
  58.         LPSTR   lpsz;
  59.         ULONG   ul;
  60.         BOOL    flag;
  61.     } ExampleStruct;
  62.  
  63.     // Example data that could go in the property value array.
  64.     ExampleStruct BinData     = { "Binary Data", "A STRING", 3752789, TRUE};
  65.     LONG          LongArray[] = { 92314535, 2231223, 111, 424242312};
  66.  
  67.     // The example property value array.
  68.     static SInitPropValue ExtensionProps[] =
  69.     {
  70.         { PT_STRING8, 0, (ULONG)"Topic Folder"}, 
  71.         { PT_LONG,    0, 0},      
  72.         { PT_BOOLEAN, 0, FALSE},  
  73.         { PT_BINARY,  0, BINARY_PROP_VALUE( BinData)},
  74.         { PT_MV_LONG, 0, MULTI_VALUE_PROP( LongArray)},
  75.     };
  76.     
  77.     // Somewhere in your OnInitDialog() function make the following call.
  78.     hr = HrSetExtProps( ARRAY_CNT( ExtensionProps), ExtensionProps);
  79. #endif
  80. #endif
  81.  
  82. // -----------------------------------------------------------------------------
  83. // This is called once per standard property sheet.  Not at all for our property
  84. // sheets.  If you want to disable some or all of the standard property sheets 
  85. // Then define this function in your code.  Your function will need to return 
  86. // FALSE to disable a default property sheet.
  87. // -----------------------------------------------------------------------------
  88.  
  89. BOOL PASCAL bShowPage( UINT iddAdminPage);
  90.  
  91. // -----------------------------------------------------------------------------
  92. // This function is called once durring initialization.  Return -1 to cause the 
  93. // first standard property sheet to be displayed.  Or return the index of one of 
  94. // our property sheets to have it come up first.  The user can override this 
  95. // function by simply defining their own function in their code.
  96. // -----------------------------------------------------------------------------
  97.  
  98. INT PASCAL iStartPage( void);
  99.  
  100. // -----------------------------------------------------------------------------
  101. // Class to initialize the DLL for both Windows and MFC.
  102. // -----------------------------------------------------------------------------
  103.  
  104. class CInitDLL : public CWinApp
  105. {
  106. public:
  107.     ~CInitDLL();
  108.     virtual BOOL InitInstance(); // Initialization
  109.     virtual int ExitInstance();  // Termination (WEP-like code)
  110.  
  111.     // Nothing special for the constructor.
  112.     CInitDLL(LPCSTR pszAppName) : CWinApp(pszAppName) {}
  113. };
  114.  
  115. // -----------------------------------------------------------------------------
  116. // This dialog class allows easy subclassing of controls.
  117. // -----------------------------------------------------------------------------
  118.  
  119. class CADialog : public CDialog
  120. {
  121. protected:    
  122.     CADialog() : CDialog() {}   // Constructor.
  123.     CADialog( LPCSTR lpszTemplateName, CWnd* pParentWnd = NULL) : CDialog( lpszTemplateName, pParentWnd) {}
  124.     CADialog( UINT nIDTemplate, CWnd* pParentWnd = NULL) : CDialog( nIDTemplate, pParentWnd) {}
  125.  
  126.     // To make subclassing controls to CWnd derived objects easier.
  127.     HRESULT HrSubclassWindow( 
  128.         int   nID,  // Id of a control in this dialog.
  129.         CWnd& Wnd); // Reference to MFC CWnd object to connect to Windows control.
  130. };
  131.  
  132. // -----------------------------------------------------------------------------
  133. // Derive your dialog class from this class to have it become an automatic
  134. // property sheet of the Exchange Administration application.
  135. //
  136. // NOTE: In your derived dialog you MUST NOT release a MAPI interface in the 
  137. //       destructor, this will cause a deadlock hang.  Use the OnDestroy() method
  138. //       of the dialog to ULRELEASE() any MAPI Interface objects.
  139. //
  140. //       The problem is that the destructor does not get called until the DLL is
  141. //       unloading.  This is a single threaded opperation in NT.  The ULRELEASE
  142. //       process needs to run multi-threaded and waits INFINITELY for threads to
  143. //       terminate.  The threads can't terminate until the DLL exits, and the DLL
  144. //       can't exit until the threads terminate resulting in a deadlock.
  145. // -----------------------------------------------------------------------------
  146.  
  147. class CAdminDialog : public CADialog
  148. {
  149. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  150. // You may find the following information useful for creating your dialog.
  151. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  152. protected:
  153.     // Protected constructor insures that you must derive a class from CAdminDialog
  154.     // in order to use it.  You may NOT instantiate directly from this class.
  155.     //
  156.     // To override the show page function you must pass in the pfnShowPage parameter.
  157.     // Your function will be called once for each default property sheet and will 
  158.     // receive an id of the sheet.  Your function must return TRUE if you want it 
  159.     // to show.
  160.     CAdminDialog( 
  161.         UINT iddDialog,     // The resource ID of your dialog.
  162.         UINT idsName,       // The resource ID of the string containing the name
  163.                             // used by admin for the tab of your property sheet.
  164.         LPSTR lpszBlobName = NULL);// Name of extension data blob.
  165.  
  166.     ~CAdminDialog();
  167.  
  168.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  169.     // Functions to make displaying of message boxes easier. 
  170.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  171.  
  172.     // If the caller does not pass in the lpszCaption then use the title of the 
  173.     // parent window for the default title of our message box.
  174.     int MessageBox( LPCSTR lpszText, LPCSTR lpszCaption = NULL, UINT nType = MB_OK);
  175.     int MessageBox2( int IDText, int IDCaption = NULL, UINT nType = MB_OK);
  176.     CString m_sMsgBoxCaption;   // This will contain the title of the parent window.
  177.  
  178.     // Displays a message box with a resource string for invalid entries.  After
  179.     // the user presses OK the appropriate control gets focus.
  180.     void InvalidEntry( int nResourceStrID, CWnd& wndCtrl);
  181.  
  182.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  183.     // Use this function to create child dialog box templates.  It will ensure that 
  184.     // the correct language and fonts are used.  Then use the CDialog::InitModalIndirect()
  185.     // function to create the dialog
  186.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  187.  
  188. public:
  189.     const HGLOBAL LoadDialogTemplate( UINT iddDialog);
  190.  
  191.     static int LoadStringA(UINT wID, LPSTR szBuf,  int cchBuf);
  192.     static int LoadStringW(UINT wID, LPWSTR wzBuf, int cchBuf);
  193.  
  194.     // Free the template loaded with the above function.
  195.     void FreeDialogTemplate( HGLOBAL* lphDlgTemplate)  { m_pAdminFunctions->pfnFreeDialogResource( (LPBYTE*) lphDlgTemplate);}
  196.  
  197.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  198.     // Override these virtual functions in your derived class if you want them to do
  199.     // something.
  200.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  201. protected:    
  202.     // Called when a different property sheet has been selected or when either the
  203.     // OK or APPLY NOW button is pressed.  This saves the data to a memory buffer 
  204.     // inside of admin.  Even if the user just switches to a different property sheet
  205.     // this needs to be done so that other property sheets can read any changes that 
  206.     // may have been made to the data.
  207.     // Return TRUE if data has been validated and saved.  Default return is TRUE.
  208.     virtual BOOL bSaveData();
  209.     
  210.     // Called when either the OK or APPLY NOW button is pressed and after bSaveData().
  211.     // Return TRUE if data has been committed.  This saves the extension data and returns
  212.     // TRUE if it was successful.
  213.     virtual BOOL bCommitData();
  214.     
  215.     // Called so that your property sheet can refresh with data that may have been changed
  216.     // by another property sheet.  You say you don't have more than one property sheet that
  217.     // modifies the same data fields.  Ahh, but the Exchange SDK provides a sample that 
  218.     // lets an Administrator view and modify any Exchange SDK packed extension data array.
  219.     virtual void Refresh();
  220.  
  221.     // Called to determine if you supply help.  Return TRUE if you do, defaults to FALSE.
  222.     virtual BOOL bHasHelp();
  223.     
  224.     // Called to start help.  Default does nothing.
  225.     virtual VOID DoHelp();
  226.  
  227.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  228.     
  229.     // Call this to inform admin that the data has changed.
  230.     void DataHasChanged() { m_pAdminFunctions->pfnInfoHasChanged( GetSafeHwnd());}
  231.  
  232.     // Get the count of extension data properties.
  233.     ULONG GetExtCount() { return( m_cExtProps);}
  234.  
  235.     // Set the extension data properties to an existing property value array.  This
  236.     // can be used to create a blob for the first time.  To do this initialized the
  237.     // lpExtProps array with just property types and no real data.  Then use the 
  238.     // CAdminDialog::HrMod...() functions to set the values.
  239.     HRESULT HrSetExtProps(
  240.         ULONG        cExtProps,     // Count of extension data properties.
  241.         LPSPropValue lpExtProps);   // Array of properties to set extension data to.
  242.     
  243.     // Overloaded function to convert our property initialization structure to
  244.     // the real MAPI property structure.  (This is temporary until MAPI changes
  245.     // their _UPV union definition.)
  246.     HRESULT HrSetExtProps(
  247.         ULONG        cExtProps,     // Count of extension data properties.
  248.         LPSInitPropValue lpExtProps)// Array of properties to set extension data to.
  249.     {
  250.         return( HrSetExtProps( cExtProps, (LPSPropValue) lpExtProps));
  251.     }
  252.  
  253.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  254.     // Functions to get extension data.
  255.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  256.  
  257.     // Use this to get a binary extension data property.
  258.     LPSBinary GetExtBinary(
  259.         ULONG iProp);       // Index of property.
  260.  
  261.     // Use this to get a string extension data property.
  262.     LPSTR GetExtString(
  263.         ULONG iProp);       // Index of property.
  264.  
  265.     // Use this to get a long extension data property.
  266.     LONG GetExtLong(
  267.         ULONG iProp);       // Index of property.
  268.  
  269.     // Use this to get a double word extension data property.
  270.     DWORD GetExtDWord(
  271.         ULONG iProp)        // Index of property.
  272.     {
  273.         return( (DWORD) GetExtLong( iProp));
  274.     }
  275.  
  276.     // Use this to get a boolean extension data property.
  277.     BOOL GetExtBool(
  278.         ULONG iProp);       // Index of property.
  279.  
  280.     // Use this to get a system time extension data property.
  281.     FILETIME GetExtSysTime(
  282.         ULONG iProp);       // Index of property.
  283.  
  284.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  285.     // Functions to modify extension data.
  286.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  287.  
  288.     // Use this to modify a binary extension data property.
  289.     HRESULT HrModExtBinary(
  290.         IN ULONG  iProp,    // Index of property
  291.         IN ULONG  cb,       // Count of new data bytes.
  292.         IN const LPBYTE lpNew);   // New data bytes.
  293.  
  294.     // Use this to modify a string extension data property.
  295.     HRESULT HrModExtString(
  296.         IN ULONG   iProp,     // Index of property
  297.         IN LPCSTR lpszNew);   // New data bytes.
  298.  
  299.     // Use this to modify a long extension data property.
  300.     HRESULT HrModExtLong(
  301.         IN ULONG  iProp,    // Index of property
  302.         IN LONG   lNew);    // New long data value.
  303.     
  304.     // Use this to modify a double word extension data property.
  305.     HRESULT HrModExtDWord(
  306.         IN ULONG  iProp,    // Index of property
  307.         IN DWORD  dwNew)     // New long data value.
  308.     {
  309.         return( HrModExtLong( iProp, (LONG) dwNew));
  310.     }
  311.     
  312.     // Use this to modify a boolean extension data property.
  313.     HRESULT HrModExtBool(
  314.         IN ULONG  iProp,    // Index of property
  315.         IN BOOL   bNew);    // New boolean data value.
  316.  
  317.     // Use this to modify a SysTime extension data property.
  318.     HRESULT HrModExtSysTime(
  319.         IN ULONG    iProp,    // Index of property
  320.         IN FILETIME ftNew);   // New boolean data value.
  321.  
  322.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  323.     // Other miscellaneous functions that wrap administration functions.
  324.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  325.  
  326.     // Add service to be tracked by Server Monitor.
  327.     HRESULT HrAddService(
  328.         IN LPSTR lpszServiceName);   // SHORT name of the service.
  329.  
  330.     // Remove service to be tracked by Server Monitor.
  331.     HRESULT HrRemoveService( 
  332.         IN LPSTR lpszServiceName);   // SHORT name of the service.
  333.  
  334.     // You MUST release the array with FreeNameList.
  335.     BOOL GetNameList( 
  336.         OUT int*     lpcNameList,     // Ptr to number of WIDE strings in the array.
  337.         OUT LPWSTR** lppwszNameList); // Ptr to a ptr of WIDE string array.  
  338.  
  339.     BOOL SetNameList(
  340.         IN int      cNameList,        // Number of WIDE strings in the array.
  341.         IN LPWSTR*  lpwszNameList);   // Ptr to a WIDE string array.  
  342.  
  343.     // Free the name list that was received in a call to GetNameList.
  344.     void CAdminDialog::FreeNameList(
  345.         IN int      cNameList,        // Number of WIDE strings in the array.
  346.         IN LPWSTR*  lpwszNameList)    // Ptr to a WIDE string array.  
  347.     {
  348.         m_pAdminFunctions->pfnFreeNameList( cNameList, lpwszNameList);
  349.     }    
  350.  
  351.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  352.     // Functions to get other miscellaneous data that admin gave us.
  353.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  354.  
  355.     // Return the MAPI session interface pointer.
  356.     IMAPISession* GetMAPISession() { return( m_pMAPISession);}
  357.  
  358.     // Return the MAPI address book interface pointer.
  359.     IAddrBook* GetAddrBook() { return( m_pAddrBook);}
  360.  
  361.     // Return the MAPI address book container interface pointer.
  362.     IABContainer* GetABContainer() { return( m_pABContainer);}
  363.  
  364.     // Return the name of computer on which the gateway runs, when applicable.
  365.     LPWSTR GetComputerName() { return( m_pAdminObjectInfo->szComputerName);}
  366.     
  367.     // Return the distinguished name of the object administered.
  368.     LPWSTR GetDN()           { return( m_pAdminObjectInfo->szDistinguishedName);}    
  369.     
  370.     // Return the distinguished name of the server running the home message database.
  371.     LPWSTR GetDNHomeMDB()    { return( m_pAdminObjectInfo->szDNHomeMDB);}
  372.  
  373.     // Return the distinguished name of the server running the home message transport agent.
  374.     LPWSTR GetDNHomeMTA()    { return( m_pAdminObjectInfo->szDNHomeMTA);}
  375.     
  376.     // Return the language id.
  377.     static LANGID GetLanguageId()   { return( LANGIDFROMLCID(m_lcid));}
  378.     static void   SetLcid(LCID lcid);
  379.  
  380.     // Return font in use by Admin.
  381.     HFONT GetAdminFont()     { return( m_pAdminObjectInfo->hfontDialog);}
  382.  
  383.     // Return the object id.  Compare this against one or more of the #defined 
  384.     // constants that can be found in "adminext.h"
  385.     UINT GetObjectId()       { return( m_pAdminObjectInfo->uObjectID);}
  386.  
  387.     // Return a const ptr to the extension data properties.
  388.     const LPSPropValue GetExtProps() { return( m_lpExtProps);}
  389.  
  390.     // Are we in read only mode?
  391.     static BOOL bIsReadOnly(){ return( m_bReadOnly);}
  392.  
  393. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  394. // Your dialog need not be concerned with these members.
  395. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  396. protected:
  397.     // Load extension data into buffer contained in this object.  This is called
  398.     // by the OnInitDialog() and OnChildActivate() functions of this class so 
  399.     // you will probably not want to call this in your code.
  400.     HRESULT HrLoadExtData();
  401.     
  402.     // Save extension data buffer that is contained in this object.  This is called
  403.     // by the bCommitData function of this class so you will probably not want
  404.     // to call this in your code.
  405.     HRESULT HrSaveExtData();
  406.  
  407. public:
  408.     static VOID ADMIN_Initialize( ADMIN_AdministratorConnections*, ADMIN_AdministratorFunction*);
  409.  
  410. private:
  411.     UINT    m_iddDialog;    // The resource ID of your dialog.
  412.     UINT    m_idsName;      // The resource ID of the string containing the name
  413.                             // used by admin for the tab of your property sheet. 
  414.     LPWSTR  m_lpwszBlobName;// Name of extension data blob (if there is one).
  415.     
  416.     ULONG        m_cExtData;   // Count of extension data blob.
  417.     LPBYTE       m_lpbExtData; // Extension data blob.
  418.     ULONG        m_cExtProps;  // Count of extension data properties. 
  419.     LPSPropValue m_lpExtProps; // Ptr to extension data properties.
  420.     
  421.     static CPtrList          m_DlgList;      // List of dialog instances derived from this class.
  422.     static IMAPISession*     m_pMAPISession; // The MAPI session handle opened by admin.
  423.     static IAddrBook*        m_pAddrBook;    // The MAPI Address book opened by admin.
  424.     static IABContainer*     m_pABContainer; // The MAPI Address Book Container opened by admin.
  425.     static ADMIN_SheetInfo*  m_pSheetInfo;   // Dynamic information used by admin.
  426.     static ADMIN_ObjectInfo* m_pAdminObjectInfo; // Admin server name and other useful DNs.
  427.     static ADMIN_AdministratorFunction* m_pAdminFunctions;  // Admin functions available to you.
  428.     static BOOL              m_bReadOnly;     // Open property sheets in read only mode.
  429.     static LCID                 m_lcid;          // LCID to be used
  430.  
  431.     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  432.  
  433.     // Finds the CAdminDialog derived object using a handle to the dialog's window.
  434.     static CAdminDialog* FindDlg( HWND hDlg);
  435.     
  436.     // Helper functions to access protected and private data.
  437.     static BOOL bInitSheet( ADMIN_ObjectInfo* poi, ULONG fFlags, ADMIN_SheetInfo** ppsi, UINT* pcsi, VOID** ppNotUsed);
  438.     static void DeinitSheet( IN VOID* pNotUsed);
  439.     
  440.     // Called directly by the Exchange Administrator program.
  441.     friend BOOL PASCAL bInstallExtension(ADMIN_ObjectInfo* poi);
  442.     friend BOOL PASCAL bDeinstallExtension(ADMIN_ObjectInfo* poi);
  443.     friend BOOL PASCAL bInitSheet( ADMIN_ObjectInfo* poi, ULONG fFlags, ADMIN_SheetInfo** ppsi, UINT* pcsi, VOID** ppNotUsed);
  444.     friend BOOL PASCAL bShowPage( UINT iddAdminPage);
  445.     friend INT  PASCAL iStartPage( void);
  446.     friend BOOL PASCAL bSaveData(VOID*, HWND);
  447.     friend BOOL PASCAL bCommitData(VOID*, HWND);
  448.     friend VOID PASCAL DeinitSheet(VOID*);
  449.     friend BOOL PASCAL bHasHelp(VOID*, HWND);
  450.     friend VOID PASCAL DoHelp(VOID*, HWND);
  451.  
  452. // -----------------------------------------------------------------------------
  453. // Check function stuff
  454. // -----------------------------------------------------------------------------
  455.  
  456. __inline HRESULT CHK_HrExtData(
  457.     ULONG iProp,            // Index of property.
  458.     ULONG ulPropType)       // Property type expected.
  459. {
  460.     if( iProp >= m_cExtProps)
  461.         RETURN( E_INVALIDARG);
  462.     
  463.     // Sanity check that should never fail.
  464.     if( !TEST_READ_PTR( m_lpExtProps, sizeof( SPropValue) * m_cExtProps))
  465.         RETURN( E_FAIL);
  466.  
  467.     // Make sure we have the property type we are expecting.
  468.     if( PROP_TYPE( m_lpExtProps[ iProp].ulPropTag) != ulPropType)
  469.         RETURN( E_FAIL);
  470.  
  471.     return( NOERROR);
  472. }
  473.  
  474. // -----------------------------------------------------------------------------
  475.  
  476. __inline HRESULT CHK_HrModExtBin( 
  477.     IN ULONG  iProp,    // Index of property
  478.     IN ULONG  cb,       // Count of new data bytes.
  479.     IN LPBYTE lpNew)    // New data bytes.
  480. {
  481.     HRESULT hr = CHK_HrExtData( iProp, PT_BINARY);
  482.     if( FAILED( hr))
  483.         return( hr);
  484.  
  485.     if( cb == 0)
  486.         RETURN( E_INVALIDARG);
  487.  
  488.     if( !TEST_READ_PTR( lpNew, cb))
  489.         RETURN( E_INVALIDARG);
  490.  
  491.     return( NOERROR);
  492. }
  493.  
  494. // -----------------------------------------------------------------------------
  495.  
  496. __inline HRESULT CHK_HrModExtString(
  497.     IN ULONG   iProp,   // Index of property
  498.     IN LPCSTR lpszNew) // New data string.
  499. {
  500.     HRESULT hr = CHK_HrExtData( iProp, PT_STRING8);
  501.     if( FAILED( hr))
  502.         return( hr);
  503.  
  504.     if( !TEST_STRING_PTR( lpszNew))
  505.         RETURN( E_INVALIDARG);
  506.  
  507.     return( NOERROR);
  508. }
  509.  
  510. // -----------------------------------------------------------------------------
  511.  
  512. __inline HRESULT CHK_HrSetExtProps(
  513.     ULONG        cExtProps,     // Count of extension data properties.
  514.     LPSPropValue lpExtProps)    // Array of properties to set extension data to.
  515. {
  516.     if( cExtProps == 0)
  517.         RETURN( E_INVALIDARG);
  518.  
  519.     if( !TEST_READ_PTR( lpExtProps, sizeof( SPropValue) * cExtProps))
  520.         RETURN( E_INVALIDARG);
  521.  
  522.     if( m_lpwszBlobName == NULL)
  523.         RETURN( E_FAIL);    // There must be a blob name to use this function.
  524.  
  525.     return( NOERROR);
  526. }
  527.  
  528.  
  529. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  530. // Class wizard stuff.
  531. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  532. public:
  533.     //{{AFX_DATA(CAdminDialog)
  534.         // NOTE: the ClassWizard will add data members here
  535.     //}}AFX_DATA
  536.  
  537.  
  538. protected:
  539.     // ClassWizard generated virtual function overrides
  540.     //{{AFX_VIRTUAL(CAdminDialog)
  541.     //}}AFX_VIRTUAL
  542.  
  543.     // Generated message map functions
  544.     //{{AFX_MSG(CAdminDialog)
  545.     virtual BOOL OnInitDialog();
  546.     afx_msg LONG OnChildActivate( UINT, LONG);
  547.     //}}AFX_MSG
  548.  
  549.     DECLARE_MESSAGE_MAP()
  550. };
  551.  
  552. // -----------------------------------------------------------------------------
  553. // Our dialog proc calls the MFC one.
  554. // -----------------------------------------------------------------------------
  555.  
  556. LRESULT CALLBACK AdminDlgProc(HWND, UINT, WPARAM, LPARAM lParam);   // Ours
  557. BOOL CALLBACK AfxDlgProc(HWND, UINT, WPARAM, LPARAM lParam);     // MFC
  558.  
  559. // -----------------------------------------------------------------------------
  560. #ifdef _GLOBAL_OBJECTS_
  561. #pragma message("Declaration of global objects for: " __FILE__)
  562.  
  563. // Instance of application initialization object.
  564. CInitDLL InitDLL(_T("InitDLL.dll"));    
  565.  
  566. // Intialize static member data.
  567. CPtrList                        CAdminDialog::m_DlgList(2);
  568. ADMIN_SheetInfo*                CAdminDialog::m_pSheetInfo = NULL;
  569. ADMIN_AdministratorFunction*    CAdminDialog::m_pAdminFunctions = NULL;  
  570. ADMIN_ObjectInfo*               CAdminDialog::m_pAdminObjectInfo = NULL;
  571. IMAPISession*                   CAdminDialog::m_pMAPISession = NULL;
  572. IAddrBook*                      CAdminDialog::m_pAddrBook = NULL;
  573. IABContainer*                   CAdminDialog::m_pABContainer = NULL;
  574. BOOL                            CAdminDialog::m_bReadOnly = FALSE;
  575. LCID                            CAdminDialog::m_lcid = MAKELCID( MAKELANGID( LANG_ENGLISH, SUBLANG_NEUTRAL),  SORT_DEFAULT);
  576.  
  577. #else  // ! _GLOBAL_OBJECTS_
  578.  
  579. extern CInitDLL InitDLL;
  580.  
  581. #endif //_GLOBAL_OBJECTS_
  582. // -----------------------------------------------------------------------------
  583.  
  584. #pragma option pop /*P_O_Pop*/
  585. #endif  //_EXADMIN_H_
  586.