WabApi.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:12k
源码类别:

模拟服务器

开发平台:

C/C++

  1. #ifndef _WABAPI_H_
  2. #define _WABAPI_H_
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #ifdef WIN16
  7. #ifdef GetLastError
  8. #undef GetLastError
  9. #endif // GetLastError
  10. #endif // WIN16
  11. typedef struct _WABACTIONITEM * LPWABACTIONITEM;
  12. /* IWABObject Interface ---------------------------------------------------- */
  13. #define CBIWABOBJECT sizeof(IWABOBJECT)
  14. #define WAB_IWABOBJECT_METHODS(IPURE)                       
  15.         MAPIMETHOD(GetLastError)                            
  16.             (THIS_  HRESULT hResult,                        
  17.                     ULONG   ulFlags,                        
  18.                     LPMAPIERROR FAR * lppMAPIError) IPURE;  
  19.         MAPIMETHOD(AllocateBuffer)                          
  20.             (THIS_  ULONG   cbSize,                         
  21.                     LPVOID FAR *    lppBuffer) IPURE;       
  22.         MAPIMETHOD(AllocateMore)                            
  23.             (THIS_  ULONG   cbSize,                         
  24.                     LPVOID  lpObject,                       
  25.                     LPVOID  FAR *   lppBuffer) IPURE;       
  26.         MAPIMETHOD(FreeBuffer)                              
  27.             (THIS_  LPVOID  lpBuffer) IPURE;                
  28.         MAPIMETHOD(Backup)                                  
  29.             (THIS_  LPSTR  lpFileName) IPURE;              
  30.         MAPIMETHOD(Import)                                  
  31.             (THIS_  LPSTR lpImportParam) IPURE;           
  32.         MAPIMETHOD(Find)                                    
  33.             (THIS_  LPADRBOOK lpIAB,                        
  34.                     HWND    hWnd) IPURE;                    
  35.         MAPIMETHOD(VCardDisplay)                            
  36.             (THIS_  LPADRBOOK lpIAB,                        
  37.                     HWND    hWnd,                           
  38.                     LPSTR  lpszFileName) IPURE;            
  39.         MAPIMETHOD(LDAPUrl)                                 
  40.             (THIS_  LPADRBOOK   lpIAB,                      
  41.                     HWND        hWnd,                       
  42.                     ULONG       ulFlags,                    
  43.                     LPSTR       lpszURL,                    
  44.                     LPMAILUSER *lppMailUser) IPURE;         
  45.         MAPIMETHOD(VCardCreate)                             
  46.             (THIS_  LPADRBOOK   lpIAB,                      
  47.                     ULONG       ulFlags,                    
  48.                     LPSTR       lpszVCard,                  
  49.                     LPMAILUSER  lpMailUser) IPURE;          
  50.         MAPIMETHOD(VCardRetrieve)                           
  51.             (THIS_  LPADRBOOK   lpIAB,                      
  52.                     ULONG       ulFlags,                    
  53.                     LPSTR       lpszVCard,                  
  54.                     LPMAILUSER *lppMailUser) IPURE;         
  55.         MAPIMETHOD(GetMe)                                   
  56.             (THIS_  LPADRBOOK   lpIAB,                      
  57.                     ULONG       ulFlags,                    
  58.                     DWORD *     lpdwAction,                 
  59.                     SBinary *   lpsbEID,                    
  60.                     ULONG       ulParam) IPURE;          
  61.         MAPIMETHOD(SetMe)                                   
  62.             (THIS_  LPADRBOOK   lpIAB,                      
  63.                     ULONG       ulFlags,                    
  64.                     SBinary     sbEID,                      
  65.                     ULONG       ulParam) IPURE;          
  66. #undef           INTERFACE
  67. #define          INTERFACE      IWABObject
  68. DECLARE_MAPI_INTERFACE_(IWABObject, IUnknown)
  69. {
  70.         BEGIN_INTERFACE
  71.         MAPI_IUNKNOWN_METHODS(PURE)
  72.         WAB_IWABOBJECT_METHODS(PURE)
  73. };
  74. DECLARE_MAPI_INTERFACE_PTR(IWABObject, LPWABOBJECT);
  75. #undef  INTERFACE
  76. #define INTERFACE       struct _IWABOBJECT
  77. #undef  METHOD_PREFIX
  78. #define METHOD_PREFIX   IWABOBJECT_
  79. #undef  LPVTBL_ELEM
  80. #define LPVTBL_ELEM             lpvtbl
  81. #undef  MAPIMETHOD_
  82. #define MAPIMETHOD_(type, method)       MAPIMETHOD_DECLARE(type, method, IWABOBJECT_)
  83.                 MAPI_IUNKNOWN_METHODS(IMPL)
  84.        WAB_IWABOBJECT_METHODS(IMPL)
  85. #undef  MAPIMETHOD_
  86. #define MAPIMETHOD_(type, method)       MAPIMETHOD_TYPEDEF(type, method, IWABOBJECT_)
  87.                 MAPI_IUNKNOWN_METHODS(IMPL)
  88.        WAB_IWABOBJECT_METHODS(IMPL)
  89. #undef  MAPIMETHOD_
  90. #define MAPIMETHOD_(type, method)       STDMETHOD_(type, method)
  91. DECLARE_MAPI_INTERFACE(IWABOBJECT_)
  92. {
  93.         BEGIN_INTERFACE
  94.         MAPI_IUNKNOWN_METHODS(IMPL)
  95.    WAB_IWABOBJECT_METHODS(IMPL)
  96. };
  97. /*** WABObject_LDAPUrl flags ***/
  98. // If this flag is specified and the LDAPUrl returns a single
  99. // query result, instructs the WAB to return the result in the
  100. // form of a MailUser object instead of displaying Details on it
  101. // If there are multiple results to the query, fail ..
  102. #define WABOBJECT_LDAPURL_RETURN_MAILUSER   0x00000001
  103. // WAB 5.0x and higher:
  104. // If your application supports Unicode and wants to pass ina Unicode
  105. //  URL to the WAB, you can cast the Unicode URL to an LPSTR and pass it
  106. // to the LDAPUrl API, *also* setting ulFlags to MAPI_UNICODE to mark the URL
  107. // as such. Casting is prefered to converting the string because 
  108. // (a) Converting the string may result in loss of data (b) since this is an
  109. // already published interface we can't modify the interface.
  110. //      MAPI_UNICODE                        0x80000000
  111. /*** WABObject_GetMe returned parameter ***/
  112. // If the GetMe call results in the creation of a new 'Me' contact,
  113. // the lpdwAction returned parameter will contain this value
  114. // indicating to the caller that the object is freshly created and
  115. // does not have any properties in it
  116. #define WABOBJECT_ME_NEW                    0x00000001
  117. /*** WABObject_GetMe flags ***/
  118. // WABObject_GetMe will create a new ME object by default, if 
  119. // none already exists. To force the call to not-create an object, if
  120. // one doesn't already exist, specify the WABOBJECT_ME_NOCREATE flag.
  121. // If no me is found, the call fails with MAPI_E_NOT_FOUND.
  122. // Other flag for WABObject_GetMe is AB_NO_DIALOG defined in wabdefs.h
  123. #define WABOBJECT_ME_NOCREATE               0x00000002
  124. /*** IWABObject_VCard Create/Retrieve ***/
  125. // Flags the WAB whether the lpszVCard parameter is a filename or if
  126. // it is a NULL terminated string containing the compelte VCard contents
  127. //
  128. #define WAB_VCARD_FILE                      0x00000000
  129. #define WAB_VCARD_STREAM                    0x00000001
  130. #ifdef WIN16
  131. BOOL WINAPI WABInitThread();
  132. #endif
  133. //
  134. // Input information to pass to WABOpen
  135. //
  136. typedef struct _tagWAB_PARAM
  137. {
  138.     ULONG   cbSize;         // sizeof(WAB_PARAM).
  139.     HWND    hwnd;           // hWnd of calling client Application. Can be NULL
  140.     LPSTR   szFileName;     // WAB File name to open. if NULL, opens default.
  141.     ULONG   ulFlags;        // See below
  142.     GUID    guidPSExt;      // A GUID that identifies the calling application's Property Sheet extensions
  143.                             // The GUID can be used to determine whether the extension prop sheets are displayed or not.
  144. } WAB_PARAM, * LPWAB_PARAM;
  145. //flags for WAB_PARAM
  146. #define WAB_USE_OE_SENDMAIL     0x00000001  // Tells WAB to use Outlook Express for e-mail before checking for a 
  147.                                             // default Simple MAPI client. Default behaviour is to check for the 
  148.                                             // Simple MAPI client first
  149. #define WAB_ENABLE_PROFILES     0x00400000  // Invokes WAB in a Identity-aware session using Identity-Manager 
  150.                                             // based profiles
  151. //
  152. // Root public entry points for WAB API
  153. //
  154. STDMETHODIMP WABOpen(LPADRBOOK FAR * lppAdrBook, LPWABOBJECT FAR * lppWABObject,
  155.   LPWAB_PARAM lpWP, DWORD Reserved2);
  156. typedef HRESULT (STDMETHODCALLTYPE WABOPEN)(
  157.     LPADRBOOK FAR * lppAdrBook,
  158.     LPWABOBJECT FAR * lppWABObject,
  159.     LPWAB_PARAM lpWP,
  160.     DWORD Reserved2
  161. );
  162. typedef WABOPEN FAR * LPWABOPEN;
  163. STDMETHODIMP WABOpenEx(LPADRBOOK FAR * lppAdrBook,
  164.   LPWABOBJECT FAR * lppWABObject,
  165.   LPWAB_PARAM lpWP,
  166.   DWORD Reserved,
  167.   ALLOCATEBUFFER * fnAllocateBuffer,
  168.   ALLOCATEMORE * fnAllocateMore,
  169.   FREEBUFFER * fnFreeBuffer);
  170. typedef HRESULT (STDMETHODCALLTYPE WABOPENEX)(
  171.     LPADRBOOK FAR * lppAdrBook,
  172.     LPWABOBJECT FAR * lppWABObject,
  173.     LPWAB_PARAM lpWP,
  174.     DWORD Reserved,
  175.     ALLOCATEBUFFER * fnAllocateBuffer,
  176.     ALLOCATEMORE * fnAllocateMore,
  177.     FREEBUFFER * fnFreeBuffer
  178. );
  179. typedef WABOPENEX FAR * LPWABOPENEX;
  180. /* --------------------- */
  181. typedef struct _WABIMPORTPARAM
  182. {
  183.     ULONG cbSize;       // sizeof(WABIMPORTPARAM)
  184.     LPADRBOOK lpAdrBook;// ptr to the IAdrBook object (required)
  185.     HWND hWnd;          // Parent HWND for any dialogs
  186.     ULONG ulFlags;      // 0 or MAPI_DIALOG to show progress dialog and messages
  187.     LPSTR lpszFileName; // FileName to import or NULL .. if NULL will show FileOpen dialog 
  188. } WABIMPORTPARAM, FAR * LPWABIMPORTPARAM;
  189. /* ---- WABEXTDISPLAY ----------------- */
  190. /* WABEXTDISPLAY Structure used in extending the WAB Details Property Dialogs 
  191.     and for doing WAB Context Menu verb extensions.
  192.    The structure is passed into the IWABExtInit::Initialize method
  193.     of the implementor */
  194. // Flags
  195. #define WAB_DISPLAY_LDAPURL 0x00000001  // The object being displayed is an LDAP URL
  196.                                         // The URL can be found in the lpsz struct member
  197. #define WAB_CONTEXT_ADRLIST 0x00000002  // THe lpv parameter contains a pointer to an
  198.                                         // AdrList structure corresponding to selected items
  199.                                         // on which to display a context menu
  200. #define WAB_DISPLAY_ISNTDS  0x00000004  // Identifies that the entry being displayed originated
  201.                                         // on the NT Directory Service, for clients that use ADSI and
  202.                                         // retrieve additional information from the service.
  203. //      MAPI_UNICODE        0x80000000  // Indicates that the WED.lpsz string is actually a UNICODE
  204.                                         //  string and should be cast to a (LPWSTR) before using it
  205.                                         // If this flag is not present then the WED.lpsz is a DBCS string
  206.                                         //  and should be cast to an LPSTR before using.
  207. // Struct
  208. typedef struct _WABEXTDISPLAY
  209. {
  210.     ULONG cbSize;
  211.     LPWABOBJECT lpWABObject;    // pointer to IWABObject
  212.     LPADRBOOK lpAdrBook;        // pointer to IAdrBook object
  213.     LPMAPIPROP lpPropObj;       // Object being displayed
  214.     BOOL fReadOnly;             // Indicates if this is a ReadOnly mode
  215.     BOOL fDataChanged;          // Set by extension sheet to signal data change
  216.     ULONG ulFlags;              // See above
  217.     LPVOID lpv;                 // Used for passing in specific data
  218.     LPTSTR lpsz;               // Used for passing in specific data
  219. } WABEXTDISPLAY, FAR * LPWABEXTDISPLAY;
  220. /* --------------------- */
  221. #define WAB_IWABEXTINIT_METHODS(IPURE)                          
  222.         MAPIMETHOD(Initialize)                                  
  223.             (THIS_  LPWABEXTDISPLAY lpWABExtDisplay)    IPURE;  
  224. #undef           INTERFACE
  225. #define          INTERFACE      IWABExtInit
  226. DECLARE_MAPI_INTERFACE_(IWABExtInit, IUnknown)
  227. {
  228.         BEGIN_INTERFACE
  229.         MAPI_IUNKNOWN_METHODS(PURE)
  230.         WAB_IWABEXTINIT_METHODS(PURE)
  231. };
  232. DECLARE_MAPI_INTERFACE_PTR(IWABExtInit, LPWABEXTINIT);
  233. DEFINE_GUID(IID_IWABExtInit, 
  234. 0xea22ebf0, 0x87a4, 0x11d1, 0x9a, 0xcf, 0x0, 0xa0, 0xc9, 0x1f, 0x9c, 0x8b);
  235. /* --------------------- */
  236. #ifndef WIN16
  237. #define WAB_DLL_NAME TEXT("WAB32.DLL")
  238. #else
  239. #define WAB_DLL_NAME "WAB16.DLL"
  240. #endif
  241. #define WAB_DLL_PATH_KEY TEXT("Software\Microsoft\WAB\DLLPath")
  242. #ifdef __cplusplus
  243. }
  244. #endif
  245. #endif /* _WABAPI_H */