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

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