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