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