commdlg: Implemented notifications are only sent with OFN_EXPLORER flag set.
[wine] / include / mapidefs.h
1 /*
2  * Copyright (C) 1998 Justin Bradford
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef MAPIDEFS_H
20 #define MAPIDEFS_H
21
22 #ifndef __WINESRC__
23 # include <windows.h>
24 #endif
25
26 #include <winerror.h>
27 #include <objbase.h>
28 #include <stddef.h>
29
30 /* Some types from other headers */
31 #ifndef __LHANDLE
32 #define __LHANDLE
33 typedef ULONG_PTR LHANDLE, *LPLHANDLE;
34 #endif
35
36 #ifndef _tagCY_DEFINED
37 #define _tagCY_DEFINED
38 typedef union tagCY
39 {
40     struct
41     {
42 #ifdef WORDS_BIGENDIAN
43         LONG  Hi;
44         ULONG Lo;
45 #else
46         ULONG Lo;
47         LONG  Hi;
48 #endif
49     } DUMMYSTRUCTNAME;
50     LONGLONG int64;
51 } CY;
52 typedef CY CURRENCY;
53 #endif /* _tagCY_DEFINED */
54
55
56 #ifndef _FILETIME_
57 #define _FILETIME_
58 typedef struct _FILETIME
59 {
60 #ifdef WORDS_BIGENDIAN
61     DWORD dwHighDateTime;
62     DWORD dwLowDateTime;
63 #else
64     DWORD dwLowDateTime;
65     DWORD dwHighDateTime;
66 #endif
67 } FILETIME, *PFILETIME, *LPFILETIME;
68 #endif
69
70 /* Memory allocation routines */
71 typedef SCODE (WINAPI ALLOCATEBUFFER)(ULONG,LPVOID*);
72 typedef SCODE (WINAPI ALLOCATEMORE)(ULONG,LPVOID,LPVOID*);
73 typedef ULONG (WINAPI FREEBUFFER)(LPVOID);
74
75 typedef ALLOCATEBUFFER *LPALLOCATEBUFFER;
76 typedef ALLOCATEMORE *LPALLOCATEMORE;
77 typedef FREEBUFFER *LPFREEBUFFER;
78
79 /* MAPI exposed interfaces */
80 typedef const IID *LPCIID;
81
82 typedef struct IAddrBook IAddrBook;
83 typedef IAddrBook *LPADRBOOK;
84 typedef struct IABContainer IABContainer;
85 typedef IABContainer *LPABCONT;
86 typedef struct IAttach IAttach;
87 typedef 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 IMAPIContainer;
94 typedef IMAPIContainer *LPMAPICONTAINER;
95 typedef struct IMAPIFolder IMAPIFolder;
96 typedef IMAPIFolder *LPMAPIFOLDER;
97 typedef struct IMAPIProgress IMAPIProgress;
98 typedef IMAPIProgress *LPMAPIPROGRESS;
99 typedef struct IMAPIStatus IMAPIStatus;
100 typedef IMAPIStatus *LPMAPISTATUS;
101 typedef struct IMessage IMessage;
102 typedef IMessage *LPMESSAGE;
103 typedef struct IMsgStore IMsgStore;
104 typedef IMsgStore *LPMDB;
105 typedef struct IProfSect IProfSect;
106 typedef IProfSect *LPPROFSECT;
107 typedef struct IProviderAdmin IProviderAdmin;
108 typedef IProviderAdmin *LPPROVIDERADMIN;
109
110 #ifndef MAPI_DIM
111 # define MAPI_DIM 1 /* Default to one dimension for variable length arrays */
112 #endif
113
114 /* Flags for abFlags[0] */
115 #define MAPI_NOTRESERVED 0x08
116 #define MAPI_NOW         0x10
117 #define MAPI_THISSESSION 0x20
118 #define MAPI_NOTRECIP    0x40
119 #define MAPI_SHORTTERM   0x80
120
121 /* Flags for abFlags[1]  */
122 #define MAPI_COMPOUND    0x80
123
124 typedef struct _ENTRYID
125 {
126     BYTE abFlags[4];
127     BYTE ab[MAPI_DIM];
128 } ENTRYID, *LPENTRYID;
129
130 /* MAPI GUID's */
131 typedef struct _MAPIUID
132 {
133     BYTE ab[sizeof(GUID)];
134 } MAPIUID, *LPMAPIUID;
135
136 #define IsEqualMAPIUID(pl,pr) (!memcmp((pl),(pr),sizeof(MAPIUID)))
137
138 #define MAPI_ONE_OFF_UID { 0x81,0x2b,0x1f,0xa4,0xbe,0xa3,0x10,0x19,0x9d,0x6e, \
139                            0x00,0xdd,0x01,0x0f,0x54,0x02 }
140 #define MAPI_ONE_OFF_UNICODE      0x8000
141 #define MAPI_ONE_OFF_NO_RICH_INFO 0x0001
142
143 /* Object types */
144 #define MAPI_STORE    1U
145 #define MAPI_ADDRBOOK 2U
146 #define MAPI_FOLDER   3U
147 #define MAPI_ABCONT   4U
148 #define MAPI_MESSAGE  5U
149 #define MAPI_MAILUSER 6U
150 #define MAPI_ATTACH   7U
151 #define MAPI_DISTLIST 8U
152 #define MAPI_PROFSECT 9U
153 #define MAPI_STATUS   10U
154 #define MAPI_SESSION  11U
155 #define MAPI_FORMINFO 12U
156
157 /* Flags for various calls */
158 #define MAPI_MODIFY                   0x00000001U /* Object can be modified */
159 #define MAPI_ACCESS_MODIFY            MAPI_MODIFY /* Want write access */
160 #define MAPI_ACCESS_READ              0x00000002U /* Want read access */
161 #define MAPI_ACCESS_DELETE            0x00000004U /* Want delete access */
162 #define MAPI_ACCESS_CREATE_HIERARCHY  0x00000008U
163 #define MAPI_ACCESS_CREATE_CONTENTS   0x00000010U
164 #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U
165 #define MAPI_UNICODE                  0x80000000U /* Strings in this call are Unicode */
166
167 #if defined (UNICODE) || defined (__WINESRC__)
168 #define fMapiUnicode MAPI_UNICODE
169 #else
170 #define fMapiUnicode 0U
171 #endif
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 /*****************************************************************************
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 typedef struct
914 {
915     ULONG cb;
916     BYTE  abEntry[MAPI_DIM];
917 } FLATENTRY, *LPFLATENTRY;
918
919 typedef struct
920 {
921     ULONG cEntries;
922     ULONG cbEntries;
923     BYTE  abEntries[MAPI_DIM];
924 } FLATENTRYLIST, *LPFLATENTRYLIST;
925
926 typedef struct
927 {
928     ULONG cb;
929     BYTE  ab[MAPI_DIM];
930 } MTSID, *LPMTSID;
931
932 typedef struct
933 {
934     ULONG cMTSIDs;
935     ULONG cbMTSIDs;
936     BYTE  abMTSIDs[MAPI_DIM];
937 } FLATMTSIDLIST, *LPFLATMTSIDLIST;
938
939 typedef struct _ADRENTRY
940 {
941     ULONG        ulReserved1;
942     ULONG        cValues;
943     LPSPropValue rgPropVals;
944 } ADRENTRY, *LPADRENTRY;
945
946 typedef struct _ADRLIST
947 {
948     ULONG    cEntries;
949     ADRENTRY aEntries[MAPI_DIM];
950 } ADRLIST, *LPADRLIST;
951
952 #endif /*MAPIDEFS_H*/