home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / edk.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  12.0 KB  |  422 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*/
  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 <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 "proptag.h"
  226. #include "edkcfg.h"
  227. #include "vsof.h"
  228. #include "vsop.h"
  229.  
  230. //==============================================================================
  231. //  MACROS
  232. //==============================================================================
  233.  
  234. #ifdef __cplusplus
  235. #ifdef FBadUnknown
  236. #undef FBadUnknown
  237. #endif
  238. #define FBadUnknown( lpObj ) ((lpObj) == NULL)
  239. #endif
  240.  
  241. // convenient macros for manipulating 64-bit integers to 32-bit integers
  242. #define LOWPART_DWORDLONG        ((DWORDLONG) 0x00000000FFFFFFFF)
  243. #define HIGHPART_DWORDLONG        ((DWORDLONG) 0xFFFFFFFF00000000)
  244.  
  245. #define MAKEDWORDLONG(lo,hi)    ( (DWORDLONG) ( ( (hi) << 32 ) | (lo) ) )
  246. #define LOWDWORD(x)                ( (DWORD) ( (x) & LOWPART_DWORDLONG ) )
  247. #define HIDWORD(x)                ( (DWORD) ( ( (x) & HIGHPART_DWORDLONG ) >> 32 ) )
  248.  
  249. #define LOWPART_LONGLONG        ((LONGLONG) 0x00000000FFFFFFFF)
  250. #define HIGHPART_LONGLONG        ((LONGLONG) 0xFFFFFFFF00000000)
  251.  
  252. #define LOWLONG(x)                ( (DWORD) ( (x) & LOWPART_LONGLONG ) )
  253. #define HILONG(x)                ( (LONG) ( ( (x) & HIGHPART_LONGLONG ) >> 32 ) )
  254.  
  255. // definition of the Exchange address type.
  256. #define EXCHANGE_ADDRTYPE    "EX"
  257.  
  258. #define MAX_ULONG (ULONG) ~0L   // All bits on.
  259.  
  260. #define EDK_MAX_QUERY_ROWS 1024
  261.  
  262. #define VALID_OBJ_TYPE(x) (((x) >= ((ULONG)0x00000001)) && \
  263.                ((x) <= ((ULONG)0x0000000B)))
  264.  
  265. #define VALID_PROP_ID(x)  ((PROP_ID((x)) != 0x0000) && (PROP_ID((x)) != 0xFFFF))
  266.  
  267. #define CbNewSPropValue(_centries) \
  268.     ((_centries)*sizeof(SPropValue))
  269.  
  270. #define CbNewFlagList(_cflag) \
  271.     (offsetof(FlagList,ulFlag) + (_cflag)*sizeof(ULONG))
  272.  
  273. #define OLECALL(x)  (x)->lpVtbl
  274.  
  275. #define ULOLERELEASE(x) \
  276. {                                    \
  277.     if((x) != NULL)                  \
  278.     {                                \
  279.         OLECALL((x))->Release((x));  \
  280.     }                                \
  281.     (x) = NULL;                      \
  282. }
  283.  
  284. #define VALID_BOOL(x)   (((x) == TRUE) || ((x) == FALSE))
  285.  
  286. #define VALID_EDK_CONTAINER(x) \
  287.     ((((ULONG)(x)) == ((ULONG)EDK_FOLDER)) || \
  288.     (((ULONG)(x)) == ((ULONG)EDK_PUBLIC_FOLDER)) || \
  289.     (((ULONG)(x)) == ((ULONG)EDK_DIRECTORY)))
  290.  
  291. // Returns count of elements in any array.
  292. #define ARRAY_CNT( array)    (sizeof( array) / sizeof(array[0]))
  293.  
  294. #if !defined(__cplusplus) || defined(CINTERFACE)
  295. #define MAPICALL(x)     (x)->lpVtbl
  296. #else
  297. #define MAPICALL(x)     (x)
  298. #endif
  299.  
  300. #ifdef  MAX_ALIGN
  301. #undef  MAX_ALIGN
  302. #endif
  303. #define MAX_ALIGN    16
  304.  
  305. //$--cbStrLen@------------------------------------------------
  306. //  Returns total number of bytes (including NULL) used by 
  307. //  a string.  Useful for string allocations...
  308. // -----------------------------------------------------------
  309. #define cbStrLenA(sz)   ((lstrlenA((sz)) + 1) * sizeof(CHAR))
  310.  
  311. #if defined(_M_IX86)
  312. #define cbStrLenW(sz)   ((lstrlenW((sz)) + 1) * sizeof(WCHAR))
  313. #else
  314. // lstrlenW can return 0 for UNALIGNED UNICODE strings on non-IX86 platforms
  315. __inline static size_t cbStrLenW(
  316.     IN UNALIGNED const WCHAR *wsz)
  317. {
  318.     size_t cbWsz = 0;
  319.  
  320.     for(; *wsz; wsz++)
  321.         cbWsz += sizeof( WCHAR);
  322.  
  323.     return( cbWsz + sizeof( WCHAR));
  324. }
  325. #endif
  326.  
  327. #ifdef UNICODE
  328. #define cbStrLen    cbStrLenW
  329. #else 
  330. #define cbStrLen    cbStrLenA
  331. #endif
  332.  
  333. // Block transfer size for streams and files
  334. #define EDK_CBTRANSFER  4096
  335.  
  336. #define ULRELEASE(x) \
  337. {                    \
  338.     UlRelease((x));  \
  339.     (x) = NULL;      \
  340. }
  341.  
  342. #define MAPIFREEBUFFER(x) \
  343. {                         \
  344.     MAPIFreeBuffer((x));  \
  345.     (x) = NULL;           \
  346. }
  347.  
  348. #define FREEPADRLIST(x) \
  349. {                       \
  350.     FreePadrlist((x));  \
  351.     (x) = NULL;         \
  352. }
  353.  
  354. #define FREEPROWS(x)    \
  355. {                       \
  356.     FreeProws((x));     \
  357.     (x) = NULL;         \
  358. }
  359.  
  360. #define FREE(x) { if((x) != NULL) { free((void *)(x)); (x) = NULL; } }
  361.  
  362. #define LOCALFREE(x) { if((x) != NULL) {LocalFree((void *)(x)); (x) = NULL;} }
  363.  
  364. #define GLOBALFREE(x) { if((x) != NULL) {GlobalFree((void *)(x)); (x) = NULL;} }
  365.  
  366. #define DLLIMPORT __declspec( dllimport )
  367. #define DLLEXPORT __declspec( dllexport )
  368.  
  369. #define STRNCPY(dst,src) lstrcpyn((dst), (src), (sizeof(dst)/sizeof(TCHAR))-1)
  370.  
  371. #define STRNCAT(dst,src) _tcsncat((dst), (src), (sizeof(dst)/sizeof(TCHAR))-1)
  372.  
  373. #define FREEHSCM(h)                         \
  374. {                                           \
  375.     if ((h) != NULL)                        \
  376.     {                                       \
  377.         if(CloseServiceHandle(h) == FALSE)  \
  378.         {                                   \
  379.             HRESULT _hr = HR_LOG(E_FAIL);   \
  380.         }                                   \
  381.         (h) = NULL;                         \
  382.     }                                       \
  383. }
  384.  
  385. #define CLOSEHANDLE(h)                                  \
  386. {                                                       \
  387.     if(((h) != NULL) && ((h) != INVALID_HANDLE_VALUE))  \
  388.     {                                                   \
  389.         if(CloseHandle((h)) == FALSE)                   \
  390.         {                                               \
  391.             HRESULT _hr = HR_LOG(E_FAIL);               \
  392.         }                                               \
  393.         (h) = NULL;                                     \
  394.     }                                                   \
  395. }
  396.  
  397. #define REGCLOSEKEY(h)                                  \
  398. {                                                       \
  399.     if((h) != NULL && (h) != INVALID_HANDLE_VALUE)      \
  400.     {                                                   \
  401.         if(RegCloseKey((h)) != ERROR_SUCCESS)           \
  402.         {                                               \
  403.             HRESULT _hr = HR_LOG(E_FAIL);               \
  404.         }                                               \
  405.         (h) = NULL;                                     \
  406.     }                                                   \
  407. }
  408.  
  409. //==============================================================================
  410. // EDK include files that depend upon above macros.
  411. //==============================================================================
  412.  
  413. #ifdef __cplusplus  // C++ classes
  414.     #include "EdkUtCPP.H"
  415. #endif
  416.  
  417. //==============================================================================
  418.  
  419. #endif  // RC_INVOKED
  420. #pragma option pop /*P_O_Pop*/
  421. #endif  // __EDK_H__
  422.