Delegates messages directly to the edit control window proc instead of
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 #ifndef _OBJBASE_H_
28 #include <objbase.h>
29 #endif
30
31 /* Some types from other headers */
32 #ifndef __LHANDLE
33 #define __LHANDLE
34 typedef ULONG_PTR LHANDLE, *LPLHANDLE;
35 #endif
36
37 #ifndef _tagCY_DEFINED
38 #define _tagCY_DEFINED
39 typedef union tagCY
40 {
41     struct
42     {
43 #ifdef WORDS_BIGENDIAN
44         LONG  Hi;
45         ULONG Lo;
46 #else
47         ULONG Lo;
48         LONG  Hi;
49 #endif
50     } DUMMYSTRUCTNAME;
51     LONGLONG int64;
52 } CY;
53 typedef CY CURRENCY;
54 #endif /* _tagCY_DEFINED */
55
56
57 #ifndef _FILETIME_
58 #define _FILETIME_
59 typedef struct _FILETIME
60 {
61     DWORD dwLowDateTime;
62     DWORD dwHighDateTime;
63 } FILETIME, *PFILETIME, *LPFILETIME;
64 #endif
65
66 /* Memory allocation routines */
67 typedef SCODE (WINAPI ALLOCATEBUFFER)(ULONG,LPVOID*);
68 typedef SCODE (WINAPI ALLOCATEMORE)(ULONG,LPVOID,LPVOID*);
69 typedef ULONG (WINAPI FREEBUFFER)(LPVOID);
70
71 typedef ALLOCATEBUFFER *LPALLOCATEBUFFER;
72 typedef ALLOCATEMORE *LPALLOCATEMORE;
73 typedef FREEBUFFER *LPFREEBUFFER;
74
75 /* MAPI exposed interfaces */
76 typedef const IID *LPCIID;
77
78 typedef struct IAddrBook IAddrBook;
79 typedef IAddrBook *LPADRBOOK;
80 typedef struct IABContainer IABContainer;
81 typedef IABContainer *LPABCONT;
82 typedef struct IAttach IAttach;
83 typedef IAttach *LPATTACH;
84 typedef struct IDistList IDistList;
85 typedef IDistList *LPDISTLIST;
86 typedef struct IMailUser IMailUser;
87 typedef IMailUser *LPMAILUSER;
88 typedef struct IMAPIAdviseSink IMAPIAdviseSink;
89 typedef IMAPIAdviseSink *LPMAPIADVISESINK;
90 typedef struct IMAPIContainer IMAPIContainer;
91 typedef IMAPIContainer *LPMAPICONTAINER;
92 typedef struct IMAPIFolder IMAPIFolder;
93 typedef IMAPIFolder *LPMAPIFOLDER;
94 typedef struct IMAPIProgress IMAPIProgress;
95 typedef IMAPIProgress *LPMAPIPROGRESS;
96 typedef struct IMAPIProp IMAPIProp;
97 typedef IMAPIProp *LPMAPIPROP;
98 typedef struct IMAPIStatus IMAPIStatus;
99 typedef IMAPIStatus *LPMAPISTATUS;
100 typedef struct IMAPITable IMAPITable;
101 typedef IMAPITable *LPMAPITABLE;
102 typedef struct IMessage IMessage;
103 typedef IMessage *LPMESSAGE;
104 typedef struct IMsgStore IMsgStore;
105 typedef IMsgStore *LPMDB;
106 typedef struct IProfSect IProfSect;
107 typedef IProfSect *LPPROFSECT;
108 typedef struct IProviderAdmin IProviderAdmin;
109 typedef IProviderAdmin *LPPROVIDERADMIN;
110
111 #ifndef MAPI_DIM
112 # define MAPI_DIM 1 /* Default to one dimension for variable length arrays */
113 #endif
114
115 /* Flags for abFlags[0] */
116 #define MAPI_NOTRESERVED 0x08
117 #define MAPI_NOW         0x10
118 #define MAPI_THISSESSION 0x20
119 #define MAPI_NOTRECIP    0x40
120 #define MAPI_SHORTTERM   0x80
121
122 /* Flags for abFlags[1]  */
123 #define MAPI_COMPOUND    0x80
124
125 typedef struct _ENTRYID
126 {
127     BYTE abFlags[4];
128     BYTE ab[MAPI_DIM];
129 } ENTRYID, *LPENTRYID;
130
131 /* MAPI GUID's */
132 typedef struct _MAPIUID
133 {
134     BYTE ab[sizeof(GUID)];
135 } MAPIUID, *LPMAPIUID;
136
137 #define IsEqualMAPIUID(pl,pr) (!memcmp((pl),(pr),sizeof(MAPIUID)))
138
139 #define MAPI_ONE_OFF_UID { 0x81,0x2b,0x1f,0xa4,0xbe,0xa3,0x10,0x19,0x9d,0x6e, \
140                            0x00,0xdd,0x01,0x0f,0x54,0x02 }
141 #define MAPI_ONE_OFF_UNICODE      0x8000
142 #define MAPI_ONE_OFF_NO_RICH_INFO 0x0001
143
144 /* Object types */
145 #define MAPI_STORE    1U
146 #define MAPI_ADDRBOOK 2U
147 #define MAPI_FOLDER   3U
148 #define MAPI_ABCONT   4U
149 #define MAPI_MESSAGE  5U
150 #define MAPI_MAILUSER 6U
151 #define MAPI_ATTACH   7U
152 #define MAPI_DISTLIST 8U
153 #define MAPI_PROFSECT 9U
154 #define MAPI_STATUS   10U
155 #define MAPI_SESSION  11U
156 #define MAPI_FORMINFO 12U
157
158 /* Flags for various calls */
159 #define MAPI_MODIFY                   0x00000001U /* Object can be modified */
160 #define MAPI_ACCESS_MODIFY            MAPI_MODIFY /* Want write access */
161 #define MAPI_ACCESS_READ              0x00000002U /* Want read access */
162 #define MAPI_ACCESS_DELETE            0x00000004U /* Want delete access */
163 #define MAPI_ACCESS_CREATE_HIERARCHY  0x00000008U
164 #define MAPI_ACCESS_CREATE_CONTENTS   0x00000010U
165 #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U
166 #define MAPI_UNICODE                  0x80000000U /* Strings in this call are Unicode */
167
168 #if defined (UNICODE) || defined (__WINESRC__)
169 #define fMapiUnicode MAPI_UNICODE
170 #else
171 #define fMapiUnicode 0U
172 #endif
173
174 /* Types of message receivers */
175 #ifndef MAPI_ORIG
176 #define MAPI_ORIG      0          /* The original author */
177 #define MAPI_TO        1          /* The primary message receiver */
178 #define MAPI_CC        2          /* A carbon copy receiver */
179 #define MAPI_BCC       3          /* A blind carbon copy receiver */
180 #define MAPI_P1        0x10000000 /* A message resend */
181 #define MAPI_SUBMITTED 0x80000000 /* This message has already been sent */
182 #endif
183
184 #ifndef cchProfileNameMax
185 #define cchProfileNameMax 64 /* Maximum length of a profile name */
186 #define cchProfilePassMax 64 /* Maximum length of a profile password */
187 #endif
188
189 /* Properties: The are the contents of cells in MAPI tables, as well as the
190  * values returned when object properties are queried.
191  */
192
193 /* Property types */
194 #define PT_UNSPECIFIED 0U
195 #define PT_NULL        1U
196 #define PT_I2          2U
197 #define PT_SHORT       PT_I2
198 #define PT_LONG        3U
199 #define PT_I4          PT_LONG
200 #define PT_R4          4U
201 #define PT_FLOAT       PT_R4
202 #define PT_DOUBLE      5U
203 #define PT_R8          PT_DOUBLE
204 #define PT_CURRENCY    6U
205 #define PT_APPTIME     7U
206 #define PT_ERROR       10U
207 #define PT_BOOLEAN     11U
208 #define PT_OBJECT      13U
209 #define PT_I8          20U
210 #define PT_LONGLONG    PT_I8
211 #define PT_STRING8     30U
212 #define PT_UNICODE     31U
213 #define PT_SYSTIME     64U
214 #define PT_CLSID       72U
215 #define PT_BINARY      258U
216
217 #define MV_FLAG     0x1000 /* This property type is multi-valued (an array) */
218 #define MV_INSTANCE 0x2000
219 #define MVI_FLAG    (MV_FLAG|MV_INSTANCE)
220 #define MVI_PROP(t) ((t)|MVI_FLAG)
221
222 #ifndef __WINESRC__
223 # ifdef UNICODE
224 # define PT_TSTRING      PT_UNICODE
225 # define PT_MV_TSTRING   (MV_FLAG|PT_UNICODE)
226 # define LPSZ            lpszW
227 # define LPPSZ           lppszW
228 # define MVSZ            MVszW
229 # else
230 # define PT_TSTRING      PT_STRING8
231 # define PT_MV_TSTRING   (MV_FLAG|PT_STRING8)
232 # define LPSZ            lpszA
233 # define LPPSZ           lppszA
234 # define MVSZ            MVszA
235 # endif
236 #endif
237
238 #define PROP_TYPE_MASK  0xFFFFU
239 #define PROP_TYPE(t)    ((t) & PROP_TYPE_MASK)
240 #define PROP_ID(t)      ((t) >> 16)
241 #define PROP_TAG(t,id)  (((id) << 16) | t)
242 #define PROP_ID_NULL    0
243 #define PROP_ID_INVALID 0xFFFF
244 #define PR_NULL         PROP_TAG(PT_NULL, PROP_ID_NULL)
245
246 #define CHANGE_PROP_TYPE(t,typ) ((0xFFFF0000 & t) | typ)
247
248 /* Multi-valued property types */
249 #define PT_MV_I2       (MV_FLAG|PT_I2)
250 #define PT_MV_SHORT    PT_MV_I2
251 #define PT_MV_LONG     (MV_FLAG|PT_LONG)
252 #define PT_MV_I4       PT_MV_LONG
253 #define PT_MV_R4       (MV_FLAG|PT_R4)
254 #define PT_MV_FLOAT    PT_MV_R4
255 #define PT_MV_DOUBLE   (MV_FLAG|PT_DOUBLE)
256 #define PT_MV_R8       PT_MV_DOUBLE
257 #define PT_MV_CURRENCY (MV_FLAG|PT_CURRENCY)
258 #define PT_MV_APPTIME  (MV_FLAG|PT_APPTIME)
259 #define PT_MV_SYSTIME  (MV_FLAG|PT_SYSTIME)
260 #define PT_MV_STRING8  (MV_FLAG|PT_STRING8)
261 #define PT_MV_BINARY   (MV_FLAG|PT_BINARY)
262 #define PT_MV_UNICODE  (MV_FLAG|PT_UNICODE)
263 #define PT_MV_CLSID    (MV_FLAG|PT_CLSID)
264 #define PT_MV_I8       (MV_FLAG|PT_I8)
265 #define PT_MV_LONGLONG PT_MV_I8
266
267
268 /* The property tag structure. This describes a list of columns */
269 typedef struct _SPropTagArray
270 {
271     ULONG cValues;              /* Number of elements in aulPropTag */
272     ULONG aulPropTag[MAPI_DIM]; /* Property tags */
273 } SPropTagArray, *LPSPropTagArray;
274
275 #define CbNewSPropTagArray(c) (offsetof(SPropTagArray,aulPropTag)+(c)*sizeof(ULONG))
276 #define CbSPropTagArray(p)    CbNewSPropTagArray((p)->cValues)
277 #define SizedSPropTagArray(n,id) \
278     struct _SPropTagArray_##id { ULONG cValues; ULONG aulPropTag[n]; } id
279
280 /* Multi-valued PT_APPTIME property value */
281 typedef struct _SAppTimeArray
282 {
283     ULONG   cValues; /* Number of doubles in lpat */
284     double *lpat;    /* Pointer to double array of length cValues */
285 } SAppTimeArray;
286
287 /* PT_BINARY property value */
288 typedef struct _SBinary
289 {
290     ULONG  cb;  /* Number of bytes in lpb */
291     LPBYTE lpb; /* Pointer to byte array of length cb */
292 } SBinary, *LPSBinary;
293
294 /* Multi-valued PT_BINARY property value */
295 typedef struct _SBinaryArray
296 {
297     ULONG    cValues; /* Number of SBinarys in lpbin */
298     SBinary *lpbin;   /* Pointer to SBinary array of length cValues */
299 } SBinaryArray;
300
301 typedef SBinaryArray ENTRYLIST, *LPENTRYLIST;
302
303 /* Multi-valued PT_CY property value */
304 typedef struct _SCurrencyArray
305 {
306     ULONG  cValues; /* Number of CYs in lpcu */
307     CY    *lpcur;   /* Pointer to CY array of length cValues */
308 } SCurrencyArray;
309
310 /* Multi-valued PT_SYSTIME property value */
311 typedef struct _SDateTimeArray
312 {
313     ULONG     cValues; /* Number of FILETIMEs in lpft */
314     FILETIME *lpft;    /* Pointer to FILETIME array of length cValues */
315 } SDateTimeArray;
316
317 /* Multi-valued PT_DOUBLE property value */
318 typedef struct _SDoubleArray
319 {
320     ULONG   cValues; /* Number of doubles in lpdbl */
321     double *lpdbl;   /* Pointer to double array of length cValues */
322 } SDoubleArray;
323
324 /* Multi-valued PT_CLSID property value */
325 typedef struct _SGuidArray
326 {
327     ULONG cValues; /* Number of GUIDs in lpguid */
328     GUID *lpguid;  /* Pointer to GUID array of length cValues */
329 } SGuidArray;
330
331 /* Multi-valued PT_LONGLONG property value */
332 typedef struct _SLargeIntegerArray
333 {
334     ULONG          cValues; /* Number of long64s in lpli */
335     LARGE_INTEGER *lpli;    /* Pointer to long64 array of length cValues */
336 } SLargeIntegerArray;
337
338 /* Multi-valued PT_LONG property value */
339 typedef struct _SLongArray
340 {
341     ULONG  cValues; /* Number of longs in lpl */
342     LONG  *lpl;     /* Pointer to long array of length cValues */
343 } SLongArray;
344
345 /* Multi-valued PT_STRING8 property value */
346 typedef struct _SLPSTRArray
347 {
348     ULONG  cValues; /* Number of Ascii strings in lppszA */
349     LPSTR *lppszA;  /* Pointer to Ascii string array of length cValues */
350 } SLPSTRArray;
351
352 /* Multi-valued PT_FLOAT property value */
353 typedef struct _SRealArray
354 {
355     ULONG cValues; /* Number of floats in lpflt */
356     float *lpflt;  /* Pointer to float array of length cValues */
357 } SRealArray;
358
359 /* Multi-valued PT_SHORT property value */
360 typedef struct _SShortArray
361 {
362     ULONG      cValues; /* Number of shorts in lpb */
363     short int *lpi;     /* Pointer to short array of length cValues */
364 } SShortArray;
365
366 /* Multi-valued PT_UNICODE property value */
367 typedef struct _SWStringArray
368 {
369     ULONG   cValues; /* Number of Unicode strings in lppszW */
370     LPWSTR *lppszW;  /* Pointer to Unicode string array of length cValues */
371 } SWStringArray;
372
373 /* A property value */
374 typedef union _PV
375 {
376     short int          i;
377     LONG               l;
378     ULONG              ul;
379     float              flt;
380     double             dbl;
381     unsigned short     b;
382     CY                 cur;
383     double             at;
384     FILETIME           ft;
385     LPSTR              lpszA;
386     SBinary            bin;
387     LPWSTR             lpszW;
388     LPGUID             lpguid;
389     LARGE_INTEGER      li;
390     SShortArray        MVi;
391     SLongArray         MVl;
392     SRealArray         MVflt;
393     SDoubleArray       MVdbl;
394     SCurrencyArray     MVcur;
395     SAppTimeArray      MVat;
396     SDateTimeArray     MVft;
397     SBinaryArray       MVbin;
398     SLPSTRArray        MVszA;
399     SWStringArray      MVszW;
400     SGuidArray         MVguid;
401     SLargeIntegerArray MVli;
402     SCODE              err;
403     LONG               x;
404 } __UPV;
405
406 /* Property value structure. This is essentially a mini-Variant */
407 typedef struct _SPropValue
408 {
409     ULONG     ulPropTag;  /* The property type */
410     ULONG     dwAlignPad; /* Alignment, treat as reserved */
411     union _PV Value;      /* The property value */
412 } SPropValue, *LPSPropValue;
413
414 /* Structure describing a table row (a collection of property values) */
415 typedef struct _SRow
416 {
417     ULONG        ulAdrEntryPad; /* Padding, treat as reserved */
418     ULONG        cValues;       /* Count of property values in lpProbs */
419     LPSPropValue lpProps;       /* Pointer to an array of property values of length cValues */
420 } SRow, *LPSRow;
421
422 /* Structure describing a set of table rows */
423 typedef struct _SRowSet
424 {
425     ULONG cRows;          /* Count of rows in aRow */
426     SRow  aRow[MAPI_DIM]; /* Array of rows of length cRows */
427 } SRowSet, *LPSRowSet;
428
429 #define CbNewSRowSet(c) (offsetof(SRowSet,aRow)+(c)*sizeof(SRow))
430 #define CbSRowSet(p)    CbNewSRowSet((p)->cRows)
431 #define SizedSRowSet(n,id) \
432     struct _SRowSet_##id { ULONG cRows; SRow aRow[n]; } id
433
434 /* Structure describing a problem with a property */
435 typedef struct _SPropProblem
436 {
437     ULONG ulIndex;   /* Index of the property */
438     ULONG ulPropTag; /* Proprty tag of the property */
439     SCODE scode;     /* Error code of the problem */
440 } SPropProblem, *LPSPropProblem;
441
442 /* A collection of property problems */
443 typedef struct _SPropProblemArray
444 {
445     ULONG        cProblem;           /* Number of problems in aProblem */
446     SPropProblem aProblem[MAPI_DIM]; /* Array of problems of length cProblem */
447 } SPropProblemArray, *LPSPropProblemArray;
448
449 /* FPropContainsProp flags */
450 #define FL_FULLSTRING     0x00000ul /* Exact string match */
451 #define FL_SUBSTRING      0x00001ul /* Substring match */
452 #define FL_PREFIX         0x00002ul /* Prefix match */
453 #define FL_IGNORECASE     0x10000ul /* Case insensitive */
454 #define FL_IGNORENONSPACE 0x20000ul /* Ignore non spacing characters */
455 #define FL_LOOSE          0x40000ul /* Try very hard to match */
456
457
458 /* Table types returned by IMAPITable_GetStatus() */
459 #define TBLTYPE_SNAPSHOT 0U /* Table is fixed at creation time and contents do not change */
460 #define TBLTYPE_KEYSET   1U /* Table has a fixed number of rows, but row values may change */
461 #define TBLTYPE_DYNAMIC  2U /* Table values and the number of rows may change */
462
463 /* Table status returned by IMAPITable_GetStatus() */
464 #define TBLSTAT_COMPLETE       0U  /* All operations have completed (normal status) */
465 #define TBLSTAT_QCHANGED       7U  /* Table data has changed as expected */
466 #define TBLSTAT_SORTING        9U  /* Table is being asynchronously sorted */
467 #define TBLSTAT_SORT_ERROR     10U /* An error occurred while sorting the table */
468 #define TBLSTAT_SETTING_COLS   11U /* Table columns are being asynchronously changed */
469 #define TBLSTAT_SETCOL_ERROR   13U /* An error occurred during column changing */
470 #define TBLSTAT_RESTRICTING    14U /* Table rows are being asynchronously restricted */
471 #define TBLSTAT_RESTRICT_ERROR 15U /* An error occurred during row restriction */
472
473 /* Flags for IMAPITable operations that can be asynchronous */
474 #define TBL_NOWAIT 1U         /* Perform the operation asynchronously */
475 #define TBL_BATCH  2U         /* Perform the operation when the results are needed */
476 #define TBL_ASYNC  TBL_NOWAIT /* Synonym for TBL_NOWAIT */
477
478 /* Flags for IMAPITable_FindRow() */
479 #define DIR_BACKWARD 1U /* Read rows backwards from the start bookmark */
480
481 /* Table bookmarks */
482 typedef ULONG BOOKMARK;
483
484 #define BOOKMARK_BEGINNING ((BOOKMARK)0) /* The first row */
485 #define BOOKMARK_CURRENT   ((BOOKMARK)1) /* The curent table row */
486 #define BOOKMARK_END       ((BOOKMARK)2) /* The last row */
487
488 /* Row restrictions */
489 typedef struct _SRestriction* LPSRestriction;
490
491 typedef struct _SAndRestriction
492 {
493     ULONG          cRes;
494     LPSRestriction lpRes;
495 } SAndRestriction;
496
497 typedef struct _SBitMaskRestriction
498 {
499     ULONG relBMR;
500     ULONG ulPropTag;
501     ULONG ulMask;
502 } SBitMaskRestriction;
503
504 typedef struct _SCommentRestriction
505 {
506     ULONG          cValues;
507     LPSRestriction lpRes;
508     LPSPropValue   lpProp;
509 } SCommentRestriction;
510
511 #define RELOP_LT 0U
512 #define RELOP_LE 1U
513 #define RELOP_GT 2U
514 #define RELOP_GE 3U
515 #define RELOP_EQ 4U
516 #define RELOP_NE 5U
517 #define RELOP_RE 6U
518
519 typedef struct _SComparePropsRestriction
520 {
521     ULONG relop;
522     ULONG ulPropTag1;
523     ULONG ulPropTag2;
524 } SComparePropsRestriction;
525
526 typedef struct _SContentRestriction
527 {
528     ULONG        ulFuzzyLevel;
529     ULONG        ulPropTag;
530     LPSPropValue lpProp;
531 } SContentRestriction;
532
533 typedef struct _SExistRestriction
534 {
535     ULONG ulReserved1;
536     ULONG ulPropTag;
537     ULONG ulReserved2;
538 } SExistRestriction;
539
540 typedef struct _SNotRestriction
541 {
542     ULONG          ulReserved;
543     LPSRestriction lpRes;
544 } SNotRestriction;
545
546 typedef struct _SOrRestriction
547 {
548     ULONG          cRes;
549     LPSRestriction lpRes;
550 } SOrRestriction;
551
552 typedef struct _SPropertyRestriction
553 {
554     ULONG        relop;
555     ULONG        ulPropTag;
556     LPSPropValue lpProp;
557 } SPropertyRestriction;
558
559 typedef struct _SSizeRestriction
560 {
561     ULONG relop;
562     ULONG ulPropTag;
563     ULONG cb;
564 } SSizeRestriction;
565
566 typedef struct _SSubRestriction
567 {
568     ULONG          ulSubObject;
569     LPSRestriction lpRes;
570 } SSubRestriction;
571
572 /* Restriction types */
573 #define RES_AND            0U
574 #define RES_OR             1U
575 #define RES_NOT            2U
576 #define RES_CONTENT        3U
577 #define RES_PROPERTY       4U
578 #define RES_COMPAREPROPS   5U
579 #define RES_BITMASK        6U
580 #define RES_SIZE           7U
581 #define RES_EXIST          8U
582 #define RES_SUBRESTRICTION 9U
583 #define RES_COMMENT        10U
584
585 typedef struct _SRestriction
586 {
587     ULONG rt;
588     union
589     {
590         SAndRestriction          resAnd;
591         SBitMaskRestriction      resBitMask;
592         SCommentRestriction      resComment;
593         SComparePropsRestriction resCompareProps;
594         SContentRestriction      resContent;
595         SExistRestriction        resExist;
596         SNotRestriction          resNot;
597         SOrRestriction           resOr;
598         SPropertyRestriction     resProperty;
599         SSizeRestriction         resSize;
600         SSubRestriction          resSub;
601     } res;
602 } SRestriction;
603
604 /* Errors */
605 typedef struct _MAPIERROR
606 {
607     ULONG  ulVersion;       /* Mapi version */
608 #if defined (UNICODE) || defined (__WINESRC__)
609     LPWSTR lpszError;       /* Error and component strings. These are Ascii */
610     LPWSTR lpszComponent;   /* unless the MAPI_UNICODE flag is passed in */
611 #else
612     LPSTR  lpszError;
613     LPSTR  lpszComponent;
614 #endif
615     ULONG  ulLowLevelError;
616     ULONG  ulContext;
617 } MAPIERROR, *LPMAPIERROR;
618
619 /* Sorting */
620 #define TABLE_SORT_ASCEND  0U
621 #define TABLE_SORT_DESCEND 1U
622 #define TABLE_SORT_COMBINE 2U
623
624 typedef struct _SSortOrder
625 {
626     ULONG ulPropTag;
627     ULONG ulOrder;
628 } SSortOrder, *LPSSortOrder;
629
630 typedef struct _SSortOrderSet
631 {
632     ULONG      cSorts;
633     ULONG      cCategories;
634     ULONG      cExpanded;
635     SSortOrder aSort[MAPI_DIM];
636 } SSortOrderSet, * LPSSortOrderSet;
637
638 #define MNID_ID     0
639 #define MNID_STRING 1
640
641 typedef struct _MAPINAMEID
642 {
643     LPGUID lpguid;
644     ULONG ulKind;
645     union
646     {
647         LONG lID;
648         LPWSTR lpwstrName;
649     } Kind;
650 } MAPINAMEID, *LPMAPINAMEID;
651
652 /* Desired notification types (bitflags) */
653 #define fnevCriticalError        0x00000001UL
654 #define fnevNewMail              0x00000002UL
655 #define fnevObjectCreated        0x00000004UL
656 #define fnevObjectDeleted        0x00000008UL
657 #define fnevObjectModified       0x00000010UL
658 #define fnevObjectMoved          0x00000020UL
659 #define fnevObjectCopied         0x00000040UL
660 #define fnevSearchComplete       0x00000080UL
661 #define fnevTableModified        0x00000100UL
662 #define fnevStatusObjectModified 0x00000200UL
663 #define fnevReservedForMapi      0x40000000UL
664 #define fnevExtended             0x80000000UL
665
666 /* Type of notification event */
667 #define TABLE_CHANGED       1U
668 #define TABLE_ERROR         2U
669 #define TABLE_ROW_ADDED     3U
670 #define TABLE_ROW_DELETED   4U
671 #define TABLE_ROW_MODIFIED  5U
672 #define TABLE_SORT_DONE     6U
673 #define TABLE_RESTRICT_DONE 7U
674 #define TABLE_SETCOL_DONE   8U
675 #define TABLE_RELOAD        9U
676
677 /* fnevCriticalError notification */
678 typedef struct _ERROR_NOTIFICATION
679 {
680     ULONG       cbEntryID;
681     LPENTRYID   lpEntryID;
682     SCODE       scode;
683     ULONG       ulFlags;
684     LPMAPIERROR lpMAPIError;
685 } ERROR_NOTIFICATION;
686
687 /* fnevNewMail notification */
688 typedef struct _NEWMAIL_NOTIFICATION
689 {
690     ULONG     cbEntryID;
691     LPENTRYID lpEntryID;
692     ULONG     cbParentID;
693     LPENTRYID lpParentID;
694     ULONG     ulFlags;
695 #if defined (UNICODE) || defined (__WINESRC__)
696     LPWSTR    lpszMessageClass;
697 #else
698     LPSTR     lpszMessageClass;
699 #endif
700     ULONG     ulMessageFlags;
701 } NEWMAIL_NOTIFICATION;
702
703 /* fnevObjectCreated/Deleted/Modified/Moved/Copied notification */
704 typedef struct _OBJECT_NOTIFICATION
705 {
706     ULONG           cbEntryID;
707     LPENTRYID       lpEntryID;
708     ULONG           ulObjType;
709     ULONG           cbParentID;
710     LPENTRYID       lpParentID;
711     ULONG           cbOldID;
712     LPENTRYID       lpOldID;
713     ULONG           cbOldParentID;
714     LPENTRYID       lpOldParentID;
715     LPSPropTagArray lpPropTagArray;
716 } OBJECT_NOTIFICATION;
717
718 /* fnevTableModified notification */
719 typedef struct _TABLE_NOTIFICATION
720 {
721     ULONG      ulTableEvent;
722     HRESULT    hResult;
723     SPropValue propIndex;
724     SPropValue propPrior;
725     SRow       row;
726     ULONG      ulPad;
727 } TABLE_NOTIFICATION;
728
729 /* fnevExtended notification */
730 typedef struct _EXTENDED_NOTIFICATION
731 {
732     ULONG  ulEvent;
733     ULONG  cb;
734     LPBYTE pbEventParameters;
735 } EXTENDED_NOTIFICATION;
736
737 /* fnevStatusObjectModified notification */
738 typedef struct
739 {
740     ULONG        cbEntryID;
741     LPENTRYID    lpEntryID;
742     ULONG        cValues;
743     LPSPropValue lpPropVals;
744 } STATUS_OBJECT_NOTIFICATION;
745
746 /* The notification structure passed to advise sinks */
747 typedef struct _NOTIFICATION
748 {
749     ULONG ulEventType;
750     ULONG ulAlignPad;
751     union
752     {
753         ERROR_NOTIFICATION         err;
754         NEWMAIL_NOTIFICATION       newmail;
755         OBJECT_NOTIFICATION        obj;
756         TABLE_NOTIFICATION         tab;
757         EXTENDED_NOTIFICATION      ext;
758         STATUS_OBJECT_NOTIFICATION statobj;
759     } info;
760 } NOTIFICATION, *LPNOTIFICATION;
761
762 typedef LONG (WINAPI NOTIFCALLBACK)(LPVOID,ULONG,LPNOTIFICATION);
763 typedef NOTIFCALLBACK *LPNOTIFCALLBACK;
764
765 /*****************************************************************************
766  * IMAPITable interface
767  *
768  * This is the read-only 'view' over an I(MAPI)TableData object.
769  */
770 #define INTERFACE IMAPITable
771 #define IMAPITable_METHODS \
772     IUnknown_METHODS \
773     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppError) PURE; \
774     STDMETHOD(Advise)(THIS_ ULONG ulMask, LPMAPIADVISESINK lpSink, ULONG *lpCxn) PURE; \
775     STDMETHOD(Unadvise)(THIS_ ULONG ulCxn) PURE; \
776     STDMETHOD(GetStatus)(THIS_ ULONG *lpStatus, ULONG *lpType) PURE; \
777     STDMETHOD(SetColumns)(THIS_ LPSPropTagArray lpProps, ULONG ulFlags) PURE; \
778     STDMETHOD(QueryColumns)(THIS_ ULONG ulFlags, LPSPropTagArray *lpCols) PURE; \
779     STDMETHOD(GetRowCount)(THIS_ ULONG ulFlags, ULONG *lpCount) PURE; \
780     STDMETHOD(SeekRow)(THIS_ BOOKMARK lpStart, LONG lRows, LONG *lpSeeked) PURE; \
781     STDMETHOD(SeekRowApprox)(THIS_ ULONG ulNum, ULONG ulDenom) PURE; \
782     STDMETHOD(QueryPosition)(THIS_ ULONG *lpRow, ULONG *lpNum, ULONG *lpDenom) PURE; \
783     STDMETHOD(FindRow)(THIS_ LPSRestriction lpRestrict, BOOKMARK lpOrigin, ULONG ulFlags) PURE; \
784     STDMETHOD(Restrict)(THIS_ LPSRestriction lpRestrict, ULONG ulFlags) PURE; \
785     STDMETHOD(CreateBookmark)(THIS_ BOOKMARK *lppPos) PURE; \
786     STDMETHOD(FreeBookmark)(THIS_ BOOKMARK lpPos) PURE; \
787     STDMETHOD(SortTable)(THIS_ LPSSortOrderSet lpSortOpts, ULONG ulFlags) PURE; \
788     STDMETHOD(QuerySortOrder)(THIS_ LPSSortOrderSet *lppSortOpts) PURE; \
789     STDMETHOD(QueryRows)(THIS_ LONG lRows, ULONG ulFlags, LPSRowSet *lppRows) PURE; \
790     STDMETHOD(Abort) (THIS) PURE; \
791     STDMETHOD(ExpandRow)(THIS_ ULONG cbKey, LPBYTE lpKey, ULONG ulRows, \
792                          ULONG ulFlags, LPSRowSet *lppRows, ULONG *lpMore) PURE; \
793     STDMETHOD(CollapseRow)(THIS_ ULONG cbKey, LPBYTE lpKey, ULONG ulFlags, ULONG *lpRows) PURE; \
794     STDMETHOD(WaitForCompletion)(THIS_ ULONG ulFlags, ULONG ulTime, ULONG *lpState) PURE; \
795     STDMETHOD(GetCollapseState)(THIS_ ULONG ulFlags, ULONG cbKey, LPBYTE lpKey, \
796                                 ULONG *lpStateLen, LPBYTE *lpState) PURE; \
797     STDMETHOD(SetCollapseState)(THIS_ ULONG ulFlags, ULONG ulLen, \
798                                 LPBYTE lpStart, BOOKMARK *lppWhere) PURE;
799 ICOM_DEFINE(IMAPITable,IUnknown)
800 #undef INTERFACE
801
802 #ifdef COBJMACROS
803         /*** IUnknown methods ***/
804 #define IMAPITable_QueryInterface(p,a,b)         (p)->lpVtbl->QueryInterface(p,a,b)
805 #define IMAPITable_AddRef(p)                     (p)->lpVtbl->AddRef(p)
806 #define IMAPITable_Release(p)                    (p)->lpVtbl->Release(p)
807         /*** IMAPITable methods ***/
808 #define IMAPITable_GetLastError(p,a,b,c)         (p)->lpVtbl->GetLastError(p,a,b,c)
809 #define IMAPITable_Advise(p,a,b,c)               (p)->lpVtbl->Advise(p,a,b,c)
810 #define IMAPITable_Unadvise(p,a)                 (p)->lpVtbl->Unadvise(p,a)
811 #define IMAPITable_GetStatus(p,a,b)              (p)->lpVtbl->GetStatus(p,a,b)
812 #define IMAPITable_SetColumns(p,a,b)             (p)->lpVtbl->SetColumns(p,a,b)
813 #define IMAPITable_QueryColumns(p,a,b)           (p)->lpVtbl->QueryColumns(p,a,b)
814 #define IMAPITable_GetRowCount(p,a,b)            (p)->lpVtbl->GetRowCount(p,a,b)
815 #define IMAPITable_SeekRow(p,a,b)                (p)->lpVtbl->SeekRow(p,a,b)
816 #define IMAPITable_SeekRowApprox(p,a,b)          (p)->lpVtbl->SeekRowApprox(p,a,b)
817 #define IMAPITable_QueryPosition(p,a,b)          (p)->lpVtbl->QueryPosition(p,a,b)
818 #define IMAPITable_FindRow(p,a,b,c)              (p)->lpVtbl->FindRow(p,a,b,c)
819 #define IMAPITable_Restrict(p,a,b)               (p)->lpVtbl->Recstrict(p,a,b)
820 #define IMAPITable_CreateBookmark(p,a)           (p)->lpVtbl->CreateBookmark(p,a)
821 #define IMAPITable_FreeBookmark(p,a)             (p)->lpVtbl->FreeBookmark(p,a)
822 #define IMAPITable_SortTable(p,a,b)              (p)->lpVtbl->SortTable(p,a,b)
823 #define IMAPITable_QuerySortOrder(p,a)           (p)->lpVtbl->QuerySortOrder(p,a)
824 #define IMAPITable_QueryRows(p,a,b,c)            (p)->lpVtbl->QueryRows(p,a,b,c)
825 #define IMAPITable_Abort(p)                      (p)->lpVtbl->Abort(p)
826 #define IMAPITable_ExpandRow(p,a,b,c,d,e,f)      (p)->lpVtbl->ExpandRow(p,a,b,c,d,e,f)
827 #define IMAPITable_CollapseRow(p,a,b,c,d)        (p)->lpVtbl->CollapseRow(p,a,b,c,d)
828 #define IMAPITable_WaitForCompletion(p,a,b,c)    (p)->lpVtbl->WaitForCompletion(p,a,b,c)
829 #define IMAPITable_GetCollapseState(p,a,b,c,d,e) (p)->lpVtbl->GetCollapseState(p,a,b,c,d,e)
830 #define IMAPITable_SetCollapseState(p,a,b,c,d)   (p)->lpVtbl->SetCollapseState(p,a,b,c,d)
831 #endif
832
833 /*****************************************************************************
834  * IMAPIAdviseSink interface
835  */
836 #define INTERFACE IMAPIAdviseSink
837 #define IMAPIAdviseSink_METHODS \
838     IUnknown_METHODS \
839     STDMETHOD(OnNotify)(THIS_ ULONG NumNotif, LPNOTIFICATION lpNotif) PURE;
840 ICOM_DEFINE(IMAPIAdviseSink,IUnknown)
841 #undef INTERFACE
842
843 #ifdef COBJMACROS
844         /*** IUnknown methods ***/
845 #define IMAPIAdviseSink_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
846 #define IMAPIAdviseSink_AddRef(p)             (p)->lpVtbl->AddRef(p)
847 #define IMAPIAdviseSink_Release(p)            (p)->lpVtbl->Release(p)
848         /*** IMAPIAdviseSink methods ***/
849 #define IMAPIAdviseSink_OnNotify(p,a,b)       (p)->lpVtbl->OnNotify(p,a,b)
850 #endif
851
852 /*****************************************************************************
853  * IMAPIProp interface
854  */
855 #define INTERFACE IMAPIProp
856 #define IMAPIProp_METHODS \
857     IUnknown_METHODS \
858     STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; \
859     STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; \
860     STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; \
861     STDMETHOD(GetPropList)(THIS_ ULONG  ulFlags, LPSPropTagArray *lppPropTagArray) PURE; \
862     STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; \
863     STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; \
864     STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; \
865     STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, \
866                       LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, \
867                       LPSPropProblemArray *lppProbs) PURE; \
868     STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, \
869                          LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; \
870     STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, \
871                                LPMAPINAMEID **lpppNames) PURE; \
872     STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE;
873 ICOM_DEFINE(IMAPIProp,IUnknown)
874 #undef INTERFACE
875
876 #ifdef COBJMACROS
877         /*** IUnknown methods ***/
878 #define IMAPIProp_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
879 #define IMAPIProp_AddRef(p)                    (p)->lpVtbl->AddRef(p)
880 #define IMAPIProp_Release(p)                   (p)->lpVtbl->Release(p)
881         /*** IMAPIProp methods ***/
882 #define IMAPIProp_GetLastError(p,a,b,c)        (p)->lpVtbl->GetLastError(p,a,b,c)        
883 #define IMAPIProp_SaveChanges(p,a)             (p)->lpVtbl->SaveChanges(p,a)             
884 #define IMAPIProp_GetProps(p,a,b,c,d)          (p)->lpVtbl->GetProps(p,a,b,c,d)          
885 #define IMAPIProp_GetPropList(p,a,b)           (p)->lpVtbl->GetPropList(p,a,b)           
886 #define IMAPIProp_OpenProperty(p,a,b,c,d,e)    (p)->lpVtbl->OpenProperty(p,a,b,c,d,e)    
887 #define IMAPIProp_SetProps(p,a,b,c)            (p)->lpVtbl->SetProps(p,a,b,c)            
888 #define IMAPIProp_DeleteProps(p,a,b)           (p)->lpVtbl->DeleteProps(p,a,b)           
889 #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)  
890 #define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g)   (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g)   
891 #define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) 
892 #define IMAPIProp_GetIDsFromNames(p,a,b,c,d)   (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d)   
893 #endif
894
895 typedef struct
896 {
897     ULONG cb;
898     BYTE  abEntry[MAPI_DIM];
899 } FLATENTRY, *LPFLATENTRY;
900
901 typedef struct
902 {
903     ULONG cEntries;
904     ULONG cbEntries;
905     BYTE  abEntries[MAPI_DIM];
906 } FLATENTRYLIST, *LPFLATENTRYLIST;
907
908 typedef struct
909 {
910     ULONG cb;
911     BYTE  ab[MAPI_DIM];
912 } MTSID, *LPMTSID;
913
914 typedef struct
915 {
916     ULONG cMTSIDs;
917     ULONG cbMTSIDs;
918     BYTE  abMTSIDs[MAPI_DIM];
919 } FLATMTSIDLIST, *LPFLATMTSIDLIST;
920
921 typedef struct _ADRENTRY
922 {
923     ULONG        ulReserved1;
924     ULONG        cValues;
925     LPSPropValue rgPropVals;
926 } ADRENTRY, *LPADRENTRY;
927
928 typedef struct _ADRLIST
929 {
930     ULONG    cEntries;
931     ADRENTRY aEntries[MAPI_DIM];
932 } ADRLIST, *LPADRLIST;
933
934 #endif /*MAPIDEFS_H*/