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