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

  1. /*
  2.  *  WABDEFS.H
  3.  *
  4.  *  Definitions used by WAB clients
  5.  *
  6.  *  History:
  7.  *      03/04/96    brucek  Copied from MAPI's mapidefs.h
  8.  *
  9.  *  Copyright 1993-1998 Microsoft Corporation. All Rights Reserved.
  10.  */
  11.  
  12. #ifdef WIN16
  13. #ifdef GetLastError
  14. #undef GetLastError
  15. #endif // GetLastError
  16. #endif // WIN16
  17.  
  18. #if !defined(MAPIDEFS_H) && !defined(WABDEFS_H)
  19. #define WABDEFS_H
  20. #if defined (WIN32)
  21.  
  22. #if defined (NT) && !defined (_WINNT)
  23. #pragma message ("\nWARNING!!\n NT defined but not _WINNT.\n    You must define _WINNT to ensure "\
  24.     "successful compile of Windows NT code\n")
  25. #define _WINNT
  26. #endif /* defined NT and not defined _WINNT */
  27. #endif /* WIN32 */
  28.  
  29. #if defined (WIN32) && !defined (MAC)   /* Must include WINDOWS.H on Win32 */
  30. #ifndef _WINDOWS_
  31. #define INC_OLE2 /* Get the OLE2 stuff */
  32. #define INC_RPC  /* harmless on Windows NT; Windows 95 needs it */
  33. #define _INC_OLE /* Windows 95 will include OLE1 without this */
  34. #include <windows.h>
  35. #endif
  36.  
  37. #ifndef _OLEERROR_H_
  38. #include <objerror.h>
  39. #endif
  40. #ifndef _OBJBASE_H_
  41. #include <objbase.h>
  42. #endif
  43. #endif
  44.  
  45. #if defined (WIN16) || defined (DOS) || defined (DOS16) || defined (MAC)
  46. #ifndef _COMPOBJ_H_
  47. #include <compobj.h>
  48. #endif
  49. #endif
  50.  
  51. #ifndef _INC_STDDEF
  52. #include <stddef.h>
  53. #endif
  54.  
  55. /* Array dimension for structures with variable-sized arrays at the end. */
  56.  
  57. #ifndef MAPI_DIM
  58. #define MAPI_DIM    1
  59. #endif
  60.  
  61. /* Provider init type. Force to cdecl always */
  62.  
  63. #ifndef STDMAPIINITCALLTYPE
  64. #if !defined (_MAC) && defined (WIN32)
  65. #define STDMAPIINITCALLTYPE     __cdecl
  66. #else
  67. #define STDMAPIINITCALLTYPE     STDMETHODCALLTYPE
  68. #endif
  69. #define STDINITMETHODIMP        HRESULT STDMAPIINITCALLTYPE
  70. #define STDINITMETHODIMP_(type) type STDMAPIINITCALLTYPE
  71. #endif
  72.  
  73. #ifdef  __cplusplus
  74. extern "C" {
  75. #endif
  76.  
  77. /* Simple data types */
  78.  
  79.  
  80. #ifndef WIN16
  81. typedef WORD                WCHAR;
  82. #endif
  83.  
  84. #ifdef UNICODE
  85. typedef WCHAR               TCHAR;
  86. #else
  87. typedef char                TCHAR;
  88. #endif
  89.  
  90. typedef WCHAR FAR *         LPWSTR;
  91. typedef const WCHAR FAR *   LPCWSTR;
  92. typedef TCHAR FAR *         LPTSTR;
  93. typedef const TCHAR FAR *   LPCTSTR;
  94. typedef BYTE FAR *          LPBYTE;
  95. typedef ULONG FAR *         LPULONG;
  96.  
  97. #ifndef __LHANDLE
  98. #define __LHANDLE
  99. typedef unsigned long   LHANDLE, FAR * LPLHANDLE;
  100. #endif
  101.  
  102. #if !defined(_WINBASE_) && !defined(_FILETIME_)
  103. #define _FILETIME_
  104. typedef struct _FILETIME
  105. {
  106.     DWORD dwLowDateTime;
  107.     DWORD dwHighDateTime;
  108. } FILETIME, FAR * LPFILETIME;
  109. #endif
  110.  
  111. #ifndef BEGIN_INTERFACE
  112. #define BEGIN_INTERFACE
  113. #endif
  114.  
  115. /*
  116.  *  This flag is used in many different MAPI calls to signify that
  117.  *  the object opened by the call should be modifiable (MAPI_MODIFY).
  118.  *  If the flag MAPI_MAX_ACCESS is set, the object returned should be
  119.  *  returned at the maximum access level allowed.  An additional
  120.  *  property available on the object (PR_ACCESS_LEVEL) uses the same
  121.  *  MAPI_MODIFY flag to say just what this new access level is.
  122.  */
  123.  
  124. #define MAPI_MODIFY             ((ULONG) 0x00000001)
  125.  
  126. /*
  127.  *  The following flags are used to indicate to the client what access
  128.  *  level is permissible in the object. They appear in PR_ACCESS in
  129.  *  message and folder objects as well as in contents and associated
  130.  *  contents tables
  131.  */
  132.  
  133. #define MAPI_ACCESS_MODIFY                  ((ULONG) 0x00000001)
  134. #define MAPI_ACCESS_READ                    ((ULONG) 0x00000002)
  135. #define MAPI_ACCESS_DELETE                  ((ULONG) 0x00000004)
  136. #define MAPI_ACCESS_CREATE_HIERARCHY        ((ULONG) 0x00000008)
  137. #define MAPI_ACCESS_CREATE_CONTENTS         ((ULONG) 0x00000010)
  138. #define MAPI_ACCESS_CREATE_ASSOCIATED       ((ULONG) 0x00000020)
  139.  
  140. /*
  141.  *  The MAPI_UNICODE flag is used in many different MAPI calls to signify
  142.  *  that strings passed through the interface are in Unicode (a 16-bit
  143.  *  character set). The default is an 8-bit character set.
  144.  *
  145.  *  The value fMapiUnicode can be used as the 'normal' value for
  146.  *  that bit, given the application's default character set.
  147.  */
  148.  
  149. #define MAPI_UNICODE            ((ULONG) 0x80000000)
  150.  
  151. #ifdef UNICODE
  152. #define fMapiUnicode            MAPI_UNICODE
  153. #else
  154. #define fMapiUnicode            0
  155. #endif
  156.  
  157. /* successful HRESULT */
  158. #define hrSuccess               0
  159.  
  160.  
  161.  
  162. /* Recipient types */
  163. #ifndef MAPI_ORIG               /* also defined in mapi.h */
  164. #define MAPI_ORIG   0           /* Recipient is message originator          */
  165. #define MAPI_TO     1           /* Recipient is a primary recipient         */
  166. #define MAPI_CC     2           /* Recipient is a copy recipient            */
  167. #define MAPI_BCC    3           /* Recipient is blind copy recipient        */
  168. #define MAPI_P1     0x10000000  /* Recipient is a P1 resend recipient       */
  169. #define MAPI_SUBMITTED 0x80000000 /* Recipient is already processed         */
  170. /* #define MAPI_AUTHORIZE 4        recipient is a CMC authorizing user      */
  171. /*#define MAPI_DISCRETE 0x10000000 Recipient is a P1 resend recipient       */
  172. #endif
  173.  
  174. /* Bit definitions for abFlags[0] of ENTRYID */
  175. #define MAPI_SHORTTERM          0x80
  176. #define MAPI_NOTRECIP           0x40
  177. #define MAPI_THISSESSION        0x20
  178. #define MAPI_NOW                0x10
  179. #define MAPI_NOTRESERVED        0x08
  180.  
  181. /* Bit definitions for abFlags[1] of ENTRYID */
  182. #define MAPI_COMPOUND           0x80
  183.  
  184. /* ENTRYID */
  185. typedef struct
  186. {
  187.     BYTE    abFlags[4];
  188.     BYTE    ab[MAPI_DIM];
  189. } ENTRYID, FAR *LPENTRYID;
  190.  
  191. #define CbNewENTRYID(_cb)       (offsetof(ENTRYID,ab) + (_cb))
  192. #define CbENTRYID(_cb)          (offsetof(ENTRYID,ab) + (_cb))
  193. #define SizedENTRYID(_cb, _name) \
  194.     struct _ENTRYID_ ## _name \
  195. { \
  196.     BYTE    abFlags[4]; \
  197.     BYTE    ab[_cb]; \
  198. } _name
  199.  
  200. /* Byte-order-independent version of GUID (world-unique identifier) */
  201. typedef struct _MAPIUID
  202. {
  203.     BYTE ab[16];
  204. } MAPIUID, FAR * LPMAPIUID;
  205.  
  206. /* Note:  need to include C run-times (memory.h) to use this macro */
  207.  
  208. #define IsEqualMAPIUID(lpuid1, lpuid2)  (!memcmp(lpuid1, lpuid2, sizeof(MAPIUID)))
  209.  
  210.  
  211. /* Object type */
  212.  
  213. #define MAPI_STORE      ((ULONG) 0x00000001)    /* Message Store */
  214. #define MAPI_ADDRBOOK   ((ULONG) 0x00000002)    /* Address Book */
  215. #define MAPI_FOLDER     ((ULONG) 0x00000003)    /* Folder */
  216. #define MAPI_ABCONT     ((ULONG) 0x00000004)    /* Address Book Container */
  217. #define MAPI_MESSAGE    ((ULONG) 0x00000005)    /* Message */
  218. #define MAPI_MAILUSER   ((ULONG) 0x00000006)    /* Individual Recipient */
  219. #define MAPI_ATTACH     ((ULONG) 0x00000007)    /* Attachment */
  220. #define MAPI_DISTLIST   ((ULONG) 0x00000008)    /* Distribution List Recipient */
  221. #define MAPI_PROFSECT   ((ULONG) 0x00000009)    /* Profile Section */
  222. #define MAPI_STATUS     ((ULONG) 0x0000000A)    /* Status Object */
  223. #define MAPI_SESSION    ((ULONG) 0x0000000B)    /* Session */
  224. #define MAPI_FORMINFO   ((ULONG) 0x0000000C)    /* Form Information */
  225.  
  226.  
  227. /*
  228.  *  Maximum length of profile names and passwords, not including
  229.  *  the null termination character.
  230.  */
  231. #ifndef cchProfileNameMax
  232. #define cchProfileNameMax   64
  233. #define cchProfilePassMax   64
  234. #endif
  235.  
  236.  
  237. /* Property Types */
  238.  
  239. #define MV_FLAG         0x1000          /* Multi-value flag */
  240.  
  241. #define PT_UNSPECIFIED  ((ULONG)  0)    /* (Reserved for interface use) type doesn't matter to caller */
  242. #define PT_NULL         ((ULONG)  1)    /* NULL property value */
  243. #define PT_I2           ((ULONG)  2)    /* Signed 16-bit value */
  244. #define PT_LONG         ((ULONG)  3)    /* Signed 32-bit value */
  245. #define PT_R4           ((ULONG)  4)    /* 4-byte floating point */
  246. #define PT_DOUBLE       ((ULONG)  5)    /* Floating point double */
  247. #define PT_CURRENCY     ((ULONG)  6)    /* Signed 64-bit int (decimal w/    4 digits right of decimal pt) */
  248. #define PT_APPTIME      ((ULONG)  7)    /* Application time */
  249. #define PT_ERROR        ((ULONG) 10)    /* 32-bit error value */
  250. #define PT_BOOLEAN      ((ULONG) 11)    /* 16-bit boolean (non-zero true) */
  251. #define PT_OBJECT       ((ULONG) 13)    /* Embedded object in a property */
  252. #define PT_I8           ((ULONG) 20)    /* 8-byte signed integer */
  253. #define PT_STRING8      ((ULONG) 30)    /* Null terminated 8-bit character string */
  254. #define PT_UNICODE      ((ULONG) 31)    /* Null terminated Unicode string */
  255. #define PT_SYSTIME      ((ULONG) 64)    /* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
  256. #define PT_CLSID        ((ULONG) 72)    /* OLE GUID */
  257. #define PT_BINARY       ((ULONG) 258)   /* Uninterpreted (counted byte array) */
  258. /* Changes are likely to these numbers, and to their structures. */
  259.  
  260. /* Alternate property type names for ease of use */
  261. #define PT_SHORT    PT_I2
  262. #define PT_I4       PT_LONG
  263. #define PT_FLOAT    PT_R4
  264. #define PT_R8       PT_DOUBLE
  265. #define PT_LONGLONG PT_I8
  266.  
  267. /*
  268.  *  The type of a MAPI-defined string property is indirected, so
  269.  *  that it defaults to Unicode string on a Unicode platform and to
  270.  *  String8 on an ANSI or DBCS platform.
  271.  *
  272.  *  Macros are defined here both for the property type, and for the
  273.  *  field of the property value structure which should be
  274.  *  dereferenced to obtain the string pointer.
  275.  */
  276.  
  277. #ifdef  UNICODE
  278. #define PT_TSTRING          PT_UNICODE
  279. #define PT_MV_TSTRING       (MV_FLAG|PT_UNICODE)
  280. #define LPSZ                lpszW
  281. #define LPPSZ               lppszW
  282. #define MVSZ                MVszW
  283. #else
  284. #define PT_TSTRING          PT_STRING8
  285. #define PT_MV_TSTRING       (MV_FLAG|PT_STRING8)
  286. #define LPSZ                lpszA
  287. #define LPPSZ               lppszA
  288. #define MVSZ                MVszA
  289. #endif
  290.  
  291.  
  292. /* Property Tags
  293.  *
  294.  * By convention, MAPI never uses 0 or FFFF as a property ID.
  295.  * Use as null values, initializers, sentinels, or what have you.
  296.  */
  297.  
  298. #define PROP_TYPE_MASK          ((ULONG)0x0000FFFF) /* Mask for Property type */
  299. #define PROP_TYPE(ulPropTag)    (((ULONG)(ulPropTag))&PROP_TYPE_MASK)
  300. #define PROP_ID(ulPropTag)      (((ULONG)(ulPropTag))>>16)
  301. #define PROP_TAG(ulPropType,ulPropID)   ((((ULONG)(ulPropID))<<16)|((ULONG)(ulPropType)))
  302. #define PROP_ID_NULL            0
  303. #define PROP_ID_INVALID         0xFFFF
  304. #define PR_NULL                 PROP_TAG( PT_NULL, PROP_ID_NULL)
  305. #define CHANGE_PROP_TYPE(ulPropTag, ulPropType) \
  306.                         (((ULONG)0xFFFF0000 & ulPropTag) | ulPropType)
  307.  
  308.  
  309. /* Multi-valued Property Types */
  310.  
  311. #define PT_MV_I2        (MV_FLAG|PT_I2)
  312. #define PT_MV_LONG      (MV_FLAG|PT_LONG)
  313. #define PT_MV_R4        (MV_FLAG|PT_R4)
  314. #define PT_MV_DOUBLE    (MV_FLAG|PT_DOUBLE)
  315. #define PT_MV_CURRENCY  (MV_FLAG|PT_CURRENCY)
  316. #define PT_MV_APPTIME   (MV_FLAG|PT_APPTIME)
  317. #define PT_MV_SYSTIME   (MV_FLAG|PT_SYSTIME)
  318. #define PT_MV_STRING8   (MV_FLAG|PT_STRING8)
  319. #define PT_MV_BINARY    (MV_FLAG|PT_BINARY)
  320. #define PT_MV_UNICODE   (MV_FLAG|PT_UNICODE)
  321. #define PT_MV_CLSID     (MV_FLAG|PT_CLSID)
  322. #define PT_MV_I8        (MV_FLAG|PT_I8)
  323.  
  324. /* Alternate property type names for ease of use */
  325. #define PT_MV_SHORT     PT_MV_I2
  326. #define PT_MV_I4        PT_MV_LONG
  327. #define PT_MV_FLOAT     PT_MV_R4
  328. #define PT_MV_R8        PT_MV_DOUBLE
  329. #define PT_MV_LONGLONG  PT_MV_I8
  330.  
  331. /*
  332.  *  Property type reserved bits
  333.  *
  334.  *  MV_INSTANCE is used as a flag in table operations to request
  335.  *  that a multi-valued property be presented as a single-valued
  336.  *  property appearing in multiple rows.
  337.  */
  338.  
  339. #define MV_INSTANCE     0x2000
  340. #define MVI_FLAG        (MV_FLAG | MV_INSTANCE)
  341. #define MVI_PROP(tag)   ((tag) | MVI_FLAG)
  342.  
  343. /* --------------- */
  344. /* Data Structures */
  345. /* --------------- */
  346.  
  347. /* Property Tag Array */
  348.  
  349. typedef struct _SPropTagArray
  350. {
  351.     ULONG   cValues;
  352.     ULONG   aulPropTag[MAPI_DIM];
  353. } SPropTagArray, FAR * LPSPropTagArray;
  354.  
  355. #define CbNewSPropTagArray(_ctag) \
  356.     (offsetof(SPropTagArray,aulPropTag) + (_ctag)*sizeof(ULONG))
  357. #define CbSPropTagArray(_lparray) \
  358.     (offsetof(SPropTagArray,aulPropTag) + \
  359.     (UINT)((_lparray)->cValues)*sizeof(ULONG))
  360. /*  SPropTagArray */
  361. #define SizedSPropTagArray(_ctag, _name) \
  362. struct _SPropTagArray_ ## _name \
  363. { \
  364.     ULONG   cValues; \
  365.     ULONG   aulPropTag[_ctag]; \
  366. } _name
  367.  
  368. /* -------------- */
  369. /* Property Value */
  370. /* -------------- */
  371.  
  372. typedef struct _SPropValue  SPropValue;
  373.  
  374.  
  375. /* 32-bit CURRENCY definition stolen from oaidl.h */
  376. /* 16-bit CURRENCY definition stolen from variant.h */
  377.  
  378. #ifndef _tagCY_DEFINED
  379. #define _tagCY_DEFINED
  380. #define _CY_DEFINED
  381. #if (defined (WIN16) || defined (DOS)) && !defined (_VARIANT_H_)
  382. typedef struct FARSTRUCT tagCY {
  383. #ifdef _MAC
  384.         long      Hi;
  385.         long Lo;
  386. #else
  387.         unsigned long Lo;
  388.         long      Hi;
  389. #endif
  390. } CY;
  391. #elif defined (WIN32)
  392. /* real definition that makes the C++ compiler happy */
  393. typedef union tagCY {
  394.     struct {
  395. #ifdef _MAC
  396.         long      Hi;
  397.         long Lo;
  398. #else
  399.         unsigned long Lo;
  400.         long      Hi;
  401. #endif
  402.     };
  403.     LONGLONG int64;
  404. } CY;
  405. #endif /* 16-bit vs 32-bit definition */
  406. #endif
  407.             /* size is 8 */
  408. typedef CY CURRENCY;
  409.  
  410. typedef struct _SBinary
  411. {
  412.     ULONG       cb;
  413.     LPBYTE      lpb;
  414. } SBinary, FAR *LPSBinary;
  415.  
  416. typedef struct _SShortArray
  417. {
  418.     ULONG       cValues;
  419.     short int   FAR *lpi;
  420. } SShortArray;
  421.  
  422. typedef struct _SGuidArray
  423. {
  424.     ULONG       cValues;
  425.     GUID        FAR *lpguid;
  426. } SGuidArray;
  427.  
  428. typedef struct _SRealArray
  429. {
  430.     ULONG       cValues;
  431.     float       FAR *lpflt;
  432. } SRealArray;
  433.  
  434. typedef struct _SLongArray
  435. {
  436.     ULONG       cValues;
  437.     LONG        FAR *lpl;
  438. } SLongArray;
  439.  
  440. typedef struct _SLargeIntegerArray
  441. {
  442.     ULONG       cValues;
  443.     LARGE_INTEGER   FAR *lpli;
  444. } SLargeIntegerArray;
  445.  
  446. typedef struct _SDateTimeArray
  447. {
  448.     ULONG       cValues;
  449.     FILETIME    FAR *lpft;
  450. } SDateTimeArray;
  451.  
  452. typedef struct _SAppTimeArray
  453. {
  454.     ULONG       cValues;
  455.     double      FAR *lpat;
  456. } SAppTimeArray;
  457.  
  458. typedef struct _SCurrencyArray
  459. {
  460.     ULONG       cValues;
  461.     CURRENCY    FAR *lpcur;
  462. } SCurrencyArray;
  463.  
  464. typedef struct _SBinaryArray
  465. {
  466.     ULONG       cValues;
  467.     SBinary     FAR *lpbin;
  468. } SBinaryArray;
  469.  
  470. typedef struct _SDoubleArray
  471. {
  472.     ULONG       cValues;
  473.     double      FAR *lpdbl;
  474. } SDoubleArray;
  475.  
  476. typedef struct _SWStringArray
  477. {
  478.     ULONG       cValues;
  479.     LPWSTR      FAR *lppszW;
  480. } SWStringArray;
  481.  
  482. typedef struct _SLPSTRArray
  483. {
  484.     ULONG       cValues;
  485.     LPSTR       FAR *lppszA;
  486. } SLPSTRArray;
  487.  
  488. typedef union _PV
  489. {
  490.     short int           i;          /* case PT_I2 */
  491.     LONG                l;          /* case PT_LONG */
  492.     ULONG               ul;         /* alias for PT_LONG */
  493.     float               flt;        /* case PT_R4 */
  494.     double              dbl;        /* case PT_DOUBLE */
  495.     unsigned short int  b;          /* case PT_BOOLEAN */
  496.     CURRENCY            cur;        /* case PT_CURRENCY */
  497.     double              at;         /* case PT_APPTIME */
  498.     FILETIME            ft;         /* case PT_SYSTIME */
  499.     LPSTR               lpszA;      /* case PT_STRING8 */
  500.     SBinary             bin;        /* case PT_BINARY */
  501.     LPWSTR              lpszW;      /* case PT_UNICODE */
  502.     LPGUID              lpguid;     /* case PT_CLSID */
  503.     LARGE_INTEGER       li;         /* case PT_I8 */
  504.     SShortArray         MVi;        /* case PT_MV_I2 */
  505.     SLongArray          MVl;        /* case PT_MV_LONG */
  506.     SRealArray          MVflt;      /* case PT_MV_R4 */
  507.     SDoubleArray        MVdbl;      /* case PT_MV_DOUBLE */
  508.     SCurrencyArray      MVcur;      /* case PT_MV_CURRENCY */
  509.     SAppTimeArray       MVat;       /* case PT_MV_APPTIME */
  510.     SDateTimeArray      MVft;       /* case PT_MV_SYSTIME */
  511.     SBinaryArray        MVbin;      /* case PT_MV_BINARY */
  512.     SLPSTRArray         MVszA;      /* case PT_MV_STRING8 */
  513.     SWStringArray       MVszW;      /* case PT_MV_UNICODE */
  514.     SGuidArray          MVguid;     /* case PT_MV_CLSID */
  515.     SLargeIntegerArray  MVli;       /* case PT_MV_I8 */
  516.     SCODE               err;        /* case PT_ERROR */
  517.     LONG                x;          /* case PT_NULL, PT_OBJECT (no usable value) */
  518. } __UPV;
  519.  
  520. typedef struct _SPropValue
  521. {
  522.     ULONG       ulPropTag;
  523.     ULONG       dwAlignPad;
  524.     union _PV   Value;
  525. } SPropValue, FAR * LPSPropValue;
  526.  
  527.  
  528. /* --------------------------------------------- */
  529. /* Property Problem and Property Problem Arrays */
  530. /* --------------------------------------------- */
  531.  
  532. typedef struct _SPropProblem
  533. {
  534.     ULONG   ulIndex;
  535.     ULONG   ulPropTag;
  536.     SCODE   scode;
  537. } SPropProblem, FAR * LPSPropProblem;
  538.  
  539. typedef struct _SPropProblemArray
  540. {
  541.     ULONG           cProblem;
  542.     SPropProblem    aProblem[MAPI_DIM];
  543. } SPropProblemArray, FAR * LPSPropProblemArray;
  544.  
  545. #define CbNewSPropProblemArray(_cprob) \
  546.     (offsetof(SPropProblemArray,aProblem) + (_cprob)*sizeof(SPropProblem))
  547. #define CbSPropProblemArray(_lparray) \
  548.     (offsetof(SPropProblemArray,aProblem) + \
  549.     (UINT) ((_lparray)->cProblem*sizeof(SPropProblem)))
  550. #define SizedSPropProblemArray(_cprob, _name) \
  551. struct _SPropProblemArray_ ## _name \
  552. { \
  553.     ULONG           cProblem; \
  554.     SPropProblem    aProblem[_cprob]; \
  555. } _name
  556.  
  557. /*
  558.  *  ENTRYLIST
  559.  */
  560.  
  561. typedef SBinaryArray ENTRYLIST, FAR *LPENTRYLIST;
  562.  
  563. /*
  564.  *  FLATENTRYLIST
  565.  *  MTSID
  566.  *  FLATMTSIDLIST
  567.  */
  568.  
  569. typedef struct {
  570.     ULONG cb;
  571.     BYTE abEntry[MAPI_DIM];
  572. } FLATENTRY, FAR *LPFLATENTRY;
  573.  
  574. typedef struct {
  575.     ULONG       cEntries;
  576.     ULONG       cbEntries;
  577.     BYTE        abEntries[MAPI_DIM];
  578. } FLATENTRYLIST, FAR *LPFLATENTRYLIST;
  579.  
  580. typedef struct {
  581.     ULONG       cb;
  582.     BYTE        ab[MAPI_DIM];
  583. } MTSID, FAR *LPMTSID;
  584.  
  585. typedef struct {
  586.     ULONG       cMTSIDs;
  587.     ULONG       cbMTSIDs;
  588.     BYTE        abMTSIDs[MAPI_DIM];
  589. } FLATMTSIDLIST, FAR *LPFLATMTSIDLIST;
  590.  
  591. #define CbNewFLATENTRY(_cb)     (offsetof(FLATENTRY,abEntry) + (_cb))
  592. #define CbFLATENTRY(_lpentry)   (offsetof(FLATENTRY,abEntry) + (_lpentry)->cb)
  593. #define CbNewFLATENTRYLIST(_cb) (offsetof(FLATENTRYLIST,abEntries) + (_cb))
  594. #define CbFLATENTRYLIST(_lplist) (offsetof(FLATENTRYLIST,abEntries) + (_lplist)->cbEntries)
  595. #define CbNewMTSID(_cb)         (offsetof(MTSID,ab) + (_cb))
  596. #define CbMTSID(_lpentry)       (offsetof(MTSID,ab) + (_lpentry)->cb)
  597. #define CbNewFLATMTSIDLIST(_cb) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_cb))
  598. #define CbFLATMTSIDLIST(_lplist) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_lplist)->cbMTSIDs)
  599. /* No SizedXXX macros for these types. */
  600.  
  601. /* ------------------------------ */
  602. /* ADRENTRY, ADRLIST */
  603.  
  604. typedef struct _ADRENTRY
  605. {
  606.     ULONG           ulReserved1;    /* Never used */
  607.     ULONG           cValues;
  608.     LPSPropValue    rgPropVals;
  609. } ADRENTRY, FAR * LPADRENTRY;
  610.  
  611. typedef struct _ADRLIST
  612. {
  613.     ULONG           cEntries;
  614.     ADRENTRY        aEntries[MAPI_DIM];
  615. } ADRLIST, FAR * LPADRLIST;
  616.  
  617. #define CbNewADRLIST(_centries) \
  618.     (offsetof(ADRLIST,aEntries) + (_centries)*sizeof(ADRENTRY))
  619. #define CbADRLIST(_lpadrlist) \
  620.     (offsetof(ADRLIST,aEntries) + (UINT)(_lpadrlist)->cEntries*sizeof(ADRENTRY))
  621. #define SizedADRLIST(_centries, _name) \
  622. struct _ADRLIST_ ## _name \
  623. { \
  624.     ULONG           cEntries; \
  625.     ADRENTRY        aEntries[_centries]; \
  626. } _name
  627.  
  628. /* ------------------------------ */
  629. /* SRow, SRowSet */
  630.  
  631. typedef struct _SRow
  632. {
  633.     ULONG           ulAdrEntryPad;  /* Pad so SRow's can map to ADRENTRY's */
  634.     ULONG           cValues;        /* Count of property values */
  635.     LPSPropValue    lpProps;        /* Property value array */
  636. } SRow, FAR * LPSRow;
  637.  
  638. typedef struct _SRowSet
  639. {
  640.     ULONG           cRows;          /* Count of rows */
  641.     SRow            aRow[MAPI_DIM]; /* Array of rows */
  642. } SRowSet, FAR * LPSRowSet;
  643.  
  644. #define CbNewSRowSet(_crow)     (offsetof(SRowSet,aRow) + (_crow)*sizeof(SRow))
  645. #define CbSRowSet(_lprowset)    (offsetof(SRowSet,aRow) + \
  646.                                     (UINT)((_lprowset)->cRows*sizeof(SRow)))
  647. #define SizedSRowSet(_crow, _name) \
  648. struct _SRowSet_ ## _name \
  649. { \
  650.     ULONG           cRows; \
  651.     SRow            aRow[_crow]; \
  652. } _name
  653.  
  654. /* MAPI Allocation Routines ------------------------------------------------ */
  655.  
  656. typedef SCODE (STDMETHODCALLTYPE ALLOCATEBUFFER)(
  657.     ULONG           cbSize,
  658.     LPVOID FAR *    lppBuffer
  659. );
  660.  
  661. typedef SCODE (STDMETHODCALLTYPE ALLOCATEMORE)(
  662.     ULONG           cbSize,
  663.     LPVOID          lpObject,
  664.     LPVOID FAR *    lppBuffer
  665. );
  666.  
  667. typedef ULONG (STDAPICALLTYPE FREEBUFFER)(
  668.     LPVOID          lpBuffer
  669. );
  670.  
  671. typedef ALLOCATEBUFFER FAR *LPALLOCATEBUFFER;
  672. typedef ALLOCATEMORE FAR *  LPALLOCATEMORE;
  673. typedef FREEBUFFER FAR *    LPFREEBUFFER;
  674.  
  675. /* MAPI Component Object Model Macros -------------------------------------- */
  676.  
  677. #if defined(MAPI_IF) && (!defined(__cplusplus) || defined(CINTERFACE))
  678. #define DECLARE_MAPI_INTERFACE(iface)                                   \
  679.         typedef struct iface##Vtbl iface##Vtbl, FAR * iface;            \
  680.         struct iface##Vtbl
  681. #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
  682.         DECLARE_MAPI_INTERFACE(iface)
  683. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  684.         typedef struct iface##Vtbl iface##Vtbl, FAR * iface, FAR * FAR * piface;
  685. #else
  686. #define DECLARE_MAPI_INTERFACE(iface)                                   \
  687.         DECLARE_INTERFACE(iface)
  688. #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
  689.         DECLARE_INTERFACE_(iface, baseiface)
  690. #ifdef __cplusplus
  691. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  692.         interface iface; typedef iface FAR * piface
  693. #else
  694. #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
  695.         typedef interface iface iface, FAR * piface
  696. #endif
  697. #endif
  698.  
  699. #define MAPIMETHOD(method)              MAPIMETHOD_(HRESULT, method)
  700. #define MAPIMETHOD_(type, method)       STDMETHOD_(type, method)
  701. #define MAPIMETHOD_DECLARE(type, method, prefix) \
  702.         STDMETHODIMP_(type) prefix##method
  703. #define MAPIMETHOD_TYPEDEF(type, method, prefix) \
  704.         typedef type (STDMETHODCALLTYPE prefix##method##_METHOD)
  705.  
  706. #define MAPI_IUNKNOWN_METHODS(IPURE)                                    \
  707.     MAPIMETHOD(QueryInterface)                                          \
  708.         (THIS_ REFIID riid, LPVOID FAR * ppvObj) IPURE;                 \
  709.     MAPIMETHOD_(ULONG,AddRef)  (THIS) IPURE;                            \
  710.     MAPIMETHOD_(ULONG,Release) (THIS) IPURE;                            \
  711.  
  712. #undef  IMPL
  713. #define IMPL
  714.  
  715. /* Pointers to MAPI Interfaces --------------------------------------------- */
  716.  
  717. typedef const IID FAR * LPCIID;
  718.  
  719. DECLARE_MAPI_INTERFACE_PTR(IMsgStore,       LPMDB);
  720. DECLARE_MAPI_INTERFACE_PTR(IMAPIFolder,     LPMAPIFOLDER);
  721. DECLARE_MAPI_INTERFACE_PTR(IMessage,        LPMESSAGE);
  722. DECLARE_MAPI_INTERFACE_PTR(IAttach,         LPATTACH);
  723. DECLARE_MAPI_INTERFACE_PTR(IAddrBook,       LPADRBOOK);
  724. DECLARE_MAPI_INTERFACE_PTR(IABContainer,    LPABCONT);
  725. DECLARE_MAPI_INTERFACE_PTR(IMailUser,       LPMAILUSER);
  726. DECLARE_MAPI_INTERFACE_PTR(IDistList,       LPDISTLIST);
  727. DECLARE_MAPI_INTERFACE_PTR(IMAPIStatus,     LPMAPISTATUS);
  728. DECLARE_MAPI_INTERFACE_PTR(IMAPITable,      LPMAPITABLE);
  729. DECLARE_MAPI_INTERFACE_PTR(IProfSect,       LPPROFSECT);
  730. DECLARE_MAPI_INTERFACE_PTR(IMAPIProp,       LPMAPIPROP);
  731. DECLARE_MAPI_INTERFACE_PTR(IMAPIContainer,  LPMAPICONTAINER);
  732. DECLARE_MAPI_INTERFACE_PTR(IMAPIAdviseSink, LPMAPIADVISESINK);
  733. DECLARE_MAPI_INTERFACE_PTR(IMAPIProgress,   LPMAPIPROGRESS);
  734. DECLARE_MAPI_INTERFACE_PTR(IProviderAdmin,  LPPROVIDERADMIN);
  735.  
  736. /* Extended MAPI Error Information ----------------------------------------- */
  737.  
  738. typedef struct _MAPIERROR
  739. {
  740.     ULONG   ulVersion;
  741.     LPTSTR  lpszError;
  742.     LPTSTR  lpszComponent;
  743.     ULONG   ulLowLevelError;
  744.     ULONG   ulContext;
  745.  
  746. } MAPIERROR, FAR * LPMAPIERROR;
  747.  
  748.  
  749. /* IMAPIAdviseSink Interface ----------------------------------------------- */
  750.  
  751. /*
  752.  *  Notification event types. The event types can be combined in a bitmask
  753.  *  for filtering. Each one has a parameter structure associated with it:
  754.  *
  755.  *      fnevCriticalError       ERROR_NOTIFICATION
  756.  *      fnevNewMail             NEWMAIL_NOTIFICATION
  757.  *      fnevObjectCreated       OBJECT_NOTIFICATION
  758.  *      fnevObjectDeleted       OBJECT_NOTIFICATION
  759.  *      fnevObjectModified      OBJECT_NOTIFICATION
  760.  *      fnevObjectCopied        OBJECT_NOTIFICATION
  761.  *      fnevSearchComplete      OBJECT_NOTIFICATION
  762.  *      fnevTableModified       TABLE_NOTIFICATION
  763.  *      fnevStatusObjectModified OBJECT_NOTIFICATION
  764.  *
  765.  *      fnevExtended            EXTENDED_NOTIFICATION
  766.  */
  767.  
  768. #define fnevCriticalError           ((ULONG) 0x00000001)
  769. #define fnevNewMail                 ((ULONG) 0x00000002)
  770. #define fnevObjectCreated           ((ULONG) 0x00000004)
  771. #define fnevObjectDeleted           ((ULONG) 0x00000008)
  772. #define fnevObjectModified          ((ULONG) 0x00000010)
  773. #define fnevObjectMoved             ((ULONG) 0x00000020)
  774. #define fnevObjectCopied            ((ULONG) 0x00000040)
  775. #define fnevSearchComplete          ((ULONG) 0x00000080)
  776. #define fnevTableModified           ((ULONG) 0x00000100)
  777. #define fnevStatusObjectModified    ((ULONG) 0x00000200)
  778. #define fnevReservedForMapi         ((ULONG) 0x40000000)
  779. #define fnevExtended                ((ULONG) 0x80000000)
  780.  
  781. /* TABLE_NOTIFICATION event types passed in ulTableEvent */
  782.  
  783. #define TABLE_CHANGED       1
  784. #define TABLE_ERROR         2
  785. #define TABLE_ROW_ADDED     3
  786. #define TABLE_ROW_DELETED   4
  787. #define TABLE_ROW_MODIFIED  5
  788. #define TABLE_SORT_DONE     6
  789. #define TABLE_RESTRICT_DONE 7
  790. #define TABLE_SETCOL_DONE   8
  791. #define TABLE_RELOAD        9
  792.  
  793. /* Event Structures */
  794.  
  795. typedef struct _ERROR_NOTIFICATION
  796. {
  797.     ULONG       cbEntryID;
  798.     LPENTRYID   lpEntryID;
  799.     SCODE       scode;
  800.     ULONG       ulFlags;            /* 0 or MAPI_UNICODE */
  801.     LPMAPIERROR lpMAPIError;        /* Detailed error information */
  802. } ERROR_NOTIFICATION;
  803.  
  804. typedef struct _NEWMAIL_NOTIFICATION
  805. {
  806.     ULONG       cbEntryID;
  807.     LPENTRYID   lpEntryID;          /* identifies the new message */
  808.     ULONG       cbParentID;
  809.     LPENTRYID   lpParentID;         /* identifies the folder it lives in */
  810.     ULONG       ulFlags;            /* 0 or MAPI_UNICODE */
  811.     LPTSTR      lpszMessageClass;   /* message class (UNICODE or string8) */
  812.     ULONG       ulMessageFlags;     /* copy of PR_MESSAGE_FLAGS */
  813. } NEWMAIL_NOTIFICATION;
  814.  
  815. typedef struct _OBJECT_NOTIFICATION
  816. {
  817.     ULONG               cbEntryID;
  818.     LPENTRYID           lpEntryID;      /* EntryID of object */
  819.     ULONG               ulObjType;      /* Type of object */
  820.     ULONG               cbParentID;
  821.     LPENTRYID           lpParentID;     /* EntryID of parent object */
  822.     ULONG               cbOldID;
  823.     LPENTRYID           lpOldID;        /* EntryID of old object */
  824.     ULONG               cbOldParentID;
  825.     LPENTRYID           lpOldParentID;  /* EntryID of old parent */
  826.     LPSPropTagArray     lpPropTagArray;
  827. } OBJECT_NOTIFICATION;
  828.  
  829. typedef struct _TABLE_NOTIFICATION
  830. {
  831.     ULONG               ulTableEvent;   /* Identifies WHICH table event */
  832.     HRESULT             hResult;        /* Value for TABLE_ERROR */
  833.     SPropValue          propIndex;      /* This row's "index property" */
  834.     SPropValue          propPrior;      /* Preceding row's "index property" */
  835.     SRow                row;            /* New data of added/modified row */
  836.     ULONG               ulPad;          /* Force to 8-byte boundary */
  837. } TABLE_NOTIFICATION;
  838.  
  839. typedef struct _EXTENDED_NOTIFICATION
  840. {
  841.     ULONG       ulEvent;                    /* extended event code */
  842.     ULONG       cb;                         /* size of event parameters */
  843.     LPBYTE      pbEventParameters;          /* event parameters */
  844. } EXTENDED_NOTIFICATION;
  845.  
  846. typedef struct
  847. {
  848.     ULONG           cbEntryID;
  849.     LPENTRYID       lpEntryID;
  850.     ULONG           cValues;
  851.     LPSPropValue    lpPropVals;
  852. } STATUS_OBJECT_NOTIFICATION;
  853.  
  854. typedef struct _NOTIFICATION
  855. {
  856.     ULONG   ulEventType;        /* notification type, i.e. fnevSomething */
  857.     ULONG   ulAlignPad;         /* Force to 8-byte boundary */
  858.     union
  859.     {
  860.         ERROR_NOTIFICATION          err;
  861.         NEWMAIL_NOTIFICATION        newmail;
  862.         OBJECT_NOTIFICATION         obj;
  863.         TABLE_NOTIFICATION          tab;
  864.         EXTENDED_NOTIFICATION       ext;
  865.         STATUS_OBJECT_NOTIFICATION  statobj;
  866.     } info;
  867. } NOTIFICATION, FAR * LPNOTIFICATION;
  868.  
  869.  
  870. /* Interface used for registering and issuing notification callbacks. */
  871.  
  872. #define MAPI_IMAPIADVISESINK_METHODS(IPURE)                             \
  873.     MAPIMETHOD_(ULONG, OnNotify)                                        \
  874.         (THIS_  ULONG                       cNotif,                     \
  875.                 LPNOTIFICATION              lpNotifications) IPURE;     \
  876.  
  877. #undef       INTERFACE
  878. #define      INTERFACE  IMAPIAdviseSink
  879. DECLARE_MAPI_INTERFACE_(IMAPIAdviseSink, IUnknown)
  880. {
  881.     BEGIN_INTERFACE
  882.     MAPI_IUNKNOWN_METHODS(PURE)
  883.     MAPI_IMAPIADVISESINK_METHODS(PURE)
  884. };
  885.  
  886. /* Callback function type for MAPIAllocAdviseSink */
  887.  
  888. typedef long (STDAPICALLTYPE NOTIFCALLBACK) (
  889.     LPVOID          lpvContext,
  890.     ULONG           cNotification,
  891.     LPNOTIFICATION  lpNotifications);
  892. typedef NOTIFCALLBACK FAR * LPNOTIFCALLBACK;
  893.  
  894. /*
  895.  *  Message name for the 16-bit MAPI notififcation engine.
  896.  *  This can be used in 16-bit applications to force processing
  897.  *  of notification callbacks.
  898.  */
  899.  
  900. #define szMAPINotificationMsg "MAPI Notify window message"
  901.  
  902.  
  903. /* IMAPIProgress Interface ------------------------------------------------- */
  904.  
  905. /* Flag values for the progress indicator */
  906.  
  907. #define MAPI_TOP_LEVEL      ((ULONG) 0x00000001)
  908.  
  909. #define MAPI_IMAPIPROGRESS_METHODS(IPURE)                               \
  910.     MAPIMETHOD(Progress)                                                \
  911.         (THIS_  ULONG                       ulValue,                    \
  912.                 ULONG                       ulCount,                    \
  913.                 ULONG                       ulTotal) IPURE;             \
  914.     MAPIMETHOD(GetFlags)                                                \
  915.         (THIS_  ULONG FAR *                 lpulFlags) IPURE;           \
  916.     MAPIMETHOD(GetMax)                                                  \
  917.         (THIS_  ULONG FAR *                 lpulMax) IPURE;             \
  918.     MAPIMETHOD(GetMin)                                                  \
  919.         (THIS_  ULONG FAR *                 lpulMin) IPURE;             \
  920.     MAPIMETHOD(SetLimits)                                               \
  921.         (THIS_  LPULONG                     lpulMin,                    \
  922.                 LPULONG                     lpulMax,                    \
  923.                 LPULONG                     lpulFlags) IPURE;           \
  924.  
  925. #undef      INTERFACE
  926. #define     INTERFACE   IMAPIProgress
  927. DECLARE_MAPI_INTERFACE_(IMAPIProgress, IUnknown)
  928. {
  929.     BEGIN_INTERFACE
  930.     MAPI_IUNKNOWN_METHODS(PURE)
  931.     MAPI_IMAPIPROGRESS_METHODS(PURE)
  932. };
  933.  
  934.  
  935. /* IMAPIProp Interface ----------------------------------------------------- */
  936.  
  937. /* GetLastError */
  938. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  939.  
  940. /*
  941.  *  Version:
  942.  */
  943. #define MAPI_ERROR_VERSION      0x00000000L
  944.  
  945. /* GetPropList */
  946. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  947.  
  948. /* GetProps */
  949. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  950.  
  951. /* SaveChanges */
  952.  
  953. #define KEEP_OPEN_READONLY      ((ULONG) 0x00000001)
  954. #define KEEP_OPEN_READWRITE     ((ULONG) 0x00000002)
  955. #define FORCE_SAVE              ((ULONG) 0x00000004)
  956. /* define MAPI_DEFERRED_ERRORS  ((ULONG) 0x00000008) below */
  957.  
  958. /* OpenProperty  - ulFlags */
  959. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  960. #define MAPI_CREATE             ((ULONG) 0x00000002)
  961. #define STREAM_APPEND           ((ULONG) 0x00000004)
  962. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  963.  
  964. /* OpenProperty  - ulInterfaceOptions, IID_IMAPITable */
  965. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  966.  
  967. /* CopyTo, CopyProps */
  968.  
  969. #define MAPI_MOVE               ((ULONG) 0x00000001)
  970. #define MAPI_NOREPLACE          ((ULONG) 0x00000002)
  971. #define MAPI_DECLINE_OK         ((ULONG) 0x00000004)
  972.  
  973. #ifndef MAPI_DIALOG             /* also defined in mapi.h */
  974. #define MAPI_DIALOG             ((ULONG) 0x00000008)
  975. #endif
  976.  
  977. #ifndef MAPI_USE_DEFAULT        /* also defined in mapi.h */
  978. #define MAPI_USE_DEFAULT        0x00000040  /* Use default profile in logon */
  979. #endif
  980.  
  981. /* Flags used in GetIDsFromNames  */
  982. /****** MAPI_CREATE             ((ULONG) 0x00000002) above */
  983.  
  984. /* Flags used in GetNamesFromIDs  (bit fields) */
  985. #define MAPI_NO_STRINGS         ((ULONG) 0x00000001)
  986. #define MAPI_NO_IDS             ((ULONG) 0x00000002)
  987.  
  988. /*  Union discriminator  */
  989. #define MNID_ID                 0
  990. #define MNID_STRING             1
  991. typedef struct _MAPINAMEID
  992. {
  993.     LPGUID lpguid;
  994.     ULONG ulKind;
  995.     union {
  996.         LONG lID;
  997.         LPWSTR lpwstrName;
  998.     } Kind;
  999.  
  1000. } MAPINAMEID, FAR * LPMAPINAMEID;
  1001.  
  1002. #define MAPI_IMAPIPROP_METHODS(IPURE)                                   \
  1003.     MAPIMETHOD(GetLastError)                                            \
  1004.         (THIS_  HRESULT                     hResult,                    \
  1005.                 ULONG                       ulFlags,                    \
  1006.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  1007.     MAPIMETHOD(SaveChanges)                                             \
  1008.         (THIS_ ULONG                        ulFlags) IPURE;             \
  1009.     MAPIMETHOD(GetProps)                                                \
  1010.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1011.                 ULONG                       ulFlags,                    \
  1012.                 ULONG FAR *                 lpcValues,                  \
  1013.                 LPSPropValue FAR *          lppPropArray) IPURE;        \
  1014.     MAPIMETHOD(GetPropList)                                             \
  1015.         (THIS_  ULONG                       ulFlags,                    \
  1016.                 LPSPropTagArray FAR *       lppPropTagArray) IPURE;     \
  1017.     MAPIMETHOD(OpenProperty)                                            \
  1018.         (THIS_  ULONG                       ulPropTag,                  \
  1019.                 LPCIID                      lpiid,                      \
  1020.                 ULONG                       ulInterfaceOptions,         \
  1021.                 ULONG                       ulFlags,                    \
  1022.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  1023.     MAPIMETHOD(SetProps)                                                \
  1024.         (THIS_  ULONG                       cValues,                    \
  1025.                 LPSPropValue                lpPropArray,                \
  1026.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1027.     MAPIMETHOD(DeleteProps)                                             \
  1028.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1029.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1030.     MAPIMETHOD(CopyTo)                                                  \
  1031.         (THIS_  ULONG                       ciidExclude,                \
  1032.                 LPCIID                      rgiidExclude,               \
  1033.                 LPSPropTagArray             lpExcludeProps,             \
  1034.                 ULONG                       ulUIParam,                  \
  1035.                 LPMAPIPROGRESS              lpProgress,                 \
  1036.                 LPCIID                      lpInterface,                \
  1037.                 LPVOID                      lpDestObj,                  \
  1038.                 ULONG                       ulFlags,                    \
  1039.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1040.     MAPIMETHOD(CopyProps)                                               \
  1041.         (THIS_  LPSPropTagArray             lpIncludeProps,             \
  1042.                 ULONG                       ulUIParam,                  \
  1043.                 LPMAPIPROGRESS              lpProgress,                 \
  1044.                 LPCIID                      lpInterface,                \
  1045.                 LPVOID                      lpDestObj,                  \
  1046.                 ULONG                       ulFlags,                    \
  1047.                 LPSPropProblemArray FAR *   lppProblems) IPURE;         \
  1048.     MAPIMETHOD(GetNamesFromIDs)                                         \
  1049.         (THIS_  LPSPropTagArray FAR *       lppPropTags,                \
  1050.                 LPGUID                      lpPropSetGuid,              \
  1051.                 ULONG                       ulFlags,                    \
  1052.                 ULONG FAR *                 lpcPropNames,               \
  1053.                 LPMAPINAMEID FAR * FAR *    lpppPropNames) IPURE;       \
  1054.     MAPIMETHOD(GetIDsFromNames)                                         \
  1055.         (THIS_  ULONG                       cPropNames,                 \
  1056.                 LPMAPINAMEID FAR *          lppPropNames,               \
  1057.                 ULONG                       ulFlags,                    \
  1058.                 LPSPropTagArray FAR *       lppPropTags) IPURE;         \
  1059.  
  1060. #undef       INTERFACE
  1061. #define      INTERFACE  IMAPIProp
  1062. DECLARE_MAPI_INTERFACE_(IMAPIProp, IUnknown)
  1063. {
  1064.     BEGIN_INTERFACE
  1065.     MAPI_IUNKNOWN_METHODS(PURE)
  1066.     MAPI_IMAPIPROP_METHODS(PURE)
  1067. };
  1068.  
  1069. /* IMAPITable Interface ---------------------------------------------------- */
  1070.  
  1071. /* Table status */
  1072.  
  1073. #define TBLSTAT_COMPLETE            ((ULONG) 0)
  1074. #define TBLSTAT_QCHANGED            ((ULONG) 7)
  1075. #define TBLSTAT_SORTING             ((ULONG) 9)
  1076. #define TBLSTAT_SORT_ERROR          ((ULONG) 10)
  1077. #define TBLSTAT_SETTING_COLS        ((ULONG) 11)
  1078. #define TBLSTAT_SETCOL_ERROR        ((ULONG) 13)
  1079. #define TBLSTAT_RESTRICTING         ((ULONG) 14)
  1080. #define TBLSTAT_RESTRICT_ERROR      ((ULONG) 15)
  1081.  
  1082.  
  1083. /* Table Type */
  1084.  
  1085. #define TBLTYPE_SNAPSHOT            ((ULONG) 0)
  1086. #define TBLTYPE_KEYSET              ((ULONG) 1)
  1087. #define TBLTYPE_DYNAMIC             ((ULONG) 2)
  1088.  
  1089.  
  1090. /* Sort order */
  1091.  
  1092. /* bit 0: set if descending, clear if ascending */
  1093.  
  1094. #define TABLE_SORT_ASCEND       ((ULONG) 0x00000000)
  1095. #define TABLE_SORT_DESCEND      ((ULONG) 0x00000001)
  1096. #define TABLE_SORT_COMBINE      ((ULONG) 0x00000002)
  1097.  
  1098.  
  1099. /* Data structures */
  1100.  
  1101. typedef struct _SSortOrder
  1102. {
  1103.     ULONG   ulPropTag;          /* Column to sort on */
  1104.     ULONG   ulOrder;            /* Ascending, descending, combine to left */
  1105. } SSortOrder, FAR * LPSSortOrder;
  1106.  
  1107. typedef struct _SSortOrderSet
  1108. {
  1109.     ULONG           cSorts;     /* Number of sort columns in aSort below*/
  1110.     ULONG           cCategories;    /* 0 for non-categorized, up to cSorts */
  1111.     ULONG           cExpanded;      /* 0 if no categories start expanded, */
  1112.                                     /*      up to cExpanded */
  1113.     SSortOrder      aSort[MAPI_DIM];    /* The sort orders */
  1114. } SSortOrderSet, FAR * LPSSortOrderSet;
  1115.  
  1116. #define CbNewSSortOrderSet(_csort) \
  1117.     (offsetof(SSortOrderSet,aSort) + (_csort)*sizeof(SSortOrder))
  1118. #define CbSSortOrderSet(_lpset) \
  1119.     (offsetof(SSortOrderSet,aSort) + \
  1120.     (UINT)((_lpset)->cSorts*sizeof(SSortOrder)))
  1121. #define SizedSSortOrderSet(_csort, _name) \
  1122. struct _SSortOrderSet_ ## _name \
  1123. { \
  1124.     ULONG           cSorts;         \
  1125.     ULONG           cCategories;    \
  1126.     ULONG           cExpanded;      \
  1127.     SSortOrder      aSort[_csort];  \
  1128. } _name
  1129.  
  1130. typedef ULONG       BOOKMARK;
  1131.  
  1132. #define BOOKMARK_BEGINNING  ((BOOKMARK) 0)      /* Before first row */
  1133. #define BOOKMARK_CURRENT    ((BOOKMARK) 1)      /* Before current row */
  1134. #define BOOKMARK_END        ((BOOKMARK) 2)      /* After last row */
  1135.  
  1136. /* Fuzzy Level */
  1137.  
  1138. #define FL_FULLSTRING       ((ULONG) 0x00000000)
  1139. #define FL_SUBSTRING        ((ULONG) 0x00000001)
  1140. #define FL_PREFIX           ((ULONG) 0x00000002)
  1141.  
  1142. #define FL_IGNORECASE       ((ULONG) 0x00010000)
  1143. #define FL_IGNORENONSPACE   ((ULONG) 0x00020000)
  1144. #define FL_LOOSE            ((ULONG) 0x00040000)
  1145.  
  1146. /* Restrictions */
  1147.  
  1148. typedef struct _SRestriction    FAR * LPSRestriction;
  1149.  
  1150. /* Restriction types */
  1151.  
  1152. #define RES_AND             ((ULONG) 0x00000000)
  1153. #define RES_OR              ((ULONG) 0x00000001)
  1154. #define RES_NOT             ((ULONG) 0x00000002)
  1155. #define RES_CONTENT         ((ULONG) 0x00000003)
  1156. #define RES_PROPERTY        ((ULONG) 0x00000004)
  1157. #define RES_COMPAREPROPS    ((ULONG) 0x00000005)
  1158. #define RES_BITMASK         ((ULONG) 0x00000006)
  1159. #define RES_SIZE            ((ULONG) 0x00000007)
  1160. #define RES_EXIST           ((ULONG) 0x00000008)
  1161. #define RES_SUBRESTRICTION  ((ULONG) 0x00000009)
  1162. #define RES_COMMENT         ((ULONG) 0x0000000A)
  1163.  
  1164. /* Relational operators. These apply to all property comparison restrictions. */
  1165.  
  1166. #define RELOP_LT        ((ULONG) 0)     /* <  */
  1167. #define RELOP_LE        ((ULONG) 1)     /* <= */
  1168. #define RELOP_GT        ((ULONG) 2)     /* >  */
  1169. #define RELOP_GE        ((ULONG) 3)     /* >= */
  1170. #define RELOP_EQ        ((ULONG) 4)     /* == */
  1171. #define RELOP_NE        ((ULONG) 5)     /* != */
  1172. #define RELOP_RE        ((ULONG) 6)     /* LIKE (Regular expression) */
  1173.  
  1174. /* Bitmask operators, for RES_BITMASK only. */
  1175.  
  1176. #define BMR_EQZ     ((ULONG) 0)     /* ==0 */
  1177. #define BMR_NEZ     ((ULONG) 1)     /* !=0 */
  1178.  
  1179. /* Subobject identifiers for RES_SUBRESTRICTION only. See MAPITAGS.H. */
  1180.  
  1181. /* #define PR_MESSAGE_RECIPIENTS  PROP_TAG(PT_OBJECT,0x0E12) */
  1182. /* #define PR_MESSAGE_ATTACHMENTS PROP_TAG(PT_OBJECT,0x0E13) */
  1183.  
  1184. typedef struct _SAndRestriction
  1185. {
  1186.     ULONG           cRes;
  1187.     LPSRestriction  lpRes;
  1188. } SAndRestriction;
  1189.  
  1190. typedef struct _SOrRestriction
  1191. {
  1192.     ULONG           cRes;
  1193.     LPSRestriction  lpRes;
  1194. } SOrRestriction;
  1195.  
  1196. typedef struct _SNotRestriction
  1197. {
  1198.     ULONG           ulReserved;
  1199.     LPSRestriction  lpRes;
  1200. } SNotRestriction;
  1201.  
  1202. typedef struct _SContentRestriction
  1203. {
  1204.     ULONG           ulFuzzyLevel;
  1205.     ULONG           ulPropTag;
  1206.     LPSPropValue    lpProp;
  1207. } SContentRestriction;
  1208.  
  1209. typedef struct _SBitMaskRestriction
  1210. {
  1211.     ULONG           relBMR;
  1212.     ULONG           ulPropTag;
  1213.     ULONG           ulMask;
  1214. } SBitMaskRestriction;
  1215.  
  1216. typedef struct _SPropertyRestriction
  1217. {
  1218.     ULONG           relop;
  1219.     ULONG           ulPropTag;
  1220.     LPSPropValue    lpProp;
  1221. } SPropertyRestriction;
  1222.  
  1223. typedef struct _SComparePropsRestriction
  1224. {
  1225.     ULONG           relop;
  1226.     ULONG           ulPropTag1;
  1227.     ULONG           ulPropTag2;
  1228. } SComparePropsRestriction;
  1229.  
  1230. typedef struct _SSizeRestriction
  1231. {
  1232.     ULONG           relop;
  1233.     ULONG           ulPropTag;
  1234.     ULONG           cb;
  1235. } SSizeRestriction;
  1236.  
  1237. typedef struct _SExistRestriction
  1238. {
  1239.     ULONG           ulReserved1;
  1240.     ULONG           ulPropTag;
  1241.     ULONG           ulReserved2;
  1242. } SExistRestriction;
  1243.  
  1244. typedef struct _SSubRestriction
  1245. {
  1246.     ULONG           ulSubObject;
  1247.     LPSRestriction  lpRes;
  1248. } SSubRestriction;
  1249.  
  1250. typedef struct _SCommentRestriction
  1251. {
  1252.     ULONG           cValues; /* # of properties in lpProp */
  1253.     LPSRestriction  lpRes;
  1254.     LPSPropValue    lpProp;
  1255. } SCommentRestriction;
  1256.  
  1257. typedef struct _SRestriction
  1258. {
  1259.     ULONG   rt;         /* Restriction type */
  1260.     union
  1261.     {
  1262.         SComparePropsRestriction    resCompareProps;    /* first */
  1263.         SAndRestriction             resAnd;
  1264.         SOrRestriction              resOr;
  1265.         SNotRestriction             resNot;
  1266.         SContentRestriction         resContent;
  1267.         SPropertyRestriction        resProperty;
  1268.         SBitMaskRestriction         resBitMask;
  1269.         SSizeRestriction            resSize;
  1270.         SExistRestriction           resExist;
  1271.         SSubRestriction             resSub;
  1272.         SCommentRestriction         resComment;
  1273.     } res;
  1274. } SRestriction;
  1275.  
  1276. /* SComparePropsRestriction is first in the union so that */
  1277. /* static initializations of 3-value restriction work.    */
  1278.  
  1279. /* Flags of the methods of IMAPITable */
  1280.  
  1281. /* QueryColumn */
  1282.  
  1283. #define TBL_ALL_COLUMNS     ((ULONG) 0x00000001)
  1284.  
  1285. /* QueryRows */
  1286. /* Possible values for PR_ROW_TYPE (for categorization) */
  1287.  
  1288. #define TBL_LEAF_ROW            ((ULONG) 1)
  1289. #define TBL_EMPTY_CATEGORY      ((ULONG) 2)
  1290. #define TBL_EXPANDED_CATEGORY   ((ULONG) 3)
  1291. #define TBL_COLLAPSED_CATEGORY  ((ULONG) 4)
  1292.  
  1293. /* Table wait flag */
  1294.  
  1295. #define TBL_NOWAIT          ((ULONG) 0x00000001)
  1296. /* alternative name for TBL_NOWAIT */
  1297. #define TBL_ASYNC           ((ULONG) 0x00000001)
  1298. #define TBL_BATCH           ((ULONG) 0x00000002)
  1299.  
  1300. /* FindRow */
  1301.  
  1302. #define DIR_BACKWARD        ((ULONG) 0x00000001)
  1303.  
  1304. /* Table cursor states */
  1305.  
  1306. #define TBL_NOADVANCE       ((ULONG) 0x00000001)
  1307.  
  1308. #define MAPI_IMAPITABLE_METHODS(IPURE)                                  \
  1309.     MAPIMETHOD(GetLastError)                                            \
  1310.         (THIS_  HRESULT                     hResult,                    \
  1311.                 ULONG                       ulFlags,                    \
  1312.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  1313.     MAPIMETHOD(Advise)                                                  \
  1314.         (THIS_  ULONG                       ulEventMask,                \
  1315.                 LPMAPIADVISESINK            lpAdviseSink,               \
  1316.                 ULONG FAR *                 lpulConnection) IPURE;      \
  1317.     MAPIMETHOD(Unadvise)                                                \
  1318.         (THIS_  ULONG                       ulConnection) IPURE;        \
  1319.     MAPIMETHOD(GetStatus)                                               \
  1320.         (THIS_  ULONG FAR *                 lpulTableStatus,            \
  1321.                 ULONG FAR *                 lpulTableType) IPURE;       \
  1322.     MAPIMETHOD(SetColumns)                                              \
  1323.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1324.                 ULONG                       ulFlags) IPURE;             \
  1325.     MAPIMETHOD(QueryColumns)                                            \
  1326.         (THIS_  ULONG                       ulFlags,                    \
  1327.                 LPSPropTagArray FAR *       lpPropTagArray) IPURE;      \
  1328.     MAPIMETHOD(GetRowCount)                                             \
  1329.         (THIS_  ULONG                       ulFlags,                    \
  1330.                 ULONG FAR *                 lpulCount) IPURE;           \
  1331.     MAPIMETHOD(SeekRow)                                                 \
  1332.         (THIS_  BOOKMARK                    bkOrigin,                   \
  1333.                 LONG                        lRowCount,                  \
  1334.                 LONG FAR *                  lplRowsSought) IPURE;       \
  1335.     MAPIMETHOD(SeekRowApprox)                                           \
  1336.         (THIS_  ULONG                       ulNumerator,                \
  1337.                 ULONG                       ulDenominator) IPURE;       \
  1338.     MAPIMETHOD(QueryPosition)                                           \
  1339.         (THIS_  ULONG FAR *                 lpulRow,                    \
  1340.                 ULONG FAR *                 lpulNumerator,              \
  1341.                 ULONG FAR *                 lpulDenominator) IPURE;     \
  1342.     MAPIMETHOD(FindRow)                                                 \
  1343.         (THIS_  LPSRestriction              lpRestriction,              \
  1344.                 BOOKMARK                    bkOrigin,                   \
  1345.                 ULONG                       ulFlags) IPURE;             \
  1346.     MAPIMETHOD(Restrict)                                                \
  1347.         (THIS_  LPSRestriction              lpRestriction,              \
  1348.                 ULONG                       ulFlags) IPURE;             \
  1349.     MAPIMETHOD(CreateBookmark)                                          \
  1350.         (THIS_  BOOKMARK FAR *              lpbkPosition) IPURE;        \
  1351.     MAPIMETHOD(FreeBookmark)                                            \
  1352.         (THIS_  BOOKMARK                    bkPosition) IPURE;          \
  1353.     MAPIMETHOD(SortTable)                                               \
  1354.         (THIS_  LPSSortOrderSet             lpSortCriteria,             \
  1355.                 ULONG                       ulFlags) IPURE;             \
  1356.     MAPIMETHOD(QuerySortOrder)                                          \
  1357.         (THIS_  LPSSortOrderSet FAR *       lppSortCriteria) IPURE;     \
  1358.     MAPIMETHOD(QueryRows)                                               \
  1359.         (THIS_  LONG                        lRowCount,                  \
  1360.                 ULONG                       ulFlags,                    \
  1361.                 LPSRowSet FAR *             lppRows) IPURE;             \
  1362.     MAPIMETHOD(Abort) (THIS) IPURE;                                     \
  1363.     MAPIMETHOD(ExpandRow)                                               \
  1364.         (THIS_  ULONG                       cbInstanceKey,              \
  1365.                 LPBYTE                      pbInstanceKey,              \
  1366.                 ULONG                       ulRowCount,                 \
  1367.                 ULONG                       ulFlags,                    \
  1368.                 LPSRowSet FAR *             lppRows,                    \
  1369.                 ULONG FAR *                 lpulMoreRows) IPURE;        \
  1370.     MAPIMETHOD(CollapseRow)                                             \
  1371.         (THIS_  ULONG                       cbInstanceKey,              \
  1372.                 LPBYTE                      pbInstanceKey,              \
  1373.                 ULONG                       ulFlags,                    \
  1374.                 ULONG FAR *                 lpulRowCount) IPURE;        \
  1375.     MAPIMETHOD(WaitForCompletion)                                       \
  1376.         (THIS_  ULONG                       ulFlags,                    \
  1377.                 ULONG                       ulTimeout,                  \
  1378.                 ULONG FAR *                 lpulTableStatus) IPURE;     \
  1379.     MAPIMETHOD(GetCollapseState)                                        \
  1380.         (THIS_  ULONG                       ulFlags,                    \
  1381.                 ULONG                       cbInstanceKey,              \
  1382.                 LPBYTE                      lpbInstanceKey,             \
  1383.                 ULONG FAR *                 lpcbCollapseState,          \
  1384.                 LPBYTE FAR *                lppbCollapseState) IPURE;   \
  1385.     MAPIMETHOD(SetCollapseState)                                        \
  1386.         (THIS_  ULONG                       ulFlags,                    \
  1387.                 ULONG                       cbCollapseState,            \
  1388.                 LPBYTE                      pbCollapseState,            \
  1389.                 BOOKMARK FAR *              lpbkLocation) IPURE;        \
  1390.  
  1391. #undef       INTERFACE
  1392. #define      INTERFACE  IMAPITable
  1393. DECLARE_MAPI_INTERFACE_(IMAPITable, IUnknown)
  1394. {
  1395.     BEGIN_INTERFACE
  1396.     MAPI_IUNKNOWN_METHODS(PURE)
  1397.     MAPI_IMAPITABLE_METHODS(PURE)
  1398. };
  1399.  
  1400. /* IProfSect Interface ----------------------------------------------------- */
  1401.  
  1402. /* Standard section for public profile properties */
  1403.  
  1404. #define PS_PROFILE_PROPERTIES_INIT \
  1405. {   0x98, 0x15, 0xAC, 0x08, 0xAA, 0xB0, 0x10, 0x1A, \
  1406.     0x8C, 0x93, 0x08, 0x00, 0x2B, 0x2A, 0x56, 0xC2  }
  1407.  
  1408.  
  1409. #define MAPI_IPROFSECT_METHODS(IPURE)
  1410.  
  1411. #undef       INTERFACE
  1412. #define      INTERFACE  IProfSect
  1413. DECLARE_MAPI_INTERFACE_(IProfSect, IMAPIProp)
  1414. {
  1415.     BEGIN_INTERFACE
  1416.     MAPI_IUNKNOWN_METHODS(PURE)
  1417.     MAPI_IMAPIPROP_METHODS(PURE)
  1418.     MAPI_IPROFSECT_METHODS(PURE)
  1419. };
  1420.  
  1421. /* IMAPIStatus Interface --------------------------------------------------- */
  1422.  
  1423. /* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */
  1424.  
  1425. #define MAPI_STORE_PROVIDER     ((ULONG) 33)    /* Message Store */
  1426. #define MAPI_AB                 ((ULONG) 34)    /* Address Book */
  1427. #define MAPI_AB_PROVIDER        ((ULONG) 35)    /* Address Book Provider */
  1428. #define MAPI_TRANSPORT_PROVIDER ((ULONG) 36)    /* Transport Provider */
  1429. #define MAPI_SPOOLER            ((ULONG) 37)    /* Message Spooler */
  1430. #define MAPI_PROFILE_PROVIDER   ((ULONG) 38)    /* Profile Provider */
  1431. #define MAPI_SUBSYSTEM          ((ULONG) 39)    /* Overall Subsystem Status */
  1432. #define MAPI_HOOK_PROVIDER      ((ULONG) 40)    /* Spooler Hook */
  1433.  
  1434. #define STATUS_VALIDATE_STATE   ((ULONG) 0x00000001)
  1435. #define STATUS_SETTINGS_DIALOG  ((ULONG) 0x00000002)
  1436. #define STATUS_CHANGE_PASSWORD  ((ULONG) 0x00000004)
  1437. #define STATUS_FLUSH_QUEUES     ((ULONG) 0x00000008)
  1438.  
  1439. #define STATUS_DEFAULT_OUTBOUND ((ULONG) 0x00000001)
  1440. #define STATUS_DEFAULT_STORE    ((ULONG) 0x00000002)
  1441. #define STATUS_PRIMARY_IDENTITY ((ULONG) 0x00000004)
  1442. #define STATUS_SIMPLE_STORE     ((ULONG) 0x00000008)
  1443. #define STATUS_XP_PREFER_LAST   ((ULONG) 0x00000010)
  1444. #define STATUS_NO_PRIMARY_IDENTITY ((ULONG) 0x00000020)
  1445. #define STATUS_NO_DEFAULT_STORE ((ULONG) 0x00000040)
  1446. #define STATUS_TEMP_SECTION     ((ULONG) 0x00000080)
  1447. #define STATUS_OWN_STORE        ((ULONG) 0x00000100)
  1448. /****** HOOK_INBOUND            ((ULONG) 0x00000200) Defined in MAPIHOOK.H */
  1449. /****** HOOK_OUTBOUND           ((ULONG) 0x00000400) Defined in MAPIHOOK.H */
  1450. #define STATUS_NEED_IPM_TREE    ((ULONG) 0x00000800)
  1451. #define STATUS_PRIMARY_STORE    ((ULONG) 0x00001000)
  1452. #define STATUS_SECONDARY_STORE  ((ULONG) 0x00002000)
  1453.  
  1454.  
  1455. /*
  1456.  * PR_STATUS_CODE bit. Low 16 bits for common values; High 16 bits
  1457.  * for provider type-specific values. (DCR 304)
  1458.  */
  1459.  
  1460. #define STATUS_AVAILABLE        ((ULONG) 0x00000001)
  1461. #define STATUS_OFFLINE          ((ULONG) 0x00000002)
  1462. #define STATUS_FAILURE          ((ULONG) 0x00000004)
  1463.  
  1464. /* Transport values of PR_STATUS_CODE */
  1465.  
  1466. #define STATUS_INBOUND_ENABLED  ((ULONG) 0x00010000)
  1467. #define STATUS_INBOUND_ACTIVE   ((ULONG) 0x00020000)
  1468. #define STATUS_INBOUND_FLUSH    ((ULONG) 0x00040000)
  1469. #define STATUS_OUTBOUND_ENABLED ((ULONG) 0x00100000)
  1470. #define STATUS_OUTBOUND_ACTIVE  ((ULONG) 0x00200000)
  1471. #define STATUS_OUTBOUND_FLUSH   ((ULONG) 0x00400000)
  1472. #define STATUS_REMOTE_ACCESS    ((ULONG) 0x00800000)
  1473.  
  1474. /* ValidateState flags */
  1475.  
  1476. #define SUPPRESS_UI                 ((ULONG) 0x00000001)
  1477. #define REFRESH_XP_HEADER_CACHE     ((ULONG) 0x00010000)
  1478. #define PROCESS_XP_HEADER_CACHE     ((ULONG) 0x00020000)
  1479. #define FORCE_XP_CONNECT            ((ULONG) 0x00040000)
  1480. #define FORCE_XP_DISCONNECT         ((ULONG) 0x00080000)
  1481. #define CONFIG_CHANGED              ((ULONG) 0x00100000)
  1482. #define ABORT_XP_HEADER_OPERATION   ((ULONG) 0x00200000)
  1483. #define SHOW_XP_SESSION_UI          ((ULONG) 0x00400000)
  1484.  
  1485. /* SettingsDialog flags */
  1486.  
  1487. #define UI_READONLY     ((ULONG) 0x00000001)
  1488.  
  1489. /* FlushQueues flags */
  1490.  
  1491. #define FLUSH_UPLOAD        ((ULONG) 0x00000002)
  1492. #define FLUSH_DOWNLOAD      ((ULONG) 0x00000004)
  1493. #define FLUSH_FORCE         ((ULONG) 0x00000008)
  1494. #define FLUSH_NO_UI         ((ULONG) 0x00000010)
  1495. #define FLUSH_ASYNC_OK      ((ULONG) 0x00000020)
  1496.  
  1497. #define MAPI_IMAPISTATUS_METHODS(IPURE)                                 \
  1498.     MAPIMETHOD(ValidateState)                                           \
  1499.         (THIS_  ULONG                       ulUIParam,                  \
  1500.                 ULONG                       ulFlags) IPURE;             \
  1501.     MAPIMETHOD(SettingsDialog)                                          \
  1502.         (THIS_  ULONG                       ulUIParam,                  \
  1503.                 ULONG                       ulFlags) IPURE;             \
  1504.     MAPIMETHOD(ChangePassword)                                          \
  1505.         (THIS_  LPTSTR                      lpOldPass,                  \
  1506.                 LPTSTR                      lpNewPass,                  \
  1507.                 ULONG                       ulFlags) IPURE;             \
  1508.     MAPIMETHOD(FlushQueues)                                             \
  1509.         (THIS_  ULONG                       ulUIParam,                  \
  1510.                 ULONG                       cbTargetTransport,          \
  1511.                 LPENTRYID                   lpTargetTransport,          \
  1512.                 ULONG                       ulFlags) IPURE;             \
  1513.  
  1514. #undef       INTERFACE
  1515. #define      INTERFACE  IMAPIStatus
  1516. DECLARE_MAPI_INTERFACE_(IMAPIStatus, IMAPIProp)
  1517. {
  1518.     BEGIN_INTERFACE
  1519.     MAPI_IUNKNOWN_METHODS(PURE)
  1520.     MAPI_IMAPIPROP_METHODS(PURE)
  1521.     MAPI_IMAPISTATUS_METHODS(PURE)
  1522. };
  1523.  
  1524. /* IMAPIContainer Interface ------------------------------------------------ */
  1525.  
  1526. /* Flags for OpenEntry() */
  1527.  
  1528. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  1529. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1530. #define MAPI_BEST_ACCESS        ((ULONG) 0x00000010)
  1531.  
  1532. /* GetContentsTable() */
  1533. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1534. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1535. /****** MAPI_ASSOCIATED         ((ULONG) 0x00000040) below */
  1536.  
  1537. /* GetHierarchyTable() */
  1538. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1539. #define CONVENIENT_DEPTH        ((ULONG) 0x00000001)
  1540. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1541.  
  1542. /* GetSearchCriteria */
  1543. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1544. #define SEARCH_RUNNING          ((ULONG) 0x00000001)
  1545. #define SEARCH_REBUILD          ((ULONG) 0x00000002)
  1546. #define SEARCH_RECURSIVE        ((ULONG) 0x00000004)
  1547. #define SEARCH_FOREGROUND       ((ULONG) 0x00000008)
  1548.  
  1549. /* SetSearchCriteria */
  1550. #define STOP_SEARCH             ((ULONG) 0x00000001)
  1551. #define RESTART_SEARCH          ((ULONG) 0x00000002)
  1552. #define RECURSIVE_SEARCH        ((ULONG) 0x00000004)
  1553. #define SHALLOW_SEARCH          ((ULONG) 0x00000008)
  1554. #define FOREGROUND_SEARCH       ((ULONG) 0x00000010)
  1555. #define BACKGROUND_SEARCH       ((ULONG) 0x00000020)
  1556.  
  1557. #define MAPI_IMAPICONTAINER_METHODS(IPURE)                              \
  1558.     MAPIMETHOD(GetContentsTable)                                        \
  1559.         (THIS_  ULONG                       ulFlags,                    \
  1560.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  1561.     MAPIMETHOD(GetHierarchyTable)                                       \
  1562.         (THIS_  ULONG                       ulFlags,                    \
  1563.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  1564.     MAPIMETHOD(OpenEntry)                                               \
  1565.         (THIS_  ULONG                       cbEntryID,                  \
  1566.                 LPENTRYID                   lpEntryID,                  \
  1567.                 LPCIID                      lpInterface,                \
  1568.                 ULONG                       ulFlags,                    \
  1569.                 ULONG FAR *                 lpulObjType,                \
  1570.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  1571.     MAPIMETHOD(SetSearchCriteria)                                       \
  1572.         (THIS_  LPSRestriction              lpRestriction,              \
  1573.                 LPENTRYLIST                 lpContainerList,            \
  1574.                 ULONG                       ulSearchFlags) IPURE;       \
  1575.     MAPIMETHOD(GetSearchCriteria)                                       \
  1576.         (THIS_  ULONG                       ulFlags,                    \
  1577.                 LPSRestriction FAR *        lppRestriction,             \
  1578.                 LPENTRYLIST FAR *           lppContainerList,           \
  1579.                 ULONG FAR *                 lpulSearchState)IPURE;      \
  1580.  
  1581. #undef       INTERFACE
  1582. #define      INTERFACE  IMAPIContainer
  1583. DECLARE_MAPI_INTERFACE_(IMAPIContainer, IMAPIProp)
  1584. {
  1585.     BEGIN_INTERFACE
  1586.     MAPI_IUNKNOWN_METHODS(PURE)
  1587.     MAPI_IMAPIPROP_METHODS(PURE)
  1588.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1589. };
  1590.  
  1591. /* IABContainer Interface -------------------------------------------------- */
  1592.  
  1593. /*
  1594.  *  IABContainer PR_CONTAINER_FLAGS values
  1595.  *  If AB_UNMODIFIABLE and AB_MODIFIABLE are both set, it means the container
  1596.  *  doesn't know if it's modifiable or not, and the client should
  1597.  *  try to modify the contents but we won't expect it to work.
  1598.  *  If the AB_RECIPIENTS flag is set and neither AB_MODIFIABLE or AB_UNMODIFIABLE
  1599.  *  bits are set, it is an error.
  1600.  */
  1601.  
  1602. typedef struct _flaglist
  1603. {
  1604.     ULONG cFlags;
  1605.     ULONG ulFlag[MAPI_DIM];
  1606. } FlagList, FAR * LPFlagList;
  1607.  
  1608.  
  1609. /*
  1610.  *  Container flags
  1611.  */
  1612. #define AB_RECIPIENTS           ((ULONG) 0x00000001)
  1613. #define AB_SUBCONTAINERS        ((ULONG) 0x00000002)
  1614. #define AB_MODIFIABLE           ((ULONG) 0x00000004)
  1615. #define AB_UNMODIFIABLE         ((ULONG) 0x00000008)
  1616. #define AB_FIND_ON_OPEN         ((ULONG) 0x00000010)
  1617. #define AB_NOT_DEFAULT          ((ULONG) 0x00000020)
  1618.  
  1619. /* CreateEntry() */
  1620.  
  1621. #define CREATE_CHECK_DUP_STRICT ((ULONG) 0x00000001)
  1622. #define CREATE_CHECK_DUP_LOOSE  ((ULONG) 0x00000002)
  1623. #define CREATE_REPLACE          ((ULONG) 0x00000004)
  1624.  
  1625. /* ResolveNames() - ulFlags */
  1626. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1627.  
  1628. /* ResolveNames() - rgulFlags */
  1629. #define MAPI_UNRESOLVED         ((ULONG) 0x00000000)
  1630. #define MAPI_AMBIGUOUS          ((ULONG) 0x00000001)
  1631. #define MAPI_RESOLVED           ((ULONG) 0x00000002)
  1632.  
  1633.  
  1634. #define MAPI_IABCONTAINER_METHODS(IPURE)                                \
  1635.     MAPIMETHOD(CreateEntry)                                             \
  1636.         (THIS_  ULONG                       cbEntryID,                  \
  1637.                 LPENTRYID                   lpEntryID,                  \
  1638.                 ULONG                       ulCreateFlags,              \
  1639.                 LPMAPIPROP FAR  *           lppMAPIPropEntry) IPURE;    \
  1640.     MAPIMETHOD(CopyEntries)                                             \
  1641.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1642.                 ULONG                       ulUIParam,                  \
  1643.                 LPMAPIPROGRESS              lpProgress,                 \
  1644.                 ULONG                       ulFlags) IPURE;             \
  1645.     MAPIMETHOD(DeleteEntries)                                           \
  1646.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1647.                 ULONG                       ulFlags) IPURE;             \
  1648.     MAPIMETHOD(ResolveNames)                                            \
  1649.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1650.                 ULONG                       ulFlags,                    \
  1651.                 LPADRLIST                   lpAdrList,                  \
  1652.                 LPFlagList                  lpFlagList) IPURE;          \
  1653.  
  1654. #undef       INTERFACE
  1655. #define      INTERFACE  IABContainer
  1656. DECLARE_MAPI_INTERFACE_(IABContainer, IMAPIContainer)
  1657. {
  1658.     BEGIN_INTERFACE
  1659.     MAPI_IUNKNOWN_METHODS(PURE)
  1660.     MAPI_IMAPIPROP_METHODS(PURE)
  1661.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1662.     MAPI_IABCONTAINER_METHODS(PURE)
  1663. };
  1664.  
  1665. /* IMailUser Interface ----------------------------------------------------- */
  1666.  
  1667. /*  Any call which can create a one-off entryID (i.e. MAPISupport::CreateOneOff
  1668.     or IAddrBook::CreateOneOff) can encode the value for PR_SEND_RICH_INFO by
  1669.     passing in the following flag in the ulFlags parameter.  Setting this flag
  1670.     indicates that PR_SEND_RICH_INFO will be FALSE.
  1671. */
  1672. #define MAPI_SEND_NO_RICH_INFO      ((ULONG) 0x00010000)
  1673.  
  1674.  
  1675.  
  1676.  
  1677. /* Values of PR_NDR_DIAG_CODE */
  1678.  
  1679. #define MAPI_DIAG(_code)    ((LONG) _code)
  1680.  
  1681. #define MAPI_DIAG_NO_DIAGNOSTIC                     MAPI_DIAG( -1 )
  1682. #define MAPI_DIAG_OR_NAME_UNRECOGNIZED              MAPI_DIAG( 0 )
  1683. #define MAPI_DIAG_OR_NAME_AMBIGUOUS                 MAPI_DIAG( 1 )
  1684. #define MAPI_DIAG_MTS_CONGESTED                     MAPI_DIAG( 2 )
  1685. #define MAPI_DIAG_LOOP_DETECTED                     MAPI_DIAG( 3 )
  1686. #define MAPI_DIAG_RECIPIENT_UNAVAILABLE             MAPI_DIAG( 4 )
  1687. #define MAPI_DIAG_MAXIMUM_TIME_EXPIRED              MAPI_DIAG( 5 )
  1688. #define MAPI_DIAG_EITS_UNSUPPORTED                  MAPI_DIAG( 6 )
  1689. #define MAPI_DIAG_CONTENT_TOO_LONG                  MAPI_DIAG( 7 )
  1690. #define MAPI_DIAG_IMPRACTICAL_TO_CONVERT            MAPI_DIAG( 8 )
  1691. #define MAPI_DIAG_PROHIBITED_TO_CONVERT             MAPI_DIAG( 9 )
  1692. #define MAPI_DIAG_CONVERSION_UNSUBSCRIBED           MAPI_DIAG( 10 )
  1693. #define MAPI_DIAG_PARAMETERS_INVALID                MAPI_DIAG( 11 )
  1694. #define MAPI_DIAG_CONTENT_SYNTAX_IN_ERROR           MAPI_DIAG( 12 )
  1695. #define MAPI_DIAG_LENGTH_CONSTRAINT_VIOLATD         MAPI_DIAG( 13 )
  1696. #define MAPI_DIAG_NUMBER_CONSTRAINT_VIOLATD         MAPI_DIAG( 14 )
  1697. #define MAPI_DIAG_CONTENT_TYPE_UNSUPPORTED          MAPI_DIAG( 15 )
  1698. #define MAPI_DIAG_TOO_MANY_RECIPIENTS               MAPI_DIAG( 16 )
  1699. #define MAPI_DIAG_NO_BILATERAL_AGREEMENT            MAPI_DIAG( 17 )
  1700. #define MAPI_DIAG_CRITICAL_FUNC_UNSUPPORTED         MAPI_DIAG( 18 )
  1701. #define MAPI_DIAG_CONVERSION_LOSS_PROHIB            MAPI_DIAG( 19 )
  1702. #define MAPI_DIAG_LINE_TOO_LONG                     MAPI_DIAG( 20 )
  1703. #define MAPI_DIAG_PAGE_TOO_LONG                     MAPI_DIAG( 21 )
  1704. #define MAPI_DIAG_PICTORIAL_SYMBOL_LOST             MAPI_DIAG( 22 )
  1705. #define MAPI_DIAG_PUNCTUATION_SYMBOL_LOST           MAPI_DIAG( 23 )
  1706. #define MAPI_DIAG_ALPHABETIC_CHARACTER_LOST         MAPI_DIAG( 24 )
  1707. #define MAPI_DIAG_MULTIPLE_INFO_LOSSES              MAPI_DIAG( 25 )
  1708. #define MAPI_DIAG_REASSIGNMENT_PROHIBITED           MAPI_DIAG( 26 )
  1709. #define MAPI_DIAG_REDIRECTION_LOOP_DETECTED         MAPI_DIAG( 27 )
  1710. #define MAPI_DIAG_EXPANSION_PROHIBITED              MAPI_DIAG( 28 )
  1711. #define MAPI_DIAG_SUBMISSION_PROHIBITED             MAPI_DIAG( 29 )
  1712. #define MAPI_DIAG_EXPANSION_FAILED                  MAPI_DIAG( 30 )
  1713. #define MAPI_DIAG_RENDITION_UNSUPPORTED             MAPI_DIAG( 31 )
  1714. #define MAPI_DIAG_MAIL_ADDRESS_INCORRECT            MAPI_DIAG( 32 )
  1715. #define MAPI_DIAG_MAIL_OFFICE_INCOR_OR_INVD         MAPI_DIAG( 33 )
  1716. #define MAPI_DIAG_MAIL_ADDRESS_INCOMPLETE           MAPI_DIAG( 34 )
  1717. #define MAPI_DIAG_MAIL_RECIPIENT_UNKNOWN            MAPI_DIAG( 35 )
  1718. #define MAPI_DIAG_MAIL_RECIPIENT_DECEASED           MAPI_DIAG( 36 )
  1719. #define MAPI_DIAG_MAIL_ORGANIZATION_EXPIRED         MAPI_DIAG( 37 )
  1720. #define MAPI_DIAG_MAIL_REFUSED                      MAPI_DIAG( 38 )
  1721. #define MAPI_DIAG_MAIL_UNCLAIMED                    MAPI_DIAG( 39 )
  1722. #define MAPI_DIAG_MAIL_RECIPIENT_MOVED              MAPI_DIAG( 40 )
  1723. #define MAPI_DIAG_MAIL_RECIPIENT_TRAVELLING         MAPI_DIAG( 41 )
  1724. #define MAPI_DIAG_MAIL_RECIPIENT_DEPARTED           MAPI_DIAG( 42 )
  1725. #define MAPI_DIAG_MAIL_NEW_ADDRESS_UNKNOWN          MAPI_DIAG( 43 )
  1726. #define MAPI_DIAG_MAIL_FORWARDING_UNWANTED          MAPI_DIAG( 44 )
  1727. #define MAPI_DIAG_MAIL_FORWARDING_PROHIB            MAPI_DIAG( 45 )
  1728. #define MAPI_DIAG_SECURE_MESSAGING_ERROR            MAPI_DIAG( 46 )
  1729. #define MAPI_DIAG_DOWNGRADING_IMPOSSIBLE            MAPI_DIAG( 47 )
  1730.  
  1731.  
  1732. #define MAPI_IMAILUSER_METHODS(IPURE)
  1733.  
  1734. #undef       INTERFACE
  1735. #define      INTERFACE  IMailUser
  1736. DECLARE_MAPI_INTERFACE_(IMailUser, IMAPIProp)
  1737. {
  1738.     BEGIN_INTERFACE
  1739.     MAPI_IUNKNOWN_METHODS(PURE)
  1740.     MAPI_IMAPIPROP_METHODS(PURE)
  1741.     MAPI_IMAILUSER_METHODS(PURE)
  1742. };
  1743.  
  1744. /* IDistList Interface ----------------------------------------------------- */
  1745.  
  1746. #define MAPI_IDISTLIST_METHODS(IPURE)                                   \
  1747.     MAPIMETHOD(CreateEntry)                                             \
  1748.         (THIS_  ULONG                       cbEntryID,                  \
  1749.                 LPENTRYID                   lpEntryID,                  \
  1750.                 ULONG                       ulCreateFlags,              \
  1751.                 LPMAPIPROP FAR  *           lppMAPIPropEntry) IPURE;    \
  1752.     MAPIMETHOD(CopyEntries)                                             \
  1753.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1754.                 ULONG                       ulUIParam,                  \
  1755.                 LPMAPIPROGRESS              lpProgress,                 \
  1756.                 ULONG                       ulFlags) IPURE;             \
  1757.     MAPIMETHOD(DeleteEntries)                                           \
  1758.         (THIS_  LPENTRYLIST                 lpEntries,                  \
  1759.                 ULONG                       ulFlags) IPURE;             \
  1760.     MAPIMETHOD(ResolveNames)                                            \
  1761.         (THIS_  LPSPropTagArray             lpPropTagArray,             \
  1762.                 ULONG                       ulFlags,                    \
  1763.                 LPADRLIST                   lpAdrList,                  \
  1764.                 LPFlagList                  lpFlagList) IPURE;          \
  1765.  
  1766. #undef       INTERFACE
  1767. #define      INTERFACE  IDistList
  1768. DECLARE_MAPI_INTERFACE_(IDistList, IMAPIContainer)
  1769. {
  1770.     BEGIN_INTERFACE
  1771.     MAPI_IUNKNOWN_METHODS(PURE)
  1772.     MAPI_IMAPIPROP_METHODS(PURE)
  1773.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1774.     MAPI_IDISTLIST_METHODS(PURE)
  1775. };
  1776.  
  1777. /* IMAPIFolder Interface --------------------------------------------------- */
  1778.  
  1779. /* IMAPIFolder folder type (enum) */
  1780.  
  1781. #define FOLDER_ROOT             ((ULONG) 0x00000000)
  1782. #define FOLDER_GENERIC          ((ULONG) 0x00000001)
  1783. #define FOLDER_SEARCH           ((ULONG) 0x00000002)
  1784.  
  1785. /* CreateMessage */
  1786. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1787. /****** MAPI_ASSOCIATED         ((ULONG) 0x00000040) below */
  1788.  
  1789. /* CopyMessages */
  1790.  
  1791. #define MESSAGE_MOVE            ((ULONG) 0x00000001)
  1792. #define MESSAGE_DIALOG          ((ULONG) 0x00000002)
  1793. /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
  1794.  
  1795. /* CreateFolder */
  1796.  
  1797. #define OPEN_IF_EXISTS          ((ULONG) 0x00000001)
  1798. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1799. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1800.  
  1801. /* DeleteFolder */
  1802.  
  1803. #define DEL_MESSAGES            ((ULONG) 0x00000001)
  1804. #define FOLDER_DIALOG           ((ULONG) 0x00000002)
  1805. #define DEL_FOLDERS             ((ULONG) 0x00000004)
  1806.  
  1807. /* EmptyFolder */
  1808. #define DEL_ASSOCIATED          ((ULONG) 0x00000008)
  1809.  
  1810. /* CopyFolder */
  1811.  
  1812. #define FOLDER_MOVE             ((ULONG) 0x00000001)
  1813. /****** FOLDER_DIALOG           ((ULONG) 0x00000002) above */
  1814. /****** MAPI_DECLINE_OK         ((ULONG) 0x00000004) above */
  1815. #define COPY_SUBFOLDERS         ((ULONG) 0x00000010)
  1816. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1817.  
  1818.  
  1819. /* SetReadFlags */
  1820.  
  1821. /****** SUPPRESS_RECEIPT        ((ULONG) 0x00000001) below */
  1822. /****** MESSAGE_DIALOG          ((ULONG) 0x00000002) above */
  1823. /****** CLEAR_READ_FLAG         ((ULONG) 0x00000004) below */
  1824. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1825. #define GENERATE_RECEIPT_ONLY   ((ULONG) 0x00000010)
  1826.  
  1827.  
  1828. /* GetMessageStatus */
  1829.  
  1830. #define MSGSTATUS_HIGHLIGHTED   ((ULONG) 0x00000001)
  1831. #define MSGSTATUS_TAGGED        ((ULONG) 0x00000002)
  1832. #define MSGSTATUS_HIDDEN        ((ULONG) 0x00000004)
  1833. #define MSGSTATUS_DELMARKED     ((ULONG) 0x00000008)
  1834.  
  1835. /* Bits for remote message status */
  1836.  
  1837. #define MSGSTATUS_REMOTE_DOWNLOAD   ((ULONG) 0x00001000)
  1838. #define MSGSTATUS_REMOTE_DELETE     ((ULONG) 0x00002000)
  1839.  
  1840. /* SaveContentsSort */
  1841.  
  1842. #define RECURSIVE_SORT          ((ULONG) 0x00000002)
  1843.  
  1844. /* PR_STATUS property */
  1845.  
  1846. #define FLDSTATUS_HIGHLIGHTED   ((ULONG) 0x00000001)
  1847. #define FLDSTATUS_TAGGED        ((ULONG) 0x00000002)
  1848. #define FLDSTATUS_HIDDEN        ((ULONG) 0x00000004)
  1849. #define FLDSTATUS_DELMARKED     ((ULONG) 0x00000008)
  1850.  
  1851. #define MAPI_IMAPIFOLDER_METHODS(IPURE)                                 \
  1852.     MAPIMETHOD(CreateMessage)                                           \
  1853.         (THIS_  LPCIID                      lpInterface,                \
  1854.                 ULONG                       ulFlags,                    \
  1855.                 LPMESSAGE FAR *             lppMessage) IPURE;          \
  1856.     MAPIMETHOD(CopyMessages)                                            \
  1857.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1858.                 LPCIID                      lpInterface,                \
  1859.                 LPVOID                      lpDestFolder,               \
  1860.                 ULONG                       ulUIParam,                  \
  1861.                 LPMAPIPROGRESS              lpProgress,                 \
  1862.                 ULONG                       ulFlags) IPURE;             \
  1863.     MAPIMETHOD(DeleteMessages)                                          \
  1864.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1865.                 ULONG                       ulUIParam,                  \
  1866.                 LPMAPIPROGRESS              lpProgress,                 \
  1867.                 ULONG                       ulFlags) IPURE;             \
  1868.     MAPIMETHOD(CreateFolder)                                            \
  1869.         (THIS_  ULONG                       ulFolderType,               \
  1870.                 LPTSTR                      lpszFolderName,             \
  1871.                 LPTSTR                      lpszFolderComment,          \
  1872.                 LPCIID                      lpInterface,                \
  1873.                 ULONG                       ulFlags,                    \
  1874.                 LPMAPIFOLDER FAR *          lppFolder) IPURE;           \
  1875.     MAPIMETHOD(CopyFolder)                                              \
  1876.         (THIS_  ULONG                       cbEntryID,                  \
  1877.                 LPENTRYID                   lpEntryID,                  \
  1878.                 LPCIID                      lpInterface,                \
  1879.                 LPVOID                      lpDestFolder,               \
  1880.                 LPTSTR                      lpszNewFolderName,          \
  1881.                 ULONG                       ulUIParam,                  \
  1882.                 LPMAPIPROGRESS              lpProgress,                 \
  1883.                 ULONG                       ulFlags) IPURE;             \
  1884.     MAPIMETHOD(DeleteFolder)                                            \
  1885.         (THIS_  ULONG                       cbEntryID,                  \
  1886.                 LPENTRYID                   lpEntryID,                  \
  1887.                 ULONG                       ulUIParam,                  \
  1888.                 LPMAPIPROGRESS              lpProgress,                 \
  1889.                 ULONG                       ulFlags) IPURE;             \
  1890.     MAPIMETHOD(SetReadFlags)                                            \
  1891.         (THIS_  LPENTRYLIST                 lpMsgList,                  \
  1892.                 ULONG                       ulUIParam,                  \
  1893.                 LPMAPIPROGRESS              lpProgress,                 \
  1894.                 ULONG                       ulFlags) IPURE;             \
  1895.     MAPIMETHOD(GetMessageStatus)                                        \
  1896.         (THIS_  ULONG                       cbEntryID,                  \
  1897.                 LPENTRYID                   lpEntryID,                  \
  1898.                 ULONG                       ulFlags,                    \
  1899.                 ULONG FAR *                 lpulMessageStatus) IPURE;   \
  1900.     MAPIMETHOD(SetMessageStatus)                                        \
  1901.         (THIS_  ULONG                       cbEntryID,                  \
  1902.                 LPENTRYID                   lpEntryID,                  \
  1903.                 ULONG                       ulNewStatus,                \
  1904.                 ULONG                       ulNewStatusMask,            \
  1905.                 ULONG FAR *                 lpulOldStatus) IPURE;       \
  1906.     MAPIMETHOD(SaveContentsSort)                                        \
  1907.         (THIS_  LPSSortOrderSet             lpSortCriteria,             \
  1908.                 ULONG                       ulFlags) IPURE;             \
  1909.     MAPIMETHOD(EmptyFolder)                                             \
  1910.         (THIS_  ULONG                       ulUIParam,                  \
  1911.                 LPMAPIPROGRESS              lpProgress,                 \
  1912.                 ULONG                       ulFlags) IPURE;             \
  1913.  
  1914. #undef       INTERFACE
  1915. #define      INTERFACE  IMAPIFolder
  1916. DECLARE_MAPI_INTERFACE_(IMAPIFolder, IMAPIContainer)
  1917. {
  1918.     BEGIN_INTERFACE
  1919.     MAPI_IUNKNOWN_METHODS(PURE)
  1920.     MAPI_IMAPIPROP_METHODS(PURE)
  1921.     MAPI_IMAPICONTAINER_METHODS(PURE)
  1922.     MAPI_IMAPIFOLDER_METHODS(PURE)
  1923. };
  1924.  
  1925. /* IMsgStore Interface ----------------------------------------------------- */
  1926.  
  1927. /*  PR_STORE_SUPPORT_MASK bits */
  1928. #define STORE_ENTRYID_UNIQUE    ((ULONG) 0x00000001)
  1929. #define STORE_READONLY          ((ULONG) 0x00000002)
  1930. #define STORE_SEARCH_OK         ((ULONG) 0x00000004)
  1931. #define STORE_MODIFY_OK         ((ULONG) 0x00000008)
  1932. #define STORE_CREATE_OK         ((ULONG) 0x00000010)
  1933. #define STORE_ATTACH_OK         ((ULONG) 0x00000020)
  1934. #define STORE_OLE_OK            ((ULONG) 0x00000040)
  1935. #define STORE_SUBMIT_OK         ((ULONG) 0x00000080)
  1936. #define STORE_NOTIFY_OK         ((ULONG) 0x00000100)
  1937. #define STORE_MV_PROPS_OK       ((ULONG) 0x00000200)
  1938. #define STORE_CATEGORIZE_OK     ((ULONG) 0x00000400)
  1939. #define STORE_RTF_OK            ((ULONG) 0x00000800)
  1940. #define STORE_RESTRICTION_OK    ((ULONG) 0x00001000)
  1941. #define STORE_SORT_OK           ((ULONG) 0x00002000)
  1942.  
  1943. /* PR_STORE_STATE bits, try not to collide with PR_STORE_SUPPORT_MASK */
  1944.  
  1945. #define STORE_HAS_SEARCHES      ((ULONG) 0x01000000)
  1946.  
  1947.  
  1948. /* OpenEntry() */
  1949.  
  1950. /****** MAPI_MODIFY             ((ULONG) 0x00000001) above */
  1951. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1952. /****** MAPI_BEST_ACCESS        ((ULONG) 0x00000010) above */
  1953.  
  1954. /* SetReceiveFolder() */
  1955.  
  1956. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1957.  
  1958. /* GetReceiveFolder() */
  1959.  
  1960. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  1961.  
  1962. /* GetReceiveFolderTable() */
  1963.  
  1964. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  1965.  
  1966. /* StoreLogoff() */
  1967.  
  1968. #define LOGOFF_NO_WAIT          ((ULONG) 0x00000001)
  1969. #define LOGOFF_ORDERLY          ((ULONG) 0x00000002)
  1970. #define LOGOFF_PURGE            ((ULONG) 0x00000004)
  1971. #define LOGOFF_ABORT            ((ULONG) 0x00000008)
  1972. #define LOGOFF_QUIET            ((ULONG) 0x00000010)
  1973.  
  1974. #define LOGOFF_COMPLETE         ((ULONG) 0x00010000)
  1975. #define LOGOFF_INBOUND          ((ULONG) 0x00020000)
  1976. #define LOGOFF_OUTBOUND         ((ULONG) 0x00040000)
  1977. #define LOGOFF_OUTBOUND_QUEUE   ((ULONG) 0x00080000)
  1978.  
  1979. /* SetLockState() */
  1980.  
  1981. #define MSG_LOCKED              ((ULONG) 0x00000001)
  1982. #define MSG_UNLOCKED            ((ULONG) 0x00000000)
  1983.  
  1984. /* Flag bits for PR_VALID_FOLDER_MASK */
  1985.  
  1986. #define FOLDER_IPM_SUBTREE_VALID        ((ULONG) 0x00000001)
  1987. #define FOLDER_IPM_INBOX_VALID          ((ULONG) 0x00000002)
  1988. #define FOLDER_IPM_OUTBOX_VALID         ((ULONG) 0x00000004)
  1989. #define FOLDER_IPM_WASTEBASKET_VALID    ((ULONG) 0x00000008)
  1990. #define FOLDER_IPM_SENTMAIL_VALID       ((ULONG) 0x00000010)
  1991. #define FOLDER_VIEWS_VALID              ((ULONG) 0x00000020)
  1992. #define FOLDER_COMMON_VIEWS_VALID       ((ULONG) 0x00000040)
  1993. #define FOLDER_FINDER_VALID             ((ULONG) 0x00000080)
  1994.  
  1995. #define MAPI_IMSGSTORE_METHODS(IPURE)                                   \
  1996.     MAPIMETHOD(Advise)                                                  \
  1997.         (THIS_  ULONG                       cbEntryID,                  \
  1998.                 LPENTRYID                   lpEntryID,                  \
  1999.                 ULONG                       ulEventMask,                \
  2000.                 LPMAPIADVISESINK            lpAdviseSink,               \
  2001.                 ULONG FAR *                 lpulConnection) IPURE;      \
  2002.     MAPIMETHOD(Unadvise)                                                \
  2003.         (THIS_  ULONG                       ulConnection) IPURE;        \
  2004.     MAPIMETHOD(CompareEntryIDs)                                         \
  2005.         (THIS_  ULONG                       cbEntryID1,                 \
  2006.                 LPENTRYID                   lpEntryID1,                 \
  2007.                 ULONG                       cbEntryID2,                 \
  2008.                 LPENTRYID                   lpEntryID2,                 \
  2009.                 ULONG                       ulFlags,                    \
  2010.                 ULONG FAR *                 lpulResult) IPURE;          \
  2011.     MAPIMETHOD(OpenEntry)                                               \
  2012.         (THIS_  ULONG                       cbEntryID,                  \
  2013.                 LPENTRYID                   lpEntryID,                  \
  2014.                 LPCIID                      lpInterface,                \
  2015.                 ULONG                       ulFlags,                    \
  2016.                 ULONG FAR *                 lpulObjType,                \
  2017.                 LPUNKNOWN FAR *             lppUnk) IPURE;              \
  2018.     MAPIMETHOD(SetReceiveFolder)                                        \
  2019.         (THIS_  LPTSTR                      lpszMessageClass,           \
  2020.                 ULONG                       ulFlags,                    \
  2021.                 ULONG                       cbEntryID,                  \
  2022.                 LPENTRYID                   lpEntryID) IPURE;           \
  2023.     MAPIMETHOD(GetReceiveFolder)                                        \
  2024.         (THIS_  LPTSTR                      lpszMessageClass,           \
  2025.                 ULONG                       ulFlags,                    \
  2026.                 ULONG FAR *                 lpcbEntryID,                \
  2027.                 LPENTRYID FAR *             lppEntryID,                 \
  2028.                 LPTSTR FAR *                lppszExplicitClass) IPURE;  \
  2029.     MAPIMETHOD(GetReceiveFolderTable)                                   \
  2030.         (THIS_  ULONG                       ulFlags,                    \
  2031.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2032.     MAPIMETHOD(StoreLogoff)                                             \
  2033.         (THIS_  ULONG FAR *                 lpulFlags) IPURE;           \
  2034.     MAPIMETHOD(AbortSubmit)                                             \
  2035.         (THIS_  ULONG                       cbEntryID,                  \
  2036.                 LPENTRYID                   lpEntryID,                  \
  2037.                 ULONG                       ulFlags) IPURE;             \
  2038.     MAPIMETHOD(GetOutgoingQueue)                                        \
  2039.         (THIS_  ULONG                       ulFlags,                    \
  2040.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2041.     MAPIMETHOD(SetLockState)                                            \
  2042.         (THIS_  LPMESSAGE                   lpMessage,                  \
  2043.                 ULONG                       ulLockState) IPURE;         \
  2044.     MAPIMETHOD(FinishedMsg)                                             \
  2045.         (THIS_  ULONG                       ulFlags,                    \
  2046.                 ULONG                       cbEntryID,                  \
  2047.                 LPENTRYID                   lpEntryID) IPURE;           \
  2048.     MAPIMETHOD(NotifyNewMail)                                           \
  2049.         (THIS_  LPNOTIFICATION              lpNotification) IPURE;      \
  2050.  
  2051. #undef       INTERFACE
  2052. #define      INTERFACE  IMsgStore
  2053. DECLARE_MAPI_INTERFACE_(IMsgStore, IMAPIProp)
  2054. {
  2055.     BEGIN_INTERFACE
  2056.     MAPI_IUNKNOWN_METHODS(PURE)
  2057.     MAPI_IMAPIPROP_METHODS(PURE)
  2058.     MAPI_IMSGSTORE_METHODS(PURE)
  2059. };
  2060.  
  2061. /* IMessage Interface ------------------------------------------------------ */
  2062.  
  2063. /* SubmitMessage */
  2064.  
  2065. #define FORCE_SUBMIT                ((ULONG) 0x00000001)
  2066.  
  2067. /* Flags defined in PR_MESSAGE_FLAGS */
  2068.  
  2069. #define MSGFLAG_READ            ((ULONG) 0x00000001)
  2070. #define MSGFLAG_UNMODIFIED      ((ULONG) 0x00000002)
  2071. #define MSGFLAG_SUBMIT          ((ULONG) 0x00000004)
  2072. #define MSGFLAG_UNSENT          ((ULONG) 0x00000008)
  2073. #define MSGFLAG_HASATTACH       ((ULONG) 0x00000010)
  2074. #define MSGFLAG_FROMME          ((ULONG) 0x00000020)
  2075. #define MSGFLAG_ASSOCIATED      ((ULONG) 0x00000040)
  2076. #define MSGFLAG_RESEND          ((ULONG) 0x00000080)
  2077. #define MSGFLAG_RN_PENDING        ((ULONG) 0x00000100)
  2078. #define MSGFLAG_NRN_PENDING        ((ULONG) 0x00000200)
  2079.  
  2080. /* Flags defined in PR_SUBMIT_FLAGS */
  2081.  
  2082. #define SUBMITFLAG_LOCKED       ((ULONG) 0x00000001)
  2083. #define SUBMITFLAG_PREPROCESS   ((ULONG) 0x00000002)
  2084.  
  2085. /* GetAttachmentTable() */
  2086. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2087.  
  2088. /* GetRecipientTable() */
  2089. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2090.  
  2091. /* ModifyRecipients */
  2092.  
  2093. /* ((ULONG) 0x00000001 is not a valid flag on ModifyRecipients. */
  2094. #define MODRECIP_ADD            ((ULONG) 0x00000002)
  2095. #define MODRECIP_MODIFY         ((ULONG) 0x00000004)
  2096. #define MODRECIP_REMOVE         ((ULONG) 0x00000008)
  2097.  
  2098. /* SetReadFlag */
  2099.  
  2100. #define SUPPRESS_RECEIPT        ((ULONG) 0x00000001)
  2101. #define CLEAR_READ_FLAG         ((ULONG) 0x00000004)
  2102. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) below */
  2103. /****** GENERATE_RECEIPT_ONLY   ((ULONG) 0x00000010) above */
  2104. #define GENERATE_RECEIPT_ONLY    ((ULONG) 0x00000010)
  2105. #define CLEAR_RN_PENDING        ((ULONG) 0x00000020)
  2106. #define CLEAR_NRN_PENDING        ((ULONG) 0x00000040)
  2107.  
  2108. /* DeleteAttach */
  2109.  
  2110. #define ATTACH_DIALOG           ((ULONG) 0x00000001)
  2111.  
  2112. /* PR_SECURITY values */
  2113. #define SECURITY_SIGNED         ((ULONG) 0x00000001)
  2114. #define SECURITY_ENCRYPTED      ((ULONG) 0x00000002)
  2115.  
  2116. /* PR_PRIORITY values */
  2117. #define PRIO_URGENT             ((long)  1)
  2118. #define PRIO_NORMAL             ((long)  0)
  2119. #define PRIO_NONURGENT          ((long) -1)
  2120.  
  2121. /* PR_SENSITIVITY values */
  2122. #define SENSITIVITY_NONE                    ((ULONG) 0x00000000)
  2123. #define SENSITIVITY_PERSONAL                ((ULONG) 0x00000001)
  2124. #define SENSITIVITY_PRIVATE                 ((ULONG) 0x00000002)
  2125. #define SENSITIVITY_COMPANY_CONFIDENTIAL    ((ULONG) 0x00000003)
  2126.  
  2127. /* PR_IMPORTANCE values */
  2128. #define IMPORTANCE_LOW          ((long) 0)
  2129. #define IMPORTANCE_NORMAL       ((long) 1)
  2130. #define IMPORTANCE_HIGH         ((long) 2)
  2131.  
  2132. #define MAPI_IMESSAGE_METHODS(IPURE)                                    \
  2133.     MAPIMETHOD(GetAttachmentTable)                                      \
  2134.         (THIS_  ULONG                       ulFlags,                    \
  2135.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2136.     MAPIMETHOD(OpenAttach)                                              \
  2137.         (THIS_  ULONG                       ulAttachmentNum,            \
  2138.                 LPCIID                      lpInterface,                \
  2139.                 ULONG                       ulFlags,                    \
  2140.                 LPATTACH FAR *              lppAttach) IPURE;           \
  2141.     MAPIMETHOD(CreateAttach)                                            \
  2142.         (THIS_  LPCIID                      lpInterface,                \
  2143.                 ULONG                       ulFlags,                    \
  2144.                 ULONG FAR *                 lpulAttachmentNum,          \
  2145.                 LPATTACH FAR *              lppAttach) IPURE;           \
  2146.     MAPIMETHOD(DeleteAttach)                                            \
  2147.         (THIS_  ULONG                       ulAttachmentNum,            \
  2148.                 ULONG                       ulUIParam,                  \
  2149.                 LPMAPIPROGRESS              lpProgress,                 \
  2150.                 ULONG                       ulFlags) IPURE;             \
  2151.     MAPIMETHOD(GetRecipientTable)                                       \
  2152.         (THIS_  ULONG                       ulFlags,                    \
  2153.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2154.     MAPIMETHOD(ModifyRecipients)                                        \
  2155.         (THIS_  ULONG                       ulFlags,                    \
  2156.                 LPADRLIST                   lpMods) IPURE;              \
  2157.     MAPIMETHOD(SubmitMessage)                                           \
  2158.         (THIS_  ULONG                       ulFlags) IPURE;             \
  2159.     MAPIMETHOD(SetReadFlag)                                             \
  2160.         (THIS_  ULONG                       ulFlags) IPURE;             \
  2161.  
  2162. #undef       INTERFACE
  2163. #define      INTERFACE  IMessage
  2164. DECLARE_MAPI_INTERFACE_(IMessage, IMAPIProp)
  2165. {
  2166.     BEGIN_INTERFACE
  2167.     MAPI_IUNKNOWN_METHODS(PURE)
  2168.     MAPI_IMAPIPROP_METHODS(PURE)
  2169.     MAPI_IMESSAGE_METHODS(PURE)
  2170. };
  2171.  
  2172. /* IAttach Interface ------------------------------------------------------- */
  2173.  
  2174. /* IAttach attachment methods: PR_ATTACH_METHOD values */
  2175.  
  2176. #define NO_ATTACHMENT           ((ULONG) 0x00000000)
  2177. #define ATTACH_BY_VALUE         ((ULONG) 0x00000001)
  2178. #define ATTACH_BY_REFERENCE     ((ULONG) 0x00000002)
  2179. #define ATTACH_BY_REF_RESOLVE   ((ULONG) 0x00000003)
  2180. #define ATTACH_BY_REF_ONLY      ((ULONG) 0x00000004)
  2181. #define ATTACH_EMBEDDED_MSG     ((ULONG) 0x00000005)
  2182. #define ATTACH_OLE              ((ULONG) 0x00000006)
  2183.  
  2184. #define MAPI_IATTACH_METHODS(IPURE)
  2185.  
  2186. #undef       INTERFACE
  2187. #define      INTERFACE  IAttach
  2188. DECLARE_MAPI_INTERFACE_(IAttach, IMAPIProp)
  2189. {
  2190.     BEGIN_INTERFACE
  2191.     MAPI_IUNKNOWN_METHODS(PURE)
  2192.     MAPI_IMAPIPROP_METHODS(PURE)
  2193.     MAPI_IATTACH_METHODS(PURE)
  2194. };
  2195.  
  2196. /* --------------------------------- */
  2197. /* Address Book interface definition */
  2198.  
  2199. /* ADRPARM ulFlags - top 4 bits used for versioning */
  2200.  
  2201. #define GET_ADRPARM_VERSION(ulFlags)  (((ULONG)ulFlags) & 0xF0000000)
  2202. #define SET_ADRPARM_VERSION(ulFlags, ulVersion)  (((ULONG)ulVersion) | (((ULONG)ulFlags) & 0x0FFFFFFF))
  2203.  
  2204. /*  Current versions of ADRPARM  */
  2205. #define ADRPARM_HELP_CTX        ((ULONG) 0x00000000)
  2206.  
  2207.  
  2208. /*  ulFlags   - bit fields */
  2209. #define DIALOG_MODAL            ((ULONG) 0x00000001)
  2210. #define DIALOG_SDI              ((ULONG) 0x00000002)
  2211. #define DIALOG_OPTIONS          ((ULONG) 0x00000004)
  2212. #define ADDRESS_ONE             ((ULONG) 0x00000008)
  2213. #define AB_SELECTONLY           ((ULONG) 0x00000010)
  2214. #define AB_RESOLVE              ((ULONG) 0x00000020)
  2215.  
  2216. /* --------------------------------- */
  2217. /*  PR_DISPLAY_TYPEs                 */
  2218. /*
  2219.  *  These standard display types are
  2220.  *  by default handled by MAPI.
  2221.  *  They have default icons associated
  2222.  *  with them.
  2223.  */
  2224.  
  2225. /*  For address book contents tables */
  2226. #define DT_MAILUSER         ((ULONG) 0x00000000)
  2227. #define DT_DISTLIST         ((ULONG) 0x00000001)
  2228. #define DT_FORUM            ((ULONG) 0x00000002)
  2229. #define DT_AGENT            ((ULONG) 0x00000003)
  2230. #define DT_ORGANIZATION     ((ULONG) 0x00000004)
  2231. #define DT_PRIVATE_DISTLIST ((ULONG) 0x00000005)
  2232. #define DT_REMOTE_MAILUSER  ((ULONG) 0x00000006)
  2233.  
  2234. /*  For address book hierarchy tables */
  2235. #define DT_MODIFIABLE       ((ULONG) 0x00010000)
  2236. #define DT_GLOBAL           ((ULONG) 0x00020000)
  2237. #define DT_LOCAL            ((ULONG) 0x00030000)
  2238. #define DT_WAN              ((ULONG) 0x00040000)
  2239. #define DT_NOT_SPECIFIC     ((ULONG) 0x00050000)
  2240.  
  2241. /*  For folder hierarchy tables */
  2242. #define DT_FOLDER           ((ULONG) 0x01000000)
  2243. #define DT_FOLDER_LINK      ((ULONG) 0x02000000)
  2244.  
  2245. /*  Accelerator callback for DIALOG_SDI form of AB UI */
  2246. typedef BOOL (STDMETHODCALLTYPE ACCELERATEABSDI)(ULONG ulUIParam,
  2247.                                                 LPVOID lpvmsg);
  2248. typedef ACCELERATEABSDI FAR * LPFNABSDI;
  2249.  
  2250. /*  Callback to application telling it that the DIALOG_SDI form of the */
  2251. /*  AB UI has been dismissed.  This is so that the above LPFNABSDI     */
  2252. /*  function doesn't keep being called.                                */
  2253. typedef void (STDMETHODCALLTYPE DISMISSMODELESS)(ULONG ulUIParam,
  2254.                                                 LPVOID lpvContext);
  2255. typedef DISMISSMODELESS FAR * LPFNDISMISS;
  2256.  
  2257. /*
  2258.  * Prototype for the client function hooked to an optional button on
  2259.  * the address book dialog
  2260.  */
  2261.  
  2262. typedef SCODE (STDMETHODCALLTYPE FAR * LPFNBUTTON)(
  2263.     ULONG               ulUIParam,
  2264.     LPVOID              lpvContext,
  2265.     ULONG               cbEntryID,
  2266.     LPENTRYID           lpSelection,
  2267.     ULONG               ulFlags
  2268. );
  2269.  
  2270.  
  2271. /* Parameters for the address book dialog */
  2272. typedef struct _ADRPARM
  2273. {
  2274.     ULONG           cbABContEntryID;
  2275.     LPENTRYID       lpABContEntryID;
  2276.     ULONG           ulFlags;
  2277.  
  2278.     LPVOID          lpReserved;
  2279.     ULONG           ulHelpContext;
  2280.     LPTSTR          lpszHelpFileName;
  2281.  
  2282.     LPFNABSDI       lpfnABSDI;
  2283.     LPFNDISMISS     lpfnDismiss;
  2284.     LPVOID          lpvDismissContext;
  2285.     LPTSTR          lpszCaption;
  2286.     LPTSTR          lpszNewEntryTitle;
  2287.     LPTSTR          lpszDestWellsTitle;
  2288.     ULONG           cDestFields;
  2289.     ULONG           nDestFieldFocus;
  2290.     LPTSTR FAR *    lppszDestTitles;
  2291.     ULONG FAR *     lpulDestComps;
  2292.     LPSRestriction  lpContRestriction;
  2293.     LPSRestriction  lpHierRestriction;
  2294. } ADRPARM, FAR * LPADRPARM;
  2295.  
  2296.  
  2297. /* ------------ */
  2298. /* Random flags */
  2299.  
  2300. /* Flag set in MAPI one off entryids */
  2301. #define MAPI_ONE_OFF_NO_RICH_INFO    0x0001
  2302.  
  2303. /* Flag for deferred error */
  2304. #define MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008)
  2305.  
  2306. /* Flag for creating and using Folder Associated Information Messages */
  2307. #define MAPI_ASSOCIATED         ((ULONG) 0x00000040)
  2308.  
  2309. /* Flags for OpenMessageStore() */
  2310.  
  2311. #define MDB_NO_DIALOG           ((ULONG) 0x00000001)
  2312. #define MDB_WRITE               ((ULONG) 0x00000004)
  2313. /****** MAPI_DEFERRED_ERRORS    ((ULONG) 0x00000008) above */
  2314. /****** MAPI_BEST_ACCESS        ((ULONG) 0x00000010) above */
  2315. #define MDB_TEMPORARY           ((ULONG) 0x00000020)
  2316. #define MDB_NO_MAIL             ((ULONG) 0x00000080)
  2317.  
  2318. /* Flags for OpenAddressBook */
  2319.  
  2320. #define AB_NO_DIALOG            ((ULONG) 0x00000001)
  2321.  
  2322. /* IMAPIControl Interface -------------------------------------------------- */
  2323.  
  2324. /* Interface used in controls (particularly the button) defined by */
  2325. /* Display Tables. */
  2326.  
  2327. /*  Flags for GetState */
  2328.  
  2329. #define  MAPI_ENABLED       ((ULONG) 0x00000000)
  2330. #define  MAPI_DISABLED      ((ULONG) 0x00000001)
  2331.  
  2332. #define MAPI_IMAPICONTROL_METHODS(IPURE)                                \
  2333.     MAPIMETHOD(GetLastError)                                            \
  2334.         (THIS_  HRESULT                     hResult,                    \
  2335.                 ULONG                       ulFlags,                    \
  2336.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  2337.     MAPIMETHOD(Activate)                                                \
  2338.         (THIS_  ULONG                       ulFlags,                    \
  2339.                 ULONG                       ulUIParam) IPURE;           \
  2340.     MAPIMETHOD(GetState)                                                \
  2341.         (THIS_  ULONG                       ulFlags,                    \
  2342.                 ULONG FAR *                 lpulState) IPURE;           \
  2343.  
  2344. #undef       INTERFACE
  2345. #define      INTERFACE  IMAPIControl
  2346. DECLARE_MAPI_INTERFACE_(IMAPIControl, IUnknown)
  2347. {
  2348.     BEGIN_INTERFACE
  2349.     MAPI_IUNKNOWN_METHODS(PURE)
  2350.     MAPI_IMAPICONTROL_METHODS(PURE)
  2351. };
  2352.  
  2353. DECLARE_MAPI_INTERFACE_PTR(IMAPIControl, LPMAPICONTROL);
  2354.  
  2355. /* Display Tables ---------------------------------------------------------- */
  2356.  
  2357. /* Flags used in display tables - that is, PR_CONTROL_FLAGS */
  2358.  
  2359. #define DT_MULTILINE        ((ULONG) 0x00000001)
  2360. #define DT_EDITABLE         ((ULONG) 0x00000002)
  2361. #define DT_REQUIRED         ((ULONG) 0x00000004)
  2362. #define DT_SET_IMMEDIATE    ((ULONG) 0x00000008)
  2363. #define DT_PASSWORD_EDIT    ((ULONG) 0x00000010)
  2364. #define DT_ACCEPT_DBCS      ((ULONG) 0x00000020)
  2365. #define DT_SET_SELECTION    ((ULONG) 0x00000040)
  2366.  
  2367. /* Display Table structures */
  2368.  
  2369. #define DTCT_LABEL          ((ULONG) 0x00000000)
  2370. #define DTCT_EDIT           ((ULONG) 0x00000001)
  2371. #define DTCT_LBX            ((ULONG) 0x00000002)
  2372. #define DTCT_COMBOBOX       ((ULONG) 0x00000003)
  2373. #define DTCT_DDLBX          ((ULONG) 0x00000004)
  2374. #define DTCT_CHECKBOX       ((ULONG) 0x00000005)
  2375. #define DTCT_GROUPBOX       ((ULONG) 0x00000006)
  2376. #define DTCT_BUTTON         ((ULONG) 0x00000007)
  2377. #define DTCT_PAGE           ((ULONG) 0x00000008)
  2378. #define DTCT_RADIOBUTTON    ((ULONG) 0x00000009)
  2379. #define DTCT_MVLISTBOX      ((ULONG) 0x0000000B)
  2380. #define DTCT_MVDDLBX        ((ULONG) 0x0000000C)
  2381.  
  2382. /* Labels */
  2383. /* Valid ulFlags:
  2384.  *   MAPI_UNICODE
  2385.  */
  2386. typedef struct _DTBLLABEL
  2387. {
  2388.     ULONG ulbLpszLabelName;
  2389.     ULONG ulFlags;
  2390. } DTBLLABEL, FAR * LPDTBLLABEL;
  2391. #define SizedDtblLabel(n,u) \
  2392. struct _DTBLLABEL_ ## u \
  2393. { \
  2394.     DTBLLABEL   dtbllabel; \
  2395.     TCHAR       lpszLabelName[n]; \
  2396. } u
  2397.  
  2398.  
  2399. /*  Simple Text Edits  */
  2400. /* Valid ulFlags:
  2401.  *   MAPI_UNICODE
  2402.  */
  2403. typedef struct _DTBLEDIT
  2404. {
  2405.     ULONG ulbLpszCharsAllowed;
  2406.     ULONG ulFlags;
  2407.     ULONG ulNumCharsAllowed;
  2408.     ULONG ulPropTag;
  2409. } DTBLEDIT, FAR * LPDTBLEDIT;
  2410. #define SizedDtblEdit(n,u) \
  2411. struct _DTBLEDIT_ ## u \
  2412. { \
  2413.     DTBLEDIT    dtbledit; \
  2414.     TCHAR       lpszCharsAllowed[n]; \
  2415. } u
  2416.  
  2417. /*  List Box  */
  2418. /* Valid ulFlags:
  2419.  */
  2420. #define MAPI_NO_HBAR        ((ULONG) 0x00000001)
  2421. #define MAPI_NO_VBAR        ((ULONG) 0x00000002)
  2422.  
  2423. typedef struct _DTBLLBX
  2424. {
  2425.     ULONG ulFlags;
  2426.     ULONG ulPRSetProperty;
  2427.     ULONG ulPRTableName;
  2428. } DTBLLBX, FAR * LPDTBLLBX;
  2429.  
  2430.  
  2431. /*  Combo Box   */
  2432. /* Valid ulFlags:
  2433.  *   MAPI_UNICODE
  2434.  */
  2435. typedef struct _DTBLCOMBOBOX
  2436. {
  2437.     ULONG ulbLpszCharsAllowed;
  2438.     ULONG ulFlags;
  2439.     ULONG ulNumCharsAllowed;
  2440.     ULONG ulPRPropertyName;
  2441.     ULONG ulPRTableName;
  2442. } DTBLCOMBOBOX, FAR * LPDTBLCOMBOBOX;
  2443. #define SizedDtblComboBox(n,u) \
  2444. struct _DTBLCOMBOBOX_ ## u \
  2445. { \
  2446.     DTBLCOMBOBOX    dtblcombobox; \
  2447.     TCHAR           lpszCharsAllowed[n]; \
  2448. } u
  2449.  
  2450.  
  2451. /*  Drop Down   */
  2452. /* Valid ulFlags:
  2453.  *   none
  2454.  */
  2455. typedef struct _DTBLDDLBX
  2456. {
  2457.     ULONG ulFlags;
  2458.     ULONG ulPRDisplayProperty;
  2459.     ULONG ulPRSetProperty;
  2460.     ULONG ulPRTableName;
  2461. } DTBLDDLBX, FAR * LPDTBLDDLBX;
  2462.  
  2463.  
  2464. /*  Check Box   */
  2465. /* Valid ulFlags:
  2466.  *   MAPI_UNICODE
  2467.  */
  2468. typedef struct _DTBLCHECKBOX
  2469. {
  2470.     ULONG ulbLpszLabel;
  2471.     ULONG ulFlags;
  2472.     ULONG ulPRPropertyName;
  2473. } DTBLCHECKBOX, FAR * LPDTBLCHECKBOX;
  2474. #define SizedDtblCheckBox(n,u) \
  2475. struct _DTBLCHECKBOX_ ## u \
  2476. { \
  2477.     DTBLCHECKBOX    dtblcheckbox; \
  2478.     TCHAR       lpszLabel[n]; \
  2479. } u
  2480.  
  2481.  
  2482.  
  2483. /*  Group Box   */
  2484. /* Valid ulFlags:
  2485.  *   MAPI_UNICODE
  2486.  */
  2487. typedef struct _DTBLGROUPBOX
  2488. {
  2489.     ULONG ulbLpszLabel;
  2490.     ULONG ulFlags;
  2491. } DTBLGROUPBOX, FAR * LPDTBLGROUPBOX;
  2492. #define SizedDtblGroupBox(n,u) \
  2493. struct _DTBLGROUPBOX_ ## u \
  2494. { \
  2495.     DTBLGROUPBOX    dtblgroupbox; \
  2496.     TCHAR           lpszLabel[n]; \
  2497. } u
  2498.  
  2499. /*  Button control   */
  2500. /* Valid ulFlags:
  2501.  *   MAPI_UNICODE
  2502.  */
  2503. typedef struct _DTBLBUTTON
  2504. {
  2505.     ULONG ulbLpszLabel;
  2506.     ULONG ulFlags;
  2507.     ULONG ulPRControl;
  2508. } DTBLBUTTON, FAR * LPDTBLBUTTON;
  2509. #define SizedDtblButton(n,u) \
  2510. struct _DTBLBUTTON_ ## u \
  2511. { \
  2512.     DTBLBUTTON  dtblbutton; \
  2513.     TCHAR       lpszLabel[n]; \
  2514. } u
  2515.  
  2516. /*  Pages   */
  2517. /* Valid ulFlags:
  2518.  *   MAPI_UNICODE
  2519.  */
  2520. typedef struct _DTBLPAGE
  2521. {
  2522.     ULONG ulbLpszLabel;
  2523.     ULONG ulFlags;
  2524.     ULONG ulbLpszComponent;
  2525.     ULONG ulContext;
  2526. } DTBLPAGE, FAR * LPDTBLPAGE;
  2527. #define SizedDtblPage(n,n1,u) \
  2528. struct _DTBLPAGE_ ## u \
  2529. { \
  2530.     DTBLPAGE    dtblpage; \
  2531.     TCHAR       lpszLabel[n]; \
  2532.     TCHAR       lpszComponent[n1]; \
  2533. } u
  2534.  
  2535. /*  Radio button   */
  2536. /* Valid ulFlags:
  2537.  *   MAPI_UNICODE
  2538.  */
  2539. typedef struct _DTBLRADIOBUTTON
  2540. {
  2541.     ULONG ulbLpszLabel;
  2542.     ULONG ulFlags;
  2543.     ULONG ulcButtons;
  2544.     ULONG ulPropTag;
  2545.     long lReturnValue;
  2546. } DTBLRADIOBUTTON, FAR * LPDTBLRADIOBUTTON;
  2547. #define SizedDtblRadioButton(n,u) \
  2548. struct _DTBLRADIOBUTTON_ ## u \
  2549. { \
  2550.     DTBLRADIOBUTTON dtblradiobutton; \
  2551.     TCHAR           lpszLabel[n]; \
  2552. } u
  2553.  
  2554.  
  2555. /*  MultiValued listbox */
  2556. /* Valid ulFlags:
  2557.  *   none
  2558.  */
  2559. typedef struct _DTBLMVLISTBOX
  2560. {
  2561.     ULONG ulFlags;
  2562.     ULONG ulMVPropTag;
  2563. } DTBLMVLISTBOX, FAR * LPDTBLMVLISTBOX;
  2564.  
  2565.  
  2566. /*  MultiValued dropdown */
  2567. /* Valid ulFlags:
  2568.  *   none
  2569.  */
  2570. typedef struct _DTBLMVDDLBX
  2571. {
  2572.     ULONG ulFlags;
  2573.     ULONG ulMVPropTag;
  2574. } DTBLMVDDLBX, FAR * LPDTBLMVDDLBX;
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580. /* IProviderAdmin Interface ---------------------------------------------- */
  2581.  
  2582. /* Flags for ConfigureMsgService */
  2583.  
  2584. #define UI_SERVICE                  0x00000002
  2585. #define SERVICE_UI_ALWAYS           0x00000002      /* Duplicate UI_SERVICE for consistency and compatibility */
  2586. #define SERVICE_UI_ALLOWED          0x00000010
  2587. #define UI_CURRENT_PROVIDER_FIRST   0x00000004
  2588. /* MSG_SERVICE_UI_READ_ONLY         0x00000008 - in MAPISPI.H */
  2589.  
  2590. /* GetProviderTable() */
  2591. /****** MAPI_UNICODE            ((ULONG) 0x80000000) above */
  2592.  
  2593. /* Values for PR_RESOURCE_FLAGS in message service table */
  2594.  
  2595. #define MAPI_IPROVIDERADMIN_METHODS(IPURE)                              \
  2596.     MAPIMETHOD(GetLastError)                                            \
  2597.         (THIS_  HRESULT                     hResult,                    \
  2598.                 ULONG                       ulFlags,                    \
  2599.                 LPMAPIERROR FAR *           lppMAPIError) IPURE;        \
  2600.     MAPIMETHOD(GetProviderTable)                                        \
  2601.         (THIS_  ULONG                       ulFlags,                    \
  2602.                 LPMAPITABLE FAR *           lppTable) IPURE;            \
  2603.     MAPIMETHOD(CreateProvider)                                          \
  2604.         (THIS_  LPTSTR                      lpszProvider,               \
  2605.                 ULONG                       cValues,                    \
  2606.                 LPSPropValue                lpProps,                    \
  2607.                 ULONG                       ulUIParam,                  \
  2608.                 ULONG                       ulFlags,                    \
  2609.                 MAPIUID FAR *               lpUID) IPURE;               \
  2610.     MAPIMETHOD(DeleteProvider)                                          \
  2611.         (THIS_  LPMAPIUID                   lpUID) IPURE;               \
  2612.     MAPIMETHOD(OpenProfileSection)                                      \
  2613.         (THIS_  LPMAPIUID                   lpUID,                      \
  2614.                 LPCIID                      lpInterface,                \
  2615.                 ULONG                       ulFlags,                    \
  2616.                 LPPROFSECT FAR *            lppProfSect) IPURE;         \
  2617.  
  2618.  
  2619. #undef       INTERFACE
  2620. #define      INTERFACE  IProviderAdmin
  2621. DECLARE_MAPI_INTERFACE_(IProviderAdmin, IUnknown)
  2622. {
  2623.     BEGIN_INTERFACE
  2624.     MAPI_IUNKNOWN_METHODS(PURE)
  2625.     MAPI_IPROVIDERADMIN_METHODS(PURE)
  2626. };
  2627.  
  2628. #ifndef WIN16
  2629.  
  2630. typedef HANDLE  HANDLE_16;
  2631. typedef WPARAM  WPARAM_16;
  2632.  
  2633. #define EXTERN_C_16
  2634. #define WINAPI_16
  2635. #define CALLBACK_16
  2636. #define EXPORT_16
  2637. #define LOADDS_16
  2638. #define HUGEP_16
  2639. #define APIENTRY_16    APIENTRY
  2640.  
  2641. #else   // ndef WIN16
  2642.  
  2643. typedef LPVOID HANDLE_16;
  2644. typedef DWORD  WPARAM_16;
  2645.  
  2646. #define EXTERN_C_16    EXTERN_C
  2647. #define WINAPI_16      WINAPI
  2648. #define CALLBACK_16    CALLBACK
  2649. #define EXPORT_16      __export
  2650. #define LOADDS_16      __loadds
  2651. #define HUGEP_16       HUGEP
  2652. #define APIENTRY_16    CALLBACK
  2653.  
  2654. #endif  // ndef WIN16
  2655.  
  2656. #ifndef WIN16
  2657.  
  2658. #define IF_WIN16(x)
  2659. #define IF_NOT_WIN16(x)     x
  2660. #define IF_WIN32(x)         x
  2661.  
  2662. #else   // ndef WIN16
  2663.  
  2664. #define IF_WIN16(x)         x
  2665. #define IF_NOT_WIN16(x) 
  2666. #define IF_WIN32(x)
  2667.  
  2668. #endif  // ndef WIN16
  2669.  
  2670. #ifdef  __cplusplus
  2671. }       /*  extern "C" */
  2672. #endif
  2673.  
  2674. #endif /* WABDEFS_H */
  2675.