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