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