msi: MsiSetMode returns a UINT system error code, not a BOOL.
[wine] / include / mapidefs.h
1 /*
2  * Copyright (C) 1998 Justin Bradford
3  * Copyright (c) 2009 Owen Rudge for CodeWeavers
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18  */
19
20 #ifndef MAPIDEFS_H
21 #define MAPIDEFS_H
22
23 #ifndef __WINESRC__
24 # include <windows.h>
25 #endif
26
27 #include <winerror.h>
28 #include <objbase.h>
29 #include <stddef.h>
30
31 /* Some types from other headers */
32 #ifndef __LHANDLE
33 #define __LHANDLE
34 typedef ULONG_PTR LHANDLE, *LPLHANDLE;
35 #endif
36
37 #ifndef _tagCY_DEFINED
38 #define _tagCY_DEFINED
39 typedef union tagCY
40 {
41     struct
42     {
43 #ifdef WORDS_BIGENDIAN
44         LONG  Hi;
45         ULONG Lo;
46 #else
47         ULONG Lo;
48         LONG  Hi;
49 #endif
50     } DUMMYSTRUCTNAME;
51     LONGLONG int64;
52 } CY;
53 typedef CY CURRENCY;
54 #endif /* _tagCY_DEFINED */
55
56
57 #ifndef _FILETIME_
58 #define _FILETIME_
59 typedef struct _FILETIME
60 {
61 #ifdef WORDS_BIGENDIAN
62     DWORD dwHighDateTime;
63     DWORD dwLowDateTime;
64 #else
65     DWORD dwLowDateTime;
66     DWORD dwHighDateTime;
67 #endif
68 } FILETIME, *PFILETIME, *LPFILETIME;
69 #endif
70
71 /* Memory allocation routines */
72 typedef SCODE (WINAPI ALLOCATEBUFFER)(ULONG,LPVOID*);
73 typedef SCODE (WINAPI ALLOCATEMORE)(ULONG,LPVOID,LPVOID*);
74 typedef ULONG (WINAPI FREEBUFFER)(LPVOID);
75
76 typedef ALLOCATEBUFFER *LPALLOCATEBUFFER;
77 typedef ALLOCATEMORE *LPALLOCATEMORE;
78 typedef FREEBUFFER *LPFREEBUFFER;
79
80 /* MAPI exposed interfaces */
81 typedef const IID *LPCIID;
82
83 typedef struct IAddrBook IAddrBook;
84 typedef IAddrBook *LPADRBOOK;
85 typedef struct IABContainer IABContainer;
86 typedef IABContainer *LPABCONT;
87 typedef struct IAttach *LPATTACH;
88 typedef struct IDistList IDistList;
89 typedef IDistList *LPDISTLIST;
90 typedef struct IMailUser IMailUser;
91 typedef IMailUser *LPMAILUSER;
92 typedef struct IMAPIAdviseSink *LPMAPIADVISESINK;
93 typedef struct IMAPIContainer *LPMAPICONTAINER;
94 typedef struct IMAPIFolder *LPMAPIFOLDER;
95 typedef struct IMAPIProgress IMAPIProgress;
96 typedef IMAPIProgress *LPMAPIPROGRESS;
97 typedef struct IMAPIStatus IMAPIStatus;
98 typedef IMAPIStatus *LPMAPISTATUS;
99 typedef struct IMessage *LPMESSAGE;
100 typedef struct IProfSect IProfSect;
101 typedef IProfSect *LPPROFSECT;
102 typedef struct IProviderAdmin IProviderAdmin;
103 typedef IProviderAdmin *LPPROVIDERADMIN;
104
105 #ifndef MAPI_DIM
106 # define MAPI_DIM 1 /* Default to one dimension for variable length arrays */
107 #endif
108
109 /* Flags for abFlags[0] */
110 #define MAPI_NOTRESERVED 0x08
111 #define MAPI_NOW         0x10
112 #define MAPI_THISSESSION 0x20
113 #define MAPI_NOTRECIP    0x40
114 #define MAPI_SHORTTERM   0x80
115
116 /* Flags for abFlags[1]  */
117 #define MAPI_COMPOUND    0x80
118
119 typedef struct _ENTRYID
120 {
121     BYTE abFlags[4];
122     BYTE ab[MAPI_DIM];
123 } ENTRYID, *LPENTRYID;
124
125 /* MAPI GUID's */
126 typedef struct _MAPIUID
127 {
128     BYTE ab[sizeof(GUID)];
129 } MAPIUID, *LPMAPIUID;
130
131 #define IsEqualMAPIUID(pl,pr) (!memcmp((pl),(pr),sizeof(MAPIUID)))
132
133 #define MAPI_ONE_OFF_UID { 0x81,0x2b,0x1f,0xa4,0xbe,0xa3,0x10,0x19,0x9d,0x6e, \
134                            0x00,0xdd,0x01,0x0f,0x54,0x02 }
135 #define MAPI_ONE_OFF_UNICODE      0x8000
136 #define MAPI_ONE_OFF_NO_RICH_INFO 0x0001
137
138 /* Object types */
139 #define MAPI_STORE    1U
140 #define MAPI_ADDRBOOK 2U
141 #define MAPI_FOLDER   3U
142 #define MAPI_ABCONT   4U
143 #define MAPI_MESSAGE  5U
144 #define MAPI_MAILUSER 6U
145 #define MAPI_ATTACH   7U
146 #define MAPI_DISTLIST 8U
147 #define MAPI_PROFSECT 9U
148 #define MAPI_STATUS   10U
149 #define MAPI_SESSION  11U
150 #define MAPI_FORMINFO 12U
151
152 /* Flags for various calls */
153 #define MAPI_MODIFY                   0x00000001U /* Object can be modified */
154 #define MAPI_CREATE                   0x00000002U /* Object can be created */
155 #define MAPI_ACCESS_MODIFY            MAPI_MODIFY /* Want write access */
156 #define MAPI_ACCESS_READ              0x00000002U /* Want read access */
157 #define MAPI_ACCESS_DELETE            0x00000004U /* Want delete access */
158 #define MAPI_ACCESS_CREATE_HIERARCHY  0x00000008U
159 #define MAPI_ACCESS_CREATE_CONTENTS   0x00000010U
160 #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U
161 #define MAPI_USE_DEFAULT              0x00000040U
162 #define MAPI_UNICODE                  0x80000000U /* Strings in this call are Unicode */
163
164 #if defined (UNICODE) || defined (__WINESRC__)
165 #define fMapiUnicode MAPI_UNICODE
166 #else
167 #define fMapiUnicode 0U
168 #endif
169
170 /* IMAPISession::OpenMessageStore() flags */
171 #define MDB_NO_DIALOG           0x00000001
172
173 /* Types of message receivers */
174 #ifndef MAPI_ORIG
175 #define MAPI_ORIG      0          /* The original author */
176 #define MAPI_TO        1          /* The primary message receiver */
177 #define MAPI_CC        2          /* A carbon copy receiver */
178 #define MAPI_BCC       3          /* A blind carbon copy receiver */
179 #define MAPI_P1        0x10000000 /* A message resend */
180 #define MAPI_SUBMITTED 0x80000000 /* This message has already been sent */
181 #endif
182
183 #ifndef cchProfileNameMax
184 #define cchProfileNameMax 64 /* Maximum length of a profile name */
185 #define cchProfilePassMax 64 /* Maximum length of a profile password */
186 #endif
187
188 /* Properties: The are the contents of cells in MAPI tables, as well as the
189  * values returned when object properties are queried.
190  */
191
192 /* Property types */
193 #define PT_UNSPECIFIED 0U
194 #define PT_NULL        1U
195 #define PT_I2          2U
196 #define PT_SHORT       PT_I2
197 #define PT_LONG        3U
198 #define PT_I4          PT_LONG
199 #define PT_R4          4U
200 #define PT_FLOAT       PT_R4
201 #define PT_DOUBLE      5U
202 #define PT_R8          PT_DOUBLE
203 #define PT_CURRENCY    6U
204 #define PT_APPTIME     7U
205 #define PT_ERROR       10U
206 #define PT_BOOLEAN     11U
207 #define PT_OBJECT      13U
208 #define PT_I8          20U
209 #define PT_LONGLONG    PT_I8
210 #define PT_STRING8     30U
211 #define PT_UNICODE     31U
212 #define PT_SYSTIME     64U
213 #define PT_CLSID       72U
214 #define PT_BINARY      258U
215
216 #define MV_FLAG     0x1000 /* This property type is multi-valued (an array) */
217 #define MV_INSTANCE 0x2000
218 #define MVI_FLAG    (MV_FLAG|MV_INSTANCE)
219 #define MVI_PROP(t) ((t)|MVI_FLAG)
220
221 #ifndef WINE_NO_UNICODE_MACROS
222 # ifdef UNICODE
223 # define PT_TSTRING      PT_UNICODE
224 # define PT_MV_TSTRING   (MV_FLAG|PT_UNICODE)
225 # define LPSZ            lpszW
226 # define LPPSZ           lppszW
227 # define MVSZ            MVszW
228 # else
229 # define PT_TSTRING      PT_STRING8
230 # define PT_MV_TSTRING   (MV_FLAG|PT_STRING8)
231 # define LPSZ            lpszA
232 # define LPPSZ           lppszA
233 # define MVSZ            MVszA
234 # endif
235 #endif
236
237 #define PROP_TYPE_MASK  0xFFFFU
238 #define PROP_TYPE(t)    ((t) & PROP_TYPE_MASK)
239 #define PROP_ID(t)      ((t) >> 16)
240 #define PROP_TAG(t,id)  (((id) << 16) | t)
241 #define PROP_ID_NULL    0
242 #define PROP_ID_INVALID 0xFFFF
243 #define PR_NULL         PROP_TAG(PT_NULL, PROP_ID_NULL)
244
245 #define CHANGE_PROP_TYPE(t,typ) ((0xFFFF0000 & t) | typ)
246
247 /* Multi-valued property types */
248 #define PT_MV_I2       (MV_FLAG|PT_I2)
249 #define PT_MV_SHORT    PT_MV_I2
250 #define PT_MV_LONG     (MV_FLAG|PT_LONG)
251 #define PT_MV_I4       PT_MV_LONG
252 #define PT_MV_R4       (MV_FLAG|PT_R4)
253 #define PT_MV_FLOAT    PT_MV_R4
254 #define PT_MV_DOUBLE   (MV_FLAG|PT_DOUBLE)
255 #define PT_MV_R8       PT_MV_DOUBLE
256 #define PT_MV_CURRENCY (MV_FLAG|PT_CURRENCY)
257 #define PT_MV_APPTIME  (MV_FLAG|PT_APPTIME)
258 #define PT_MV_SYSTIME  (MV_FLAG|PT_SYSTIME)
259 #define PT_MV_STRING8  (MV_FLAG|PT_STRING8)
260 #define PT_MV_BINARY   (MV_FLAG|PT_BINARY)
261 #define PT_MV_UNICODE  (MV_FLAG|PT_UNICODE)
262 #define PT_MV_CLSID    (MV_FLAG|PT_CLSID)
263 #define PT_MV_I8       (MV_FLAG|PT_I8)
264 #define PT_MV_LONGLONG PT_MV_I8
265
266
267 /* The property tag structure. This describes a list of columns */
268 typedef struct _SPropTagArray
269 {
270     ULONG cValues;              /* Number of elements in aulPropTag */
271     ULONG aulPropTag[MAPI_DIM]; /* Property tags */
272 } SPropTagArray, *LPSPropTagArray;
273
274 #define CbNewSPropTagArray(c) (offsetof(SPropTagArray,aulPropTag)+(c)*sizeof(ULONG))
275 #define CbSPropTagArray(p)    CbNewSPropTagArray((p)->cValues)
276 #define SizedSPropTagArray(n,id) \
277     struct _SPropTagArray_##id { ULONG cValues; ULONG aulPropTag[n]; } id
278
279 /* Multi-valued PT_APPTIME property value */
280 typedef struct _SAppTimeArray
281 {
282     ULONG   cValues; /* Number of doubles in lpat */
283     double *lpat;    /* Pointer to double array of length cValues */
284 } SAppTimeArray;
285
286 /* PT_BINARY property value */
287 typedef struct _SBinary
288 {
289     ULONG  cb;  /* Number of bytes in lpb */
290     LPBYTE lpb; /* Pointer to byte array of length cb */
291 } SBinary, *LPSBinary;
292
293 /* Multi-valued PT_BINARY property value */
294 typedef struct _SBinaryArray
295 {
296     ULONG    cValues; /* Number of SBinarys in lpbin */
297     SBinary *lpbin;   /* Pointer to SBinary array of length cValues */
298 } SBinaryArray;
299
300 typedef SBinaryArray ENTRYLIST, *LPENTRYLIST;
301
302 /* Multi-valued PT_CY property value */
303 typedef struct _SCurrencyArray
304 {
305     ULONG  cValues; /* Number of CYs in lpcu */
306     CY    *lpcur;   /* Pointer to CY array of length cValues */
307 } SCurrencyArray;
308
309 /* Multi-valued PT_SYSTIME property value */
310 typedef struct _SDateTimeArray
311 {
312     ULONG     cValues; /* Number of FILETIMEs in lpft */
313     FILETIME *lpft;    /* Pointer to FILETIME array of length cValues */
314 } SDateTimeArray;
315
316 /* Multi-valued PT_DOUBLE property value */
317 typedef struct _SDoubleArray
318 {
319     ULONG   cValues; /* Number of doubles in lpdbl */
320     double *lpdbl;   /* Pointer to double array of length cValues */
321 } SDoubleArray;
322
323 /* Multi-valued PT_CLSID property value */
324 typedef struct _SGuidArray
325 {
326     ULONG cValues; /* Number of GUIDs in lpguid */
327     GUID *lpguid;  /* Pointer to GUID array of length cValues */
328 } SGuidArray;
329
330 /* Multi-valued PT_LONGLONG property value */
331 typedef struct _SLargeIntegerArray
332 {
333     ULONG          cValues; /* Number of long64s in lpli */
334     LARGE_INTEGER *lpli;    /* Pointer to long64 array of length cValues */
335 } SLargeIntegerArray;
336
337 /* Multi-valued PT_LONG property value */
338 typedef struct _SLongArray
339 {
340     ULONG  cValues; /* Number of longs in lpl */
341     LONG  *lpl;     /* Pointer to long array of length cValues */
342 } SLongArray;
343
344 /* Multi-valued PT_STRING8 property value */
345 typedef struct _SLPSTRArray
346 {
347     ULONG  cValues; /* Number of Ascii strings in lppszA */
348     LPSTR *lppszA;  /* Pointer to Ascii string array of length cValues */
349 } SLPSTRArray;
350
351 /* Multi-valued PT_FLOAT property value */
352 typedef struct _SRealArray
353 {
354     ULONG cValues; /* Number of floats in lpflt */
355     float *lpflt;  /* Pointer to float array of length cValues */
356 } SRealArray;
357
358 /* Multi-valued PT_SHORT property value */
359 typedef struct _SShortArray
360 {
361     ULONG      cValues; /* Number of shorts in lpb */
362     short int *lpi;     /* Pointer to short array of length cValues */
363 } SShortArray;
364
365 /* Multi-valued PT_UNICODE property value */
366 typedef struct _SWStringArray
367 {
368     ULONG   cValues; /* Number of Unicode strings in lppszW */
369     LPWSTR *lppszW;  /* Pointer to Unicode string array of length cValues */
370 } SWStringArray;
371
372 /* A property value */
373 typedef union _PV
374 {
375     short int          i;
376     LONG               l;
377     ULONG              ul;
378     float              flt;
379     double             dbl;
380     unsigned short     b;
381     CY                 cur;
382     double             at;
383     FILETIME           ft;
384     LPSTR              lpszA;
385     SBinary            bin;
386     LPWSTR             lpszW;
387     LPGUID             lpguid;
388     LARGE_INTEGER      li;
389     SShortArray        MVi;
390     SLongArray         MVl;
391     SRealArray         MVflt;
392     SDoubleArray       MVdbl;
393     SCurrencyArray     MVcur;
394     SAppTimeArray      MVat;
395     SDateTimeArray     MVft;
396     SBinaryArray       MVbin;
397     SLPSTRArray        MVszA;
398     SWStringArray      MVszW;
399     SGuidArray         MVguid;
400     SLargeIntegerArray MVli;
401     SCODE              err;
402     LONG               x;
403 } __UPV;
404
405 /* Property value structure. This is essentially a mini-Variant */
406 typedef struct _SPropValue
407 {
408     ULONG     ulPropTag;  /* The property type */
409     ULONG     dwAlignPad; /* Alignment, treat as reserved */
410     union _PV Value;      /* The property value */
411 } SPropValue, *LPSPropValue;
412
413 /* Structure describing a table row (a collection of property values) */
414 typedef struct _SRow
415 {
416     ULONG        ulAdrEntryPad; /* Padding, treat as reserved */
417     ULONG        cValues;       /* Count of property values in lpProbs */
418     LPSPropValue lpProps;       /* Pointer to an array of property values of length cValues */
419 } SRow, *LPSRow;
420
421 /* Structure describing a set of table rows */
422 typedef struct _SRowSet
423 {
424     ULONG cRows;          /* Count of rows in aRow */
425     SRow  aRow[MAPI_DIM]; /* Array of rows of length cRows */
426 } SRowSet, *LPSRowSet;
427
428 #define CbNewSRowSet(c) (offsetof(SRowSet,aRow)+(c)*sizeof(SRow))
429 #define CbSRowSet(p)    CbNewSRowSet((p)->cRows)
430 #define SizedSRowSet(n,id) \
431     struct _SRowSet_##id { ULONG cRows; SRow aRow[n]; } id
432
433 /* Structure describing a problem with a property */
434 typedef struct _SPropProblem
435 {
436     ULONG ulIndex;   /* Index of the property */
437     ULONG ulPropTag; /* Property tag of the property */
438     SCODE scode;     /* Error code of the problem */
439 } SPropProblem, *LPSPropProblem;
440
441 /* A collection of property problems */
442 typedef struct _SPropProblemArray
443 {
444     ULONG        cProblem;           /* Number of problems in aProblem */
445     SPropProblem aProblem[MAPI_DIM]; /* Array of problems of length cProblem */
446 } SPropProblemArray, *LPSPropProblemArray;
447
448 /* FPropContainsProp flags */
449 #define FL_FULLSTRING     0x00000ul /* Exact string match */
450 #define FL_SUBSTRING      0x00001ul /* Substring match */
451 #define FL_PREFIX         0x00002ul /* Prefix match */
452 #define FL_IGNORECASE     0x10000ul /* Case insensitive */
453 #define FL_IGNORENONSPACE 0x20000ul /* Ignore non spacing characters */
454 #define FL_LOOSE          0x40000ul /* Try very hard to match */
455
456
457 /* Table types returned by IMAPITable_GetStatus() */
458 #define TBLTYPE_SNAPSHOT 0U /* Table is fixed at creation time and contents do not change */
459 #define TBLTYPE_KEYSET   1U /* Table has a fixed number of rows, but row values may change */
460 #define TBLTYPE_DYNAMIC  2U /* Table values and the number of rows may change */
461
462 /* Table status returned by IMAPITable_GetStatus() */
463 #define TBLSTAT_COMPLETE       0U  /* All operations have completed (normal status) */
464 #define TBLSTAT_QCHANGED       7U  /* Table data has changed as expected */
465 #define TBLSTAT_SORTING        9U  /* Table is being asynchronously sorted */
466 #define TBLSTAT_SORT_ERROR     10U /* An error occurred while sorting the table */
467 #define TBLSTAT_SETTING_COLS   11U /* Table columns are being asynchronously changed */
468 #define TBLSTAT_SETCOL_ERROR   13U /* An error occurred during column changing */
469 #define TBLSTAT_RESTRICTING    14U /* Table rows are being asynchronously restricted */
470 #define TBLSTAT_RESTRICT_ERROR 15U /* An error occurred during row restriction */
471
472 /* Flags for IMAPITable operations that can be asynchronous */
473 #define TBL_NOWAIT 1U         /* Perform the operation asynchronously */
474 #define TBL_BATCH  2U         /* Perform the operation when the results are needed */
475 #define TBL_ASYNC  TBL_NOWAIT /* Synonym for TBL_NOWAIT */
476
477 /* Flags for IMAPITable_FindRow() */
478 #define DIR_BACKWARD 1U /* Read rows backwards from the start bookmark */
479
480 /* Table bookmarks */
481 typedef ULONG BOOKMARK;
482
483 #define BOOKMARK_BEGINNING ((BOOKMARK)0) /* The first row */
484 #define BOOKMARK_CURRENT   ((BOOKMARK)1) /* The curent table row */
485 #define BOOKMARK_END       ((BOOKMARK)2) /* The last row */
486
487 /* Row restrictions */
488 typedef struct _SRestriction* LPSRestriction;
489
490 typedef struct _SAndRestriction
491 {
492     ULONG          cRes;
493     LPSRestriction lpRes;
494 } SAndRestriction;
495
496 typedef struct _SBitMaskRestriction
497 {
498     ULONG relBMR;
499     ULONG ulPropTag;
500     ULONG ulMask;
501 } SBitMaskRestriction;
502
503 typedef struct _SCommentRestriction
504 {
505     ULONG          cValues;
506     LPSRestriction lpRes;
507     LPSPropValue   lpProp;
508 } SCommentRestriction;
509
510 #define RELOP_LT 0U
511 #define RELOP_LE 1U
512 #define RELOP_GT 2U
513 #define RELOP_GE 3U
514 #define RELOP_EQ 4U
515 #define RELOP_NE 5U
516 #define RELOP_RE 6U
517
518 typedef struct _SComparePropsRestriction
519 {
520     ULONG relop;
521     ULONG ulPropTag1;
522     ULONG ulPropTag2;
523 } SComparePropsRestriction;
524
525 typedef struct _SContentRestriction
526 {
527     ULONG        ulFuzzyLevel;
528     ULONG        ulPropTag;
529     LPSPropValue lpProp;
530 } SContentRestriction;
531
532 typedef struct _SExistRestriction
533 {
534     ULONG ulReserved1;
535     ULONG ulPropTag;
536     ULONG ulReserved2;
537 } SExistRestriction;
538
539 typedef struct _SNotRestriction
540 {
541     ULONG          ulReserved;
542     LPSRestriction lpRes;
543 } SNotRestriction;
544
545 typedef struct _SOrRestriction
546 {
547     ULONG          cRes;
548     LPSRestriction lpRes;
549 } SOrRestriction;
550
551 typedef struct _SPropertyRestriction
552 {
553     ULONG        relop;
554     ULONG        ulPropTag;
555     LPSPropValue lpProp;
556 } SPropertyRestriction;
557
558 typedef struct _SSizeRestriction
559 {
560     ULONG relop;
561     ULONG ulPropTag;
562     ULONG cb;
563 } SSizeRestriction;
564
565 typedef struct _SSubRestriction
566 {
567     ULONG          ulSubObject;
568     LPSRestriction lpRes;
569 } SSubRestriction;
570
571 /* Restriction types */
572 #define RES_AND            0U
573 #define RES_OR             1U
574 #define RES_NOT            2U
575 #define RES_CONTENT        3U
576 #define RES_PROPERTY       4U
577 #define RES_COMPAREPROPS   5U
578 #define RES_BITMASK        6U
579 #define RES_SIZE           7U
580 #define RES_EXIST          8U
581 #define RES_SUBRESTRICTION 9U
582 #define RES_COMMENT        10U
583
584 typedef struct _SRestriction
585 {
586     ULONG rt;
587     union
588     {
589         SAndRestriction          resAnd;
590         SBitMaskRestriction      resBitMask;
591         SCommentRestriction      resComment;
592         SComparePropsRestriction resCompareProps;
593         SContentRestriction      resContent;
594         SExistRestriction        resExist;
595         SNotRestriction          resNot;
596         SOrRestriction           resOr;
597         SPropertyRestriction     resProperty;
598         SSizeRestriction         resSize;
599         SSubRestriction          resSub;
600     } res;
601 } SRestriction;
602
603 /* Errors */
604 typedef struct _MAPIERROR
605 {
606     ULONG  ulVersion;       /* Mapi version */
607 #if defined (UNICODE) || defined (__WINESRC__)
608     LPWSTR lpszError;       /* Error and component strings. These are Ascii */
609     LPWSTR lpszComponent;   /* unless the MAPI_UNICODE flag is passed in */
610 #else
611     LPSTR  lpszError;
612     LPSTR  lpszComponent;
613 #endif
614     ULONG  ulLowLevelError;
615     ULONG  ulContext;
616 } MAPIERROR, *LPMAPIERROR;
617
618 /* Sorting */
619 #define TABLE_SORT_ASCEND  0U
620 #define TABLE_SORT_DESCEND 1U
621 #define TABLE_SORT_COMBINE 2U
622
623 typedef struct _SSortOrder
624 {
625     ULONG ulPropTag;
626     ULONG ulOrder;
627 } SSortOrder, *LPSSortOrder;
628
629 typedef struct _SSortOrderSet
630 {
631     ULONG      cSorts;
632     ULONG      cCategories;
633     ULONG      cExpanded;
634     SSortOrder aSort[MAPI_DIM];
635 } SSortOrderSet, * LPSSortOrderSet;
636
637 #define MNID_ID     0
638 #define MNID_STRING 1
639
640 typedef struct _MAPINAMEID
641 {
642     LPGUID lpguid;
643     ULONG ulKind;
644     union
645     {
646         LONG lID;
647         LPWSTR lpwstrName;
648     } Kind;
649 } MAPINAMEID, *LPMAPINAMEID;
650
651 /* Desired notification types (bitflags) */
652 #define fnevCriticalError        0x00000001UL
653 #define fnevNewMail              0x00000002UL
654 #define fnevObjectCreated        0x00000004UL
655 #define fnevObjectDeleted        0x00000008UL
656 #define fnevObjectModified       0x00000010UL
657 #define fnevObjectMoved          0x00000020UL
658 #define fnevObjectCopied         0x00000040UL
659 #define fnevSearchComplete       0x00000080UL
660 #define fnevTableModified        0x00000100UL
661 #define fnevStatusObjectModified 0x00000200UL
662 #define fnevReservedForMapi      0x40000000UL
663 #define fnevExtended             0x80000000UL
664
665 /* Type of notification event */
666 #define TABLE_CHANGED       1U
667 #define TABLE_ERROR         2U
668 #define TABLE_ROW_ADDED     3U
669 #define TABLE_ROW_DELETED   4U
670 #define TABLE_ROW_MODIFIED  5U
671 #define TABLE_SORT_DONE     6U
672 #define TABLE_RESTRICT_DONE 7U
673 #define TABLE_SETCOL_DONE   8U
674 #define TABLE_RELOAD        9U
675
676 /* fnevCriticalError notification */
677 typedef struct _ERROR_NOTIFICATION
678 {
679     ULONG       cbEntryID;
680     LPENTRYID   lpEntryID;
681     SCODE       scode;
682     ULONG       ulFlags;
683     LPMAPIERROR lpMAPIError;
684 } ERROR_NOTIFICATION;
685
686 /* fnevNewMail notification */
687 typedef struct _NEWMAIL_NOTIFICATION
688 {
689     ULONG     cbEntryID;
690     LPENTRYID lpEntryID;
691     ULONG     cbParentID;
692     LPENTRYID lpParentID;
693     ULONG     ulFlags;
694 #if defined (UNICODE) || defined (__WINESRC__)
695     LPWSTR    lpszMessageClass;
696 #else
697     LPSTR     lpszMessageClass;
698 #endif
699     ULONG     ulMessageFlags;
700 } NEWMAIL_NOTIFICATION;
701
702 /* fnevObjectCreated/Deleted/Modified/Moved/Copied notification */
703 typedef struct _OBJECT_NOTIFICATION
704 {
705     ULONG           cbEntryID;
706     LPENTRYID       lpEntryID;
707     ULONG           ulObjType;
708     ULONG           cbParentID;
709     LPENTRYID       lpParentID;
710     ULONG           cbOldID;
711     LPENTRYID       lpOldID;
712     ULONG           cbOldParentID;
713     LPENTRYID       lpOldParentID;
714     LPSPropTagArray lpPropTagArray;
715 } OBJECT_NOTIFICATION;
716
717 /* fnevTableModified notification */
718 typedef struct _TABLE_NOTIFICATION
719 {
720     ULONG      ulTableEvent;
721     HRESULT    hResult;
722     SPropValue propIndex;
723     SPropValue propPrior;
724     SRow       row;
725     ULONG      ulPad;
726 } TABLE_NOTIFICATION;
727
728 /* fnevExtended notification */
729 typedef struct _EXTENDED_NOTIFICATION
730 {
731     ULONG  ulEvent;
732     ULONG  cb;
733     LPBYTE pbEventParameters;
734 } EXTENDED_NOTIFICATION;
735
736 /* fnevStatusObjectModified notification */
737 typedef struct
738 {
739     ULONG        cbEntryID;
740     LPENTRYID    lpEntryID;
741     ULONG        cValues;
742     LPSPropValue lpPropVals;
743 } STATUS_OBJECT_NOTIFICATION;
744
745 /* The notification structure passed to advise sinks */
746 typedef struct _NOTIFICATION
747 {
748     ULONG ulEventType;
749     ULONG ulAlignPad;
750     union
751     {
752         ERROR_NOTIFICATION         err;
753         NEWMAIL_NOTIFICATION       newmail;
754         OBJECT_NOTIFICATION        obj;
755         TABLE_NOTIFICATION         tab;
756         EXTENDED_NOTIFICATION      ext;
757         STATUS_OBJECT_NOTIFICATION statobj;
758     } info;
759 } NOTIFICATION, *LPNOTIFICATION;
760
761 typedef LONG (WINAPI NOTIFCALLBACK)(LPVOID,ULONG,LPNOTIFICATION);
762 typedef NOTIFCALLBACK *LPNOTIFCALLBACK;
763
764 /* IMAPIContainer::OpenEntry flags */
765 #define MAPI_BEST_ACCESS    0x00000010
766
767 /*****************************************************************************
768  * IMAPITable interface
769  *
770  * This is the read-only 'view' over an I(MAPI)TableData object.
771  */
772 #define INTERFACE IMAPITable
773 DECLARE_INTERFACE_(IMAPITable,IUnknown)
774 {
775     /*** IUnknown methods ***/
776     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
777     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
778     STDMETHOD_(ULONG,Release)(THIS) PURE;
779     /*** IMAPITable methods ***/
780     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppError) PURE;
781     STDMETHOD(Advise)(THIS_ ULONG ulMask, LPMAPIADVISESINK lpSink, ULONG *lpCxn) PURE;
782     STDMETHOD(Unadvise)(THIS_ ULONG ulCxn) PURE;
783     STDMETHOD(GetStatus)(THIS_ ULONG *lpStatus, ULONG *lpType) PURE;
784     STDMETHOD(SetColumns)(THIS_ LPSPropTagArray lpProps, ULONG ulFlags) PURE;
785     STDMETHOD(QueryColumns)(THIS_ ULONG ulFlags, LPSPropTagArray *lpCols) PURE;
786     STDMETHOD(GetRowCount)(THIS_ ULONG ulFlags, ULONG *lpCount) PURE;
787     STDMETHOD(SeekRow)(THIS_ BOOKMARK lpStart, LONG lRows, LONG *lpSeeked) PURE;
788     STDMETHOD(SeekRowApprox)(THIS_ ULONG ulNum, ULONG ulDenom) PURE;
789     STDMETHOD(QueryPosition)(THIS_ ULONG *lpRow, ULONG *lpNum, ULONG *lpDenom) PURE;
790     STDMETHOD(FindRow)(THIS_ LPSRestriction lpRestrict, BOOKMARK lpOrigin, ULONG ulFlags) PURE;
791     STDMETHOD(Restrict)(THIS_ LPSRestriction lpRestrict, ULONG ulFlags) PURE;
792     STDMETHOD(CreateBookmark)(THIS_ BOOKMARK *lppPos) PURE;
793     STDMETHOD(FreeBookmark)(THIS_ BOOKMARK lpPos) PURE;
794     STDMETHOD(SortTable)(THIS_ LPSSortOrderSet lpSortOpts, ULONG ulFlags) PURE;
795     STDMETHOD(QuerySortOrder)(THIS_ LPSSortOrderSet *lppSortOpts) PURE;
796     STDMETHOD(QueryRows)(THIS_ LONG lRows, ULONG ulFlags, LPSRowSet *lppRows) PURE;
797     STDMETHOD(Abort) (THIS) PURE;
798     STDMETHOD(ExpandRow)(THIS_ ULONG cbKey, LPBYTE lpKey, ULONG ulRows,
799                          ULONG ulFlags, LPSRowSet *lppRows, ULONG *lpMore) PURE;
800     STDMETHOD(CollapseRow)(THIS_ ULONG cbKey, LPBYTE lpKey, ULONG ulFlags, ULONG *lpRows) PURE;
801     STDMETHOD(WaitForCompletion)(THIS_ ULONG ulFlags, ULONG ulTime, ULONG *lpState) PURE;
802     STDMETHOD(GetCollapseState)(THIS_ ULONG ulFlags, ULONG cbKey, LPBYTE lpKey,
803                                 ULONG *lpStateLen, LPBYTE *lpState) PURE;
804     STDMETHOD(SetCollapseState)(THIS_ ULONG ulFlags, ULONG ulLen,
805                                 LPBYTE lpStart, BOOKMARK *lppWhere) PURE;
806 };
807 #undef INTERFACE
808
809 #if !defined(__cplusplus) || defined(CINTERFACE)
810         /*** IUnknown methods ***/
811 #define IMAPITable_QueryInterface(p,a,b)         (p)->lpVtbl->QueryInterface(p,a,b)
812 #define IMAPITable_AddRef(p)                     (p)->lpVtbl->AddRef(p)
813 #define IMAPITable_Release(p)                    (p)->lpVtbl->Release(p)
814         /*** IMAPITable methods ***/
815 #define IMAPITable_GetLastError(p,a,b,c)         (p)->lpVtbl->GetLastError(p,a,b,c)
816 #define IMAPITable_Advise(p,a,b,c)               (p)->lpVtbl->Advise(p,a,b,c)
817 #define IMAPITable_Unadvise(p,a)                 (p)->lpVtbl->Unadvise(p,a)
818 #define IMAPITable_GetStatus(p,a,b)              (p)->lpVtbl->GetStatus(p,a,b)
819 #define IMAPITable_SetColumns(p,a,b)             (p)->lpVtbl->SetColumns(p,a,b)
820 #define IMAPITable_QueryColumns(p,a,b)           (p)->lpVtbl->QueryColumns(p,a,b)
821 #define IMAPITable_GetRowCount(p,a,b)            (p)->lpVtbl->GetRowCount(p,a,b)
822 #define IMAPITable_SeekRow(p,a,b)                (p)->lpVtbl->SeekRow(p,a,b)
823 #define IMAPITable_SeekRowApprox(p,a,b)          (p)->lpVtbl->SeekRowApprox(p,a,b)
824 #define IMAPITable_QueryPosition(p,a,b)          (p)->lpVtbl->QueryPosition(p,a,b)
825 #define IMAPITable_FindRow(p,a,b,c)              (p)->lpVtbl->FindRow(p,a,b,c)
826 #define IMAPITable_Restrict(p,a,b)               (p)->lpVtbl->Recstrict(p,a,b)
827 #define IMAPITable_CreateBookmark(p,a)           (p)->lpVtbl->CreateBookmark(p,a)
828 #define IMAPITable_FreeBookmark(p,a)             (p)->lpVtbl->FreeBookmark(p,a)
829 #define IMAPITable_SortTable(p,a,b)              (p)->lpVtbl->SortTable(p,a,b)
830 #define IMAPITable_QuerySortOrder(p,a)           (p)->lpVtbl->QuerySortOrder(p,a)
831 #define IMAPITable_QueryRows(p,a,b,c)            (p)->lpVtbl->QueryRows(p,a,b,c)
832 #define IMAPITable_Abort(p)                      (p)->lpVtbl->Abort(p)
833 #define IMAPITable_ExpandRow(p,a,b,c,d,e,f)      (p)->lpVtbl->ExpandRow(p,a,b,c,d,e,f)
834 #define IMAPITable_CollapseRow(p,a,b,c,d)        (p)->lpVtbl->CollapseRow(p,a,b,c,d)
835 #define IMAPITable_WaitForCompletion(p,a,b,c)    (p)->lpVtbl->WaitForCompletion(p,a,b,c)
836 #define IMAPITable_GetCollapseState(p,a,b,c,d,e) (p)->lpVtbl->GetCollapseState(p,a,b,c,d,e)
837 #define IMAPITable_SetCollapseState(p,a,b,c,d)   (p)->lpVtbl->SetCollapseState(p,a,b,c,d)
838 #endif
839
840 typedef IMAPITable *LPMAPITABLE;
841
842 /*****************************************************************************
843  * IMAPIAdviseSink interface
844  */
845 #define INTERFACE IMAPIAdviseSink
846 DECLARE_INTERFACE_(IMAPIAdviseSink,IUnknown)
847 {
848     /*** IUnknown methods ***/
849     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
850     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
851     STDMETHOD_(ULONG,Release)(THIS) PURE;
852     /*** IMAPIAdviseSink methods ***/
853     STDMETHOD(OnNotify)(THIS_ ULONG NumNotif, LPNOTIFICATION lpNotif) PURE;
854 };
855 #undef INTERFACE
856
857 #if !defined(__cplusplus) || defined(CINTERFACE)
858         /*** IUnknown methods ***/
859 #define IMAPIAdviseSink_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
860 #define IMAPIAdviseSink_AddRef(p)             (p)->lpVtbl->AddRef(p)
861 #define IMAPIAdviseSink_Release(p)            (p)->lpVtbl->Release(p)
862         /*** IMAPIAdviseSink methods ***/
863 #define IMAPIAdviseSink_OnNotify(p,a,b)       (p)->lpVtbl->OnNotify(p,a,b)
864 #endif
865
866 /*****************************************************************************
867  * IMAPIProp interface
868  */
869 #define INTERFACE IMAPIProp
870 DECLARE_INTERFACE_(IMAPIProp,IUnknown)
871 {
872     /*** IUnknown methods ***/
873     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
874     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
875     STDMETHOD_(ULONG,Release)(THIS) PURE;
876     /*** IMAPIProp methods ***/
877     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
878     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
879     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
880     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
881     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
882     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
883     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
884     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
885                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
886                       LPSPropProblemArray *lppProbs) PURE;
887     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
888                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
889     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
890                                LPMAPINAMEID **lpppNames) PURE;
891     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
892 };
893 #undef INTERFACE
894
895 #if !defined(__cplusplus) || defined(CINTERFACE)
896         /*** IUnknown methods ***/
897 #define IMAPIProp_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
898 #define IMAPIProp_AddRef(p)                    (p)->lpVtbl->AddRef(p)
899 #define IMAPIProp_Release(p)                   (p)->lpVtbl->Release(p)
900         /*** IMAPIProp methods ***/
901 #define IMAPIProp_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
902 #define IMAPIProp_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
903 #define IMAPIProp_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
904 #define IMAPIProp_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
905 #define IMAPIProp_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
906 #define IMAPIProp_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
907 #define IMAPIProp_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
908 #define IMAPIProp_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
909 #define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
910 #define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
911 #define IMAPIProp_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
912 #endif
913
914 typedef IMAPIProp *LPMAPIPROP;
915
916 #define KEEP_OPEN_READONLY      (0x00000001U)
917 #define KEEP_OPEN_READWRITE     (0x00000002U)
918 #define FORCE_SAVE              (0x00000004U)
919
920 /*****************************************************************************
921  * IMsgStore interface
922  */
923 #define INTERFACE IMsgStore
924 DECLARE_INTERFACE_(IMsgStore,IMAPIProp)
925 {
926     /*** IUnknown methods ***/
927     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
928     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
929     STDMETHOD_(ULONG,Release)(THIS) PURE;
930     /*** IMAPIProp methods ***/
931     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
932     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
933     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
934     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
935     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
936     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
937     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
938     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
939                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
940                       LPSPropProblemArray *lppProbs) PURE;
941     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
942                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
943     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
944                                LPMAPINAMEID **lpppNames) PURE;
945     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
946     /*** IMsgStore methods ***/
947     STDMETHOD(Advise)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink,
948                       ULONG * lpulConnection) PURE;
949     STDMETHOD(Unadvise)(THIS_ ULONG ulConnection) PURE;
950     STDMETHOD(CompareEntryIDs)(THIS_ ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2,
951                 ULONG ulFlags, ULONG * lpulResult) PURE;
952     STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG *lpulObjType,
953                 LPUNKNOWN *lppUnk) PURE;
954     STDMETHOD(SetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE;
955     STDMETHOD(GetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG * lpcbEntryID, LPENTRYID *lppEntryID,
956                 LPSTR *lppszExplicitClass) PURE;
957     STDMETHOD(GetReceiveFolderTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
958     STDMETHOD(StoreLogoff)(THIS_ ULONG * lpulFlags) PURE;
959     STDMETHOD(AbortSubmit)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags) PURE;
960     STDMETHOD(GetOutgoingQueue)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
961     STDMETHOD(SetLockState)(THIS_ LPMESSAGE lpMessage, ULONG ulLockState) PURE;
962     STDMETHOD(FinishedMsg)(THIS_ ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE;
963     STDMETHOD(NotifyNewMail)(THIS_ LPNOTIFICATION lpNotification) PURE;
964 };
965 #undef INTERFACE
966
967 #if !defined(__cplusplus) || defined(CINTERFACE)
968         /*** IUnknown methods ***/
969 #define IMsgStore_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
970 #define IMsgStore_AddRef(p)                    (p)->lpVtbl->AddRef(p)
971 #define IMsgStore_Release(p)                   (p)->lpVtbl->Release(p)
972         /*** IMAPIProp methods ***/
973 #define IMsgStore_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
974 #define IMsgStore_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
975 #define IMsgStore_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
976 #define IMsgStore_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
977 #define IMsgStore_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
978 #define IMsgStore_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
979 #define IMsgStore_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
980 #define IMsgStore_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
981 #define IMsgStore_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
982 #define IMsgStore_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
983 #define IMsgStore_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
984         /*** IMsgStore methods ***/
985 #define IMsgStore_Advise(p,a,b,c,d,e)            (p)->lpVtbl->Advise(p,a,b,c,d,e)
986 #define IMsgStore_Unadvise(p,a)                  (p)->lpVtbl->Unadvise(p,a)
987 #define IMsgStore_CompareEntryIDs(p,a,b,c,d,e,f) (p)->lpVtbl->CompareEntryIDs(p,a,b,c,d,e,f)
988 #define IMsgStore_OpenEntry(p,a,b,c,d,e,f)       (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f)
989 #define IMsgStore_SetReceiveFolder(p,a,b,c,d)    (p)->lpVtbl->SetReceiveFolder(p,a,b,c,d)
990 #define IMsgStore_GetReceiveFolder(p,a,b,c,d,e)  (p)->lpVtbl->GetReceiveFolder(p,a,b,c,d,e)
991 #define IMsgStore_GetReceiveFolderTable(p,a,b)   (p)->lpVtbl->GetReceiveFolderTable(p,a,b)
992 #define IMsgStore_StoreLogoff(p,a)               (p)->lpVtbl->StoreLogoff(p,a)
993 #define IMsgStore_AbortSubmit(p,a,b,c)           (p)->lpVtbl->AbortSubmit(p,a,b,c)
994 #define IMsgStore_GetOutgoingQueue(p,a,b)        (p)->lpVtbl->GetOutgoingQueue(p,a,b)
995 #define IMsgStore_SetLockState(p,a,b)            (p)->lpVtbl->SetLockState(p,a,b)
996 #define IMsgStore_FinishedMsg(p,a,b,c)           (p)->lpVtbl->FinishedMsg(p,a,b,c)
997 #define IMsgStore_NotifyNewMail(p,a)             (p)->lpVtbl->NotifyNewMail(p,a)
998
999 #endif
1000
1001 typedef IMsgStore *LPMDB;
1002
1003 /*****************************************************************************
1004  * IMAPIContainer interface
1005  */
1006 #define INTERFACE IMAPIContainer
1007 DECLARE_INTERFACE_(IMAPIContainer,IMAPIProp)
1008 {
1009     /*** IUnknown methods ***/
1010     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1011     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1012     STDMETHOD_(ULONG,Release)(THIS) PURE;
1013     /*** IMAPIProp methods ***/
1014     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
1015     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
1016     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
1017     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
1018     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
1019     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
1020     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
1021     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
1022                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
1023                       LPSPropProblemArray *lppProbs) PURE;
1024     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
1025                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
1026     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
1027                                LPMAPINAMEID **lpppNames) PURE;
1028     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
1029     /*** IMAPIContainer methods ***/
1030     STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
1031     STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
1032     STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags,
1033                          ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE;
1034     STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE;
1035     STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList,
1036                                  ULONG * lpulSearchState) PURE;
1037 };
1038 #undef INTERFACE
1039
1040 #if !defined(__cplusplus) || defined(CINTERFACE)
1041         /*** IUnknown methods ***/
1042 #define IMAPIContainer_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
1043 #define IMAPIContainer_AddRef(p)                    (p)->lpVtbl->AddRef(p)
1044 #define IMAPIContainer_Release(p)                   (p)->lpVtbl->Release(p)
1045         /*** IMAPIProp methods ***/
1046 #define IMAPIContainer_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
1047 #define IMAPIContainer_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
1048 #define IMAPIContainer_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
1049 #define IMAPIContainer_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
1050 #define IMAPIContainer_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
1051 #define IMAPIContainer_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
1052 #define IMAPIContainer_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
1053 #define IMAPIContainer_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
1054 #define IMAPIContainer_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
1055 #define IMAPIContainer_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
1056 #define IMAPIContainer_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
1057         /*** IMAPIContainer methods ***/
1058 #define IMAPIContainer_GetContentsTable(p,a,b)      (p)->lpVtbl->GetContentsTable(p,a,b)
1059 #define IMAPIContainer_GetHierarchyTable(p,a,b)     (p)->lpVtbl->GetHierarchyTable(p,a,b)
1060 #define IMAPIContainer_OpenEntry(p,a,b,c,d,e,f)     (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f)
1061 #define IMAPIContainer_SetSearchCriteria(p,a,b,c)   (p)->lpVtbl->SetSearchCriteria(p,a,b,c)
1062 #define IMAPIContainer_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d)
1063
1064 #endif
1065
1066 /*****************************************************************************
1067  * IMAPIFolder interface
1068  */
1069 #define INTERFACE IMAPIFolder
1070 DECLARE_INTERFACE_(IMAPIFolder,IMAPIContainer)
1071 {
1072     /*** IUnknown methods ***/
1073     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1074     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1075     STDMETHOD_(ULONG,Release)(THIS) PURE;
1076     /*** IMAPIProp methods ***/
1077     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
1078     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
1079     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
1080     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
1081     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
1082     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
1083     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
1084     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
1085                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
1086                       LPSPropProblemArray *lppProbs) PURE;
1087     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
1088                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
1089     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
1090                                LPMAPINAMEID **lpppNames) PURE;
1091     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
1092     /*** IMAPIContainer methods ***/
1093     STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
1094     STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE;
1095     STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags,
1096                          ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE;
1097     STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE;
1098     STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList,
1099                                  ULONG * lpulSearchState) PURE;
1100     /*** IMAPIFolder methods ***/
1101     STDMETHOD(CreateMessage)(THIS_ LPCIID lpInterface, ULONG ulFlags, LPMESSAGE *lppMessage) PURE;
1102     STDMETHOD(CopyMessages)(THIS_ LPENTRYLIST lpMsgList, LPCIID lpInterface, LPVOID lpDestFolder, ULONG ulUIParam,
1103                             LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1104     STDMETHOD(DeleteMessages)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1105     STDMETHOD(CreateFolder)(THIS_ ULONG ulFolderType, LPSTR lpszFolderName, LPSTR lpszFolderComment, LPCIID lpInterface,
1106                             ULONG ulFlags, LPMAPIFOLDER lppFolder) PURE;
1107     STDMETHOD(CopyFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, LPVOID lpDestFolder,
1108                           LPSTR lpszNewFolderName, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1109     STDMETHOD(DeleteFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulUIParam, LPMAPIPROGRESS lpProgress,
1110                             ULONG ulFlags) PURE;
1111     STDMETHOD(SetReadFlags)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1112     STDMETHOD(GetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags, ULONG * lpulMessageStatus) PURE;
1113     STDMETHOD(SetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulNewStatus,
1114                                 ULONG ulNewStatusMask, ULONG * lpulOldStatus) PURE;
1115     STDMETHOD(SaveContentsSort)(THIS_ LPSSortOrderSet lpSortCriteria, ULONG ulFlags) PURE;
1116     STDMETHOD(EmptyFolder) (THIS_ ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1117 };
1118 #undef INTERFACE
1119
1120 #if !defined(__cplusplus) || defined(CINTERFACE)
1121         /*** IUnknown methods ***/
1122 #define IMAPIFolder_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
1123 #define IMAPIFolder_AddRef(p)                    (p)->lpVtbl->AddRef(p)
1124 #define IMAPIFolder_Release(p)                   (p)->lpVtbl->Release(p)
1125         /*** IMAPIProp methods ***/
1126 #define IMAPIFolder_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
1127 #define IMAPIFolder_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
1128 #define IMAPIFolder_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
1129 #define IMAPIFolder_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
1130 #define IMAPIFolder_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
1131 #define IMAPIFolder_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
1132 #define IMAPIFolder_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
1133 #define IMAPIFolder_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
1134 #define IMAPIFolder_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
1135 #define IMAPIFolder_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
1136 #define IMAPIFolder_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
1137         /*** IMAPIContainer methods ***/
1138 #define IMAPIFolder_GetContentsTable(p,a,b)      (p)->lpVtbl->GetContentsTable(p,a,b)
1139 #define IMAPIFolder_GetHierarchyTable(p,a,b)     (p)->lpVtbl->GetHierarchyTable(p,a,b)
1140 #define IMAPIFolder_OpenEntry(p,a,b,c,d,e,f)     (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f)
1141 #define IMAPIFolder_SetSearchCriteria(p,a,b,c)   (p)->lpVtbl->SetSearchCriteria(p,a,b,c)
1142 #define IMAPIFolder_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d)
1143         /*** IMAPIFolder methods ***/
1144 #define IMAPIFolder_CreateMessage(p,a,b,c)        (p)->lpVtbl->CreateMessage(p,a,b,c)
1145 #define IMAPIFolder_CopyMessages(p,a,b,c,d,e,f)   (p)->lpVtbl->CopyMessages(p,a,b,c,d,e,f)
1146 #define IMAPIFolder_DeleteMessages(p,a,b,c,d)     (p)->lpVtbl->DeleteMessages(p,a,b,c,d)
1147 #define IMAPIFolder_CreateFolder(p,a,b,c,d,e,f)   (p)->lpVtbl->CreateFolder(p,a,b,c,d,e,f)
1148 #define IMAPIFolder_CopyFolder(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CopyFolder(p,a,b,c,d,e,f,g,h)
1149 #define IMAPIFolder_DeleteFolder(p,a,b,c,d,e)     (p)->lpVtbl->CreateFolder(p,a,b,c,d,e)
1150 #define IMAPIFolder_SetReadFlags(p,a,b,c,d)       (p)->lpVtbl->SetReadFlags(p,a,b,c,d)
1151 #define IMAPIFolder_GetMessageStatus(p,a,b,c,d)   (p)->lpVtbl->GetMessageStatus(p,a,b,c,d)
1152 #define IMAPIFolder_SetMessageStatus(p,a,b,c,d,e) (p)->lpVtbl->SetMessageStatus(p,a,b,c,d,e)
1153 #define IMAPIFolder_SaveContentsSort(p,a,b)       (p)->lpVtbl->SaveContentsSort(p,a,b)
1154 #define IMAPIFolder_EmptyFolder(p,a,b,c)          (p)->lpVtbl->EmptyFolder(p,a,b,c)
1155
1156 #endif
1157
1158 typedef struct
1159 {
1160     ULONG cb;
1161     BYTE  abEntry[MAPI_DIM];
1162 } FLATENTRY, *LPFLATENTRY;
1163
1164 typedef struct
1165 {
1166     ULONG cEntries;
1167     ULONG cbEntries;
1168     BYTE  abEntries[MAPI_DIM];
1169 } FLATENTRYLIST, *LPFLATENTRYLIST;
1170
1171 typedef struct
1172 {
1173     ULONG cb;
1174     BYTE  ab[MAPI_DIM];
1175 } MTSID, *LPMTSID;
1176
1177 typedef struct
1178 {
1179     ULONG cMTSIDs;
1180     ULONG cbMTSIDs;
1181     BYTE  abMTSIDs[MAPI_DIM];
1182 } FLATMTSIDLIST, *LPFLATMTSIDLIST;
1183
1184 typedef struct _ADRENTRY
1185 {
1186     ULONG        ulReserved1;
1187     ULONG        cValues;
1188     LPSPropValue rgPropVals;
1189 } ADRENTRY, *LPADRENTRY;
1190
1191 typedef struct _ADRLIST
1192 {
1193     ULONG    cEntries;
1194     ADRENTRY aEntries[MAPI_DIM];
1195 } ADRLIST, *LPADRLIST;
1196
1197 /*****************************************************************************
1198  * IMessage interface
1199  */
1200 #define INTERFACE IMessage
1201 DECLARE_INTERFACE_(IMessage,IMAPIProp)
1202 {
1203     /*** IUnknown methods ***/
1204     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1205     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1206     STDMETHOD_(ULONG,Release)(THIS) PURE;
1207     /*** IMAPIProp methods ***/
1208     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
1209     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
1210     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
1211     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
1212     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
1213     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
1214     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
1215     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
1216                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
1217                       LPSPropProblemArray *lppProbs) PURE;
1218     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
1219                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
1220     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
1221                                LPMAPINAMEID **lpppNames) PURE;
1222     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
1223     /*** IMessage methods ***/
1224     STDMETHOD(GetAttachmentTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE;
1225     STDMETHOD(OpenAttach)(THIS_ ULONG ulAttachmentNum, LPCIID lpInterface, ULONG ulFlags, LPATTACH *lppAttach) PURE;
1226     STDMETHOD(CreateAttach)(THIS_ LPCIID lpInterface, ULONG ulFlags, ULONG *lpulAttachmentNum, LPATTACH *lppAttach) PURE;
1227     STDMETHOD(DeleteAttach)(THIS_ ULONG ulAttachmentNum, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE;
1228     STDMETHOD(GetRecipientTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE;
1229     STDMETHOD(ModifyRecipients)(THIS_ ULONG ulFlags, LPADRLIST lpMods) PURE;
1230     STDMETHOD(SubmitMessage)(THIS_ ULONG ulFlags) PURE;
1231     STDMETHOD(SetReadFlag)(THIS_ ULONG ulFlags) PURE;
1232 };
1233 #undef INTERFACE
1234
1235 #if !defined(__cplusplus) || defined(CINTERFACE)
1236         /*** IUnknown methods ***/
1237 #define IMessage_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
1238 #define IMessage_AddRef(p)                    (p)->lpVtbl->AddRef(p)
1239 #define IMessage_Release(p)                   (p)->lpVtbl->Release(p)
1240         /*** IMAPIProp methods ***/
1241 #define IMessage_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
1242 #define IMessage_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
1243 #define IMessage_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
1244 #define IMessage_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
1245 #define IMessage_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
1246 #define IMessage_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
1247 #define IMessage_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
1248 #define IMessage_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
1249 #define IMessage_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
1250 #define IMessage_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
1251 #define IMessage_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
1252         /*** IMessage methods ***/
1253 #define IMessage_GetAttachmentTable(p,a,b)    (p)->lpVtbl->GetAttachmentTable(p,a,b)
1254 #define IMessage_OpenAttach(p,a,b,c,d)        (p)->lpVtbl->OpenAttach(p,a,b,c,d)
1255 #define IMessage_CreateAttach(p,a,b,c,d)      (p)->lpVtbl->CreateAttach(p,a,b,c,d)
1256 #define IMessage_DeleteAttach(p,a,b,c,d)      (p)->lpVtbl->DeleteAttach(p,a,b,c,d)
1257 #define IMessage_GetRecipientTable(p,a,b)     (p)->lpVtbl->GetRecipientTable(p,a,b)
1258 #define IMessage_ModifyRecipients(p,a,b)      (p)->lpVtbl->ModifyRecipients(p,a,b)
1259 #define IMessage_SubmitMessage(p,a)           (p)->lpVtbl->SubmitMessage(p,a)
1260 #define IMessage_SetReadFlag(p,a)             (p)->lpVtbl->SetReadFlag(p,a)
1261
1262 #endif
1263
1264 /* Message flags (PR_MESSAGE_FLAGS) */
1265
1266 #define MSGFLAG_READ         0x00000001U
1267 #define MSGFLAG_UNMODIFIED   0x00000002U
1268 #define MSGFLAG_SUBMIT       0x00000004U
1269 #define MSGFLAG_UNSENT       0x00000008U
1270 #define MSGFLAG_HASATTACH    0x00000010U
1271 #define MSGFLAG_FROMME       0x00000020U
1272
1273 /*****************************************************************************
1274  * IAttach interface
1275  */
1276 #define INTERFACE IAttach
1277 DECLARE_INTERFACE_(IAttach,IMAPIProp)
1278 {
1279     /*** IUnknown methods ***/
1280     STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
1281     STDMETHOD_(ULONG,AddRef)(THIS) PURE;
1282     STDMETHOD_(ULONG,Release)(THIS) PURE;
1283     /*** IMAPIProp methods ***/
1284     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE;
1285     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE;
1286     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE;
1287     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE;
1288     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE;
1289     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE;
1290     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE;
1291     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam,
1292                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags,
1293                       LPSPropProblemArray *lppProbs) PURE;
1294     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress,
1295                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE;
1296     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount,
1297                                LPMAPINAMEID **lpppNames) PURE;
1298     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
1299 };
1300 #undef INTERFACE
1301
1302 #if !defined(__cplusplus) || defined(CINTERFACE)
1303         /*** IUnknown methods ***/
1304 #define IAttach_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
1305 #define IAttach_AddRef(p)                    (p)->lpVtbl->AddRef(p)
1306 #define IAttach_Release(p)                   (p)->lpVtbl->Release(p)
1307         /*** IMAPIProp methods ***/
1308 #define IAttach_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)
1309 #define IAttach_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)
1310 #define IAttach_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)
1311 #define IAttach_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)
1312 #define IAttach_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)
1313 #define IAttach_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)
1314 #define IAttach_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)
1315 #define IAttach_CopyTo(p,a,b,c,d,e,f,g,h,i)  (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i)
1316 #define IAttach_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)
1317 #define IAttach_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e)
1318 #define IAttach_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)
1319 #endif
1320
1321 /* Attachment flags */
1322
1323 #define NO_ATTACHMENT        0x00000000U
1324 #define ATTACH_BY_VALUE      0x00000001U
1325
1326 #endif /*MAPIDEFS_H*/