home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / edkcfg.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  10KB  |  202 lines

  1. // --edkcfg.h-------------------------------------------------------------------
  2. // 
  3. //  EDK Gateway Configuration Routines
  4. //
  5. // Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.
  6. //
  7. // -----------------------------------------------------------------------------
  8.  
  9. #ifndef _EDKCFG_H_
  10. #define _EDKCFG_H_
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif // __cplusplus
  15.  
  16. //
  17. // Type Definitions
  18. //
  19.  
  20. //$--ADVISECALLBACK-------------------------------------------------------------
  21. //  Function type for routine to be called when a binary blob changes.
  22. // -----------------------------------------------------------------------------
  23. typedef HRESULT (ADVISECALLBACK) (
  24.     LPVOID              lpvUserContext, 
  25.     LPWSTR              lpwszOwnerTag, 
  26.     ULONG               cProps, 
  27.     LPSPropValue        lpProps);
  28.  
  29. typedef ADVISECALLBACK *LPADVISECALLBACK;
  30.  
  31. //$--ADVISENOTIFY---------------------------------------------------------------
  32. //  Object attached to an ADVISEOBJ, which represents a single blob and the 
  33. //  callback routine to call when it is modified.
  34. // -----------------------------------------------------------------------------
  35. typedef struct _AdviseNotify {
  36.     struct _AdviseNotify * lpNext;
  37.     LPSTR              lpszOwnerTag;
  38.     LPWSTR              lpwszOwnerTag;
  39.     LPBYTE              lpbBlob;
  40.     ULONG               cbBlob;
  41.     LPADVISECALLBACK    lpfnCallback;
  42.     LPVOID              lpvUserContext;
  43.     BOOL                fFirstTime;
  44. } ADVISENOTIFY, *LPADVISENOTIFY;
  45.  
  46. //$--ADVISEOBJ------------------------------------------------------------------
  47. //  Object representing a MAPI session whose extension data is being monitored.
  48. // -----------------------------------------------------------------------------
  49. typedef struct {
  50.     LPMAPISESSION       lpSession;
  51.     LPMAPIPROP          lpCurrentObject;
  52.     ULONG               nPollInterval;
  53.     ULONG               ulUSNChangedPropTag;
  54.     ULONG               ulExtensionDataPropTag;
  55.     CRITICAL_SECTION    csCriticalSection;
  56.     HANDLE              hPollThreadStop;
  57.     HANDLE              hPollThread;
  58.     ULONG               ulPollThreadID;
  59.     ULONG               ulUSNChanged;
  60.     LPSPropValue        lpExtensionData;
  61.     LPADVISENOTIFY      lpNotifyList;
  62. } ADVISEOBJ, *LPADVISEOBJ;
  63.  
  64. //
  65. // Function Prototypes
  66. //
  67.  
  68. //$--HrCfgCreateAdviseObj-------------------------------------------------------
  69. //  Begin monitoring of a MAPI session for changes to extension data.
  70. //  This routine should be called once to create an advise object for a MAPI 
  71. //  session that is being monitored.  Then, HrCfgAdvise() should be called 
  72. //  once for each extension data section that is being monitored.
  73. //  If nPollInterval == 0 then no monitoring thread is created, and the user 
  74. //  must do polling manually by calling HrCfgPollAdviseObj().
  75. // -----------------------------------------------------------------------------
  76. HRESULT HrCfgCreateAdviseObj(               // RETURNS: HRESULT
  77.     IN  LPMAPISESSION       lpSession,      // MAPI session to monitor
  78.     IN  ULONG               nPollInterval,  // milliseconds between polling
  79.     OUT LPADVISEOBJ *       lppAdviseObj);  // created advise object
  80.  
  81. //$--HrCfgPollAdviseObj---------------------------------------------------------
  82. //  Checks an advise object against what is stored in the DSA.  Calls the 
  83. //  notification routines if there are any changes.
  84. // -----------------------------------------------------------------------------
  85. HRESULT HrCfgPollAdviseObj(                 // RETURNS: HRESULT
  86.     IN  LPADVISEOBJ     lpAdviseObj);       // advise object to poll
  87.  
  88. //$--HrCfgDestroyAdviseObj------------------------------------------------------
  89. //  End monitoring of a MAPI session.  This routine calls HrCfgUnadvise() for 
  90. //  any extension data sections that are actively being monitored.
  91. // -----------------------------------------------------------------------------
  92. HRESULT HrCfgDestroyAdviseObj(              // RETURNS: HRESULT
  93.     IN  LPADVISEOBJ         lpAdviseObj);   // advise object to destroy
  94.  
  95. //$--HrCfgAdvise----------------------------------------------------------------
  96. //  Begin monitoring of an extension data section.  When the extension data 
  97. //  changes, the specified callback routine is called.  Note: The callback 
  98. //  routine will be called once from hrCfgAdvise() to set the initial extension 
  99. //  data values.
  100. // -----------------------------------------------------------------------------
  101. HRESULT HrCfgAdvise(                        // RETURNS: HRESULT
  102.     IN  LPADVISEOBJ         lpAdviseObj,    // advise object
  103.     IN  LPSTR               lpszSection,    // name of extension data section
  104.     IN  LPADVISECALLBACK    lpfnCallback,   // function to call on changes
  105.     IN  LPVOID              lpvUserContext); // user-defined context
  106.  
  107. //$--HrCfgUnadvise--------------------------------------------------------------
  108. //  End monitoring of an extension data section.
  109. // -----------------------------------------------------------------------------
  110. HRESULT HrCfgUnadvise(                      // RETURNS: HRESULT
  111.     IN  LPADVISEOBJ         lpAdviseObj,    // advise object
  112.     IN  LPSTR               lpszSection);   // name of extension data section
  113.  
  114. //$--HrCfgPackData--------------------------------------------------------------
  115. //  Take a configuration name and a set of MAPI properties and pack them into 
  116. //  a binary buffer suitable to be saved in the directory information tree for 
  117. //  the gateway or other object.
  118. // -----------------------------------------------------------------------------
  119. HRESULT HrCfgPackDataA(                        // RETURN: HRESULT
  120.     IN    LPSTR            lpszOwnerTag,        // name of configuration (or NULL)
  121.     IN    ULONG            cProps,                // number of MAPI properties
  122.     IN    LPSPropValue    lpProps,            // MAPI properties for this config.
  123.     OUT    ULONG *            lpcbConfigData,        // size of resulting binary struct.
  124.     OUT    LPBYTE *        lppbConfigData);    // resulting binary structure
  125.  
  126. HRESULT HrCfgPackDataW(                        // RETURN: HRESULT
  127.     IN    LPWSTR            lpwszOwnerTag,        // name of configuration (or NULL)
  128.     IN    ULONG            cProps,                // number of MAPI properties
  129.     IN    LPSPropValue    lpProps,            // MAPI properties for this config.
  130.     OUT    ULONG *            lpcbConfigData,        // size of resulting binary struct.
  131.     OUT    LPBYTE *        lppbConfigData);    // resulting binary structure
  132.  
  133. #ifdef UNICODE
  134. #define HrCfgPackData HrCfgPackDataW
  135. #else
  136. #define HrCfgPackData HrCfgPackDataA
  137. #endif
  138.  
  139. //$--HrCfgUnpackData------------------------------------------------------------
  140. //  Take a packed binary buffer and unpack it to yield a configuration name, 
  141. //  number of properties, and an array of MAPI properties.  If the number of 
  142. //  properties is zero then NULL is returned for the array of properties.
  143. // -----------------------------------------------------------------------------
  144. HRESULT HrCfgUnpackDataA(                    // RETURNS: HRESULT
  145.     IN    ULONG            cbConfigData,        // size of of binary structure
  146.     IN    LPBYTE            lpbConfigData,        // pointer to binary structure
  147.     OUT    LPSTR *            lppszOwnerTag,      // name of configuration (or NULL)
  148.     OUT    ULONG *            lpcProps,            // number of MAPI properties
  149.     OUT    LPSPropValue *    lppProps);            // MAPI properties for this config.
  150.  
  151. HRESULT HrCfgUnpackDataW(                    // RETURNS: HRESULT
  152.     IN    ULONG            cbConfigData,        // size of of binary structure
  153.     IN    LPBYTE            lpbConfigData,        // pointer to binary structure
  154.     OUT    LPWSTR *        lppwszOwnerTag,     // name of configuration (or NULL)
  155.     OUT    ULONG *            lpcProps,            // number of MAPI properties
  156.     OUT    LPSPropValue *    lppProps);            // MAPI properties for this config.
  157.  
  158. #ifdef UNICODE
  159. #define HrCfgUnpackData HrCfgUnpackDataW
  160. #else
  161. #define HrCfgUnpackData HrCfgUnpackDataA
  162. #endif
  163.  
  164. //$--HrOpenSiteContainer-----------------------------------------------------------------
  165. //  Takes a pointer to a MAPI session and returns an IMAPIProp interface for 
  166. //  the current site object.
  167. // -----------------------------------------------------------------------------
  168. HRESULT HrOpenSiteContainer(                            // RETURNS: HRESULT
  169.     IN    LPMAPISESSION    lpSession,            // MAPI session
  170.     OUT    LPMAPIPROP *    lppSite);           // current site
  171.  
  172. //$--HrOpenSiteContainerAddressing-------------------------------------------------------
  173. //  Takes a pointer to a MAPI session and returns an IMAPIProp interface for 
  174. //  the current site addressing object.
  175. // -----------------------------------------------------------------------------
  176. HRESULT HrOpenSiteContainerAddressing(               // RETURNS: HRESULT
  177.     IN    LPMAPISESSION    lpSession,          // MAPI session
  178.     OUT    LPMAPIPROP *    lppSiteAddressing); // current site addressing
  179.  
  180. //$--HrOpenSessionObject--------------------------------------------------------
  181. //  Takes a pointer to a MAPI session and returns an IMAPIProp interface for 
  182. //  the current object that the session is logged in as.
  183. // -----------------------------------------------------------------------------
  184. HRESULT HrOpenSessionObject(                // RETURNS: HRESULT
  185.     IN    LPMAPISESSION    lpSession,            // MAPI session
  186.     OUT    LPMAPIPROP *    lppCurrentObject);    // current object
  187.  
  188. //$--HrCfgPropertyTagFromNameId----------------------------------------------------
  189. //  Takes a pointer to an IMAPIProp interface and a name ID, and returns the 
  190. //  MAPI property tag that represents the given name ID for that interface.
  191. // -----------------------------------------------------------------------------
  192. HRESULT HrCfgPropertyTagFromNameId(            // RETURNS: HRESULT
  193.     IN    LPMAPIPROP        lpMAPIProp,            // IMAPIProp interface
  194.     IN  LONG            lNameID,            // Name ID
  195.     OUT    ULONG *            lpulPropTag);        // MAPI property tag of name ID
  196.  
  197. #ifdef __cplusplus
  198. }
  199. #endif
  200.  
  201. #endif
  202.