home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / EDK.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  12.0 KB  |  425 lines

  1. // --edk.h----------------------------------------------------------------------
  2. // 
  3. //  Master include file for Microsoft Exchange SDK
  4. // 
  5. // Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.
  6. // -----------------------------------------------------------------------------
  7.  
  8. #ifndef __EDK_H__
  9. #pragma option push -b -a8 -pc -A- /*P_O_Push_S*/
  10. #define __EDK_H__
  11.  
  12. //==============================================================================
  13. //  VERSION INFORMATION
  14. //==============================================================================
  15.  
  16. #define EDK_MAJOR_VERSION       1                   // major header version
  17. #define EDK_MINOR_VERSION       0                   // minor header version
  18. #define EDK_VERSION_NUMBER      ((EDK_MAJOR_VERSION<<8)|EDK_MINOR_VERSION)
  19. #define EDK_VERSION_STR         "1.00.00\0"
  20.  
  21. //==============================================================================
  22. // By default, the VC++ Workbench creates a make file with _DEBUG or NDEBUG.  
  23. // We need to define DEBUG or SHIP to work with all the header files.
  24. //==============================================================================
  25.  
  26. #if !defined(DEBUG) && !defined(SHIP)
  27.     #ifdef _DEBUG
  28.         #define DEBUG
  29.         #define TEST
  30.     #else   // NDEBUG should be defined
  31.         #define SHIP
  32.     #endif
  33. #endif
  34.  
  35. //==============================================================================
  36. //  NON-RESOURCE
  37. //==============================================================================
  38.  
  39. #ifndef RC_INVOKED      // skip rest of file
  40.  
  41. #pragma warning(disable:4100 4103 4115 4200 4201 4204 4211 4214 4505 4514 4611 4706 4710)
  42.  
  43. #define _INC_OLE
  44. #define INC_RPC
  45. #define INC_OLE2
  46.  
  47. #ifdef UNICODE
  48. #ifndef _UNICODE
  49. #define _UNICODE
  50. #endif
  51. #endif
  52.  
  53. #if defined(_M_IX86)
  54. #define _EXCHANGE_MACHINE_TYPE "i386"
  55. #elif  defined(_M_ALPHA)
  56. #define _EXCHANGE_MACHINE_TYPE "ALPHA"
  57. #elif  defined(_M_MRX000)
  58. #define _EXCHANGE_MACHINE_TYPE "MIPS"
  59. #elif  defined(_M_PPC)
  60. #define _EXCHANGE_MACHINE_TYPE "PPC"
  61. #endif
  62.  
  63. #include <windows.h>
  64. #include <windowsx.h>
  65.  
  66. #pragma warning(disable:4103)
  67. #include <objbase.h>
  68. #pragma warning(disable:4103)
  69.  
  70. #ifdef EXTERN_C
  71. #undef EXTERN_C
  72. #endif
  73.  
  74. #ifdef __cplusplus
  75.     #define EXTERN_C    extern "C"
  76. #else
  77.     #define EXTERN_C    extern
  78. #endif
  79.  
  80. EXTERN_C const IID IID_IExchangeManageStore;
  81. EXTERN_C const IID IID_IExchangeModifyTable;
  82. EXTERN_C const IID IID_IExchangeConfigureXfer;
  83. EXTERN_C const IID IID_IExchangeXferBuffer;
  84. EXTERN_C const IID IID_IExchangeExportChanges;
  85. EXTERN_C const IID IID_IExchangeImportHierarchyChanges;
  86. EXTERN_C const IID IID_IExchangeImportContentsChanges;
  87. EXTERN_C const IID LIBID_aclcls;
  88. EXTERN_C const IID IID_IExchangeFolderACLs;
  89. EXTERN_C const IID LIBID_rulecls;
  90. EXTERN_C const IID IID_IExchangeFolderRules;
  91. EXTERN_C const IID IID_IEDKVirtualStreamOnProperty;
  92. EXTERN_C const IID IID_IExchangeRuleAction;
  93. EXTERN_C const IID IID_IExchangeFastTransfer;
  94. EXTERN_C const IID IID_IExchangeFavorites;
  95. EXTERN_C const IID IID_IExchangeMessageCpid0;
  96. EXTERN_C const IID IID_IExchangeRuleExtCallback;
  97. EXTERN_C const IID IID_IExchangeRuleExt;
  98.  
  99. #ifdef EDK_USES_IID
  100. #define INITGUID
  101.  
  102. #include <initguid.h>
  103.  
  104. #pragma warning(disable:4200)
  105. #include <edkguid.h>
  106. #include <aclsid.h>
  107. #include <rclsid.h>
  108. #include <vsopcsid.h>
  109. #pragma warning(disable:4200)
  110.  
  111. #define USES_IID_IUnknown
  112. #define USES_IID_IMessage
  113. #define USES_IID_IStream
  114. #define USES_IID_IClassFactory
  115. #define USES_IID_IPersistMessage
  116. #define USES_IID_IMAPIForm
  117. #define USES_IID_IMAPIProp
  118. #define USES_IID_IMAPIPropData
  119. #define USES_IID_IMAPIFolder
  120. #define USES_IID_IABContainer
  121. #define USES_IID_IAddrBook
  122. #define USES_IID_IMAPIFormInfo
  123. #define USES_IID_IMailUser
  124. #define USES_IID_IAttachment
  125. #define USES_IID_IDistList
  126. #define USES_IID_IMAPIStatus
  127. #define USES_IID_IMAPISession
  128. #define USES_IID_IMsgStore
  129. #define USES_IID_IProfSect
  130. #define USES_IID_IMAPIContainer
  131. #define USES_IID_IMAPITable
  132. #define USES_PS_MAPI
  133. #define USES_PS_PUBLIC_STRINGS
  134. #endif
  135.  
  136. #include <assert.h>
  137. #include <conio.h>
  138. #include <ctl3d.h>
  139. #include <ctype.h>
  140. #include <fcntl.h>
  141. #include <io.h>
  142. #include <limits.h>
  143. #include <malloc.h>
  144.  
  145. #define _MAPINLS_H_
  146.  
  147. #pragma warning(disable:4200)
  148. #include <mapidefs.h>
  149. #pragma warning(disable:4200)
  150.  
  151. #ifdef DEBUG
  152. #ifdef MAPI_DEFERRED_ERRORS
  153. #undef MAPI_DEFERRED_ERRORS
  154. #endif
  155. #define MAPI_DEFERRED_ERRORS    0
  156. #endif
  157.  
  158. #include <mapicode.h>
  159. #include <mapiform.h>
  160. #include <mapiguid.h>
  161. #include <mapispi.h>
  162. #include <mapitags.h>
  163. #include <mapiutil.h>
  164. #include <mapival.h>
  165. #include <mapiwin.h>
  166. #include <mapix.h>
  167. #include <rtflib.h>
  168.  
  169. #include <memory.h>
  170.  
  171. #pragma warning(disable:4200)
  172. #include <edkmdb.h>
  173. #pragma warning(disable:4200)
  174.  
  175. #pragma warning(disable:4200)
  176. #include <_entryid.h>
  177. #pragma warning(disable:4200)
  178.  
  179. #include <process.h>
  180. #include <stdarg.h>
  181. #include <stdio.h>
  182. #include <stdlib.h>
  183. #include <string.h>
  184. #include <tchar.h>
  185.  
  186. #pragma warning(disable:4200)
  187. #include <tnef.h>
  188. #pragma warning(disable:4200)
  189.  
  190. #include <wchar.h>
  191. #include <winbase.h>
  192. #include <winperf.h>
  193.  
  194.  
  195. #pragma warning(disable:4200)
  196. #include <imessage.h>
  197. #pragma warning(disable:4200)
  198.  
  199. #include <emsabtag.h>
  200.  
  201. //==============================================================================
  202. // EDK include files.  See end of file for more include files that need to be
  203. // included after macro definitions.
  204. //==============================================================================
  205.  
  206. #include "edkmsg.h"
  207.  
  208. #include "edkcode.h"
  209. #include "edkdebug.h"
  210.  
  211. #include "edkmapi.h"
  212. #include "addrlkup.h"
  213. #include "edktrack.h"
  214. #include "convstrc.h"
  215. #include "convcwrp.h"
  216. #include "edkevent.h"
  217. #include "exchinst.h"
  218. #include "monitor.h"
  219. #include "gwreport.h"
  220. #include "stats.h"
  221. #include "stattype.h"
  222. #include "winwrap.h"
  223. #include "mblogon.h"
  224. #include "edkutils.h"
  225. #include "newpst.h"
  226. #include "aclcls.h"
  227. #include "rulecls.h"
  228. #include "proptag.h"
  229. #include "edkcfg.h"
  230. #include "vsof.h"
  231. #include "vsop.h"
  232.  
  233. //==============================================================================
  234. //  MACROS
  235. //==============================================================================
  236.  
  237. #ifdef __cplusplus
  238. #ifdef FBadUnknown
  239. #undef FBadUnknown
  240. #endif
  241. #define FBadUnknown( lpObj ) ((lpObj) == NULL)
  242. #endif
  243.  
  244. // convenient macros for manipulating 64-bit integers to 32-bit integers
  245. #define LOWPART_DWORDLONG        ((DWORDLONG) 0x00000000FFFFFFFF)
  246. #define HIGHPART_DWORDLONG        ((DWORDLONG) 0xFFFFFFFF00000000)
  247.  
  248. #define MAKEDWORDLONG(lo,hi)    ( (DWORDLONG) ( ( (hi) << 32 ) | (lo) ) )
  249. #define LOWDWORD(x)                ( (DWORD) ( (x) & LOWPART_DWORDLONG ) )
  250. #define HIDWORD(x)                ( (DWORD) ( ( (x) & HIGHPART_DWORDLONG ) >> 32 ) )
  251.  
  252. #define LOWPART_LONGLONG        ((LONGLONG) 0x00000000FFFFFFFF)
  253. #define HIGHPART_LONGLONG        ((LONGLONG) 0xFFFFFFFF00000000)
  254.  
  255. #define LOWLONG(x)                ( (DWORD) ( (x) & LOWPART_LONGLONG ) )
  256. #define HILONG(x)                ( (LONG) ( ( (x) & HIGHPART_LONGLONG ) >> 32 ) )
  257.  
  258. // definition of the Exchange address type.
  259. #define EXCHANGE_ADDRTYPE    "EX"
  260.  
  261. #define MAX_ULONG (ULONG) ~0L   // All bits on.
  262.  
  263. #define EDK_MAX_QUERY_ROWS 1024
  264.  
  265. #define VALID_OBJ_TYPE(x) (((x) >= ((ULONG)0x00000001)) && \
  266.                ((x) <= ((ULONG)0x0000000B)))
  267.  
  268. #define VALID_PROP_ID(x)  ((PROP_ID((x)) != 0x0000) && (PROP_ID((x)) != 0xFFFF))
  269.  
  270. #define CbNewSPropValue(_centries) \
  271.     ((_centries)*sizeof(SPropValue))
  272.  
  273. #define CbNewFlagList(_cflag) \
  274.     (offsetof(FlagList,ulFlag) + (_cflag)*sizeof(ULONG))
  275.  
  276. #define OLECALL(x)  (x)->lpVtbl
  277.  
  278. #define ULOLERELEASE(x) \
  279. {                                    \
  280.     if((x) != NULL)                  \
  281.     {                                \
  282.         OLECALL((x))->Release((x));  \
  283.     }                                \
  284.     (x) = NULL;                      \
  285. }
  286.  
  287. #define VALID_BOOL(x)   (((x) == TRUE) || ((x) == FALSE))
  288.  
  289. #define VALID_EDK_CONTAINER(x) \
  290.     ((((ULONG)(x)) == ((ULONG)EDK_FOLDER)) || \
  291.     (((ULONG)(x)) == ((ULONG)EDK_PUBLIC_FOLDER)) || \
  292.     (((ULONG)(x)) == ((ULONG)EDK_DIRECTORY)))
  293.  
  294. // Returns count of elements in any array.
  295. #define ARRAY_CNT( array)    (sizeof( array) / sizeof(array[0]))
  296.  
  297. #if !defined(__cplusplus) || defined(CINTERFACE)
  298. #define MAPICALL(x)     (x)->lpVtbl
  299. #else
  300. #define MAPICALL(x)     (x)
  301. #endif
  302.  
  303. #ifdef  MAX_ALIGN
  304. #undef  MAX_ALIGN
  305. #endif
  306. #define MAX_ALIGN    16
  307.  
  308. //$--cbStrLen@------------------------------------------------
  309. //  Returns total number of bytes (including NULL) used by 
  310. //  a string.  Useful for string allocations...
  311. // -----------------------------------------------------------
  312. #define cbStrLenA(sz)   ((lstrlenA((sz)) + 1) * sizeof(CHAR))
  313.  
  314. #if defined(_M_IX86)
  315. #define cbStrLenW(sz)   ((lstrlenW((sz)) + 1) * sizeof(WCHAR))
  316. #else
  317. // lstrlenW can return 0 for UNALIGNED UNICODE strings on non-IX86 platforms
  318. __inline static size_t cbStrLenW(
  319.     IN UNALIGNED const WCHAR *wsz)
  320. {
  321.     size_t cbWsz = 0;
  322.  
  323.     for(; *wsz; wsz++)
  324.         cbWsz += sizeof( WCHAR);
  325.  
  326.     return( cbWsz + sizeof( WCHAR));
  327. }
  328. #endif
  329.  
  330. #ifdef UNICODE
  331. #define cbStrLen    cbStrLenW
  332. #else 
  333. #define cbStrLen    cbStrLenA
  334. #endif
  335.  
  336. // Block transfer size for streams and files
  337. #define EDK_CBTRANSFER  4096
  338.  
  339. #define ULRELEASE(x) \
  340. {                    \
  341.     UlRelease((x));  \
  342.     (x) = NULL;      \
  343. }
  344.  
  345. #define MAPIFREEBUFFER(x) \
  346. {                         \
  347.     MAPIFreeBuffer((x));  \
  348.     (x) = NULL;           \
  349. }
  350.  
  351. #define FREEPADRLIST(x) \
  352. {                       \
  353.     FreePadrlist((x));  \
  354.     (x) = NULL;         \
  355. }
  356.  
  357. #define FREEPROWS(x)    \
  358. {                       \
  359.     FreeProws((x));     \
  360.     (x) = NULL;         \
  361. }
  362.  
  363. #define FREE(x) { if((x) != NULL) { free((void *)(x)); (x) = NULL; } }
  364.  
  365. #define LOCALFREE(x) { if((x) != NULL) {LocalFree((void *)(x)); (x) = NULL;} }
  366.  
  367. #define GLOBALFREE(x) { if((x) != NULL) {GlobalFree((void *)(x)); (x) = NULL;} }
  368.  
  369. #define DLLIMPORT __declspec( dllimport )
  370. #define DLLEXPORT __declspec( dllexport )
  371.  
  372. #define STRNCPY(dst,src) lstrcpyn((dst), (src), (sizeof(dst)/sizeof(TCHAR))-1)
  373.  
  374. #define STRNCAT(dst,src) _tcsncat((dst), (src), (sizeof(dst)/sizeof(TCHAR))-1)
  375.  
  376. #define FREEHSCM(h)                         \
  377. {                                           \
  378.     if ((h) != NULL)                        \
  379.     {                                       \
  380.         if(CloseServiceHandle(h) == FALSE)  \
  381.         {                                   \
  382.             HRESULT _hr = HR_LOG(E_FAIL);   \
  383.         }                                   \
  384.         (h) = NULL;                         \
  385.     }                                       \
  386. }
  387.  
  388. #define CLOSEHANDLE(h)                                  \
  389. {                                                       \
  390.     if(((h) != NULL) && ((h) != INVALID_HANDLE_VALUE))  \
  391.     {                                                   \
  392.         if(CloseHandle((h)) == FALSE)                   \
  393.         {                                               \
  394.             HRESULT _hr = HR_LOG(E_FAIL);               \
  395.         }                                               \
  396.         (h) = NULL;                                     \
  397.     }                                                   \
  398. }
  399.  
  400. #define REGCLOSEKEY(h)                                  \
  401. {                                                       \
  402.     if((h) != NULL && (h) != INVALID_HANDLE_VALUE)      \
  403.     {                                                   \
  404.         if(RegCloseKey((h)) != ERROR_SUCCESS)           \
  405.         {                                               \
  406.             HRESULT _hr = HR_LOG(E_FAIL);               \
  407.         }                                               \
  408.         (h) = NULL;                                     \
  409.     }                                                   \
  410. }
  411.  
  412. //==============================================================================
  413. // EDK include files that depend upon above macros.
  414. //==============================================================================
  415.  
  416. #ifdef __cplusplus  // C++ classes
  417.     #include "EdkUtCPP.H"
  418. #endif
  419.  
  420. //==============================================================================
  421.  
  422. #endif  // RC_INVOKED
  423. #pragma option pop /*P_O_Pop*/
  424. #endif  // __EDK_H__
  425.