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