Add minimalistic protected-headers support
[gpgol.git] / src / mymapi.h
1 /* mymapi.h - MAPI definitions required for GpgOL and Mingw32
2  * Copyright (C) 1998 Justin Bradford
3  * Copyright (C) 2000 François Gouget
4  * Copyright (C) 2005, 2007 g10 Code GmbH
5  * Copyright (C) 2015 by Bundesamt für Sicherheit in der Informationstechnik
6  * Software engineering by Intevation GmbH
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21
22 /* This header has been put together from the mingw32 and Wine
23    headers.  The first were missing the MAPI definitions and the
24    latter one is not compatible to the first one.  We only declare
25    stuff we really need for this project.
26
27    Revisions:
28    2005-07-26  Initial version (wk at g10code).
29    2005-08-14  Tweaked for use with myexchext.h.
30    2007-07-19  Add IConverterSession.  Info taken from
31                  http://blogs.msdn.com/stephen_griffin/archive/2007/06/22/
32                  iconvertersession-do-you-converter-session.aspx
33    2007-07-23  More IConverterSession features.
34    2007-07-23  Add IMAPISession; taken from WINE.
35    2007-07-24  Add IMsgStore, IMAPIContainer and IMAPIFolder taken from specs.
36                Reorganized code.
37    2008-08-01  Add IMAPIFormContainer taken from specs.
38 */
39
40 #ifndef MAPI_H
41 #define MAPI_H
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /* Some types */
48
49 #ifndef __LHANDLE
50 #define __LHANDLE
51 typedef unsigned long           LHANDLE, *LPLHANDLE;
52 #endif
53 #define lhSessionNull           ((LHANDLE)0)
54
55 typedef unsigned long           FLAGS;
56
57
58 typedef struct _MAPIUID
59 {
60     BYTE ab[sizeof(GUID)];
61 } MAPIUID, *LPMAPIUID;
62
63
64 struct MapiFileDesc_s
65 {
66   ULONG ulReserved;
67   ULONG flFlags;
68   ULONG nPosition;
69   LPSTR lpszPathName;
70   LPSTR lpszFileName;
71   LPVOID lpFileType;
72 };
73 typedef struct MapiFileDesc_s MapiFileDesc;
74 typedef struct MapiFileDesc_s *lpMapiFileDesc;
75
76 struct MapiRecipDesc_s
77 {
78   ULONG ulReserved;
79   ULONG ulRecipClass;
80   LPSTR lpszName;
81   LPSTR lpszAddress;
82   ULONG ulEIDSize;
83   LPVOID lpEntryID;
84 };
85 typedef struct MapiRecipDesc_s MapiRecipDesc;
86 typedef struct MapiRecipDesc_s *lpMapiRecipDesc;
87
88 struct MapiMessage_s
89 {
90   ULONG ulReserved;
91   LPSTR lpszSubject;
92   LPSTR lpszNoteText;
93   LPSTR lpszMessageType;
94   LPSTR lpszDateReceived;
95   LPSTR lpszConversationID;
96   FLAGS flFlags;
97   lpMapiRecipDesc lpOriginator;
98   ULONG nRecipCount;
99   lpMapiRecipDesc lpRecips;
100   ULONG nFileCount;
101   lpMapiFileDesc lpFiles;
102 };
103 typedef struct MapiMessage_s MapiMessage;
104 typedef struct MapiMessage_s *lpMapiMessage;
105
106
107 /* Error codes */
108 #define MAPI_E_NO_ACCESS                   E_ACCESSDENIED
109 #define MAPI_E_NOT_FOUND                   ((SCODE)0x8004010F)
110
111
112 /* Object types.  */
113 #define MAPI_STORE      0x00000001u
114 #define MAPI_ADDRBOOK   0x00000002u
115 #define MAPI_FOLDER     0x00000003u
116 #define MAPI_ABCONT     0x00000004u
117 #define MAPI_MESSAGE    0x00000005u
118 #define MAPI_MAILUSER   0x00000006u
119 #define MAPI_ATTACH     0x00000007u
120 #define MAPI_DISTLIST   0x00000008u
121 #define MAPI_PROFSECT   0x00000009u
122 #define MAPI_STATUS     0x0000000Au
123 #define MAPI_SESSION    0x0000000Bu
124 #define MAPI_FORMINFO   0x0000000Cu
125
126
127 /* MAPILogon */
128 #define MAPI_LOGON_UI           0x00000001
129 #define MAPI_PASSWORD_UI        0x00020000
130 #define MAPI_NEW_SESSION        0x00000002
131 #define MAPI_FORCE_DOWNLOAD     0x00001000
132 #define MAPI_EXTENDED           0x00000020
133
134
135 /* MAPISendMail */
136 #define MAPI_DIALOG             0x00000008
137
138
139 /* Flags for various calls */
140 #define MAPI_MODIFY                   0x00000001U /* Object can be modified. */
141 #define MAPI_CREATE                   0x00000002U
142 #define MAPI_ACCESS_MODIFY            MAPI_MODIFY /* Want write access. */
143 #define MAPI_ACCESS_READ              0x00000002U /* Want read access. */
144 #define MAPI_ACCESS_DELETE            0x00000004U /* Want delete access. */
145 #define MAPI_ACCESS_CREATE_HIERARCHY  0x00000008U
146 #define MAPI_ACCESS_CREATE_CONTENTS   0x00000010U
147 #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U
148 #define MAPI_UNICODE                  0x80000000U /* Strings in this
149                                                      call are Unicode. */
150
151 #define MAPI_DEFERRED_ERRORS          0x00000008ul
152 #define MAPI_BEST_ACCESS              0x00000010ul
153 #define MAPI_CACHE_ONLY               0x00004000ul
154
155 #define MDB_NO_DIALOG                 0x00000001ul
156 #define MDB_WRITE                     0x00000004ul
157 #define MDB_TEMPORARY                 0x00000020ul
158 #define MDB_NO_MAIL                   0x00000080ul
159
160
161 #define ATTACH_BY_VALUE       1
162 #define ATTACH_BY_REFERENCE   2
163 #define ATTACH_BY_REF_RESOLVE 3
164 #define ATTACH_BY_REF_ONLY    4
165 #define ATTACH_EMBEDDED_MSG   5
166 #define ATTACH_OLE            6
167
168
169 #define KEEP_OPEN_READONLY            0x00000001
170 #define KEEP_OPEN_READWRITE           0x00000002
171 #define FORCE_SAVE                    0x00000004
172
173 #define SOF_UNIQUEFILENAME            0x80000000
174
175 #define RTF_SYNC_RTF_CHANGED          1
176 #define RTF_SYNC_BODY_CHANGED         2
177
178
179 #define FORCE_SUBMIT                  0x00000001ul
180
181 #define MSGFLAG_READ                  0x00000001ul
182 #define MSGFLAG_UNMODIFIED            0x00000002ul
183 #define MSGFLAG_SUBMIT                0x00000004ul
184 #define MSGFLAG_UNSENT                0x00000008ul
185 #define MSGFLAG_HASATTACH             0x00000010ul
186 #define MSGFLAG_FROMME                0x00000020ul
187 #define MSGFLAG_ASSOCIATED            0x00000040ul
188 #define MSGFLAG_RESEND                0x00000080ul
189 #define MSGFLAG_RN_PENDING            0x00000100ul
190 #define MSGFLAG_NRN_PENDING           0x00000200ul
191
192 #define SUBMITFLAG_LOCKED             0x00000001ul
193 #define SUBMITFLAG_PREPROCESS         0x00000002ul
194
195 #define HOOK_DELETE                   0x00000001ul
196 #define HOOK_CANCEL                   0x00000002ul
197
198 #define HOOK_INBOUND                  0x00000200ul
199 #define HOOK_OUTBOUND                 0x00000400ul
200
201
202 #ifndef MAPI_DIM
203 # define MAPI_DIM 1 /* Default to one dimension for variable length arrays */
204 #endif
205
206 DEFINE_OLEGUID(IID_IABContainer,0x2030D,0,0);
207 DEFINE_OLEGUID(IID_IABLogon,0x20314,0,0);
208 DEFINE_OLEGUID(IID_IABProvider,0x20311,0,0);
209 DEFINE_OLEGUID(IID_IAddrBook,0x20309,0,0);
210 DEFINE_OLEGUID(IID_IAttachment,0x20308,0,0);
211 DEFINE_OLEGUID(IID_IDistList,0x2030E,0,0);
212 DEFINE_OLEGUID(IID_IEnumMAPIFormProp,0x20323,0,0);
213 DEFINE_OLEGUID(IID_IMailUser,0x2030A,0,0);
214 DEFINE_OLEGUID(IID_IMAPIAdviseSink,0x20302,0,0);
215 DEFINE_OLEGUID(IID_IMAPIContainer,0x2030B,0,0);
216 DEFINE_OLEGUID(IID_IMAPIControl,0x2031B,0,0);
217 DEFINE_OLEGUID(IID_IMAPIFolder,0x2030C,0,0);
218 DEFINE_OLEGUID(IID_IMAPIForm,0x20327,0,0);
219 DEFINE_OLEGUID(IID_IMAPIFormAdviseSink,0x2032F,0,0);
220 DEFINE_OLEGUID(IID_IMAPIFormContainer,0x2032E,0,0);
221 DEFINE_OLEGUID(IID_IMAPIFormFactory,0x20350,0,0);
222 DEFINE_OLEGUID(IID_IMAPIFormInfo,0x20324,0,0);
223 DEFINE_OLEGUID(IID_IMAPIFormMgr,0x20322,0,0);
224 DEFINE_OLEGUID(IID_IMAPIFormProp,0x2032D,0,0);
225 DEFINE_OLEGUID(IID_IMAPIMessageSite,0x20370,0,0);
226 DEFINE_OLEGUID(IID_IMAPIProgress,0x2031F,0,0);
227 DEFINE_OLEGUID(IID_IMAPIProp,0x20303,0,0);
228 DEFINE_OLEGUID(IID_IMAPIPropData,0x2031A,0,0);
229 DEFINE_OLEGUID(IID_IMAPISession,0x20300,0,0);
230 DEFINE_OLEGUID(IID_IMAPISpoolerInit,0x20317,0,0);
231 DEFINE_OLEGUID(IID_IMAPISpoolerService,0x2031E,0,0);
232 DEFINE_OLEGUID(IID_IMAPISpoolerSession,0x20318,0,0);
233 DEFINE_OLEGUID(IID_IMAPIStatus,0x20305,0,0);
234 DEFINE_OLEGUID(IID_IMAPISup,0x2030F,0,0);
235 DEFINE_OLEGUID(IID_IMAPITable,0x20301,0,0);
236 DEFINE_OLEGUID(IID_IMAPITableData,0x20316,0,0);
237 DEFINE_OLEGUID(IID_IMAPIViewAdviseSink,0x2032B,0,0);
238 DEFINE_OLEGUID(IID_IMAPIViewContext,0x20321,0,0);
239 DEFINE_OLEGUID(IID_IMessage,0x20307,0,0);
240 DEFINE_OLEGUID(IID_IMsgServiceAdmin,0x2031D,0,0);
241 DEFINE_OLEGUID(IID_IMsgStore,0x20306,0,0);
242 DEFINE_OLEGUID(IID_IMSLogon,0x20313,0,0);
243 DEFINE_OLEGUID(IID_IMSProvider,0x20310,0,0);
244 DEFINE_OLEGUID(IID_IPersistMessage,0x2032A,0,0);
245 DEFINE_OLEGUID(IID_IProfAdmin,0x2031C,0,0);
246 DEFINE_OLEGUID(IID_IProfSect,0x20304,0,0);
247 DEFINE_OLEGUID(IID_IProviderAdmin,0x20325,0,0);
248 DEFINE_OLEGUID(IID_ISpoolerHook,0x20320,0,0);
249 DEFINE_OLEGUID(IID_IStream, 0x0000c, 0, 0);
250 DEFINE_OLEGUID(IID_IStreamDocfile,0x2032C,0,0);
251 DEFINE_OLEGUID(IID_IStreamTnef,0x20330,0,0);
252 DEFINE_OLEGUID(IID_ITNEF,0x20319,0,0);
253 DEFINE_OLEGUID(IID_IXPLogon,0x20315,0,0);
254 DEFINE_OLEGUID(IID_IXPProvider,0x20312,0,0);
255 DEFINE_OLEGUID(MUID_PROFILE_INSTANCE,0x20385,0,0);
256 DEFINE_OLEGUID(PS_MAPI,0x20328,0,0);
257 DEFINE_OLEGUID(PS_PUBLIC_STRINGS,0x20329,0,0);
258 DEFINE_OLEGUID(PS_ROUTING_ADDRTYPE,0x20381,0,0);
259 DEFINE_OLEGUID(PS_ROUTING_DISPLAY_NAME,0x20382,0,0);
260 DEFINE_OLEGUID(PS_ROUTING_EMAIL_ADDRESSES,0x20380,0,0);
261 DEFINE_OLEGUID(PS_ROUTING_ENTRYID,0x20383,0,0);
262 DEFINE_OLEGUID(PS_ROUTING_SEARCH_KEY,0x20384,0,0);
263
264 DEFINE_GUID(CLSID_IConverterSession, 0x4e3a7680, 0xb77a,
265             0x11d0, 0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
266 DEFINE_GUID(IID_IConverterSession, 0x4b401570, 0xb77b,
267             0x11d0, 0x9d, 0xa5, 0x0, 0xc0, 0x4f, 0xd6, 0x56, 0x85);
268
269
270
271 struct _ENTRYID
272 {
273     BYTE abFlags[4];
274     BYTE ab[MAPI_DIM];
275 };
276 typedef struct _ENTRYID ENTRYID;
277 typedef struct _ENTRYID *LPENTRYID;
278
279
280 /* The property tag structure. This describes a list of columns */
281 typedef struct _SPropTagArray
282 {
283     ULONG cValues;              /* Number of elements in aulPropTag */
284     ULONG aulPropTag[MAPI_DIM]; /* Property tags */
285 } SPropTagArray, *LPSPropTagArray;
286
287 #define CbNewSPropTagArray(c) \
288                (offsetof(SPropTagArray,aulPropTag)+(c)*sizeof(ULONG))
289 #define CbSPropTagArray(p)    CbNewSPropTagArray((p)->cValues)
290 #define SizedSPropTagArray(n,id) \
291     struct _SPropTagArray_##id { ULONG cValues; ULONG aulPropTag[n]; } id
292
293
294 /* Multi-valued PT_APPTIME property value */
295 typedef struct _SAppTimeArray
296 {
297     ULONG   cValues; /* Number of doubles in lpat */
298     double *lpat;    /* Pointer to double array of length cValues */
299 } SAppTimeArray;
300
301 /* PT_BINARY property value */
302 typedef struct _SBinary
303 {
304     ULONG  cb;  /* Number of bytes in lpb */
305     LPBYTE lpb; /* Pointer to byte array of length cb */
306 } SBinary, *LPSBinary;
307
308 /* Multi-valued PT_BINARY property value */
309 typedef struct _SBinaryArray
310 {
311     ULONG    cValues; /* Number of SBinarys in lpbin */
312     SBinary *lpbin;   /* Pointer to SBinary array of length cValues */
313 } SBinaryArray;
314
315 typedef SBinaryArray ENTRYLIST, *LPENTRYLIST;
316
317 /* Multi-valued PT_CY property value */
318 typedef struct _SCurrencyArray
319 {
320     ULONG  cValues; /* Number of CYs in lpcu */
321     CY    *lpcur;   /* Pointer to CY array of length cValues */
322 } SCurrencyArray;
323
324 /* Multi-valued PT_SYSTIME property value */
325 typedef struct _SDateTimeArray
326 {
327     ULONG     cValues; /* Number of FILETIMEs in lpft */
328     FILETIME *lpft;    /* Pointer to FILETIME array of length cValues */
329 } SDateTimeArray;
330
331 /* Multi-valued PT_DOUBLE property value */
332 typedef struct _SDoubleArray
333 {
334     ULONG   cValues; /* Number of doubles in lpdbl */
335     double *lpdbl;   /* Pointer to double array of length cValues */
336 } SDoubleArray;
337
338 /* Multi-valued PT_CLSID property value */
339 typedef struct _SGuidArray
340 {
341     ULONG cValues; /* Number of GUIDs in lpguid */
342     GUID *lpguid;  /* Pointer to GUID array of length cValues */
343 } SGuidArray;
344
345 /* Multi-valued PT_LONGLONG property value */
346 typedef struct _SLargeIntegerArray
347 {
348     ULONG          cValues; /* Number of long64s in lpli */
349     LARGE_INTEGER *lpli;    /* Pointer to long64 array of length cValues */
350 } SLargeIntegerArray;
351
352 /* Multi-valued PT_LONG property value */
353 typedef struct _SLongArray
354 {
355     ULONG  cValues; /* Number of longs in lpl */
356     LONG  *lpl;     /* Pointer to long array of length cValues */
357 } SLongArray;
358
359 /* Multi-valued PT_STRING8 property value */
360 typedef struct _SLPSTRArray
361 {
362     ULONG  cValues; /* Number of Ascii strings in lppszA */
363     LPSTR *lppszA;  /* Pointer to Ascii string array of length cValues */
364 } SLPSTRArray;
365
366 /* Multi-valued PT_FLOAT property value */
367 typedef struct _SRealArray
368 {
369     ULONG cValues; /* Number of floats in lpflt */
370     float *lpflt;  /* Pointer to float array of length cValues */
371 } SRealArray;
372
373 /* Multi-valued PT_SHORT property value */
374 typedef struct _SShortArray
375 {
376     ULONG      cValues; /* Number of shorts in lpb */
377     short int *lpi;     /* Pointer to short array of length cValues */
378 } SShortArray;
379
380 /* Multi-valued PT_UNICODE property value */
381 typedef struct _SWStringArray
382 {
383     ULONG   cValues; /* Number of Unicode strings in lppszW */
384     LPWSTR *lppszW;  /* Pointer to Unicode string array of length cValues */
385 } SWStringArray;
386
387
388 /* A property value */
389 union PV_u
390 {
391     short int          i;
392     LONG               l;
393     ULONG              ul;
394     float              flt;
395     double             dbl;
396     unsigned short     b;
397     CY                 cur;
398     double             at;
399     FILETIME           ft;
400     LPSTR              lpszA;
401     SBinary            bin;
402     LPWSTR             lpszW;
403     LPGUID             lpguid;
404     LARGE_INTEGER      li;
405     SShortArray        MVi;
406     SLongArray         MVl;
407     SRealArray         MVflt;
408     SDoubleArray       MVdbl;
409     SCurrencyArray     MVcur;
410     SAppTimeArray      MVat;
411     SDateTimeArray     MVft;
412     SBinaryArray       MVbin;
413     SLPSTRArray        MVszA;
414     SWStringArray      MVszW;
415     SGuidArray         MVguid;
416     SLargeIntegerArray MVli;
417     SCODE              err;
418     LONG               x;
419 };
420 typedef union PV_u uPV;
421
422 /* Property value structure. This is essentially a mini-Variant. */
423 struct SPropValue_s
424 {
425   ULONG     ulPropTag;  /* The property type. */
426   ULONG     dwAlignPad; /* Alignment, treat as reserved. */
427   uPV       Value;      /* The property value. */
428 };
429 typedef struct SPropValue_s SPropValue;
430 typedef struct SPropValue_s *LPSPropValue;
431
432 /* Structure describing a table row (a collection of property values). */
433 struct SRow_s
434 {
435   ULONG        ulAdrEntryPad; /* Padding, treat as reserved. */
436   ULONG        cValues;       /* Count of property values in lpProbs. */
437   LPSPropValue lpProps;       /* Pointer to an array of property
438                                  values of length cValues. */
439 };
440 typedef struct SRow_s SRow;
441 typedef struct SRow_s *LPSRow;
442
443
444 /* Structure describing a set of table rows. */
445 struct SRowSet_s
446 {
447   ULONG cRows;          /* Count of rows in aRow. */
448   SRow  aRow[MAPI_DIM]; /* Array of rows of length cRows. */
449 };
450 typedef struct SRowSet_s *LPSRowSet;
451
452
453 /* Structure describing a problem with a property */
454 typedef struct _SPropProblem
455 {
456     ULONG ulIndex;   /* Index of the property */
457     ULONG ulPropTag; /* Proprty tag of the property */
458     SCODE scode;     /* Error code of the problem */
459 } SPropProblem, *LPSPropProblem;
460
461 /* A collection of property problems */
462 typedef struct _SPropProblemArray
463 {
464     ULONG        cProblem;           /* Number of problems in aProblem */
465     SPropProblem aProblem[MAPI_DIM]; /* Array of problems of length cProblem */
466 } SPropProblemArray, *LPSPropProblemArray;
467
468
469 /* Table bookmarks */
470 typedef ULONG BOOKMARK;
471
472 #define BOOKMARK_BEGINNING ((BOOKMARK)0) /* The first row */
473 #define BOOKMARK_CURRENT   ((BOOKMARK)1) /* The curent table row */
474 #define BOOKMARK_END       ((BOOKMARK)2) /* The last row */
475
476
477 /* Row restrictions */
478 typedef struct _SRestriction* LPSRestriction;
479
480
481 /* Errors. */
482 typedef struct _MAPIERROR
483 {
484     ULONG  ulVersion;       /* Mapi version */
485 #if defined (UNICODE) || defined (__WINESRC__)
486     LPWSTR lpszError;       /* Error and component strings. These are Ascii */
487     LPWSTR lpszComponent;   /* unless the MAPI_UNICODE flag is passed in */
488 #else
489     LPSTR  lpszError;
490     LPSTR  lpszComponent;
491 #endif
492     ULONG  ulLowLevelError;
493     ULONG  ulContext;
494 } MAPIERROR, *LPMAPIERROR;
495
496
497 /* Sorting */
498 #define TABLE_SORT_ASCEND  0U
499 #define TABLE_SORT_DESCEND 1U
500 #define TABLE_SORT_COMBINE 2U
501
502 typedef struct _SSortOrder
503 {
504     ULONG ulPropTag;
505     ULONG ulOrder;
506 } SSortOrder, *LPSSortOrder;
507
508 typedef struct _SSortOrderSet
509 {
510     ULONG      cSorts;
511     ULONG      cCategories;
512     ULONG      cExpanded;
513     SSortOrder aSort[MAPI_DIM];
514 } SSortOrderSet, * LPSSortOrderSet;
515
516
517
518 typedef struct _MAPINAMEID
519 {
520     LPGUID lpguid;
521     ULONG ulKind;
522     union
523     {
524         LONG lID;
525         LPWSTR lpwstrName;
526     } Kind;
527 } MAPINAMEID, *LPMAPINAMEID;
528
529 #define MNID_ID     0
530 #define MNID_STRING 1
531
532
533 typedef struct _ADRENTRY
534 {
535     ULONG        ulReserved1;
536     ULONG        cValues;
537     LPSPropValue rgPropVals;
538 } ADRENTRY, *LPADRENTRY;
539
540 typedef struct _ADRLIST
541 {
542     ULONG    cEntries;
543     ADRENTRY aEntries[MAPI_DIM];
544 } ADRLIST, *LPADRLIST;
545
546
547 struct IAddrBook;
548 typedef struct IAddrBook *LPADRBOOK;
549
550
551 /* FIXME: Need to move the HCHARSET definition to some other place.  */
552 typedef void *HCHARSET;
553
554
555 typedef enum tagCHARSETTYPE
556   {
557     CHARSET_BODY = 0,
558     CHARSET_HEADER = 1,
559     CHARSET_WEB = 2
560   }
561 CHARSETTYPE;
562
563 typedef enum tagCSETAPPLYTYPE
564   {
565     CSET_APPLY_UNTAGGED = 0,
566     CSET_APPLY_ALL = 1,
567     CSET_APPLY_TAG_ALL = 2
568   }
569 CSETAPPLYTYPE;
570
571
572 /* Note that this is just a minimal definition.  */
573 typedef struct
574 {
575   ULONG ulEventType;  /* Notification type.  */
576   ULONG ulAlignPad;   /* Force alignment on a 8 byte.  */
577   union {
578     struct {
579       ULONG           n_entryid;
580       LPENTRYID       entryid;
581       ULONG           obj_type;
582       ULONG           n_parentid;
583       LPENTRYID       parentid;
584       ULONG           n_oldid;
585       LPENTRYID       oldid;
586       ULONG           n_oldparentid;
587       LPENTRYID       oldparentid;
588       LPSPropTagArray prop_tag_array;
589     } obj;
590   } info;
591 } NOTIFICATION, FAR *LPNOTIFICATION;
592
593
594 /* Definitions required for IConverterSession. */
595 typedef enum tagMIMESAVETYPE
596   {
597     SAVE_RFC822 = 0,    /* Use uuencode for attachments.  */
598     SAVE_RFC1521 = 1    /* Regular MIME.  */
599   }
600 MIMESAVETYPE;
601
602 typedef enum tagENCODINGTYPE
603   {
604     IET_BINARY   = 0,
605     IET_BASE64   = 1,
606     IET_UUENCODE = 2,
607     IET_QP       = 3,
608     IET_7BIT     = 4,
609     IET_8BIT     = 5,
610     IET_INETCSET = 6,
611     IET_UNICODE  = 7,
612     IET_RFC1522  = 8,
613     IET_ENCODED  = 9,
614     IET_CURRENT  = 10,
615     IET_UNKNOWN  = 11,
616     IET_BINHEX40 = 12,
617     IET_LAST     = 13
618   }
619 ENCODINGTYPE;
620
621 #define CCSF_SMTP            0x0002 /* The input is an SMTP message.  */
622 #define CCSF_NOHEADERS       0x0004 /* Ignore headers outside the message.  */
623 #define CCSF_USE_TNEF        0x0010 /* Embed TNEF in MIME.  */
624 #define CCSF_INCLUDE_BCC     0x0020 /* Include BCC recipients.  */
625 #define CCSF_8BITHEADERS     0x0040 /* Allow 8-bit headers. (mapi->mime) */
626 #define CCSF_USE_RTF         0x0080 /* Convert HTML to RTF.  */
627 #define CCSF_PLAIN_TEXT_ONLY 0x1000 /* Create only plain text (mapi->mime) */
628 #define CCSF_NO_MSGID        0x4000 /* Do not include Message-Id.  */
629
630
631 \f
632 /**** Class definitions ****/
633 typedef const IID *LPCIID;
634
635
636 struct IAttach;
637 typedef struct IAttach *LPATTACH;
638
639 struct IMAPIAdviseSink;
640 typedef struct IMAPIAdviseSink *LPMAPIADVISESINK;
641
642 struct IMAPIProgress;
643 typedef struct IMAPIProgress *LPMAPIPROGRESS;
644
645 struct IMAPITable;
646 typedef struct IMAPITable *LPMAPITABLE;
647
648 struct IMAPIProp;
649 typedef struct IMAPIProp *LPMAPIPROP;
650
651 struct IMessage;
652 typedef struct IMessage *LPMESSAGE;
653
654 struct IMAPIContainer;
655 typedef struct IMAPIContainer *LPMAPICONTAINER;
656
657 struct IMAPIFolder;
658 typedef struct IMAPIFolder *LPMAPIFOLDER;
659
660 struct IMsgStore;
661 typedef struct IMsgStore *LPMDB;
662
663 struct IMAPISession;
664 typedef struct IMAPISession *LPMAPISESSION;
665
666 struct IMsgServiceAdmin;
667 typedef struct IMsgServiceAdmin *LPSERVICEADMIN;
668
669 struct IConverterSession;
670 typedef struct IConverterSession *LPCONVERTERSESSION;
671
672 struct IProfSect;
673 typedef struct IProfSect *LPPROFSECT;
674
675 struct ISpoolerHook;
676 typedef struct ISpoolerHook *LPSPOOLERHOOK;
677
678 struct IMAPIFormContainer;
679 typedef struct IMAPIFormContainer *LPMAPIFORMCONTAINER;
680
681
682 /*** IMAPIProp methods ***/
683 #define MY_IMAPIPROP_METHODS \
684   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR FAR*);         \
685   STDMETHOD(SaveChanges)(THIS_ ULONG);                                     \
686   STDMETHOD(GetProps)(THIS_ LPSPropTagArray, ULONG, ULONG FAR*,            \
687                       LPSPropValue FAR*);                                  \
688   STDMETHOD(GetPropList)(THIS_ ULONG, LPSPropTagArray FAR *);              \
689   STDMETHOD(OpenProperty)(THIS_ ULONG, LPCIID lpiid, ULONG,                \
690                           ULONG, LPUNKNOWN FAR*);                          \
691   STDMETHOD(SetProps)(THIS_ LONG, LPSPropValue, LPSPropProblemArray FAR*); \
692   STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray, LPSPropProblemArray FAR *);\
693   STDMETHOD(CopyTo)(THIS_ ULONG, LPCIID, LPSPropTagArray, ULONG,           \
694                     LPMAPIPROGRESS, LPCIID lpInterface, LPVOID,            \
695                     ULONG, LPSPropProblemArray FAR*);                      \
696   STDMETHOD(CopyProps)(THIS_ LPSPropTagArray, ULONG, LPMAPIPROGRESS,       \
697                        LPCIID, LPVOID, ULONG, LPSPropProblemArray FAR*);   \
698   STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray FAR*, LPGUID,           \
699                              ULONG, ULONG FAR*, LPMAPINAMEID FAR* FAR*);   \
700   STDMETHOD(GetIDsFromNames)(THIS_ ULONG, LPMAPINAMEID FAR*, ULONG,        \
701                              LPSPropTagArray FAR*)
702
703 /*** IMsgstore methods ***/
704 #define MY_IMSGSTORE_METHODS \
705   STDMETHOD(Advise)(THIS_ ULONG n_entryid, LPENTRYID entryid,                \
706                     ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink,        \
707                     ULONG FAR *connection) PURE;                             \
708   STDMETHOD(Unadvise)(THIS_ ULONG connection) PURE;                          \
709   STDMETHOD(CompareEntryIDs)(THIS_  ULONG n_entryid1, LPENTRYID entryid1,    \
710                              ULONG n_entryid2, LPENTRYID entryid2,           \
711                              ULONG flags, ULONG FAR *lpulResult) PURE;       \
712   STDMETHOD(OpenEntry)(THIS_ ULONG n_entryid, LPENTRYID entryid,             \
713                        LPCIID lpInterface, ULONG flags,                      \
714                        ULONG FAR *obj_type, LPUNKNOWN FAR *lppUnk) PURE;     \
715   STDMETHOD(SetReceiveFolder)(THIS_ LPTSTR message_class, ULONG flags,       \
716                               ULONG n_entryid, LPENTRYID entryid) PURE;      \
717   STDMETHOD(GetReceiveFolder)(THIS_ LPTSTR message_class, ULONG flags,       \
718                               ULONG FAR *r_nentryid,LPENTRYID FAR *r_entryid,\
719                               LPTSTR FAR *lppszExplicitClass) PURE;          \
720   STDMETHOD(GetReceiveFolderTable)(THIS_ ULONG flags,                        \
721                                    LPMAPITABLE FAR *lppTable) PURE;          \
722   STDMETHOD(StoreLogoff)(THIS_ ULONG FAR *r_flags) PURE;                     \
723   STDMETHOD(AbortSubmit)(THIS_ ULONG nentryid, LPENTRYID entryid,            \
724                          ULONG flags) PURE;                                  \
725   STDMETHOD(GetOutgoingQueue)(THIS_ ULONG flags,LPMAPITABLE FAR *table) PURE;\
726   STDMETHOD(SetLockState)(THIS_ LPMESSAGE message, ULONG lock_state) PURE;   \
727   STDMETHOD(FinishedMsg)(THIS_ ULONG ulFlags,                                \
728                          ULONG nentryid, LPENTRYID entryid) PURE;            \
729   STDMETHOD(NotifyNewMail)(THIS_ LPNOTIFICATION notification) PURE
730
731
732 /*** IMessage methods ***/
733 #define MY_IMESSAGE_METHODS \
734   STDMETHOD(GetAttachmentTable)(THIS_ ULONG, LPMAPITABLE FAR*) PURE;         \
735   STDMETHOD(OpenAttach)(THIS_ ULONG, LPCIID, ULONG, LPATTACH FAR*) PURE;     \
736   STDMETHOD(CreateAttach)(THIS_ LPCIID, ULONG, ULONG FAR*,                   \
737                           LPATTACH FAR*) PURE;                               \
738   STDMETHOD(DeleteAttach)(THIS_ ULONG, ULONG, LPMAPIPROGRESS, ULONG) PURE;   \
739   STDMETHOD(GetRecipientTable)(THIS_ ULONG, LPMAPITABLE FAR*) PURE;          \
740   STDMETHOD(ModifyRecipients)(THIS_ ULONG, LPADRLIST) PURE;                  \
741   STDMETHOD(SubmitMessage)(THIS_ ULONG) PURE;                                \
742   STDMETHOD(SetReadFlag)(THIS_ ULONG) PURE
743
744 /*** IMAPIContainer ***/
745 #define MY_IMAPICONTAINER_METHODS \
746   STDMETHOD(GetContentsTable)(THIS_ ULONG flags,                             \
747                               LPMAPITABLE FAR *table) PURE;                  \
748   STDMETHOD(GetHierarchyTable)(THIS_ ULONG flags,                            \
749                                LPMAPITABLE FAR *table) PURE;                 \
750   STDMETHOD(OpenEntry)(THIS_ ULONG n_entryid, LPENTRYID entryid,             \
751                        LPCIID iface, ULONG flags,                            \
752                        ULONG FAR *obj_type, LPUNKNOWN FAR *lppUnk) PURE;     \
753   STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction restriction,             \
754                                LPENTRYLIST container_list,                   \
755                                ULONG  search_flags) PURE;                    \
756   STDMETHOD(GetSearchCriteria)(THIS_ ULONG flags,                            \
757                                LPSRestriction FAR *restriction,              \
758                                LPENTRYLIST FAR *container_list,              \
759                                ULONG FAR *search_state) PURE
760
761
762 /*** IMAPIFolder methods ***/
763 #define MY_IMAPIFOLDER_METHODS \
764   STDMETHOD(CreateMessage)(THIS_ LPCIID iface, ULONG flags,                  \
765                            LPMESSAGE FAR *message) PURE;                     \
766   STDMETHOD(CopyMessages)(THIS_ LPENTRYLIST msg_list, LPCIID iface,          \
767                           LPVOID dest_folder, ULONG ui_param,                \
768                           LPMAPIPROGRESS progress, ULONG flags) PURE;        \
769   STDMETHOD(DeleteMessages)(THIS_ LPENTRYLIST msg_list, ULONG uiparam,       \
770                             LPMAPIPROGRESS progress, ULONG flags) PURE;      \
771   STDMETHOD(CreateFolder)(THIS_ ULONG folder_type, LPTSTR folder_name,       \
772                           LPTSTR folder_comment, LPCIID iface,               \
773                           ULONG flags, LPMAPIFOLDER FAR *folder) PURE;       \
774   STDMETHOD(CopyFolder)(THIS_ ULONG n_entryid, LPENTRYID entryid,            \
775                         LPCIID iface, LPVOID dest_folder,                    \
776                         LPTSTR new_folder_name, ULONG uiparam,               \
777                         LPMAPIPROGRESS progress, ULONG flags) PURE;          \
778   STDMETHOD(DeleteFolder)(THIS_ ULONG n_entryid, LPENTRYID entryid,          \
779                           ULONG uiparam,                                     \
780                           LPMAPIPROGRESS progress, ULONG flags) PURE;        \
781   STDMETHOD(SetReadFlags)(THIS_ LPENTRYLIST msg_list, ULONG uiparam,         \
782                           LPMAPIPROGRESS progress, ULONG flags) PURE;        \
783   STDMETHOD(GetMessageStatus)(THIS_ ULONG n_entryid, LPENTRYID entryid,      \
784                               ULONG flags, ULONG FAR *message_status) PURE;  \
785   STDMETHOD(SetMessageStatus)(THIS_ ULONG n_entryid, LPENTRYID entryid,      \
786                               ULONG new_status, ULONG new_status_mask,       \
787                               ULONG FAR *r_old_status) PURE;                 \
788   STDMETHOD(SaveContentsSort)(THIS_ LPSSortOrderSet sort_criteria,           \
789                               ULONG flags) PURE;                             \
790   STDMETHOD(EmptyFolder)(THIS_ ULONG uiparam,                                \
791                          LPMAPIPROGRESS progress, ULONG flags) PURE
792
793
794 /*** IMAPITable methods ***/
795 #define MY_IMAPITABLE_METHODS \
796   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR*) PURE;          \
797   STDMETHOD(Advise)(THIS_ ULONG, LPMAPIADVISESINK, ULONG*) PURE;             \
798   STDMETHOD(Unadvise)(THIS_ ULONG ulCxn) PURE;                               \
799   STDMETHOD(GetStatus)(THIS_ ULONG*, ULONG*) PURE;                           \
800   STDMETHOD(SetColumns)(THIS_ LPSPropTagArray, ULONG) PURE;                  \
801   STDMETHOD(QueryColumns)(THIS_ ULONG, LPSPropTagArray*) PURE;               \
802   STDMETHOD(GetRowCount)(THIS_ ULONG, ULONG *) PURE;                         \
803   STDMETHOD(SeekRow)(THIS_ BOOKMARK, LONG, LONG*) PURE;                      \
804   STDMETHOD(SeekRowApprox)(THIS_ ULONG, ULONG) PURE;                         \
805   STDMETHOD(QueryPosition)(THIS_ ULONG*, ULONG*, ULONG*) PURE;               \
806   STDMETHOD(FindRow)(THIS_ LPSRestriction, BOOKMARK, ULONG) PURE;            \
807   STDMETHOD(Restrict)(THIS_ LPSRestriction, ULONG) PURE;                     \
808   STDMETHOD(CreateBookmark)(THIS_ BOOKMARK*) PURE;                           \
809   STDMETHOD(FreeBookmark)(THIS_ BOOKMARK) PURE;                              \
810   STDMETHOD(SortTable)(THIS_ LPSSortOrderSet, ULONG) PURE;                   \
811   STDMETHOD(QuerySortOrder)(THIS_ LPSSortOrderSet*) PURE;                    \
812   STDMETHOD(QueryRows)(THIS_ LONG, ULONG, LPSRowSet*) PURE;                  \
813   STDMETHOD(Abort)(THIS) PURE;                                               \
814   STDMETHOD(ExpandRow)(THIS_ ULONG, LPBYTE, ULONG, ULONG,                    \
815                        LPSRowSet*, ULONG*) PURE;                             \
816   STDMETHOD(CollapseRow)(THIS_ ULONG, LPBYTE, ULONG, ULONG*) PURE;           \
817   STDMETHOD(WaitForCompletion)(THIS_ ULONG, ULONG, ULONG*) PURE;             \
818   STDMETHOD(GetCollapseState)(THIS_ ULONG, ULONG,LPBYTE,ULONG*,LPBYTE*) PURE;\
819   STDMETHOD(SetCollapseState)(THIS_ ULONG, ULONG, LPBYTE, BOOKMARK*) PURE
820
821
822
823 /*** IMAPISession methods ***/
824 #define MY_IMAPISESSION_METHODS \
825   STDMETHOD(GetLastError)(THIS_ HRESULT hResult, ULONG ulFlags,               \
826                           LPMAPIERROR *lppMAPIError) PURE;                    \
827   STDMETHOD(GetMsgStoresTable)(THIS_ ULONG ulFlags,                           \
828                                LPMAPITABLE *lppTable) PURE;                   \
829   STDMETHOD(OpenMsgStore)(THIS_ ULONG_PTR ulUIParam, ULONG cbId,              \
830                           LPENTRYID lpId, LPCIID lpIFace,                     \
831                           ULONG ulFlags, LPMDB *lppMDB) PURE;                 \
832   STDMETHOD(OpenAddressBook)(THIS_ ULONG_PTR ulUIParam, LPCIID iid,           \
833                              ULONG ulFlags, LPADRBOOK *lppAdrBook) PURE;      \
834   STDMETHOD(OpenProfileSection)(THIS_ LPMAPIUID lpUID, LPCIID iid,            \
835                                 ULONG ulFlags, LPPROFSECT *lppProf) PURE;     \
836   STDMETHOD(GetStatusTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE; \
837   STDMETHOD(OpenEntry)(THIS_ ULONG cbId, LPENTRYID lpId, LPCIID iid,          \
838                        ULONG ulFlags, ULONG *lpType, LPUNKNOWN *lppUnk) PURE; \
839   STDMETHOD(CompareEntryIDs)(THIS_ ULONG cbLID, LPENTRYID lpLID, ULONG cbRID, \
840                              LPENTRYID lpRID, ULONG ulFlags,                  \
841                              ULONG *lpRes) PURE;                              \
842   STDMETHOD(Advise)(THIS_ ULONG cbId, LPENTRYID lpId, ULONG ulMask,           \
843                     LPMAPIADVISESINK lpSink, ULONG *lpCxn) PURE;              \
844   STDMETHOD(Unadvise)(THIS_ ULONG ulConnection) PURE;                         \
845   STDMETHOD(MessageOptions)(THIS_ ULONG_PTR ulUIParam, ULONG ulFlags,         \
846                             LPSTR lpszAddr, LPMESSAGE lpMsg) PURE;            \
847   STDMETHOD(QueryDefaultMessageOpt)(THIS_ LPSTR lpszAddr, ULONG ulFlags,      \
848                                     ULONG *lpcVals,                           \
849                                     LPSPropValue *lppOpts) PURE;              \
850   STDMETHOD(EnumAdrTypes)(THIS_ ULONG ulFlags, ULONG *lpcTypes,               \
851                           LPSTR **lpppszTypes) PURE;                          \
852   STDMETHOD(QueryIdentity)(THIS_ ULONG *lpcbId, LPENTRYID *lppEntryID) PURE;  \
853   STDMETHOD(Logoff)(THIS_ ULONG_PTR ulUIParam, ULONG ulFlags,                 \
854                     ULONG ulReserved) PURE;                                   \
855   STDMETHOD(SetDefaultStore)(THIS_ ULONG ulFlags, ULONG cbId,                 \
856                              LPENTRYID lpId) PURE;                            \
857   STDMETHOD(AdminServices)(THIS_ ULONG ulFlags, LPSERVICEADMIN *lppAdmin)PURE;\
858   STDMETHOD(ShowForm)(THIS_ ULONG_PTR ulUIParam, LPMDB lpStore,               \
859                       LPMAPIFOLDER lpParent, LPCIID iid, ULONG ulToken,       \
860                       LPMESSAGE lpSent, ULONG ulFlags, ULONG ulStatus,        \
861                       ULONG ulMsgFlags, ULONG ulAccess, LPSTR lpszClass)PURE; \
862   STDMETHOD(PrepareForm)(THIS_ LPCIID lpIFace, LPMESSAGE lpMsg,               \
863                          ULONG *lpToken) PURE;
864
865
866 /*** ISpoolerHook methods ***/
867 #define MY_ISPOOLERHOOK_METHODS \
868   STDMETHOD(InboundMsgHook)(THIS_ LPMESSAGE message, LPMAPIFOLDER folder,     \
869                             LPMDB mdb, ULONG FAR *r_flags,                    \
870                             ULONG FAR *n_entryid, LPBYTE FAR *entryid) PURE;  \
871   STDMETHOD(OutboundMsgHook)(THIS_ LPMESSAGE message, LPMAPIFOLDER folder,    \
872                              LPMDB mdb, ULONG FAR *r_flags,                   \
873                              ULONG FAR *n_entryid, LPBYTE FAR *entryid) PURE
874
875 /* In difference to the MY_ macros the DECLARE_ macros are not undefined
876    in this header. */
877
878 /*** IUnknown methods ***/
879 #define DECLARE_IUNKNOWN_METHODS                                              \
880   STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;                       \
881   STDMETHOD_(ULONG,AddRef)(THIS) PURE;                                        \
882   STDMETHOD_(ULONG,Release)(THIS) PURE
883
884 /*** IDispatch methods ***/
885 #define DECLARE_IDISPATCH_METHODS                                             \
886   STDMETHOD(GetTypeInfoCount)(THIS_ UINT*) PURE;                              \
887   STDMETHOD(GetTypeInfo)(THIS_ UINT, LCID, LPTYPEINFO*) PURE;                 \
888   STDMETHOD(GetIDsOfNames)(THIS_ REFIID, LPOLESTR*, UINT, LCID, DISPID*) PURE;\
889   STDMETHOD(Invoke)(THIS_ DISPID, REFIID, LCID, WORD,                         \
890                     DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*) PURE
891
892
893 \f
894 EXTERN_C const IID IID_IMAPIProp;
895 #undef INTERFACE
896 #define INTERFACE IMAPIProp
897 DECLARE_INTERFACE_(IMAPIProp,IUnknown)
898 {
899   DECLARE_IUNKNOWN_METHODS;
900   MY_IMAPIPROP_METHODS;
901 };
902
903
904
905 EXTERN_C const IID IID_IMsgStore;
906 #undef INTERFACE
907 #define INTERFACE IMsgStore
908 DECLARE_INTERFACE_(IMsgStore,IMAPIProp)
909 {
910   DECLARE_IUNKNOWN_METHODS;
911   MY_IMAPIPROP_METHODS;
912   MY_IMSGSTORE_METHODS;
913 };
914
915
916 EXTERN_C const IID IID_IMessage;
917 #undef INTERFACE
918 #define INTERFACE IMessage
919 DECLARE_INTERFACE_(IMessage,IMAPIProp)
920 {
921   DECLARE_IUNKNOWN_METHODS;
922   MY_IMAPIPROP_METHODS;
923   MY_IMESSAGE_METHODS;
924 };
925
926
927 EXTERN_C const IID IID_IMAPIContainer;
928 #undef INTERFACE
929 #define INTERFACE IMAPIContainer
930 DECLARE_INTERFACE_(IMAPIContainer,IMAPIProp)
931 {
932   DECLARE_IUNKNOWN_METHODS;
933   MY_IMAPIPROP_METHODS;
934   MY_IMAPICONTAINER_METHODS;
935 };
936
937
938 EXTERN_C const IID IID_IMAPIFolder;
939 #undef INTERFACE
940 #define INTERFACE IMAPIFolder
941 DECLARE_INTERFACE_(IMAPIFolder,IMAPIContainer)
942 {
943   DECLARE_IUNKNOWN_METHODS;
944   MY_IMAPIPROP_METHODS;
945   MY_IMAPICONTAINER_METHODS;
946   MY_IMAPIFOLDER_METHODS;
947 };
948
949
950 EXTERN_C const IID IID_IAttachment;
951 #undef INTERFACE
952 #define INTERFACE IAttach
953 DECLARE_INTERFACE_(IAttach, IMAPIProp)
954 {
955   DECLARE_IUNKNOWN_METHODS;
956   MY_IMAPIPROP_METHODS;
957   /*** IAttach methods ***/
958   /* No methods */
959 };
960
961
962 EXTERN_C const IID IID_IMAPITableData;
963 #undef INTERFACE
964 #define INTERFACE IMAPITable
965 DECLARE_INTERFACE_(IMAPITable,IUnknown)
966 {
967   DECLARE_IUNKNOWN_METHODS;
968   MY_IMAPITABLE_METHODS;
969 };
970
971
972 EXTERN_C const IID IID_IMAPISession;
973 #undef INTERFACE
974 #define INTERFACE IMAPISession
975 DECLARE_INTERFACE_(IMAPISession, IUnknown)
976 {
977   DECLARE_IUNKNOWN_METHODS;
978   MY_IMAPISESSION_METHODS;
979 };
980
981
982
983
984 EXTERN_C const IID IID_IConverterSession;
985 #undef INTERFACE
986 #define INTERFACE IConverterSession
987 DECLARE_INTERFACE_(IConverterSession, IUnknown)
988 {
989   DECLARE_IUNKNOWN_METHODS;
990
991   /*** IConverterSession ***/
992
993   /* Pass a MAPI address book to be used for name resultion to the
994      converter.  */
995   STDMETHOD(SetAdrBook)(THIS_ LPADRBOOK pab);
996   /* For an encoding for the outermost MIME container.  */
997   STDMETHOD(SetEncoding)(THIS_ ENCODINGTYPE);
998   STDMETHOD(PlaceHolder3)(THIS);
999   /* Convert a MIME stream to a MAPI message.  SRC_SRV needs to be
1000      NULL. */
1001   STDMETHOD(MIMEToMAPI)(THIS_ LPSTREAM pstm, LPMESSAGE pmsg,
1002                         LPCSTR src_srv, ULONG flags);
1003   /* Convert a MAPI message to a MIME stream. */
1004   STDMETHOD(MAPIToMIMEStm)(THIS_ LPMESSAGE pmsg, LPSTREAM pstm, ULONG flags);
1005   STDMETHOD(PlaceHolder6)(THIS);
1006   STDMETHOD(PlaceHolder7)(THIS);
1007   STDMETHOD(PlaceHolder8)(THIS);
1008   /* Enable text wrapping and the maximum line length.  */
1009   STDMETHOD(SetTextWrapping)(THIS_ BOOL, ULONG);
1010   /* Set the MIME save format.  The default is SAVE_RFC1521 (MIME) but
1011      my be changed using this function to SAVE_RFC822 (uuencode).  */
1012   STDMETHOD(SetSaveFormat)(THIS_ MIMESAVETYPE);
1013   STDMETHOD(PlaceHolder11)(THIS);
1014   /* Tell which character set to use.  HCHARSET is either NULL or a
1015      handle retrieved by (e.g.) MimeOleGetCodePageCharset.  If FAPPLY
1016      is false, HCHARSET is not used.  */
1017   STDMETHOD(SetCharset)(THIS_ BOOL fApply, HCHARSET hcharset,
1018                         CSETAPPLYTYPE csetapplytype);
1019 };
1020
1021
1022 EXTERN_C const IID IID_ISpoolerHook;
1023 #undef INTERFACE
1024 #define INTERFACE ISpoolerHook
1025 DECLARE_INTERFACE_(ISpoolerHook, IUnknown)
1026 {
1027   DECLARE_IUNKNOWN_METHODS;
1028   MY_ISPOOLERHOOK_METHODS;
1029 };
1030
1031
1032
1033 /* IMAPIFormContainer */
1034
1035 #define MAPIFORM_INSTALL_OVERWRITEONCONFLICT  0x10
1036
1037 typedef struct _SMAPIFormPropEnumVal
1038 {
1039   LPTSTR pszDisplayName;
1040   ULONG nVal;
1041 } SMAPIFormPropEnumVal, *LPMAPIFORMPROPENUMVAL;
1042
1043
1044 typedef struct _SMAPIFormProp
1045 {
1046   ULONG      ulFlags;
1047   ULONG      nPropType;
1048   MAPINAMEID nmid;
1049   LPTSTR     pszDisplayName;
1050   ULONG      nSpecialType;
1051   union {
1052     struct {
1053       MAPINAMEID nmidIdx;
1054       ULONG cfpevAvailable;
1055       LPMAPIFORMPROPENUMVAL pfpevAvailable;
1056     } s1;
1057   } u;
1058 } SMAPIFormProp, *LPMAPIFORMPROP;
1059
1060 typedef struct _SMAPIFormPropArray
1061 {
1062   ULONG cProps;
1063   ULONG ulPad;
1064   SMAPIFormProp aFormProp[MAPI_DIM];
1065 } SMAPIFormPropArray, *LPMAPIFORMPROPARRAY;
1066
1067 typedef struct _SMessageClassArray
1068 {
1069   ULONG  cValues;
1070   LPCSTR aMessageClass[MAPI_DIM];
1071 } SMessageClassArray, *LPSMESSAGECLASSARRAY;
1072
1073
1074 /* Fixme: The void ptr in ResolveMessageClass and SMAPIFormInfoArray
1075    should be a LPMAPIFORMINFO, but we have not yet defined the
1076    corresponding class. */
1077 typedef struct _SMAPIFormInfoArray
1078 {
1079   ULONG cForms;
1080   void * aFormInfo[MAPI_DIM];
1081 } SMAPIFormInfoArray, *LPSMAPIFORMINFOARRAY;
1082
1083 #define MY_IMAPIFORMCONTAINER_METHODS                                         \
1084   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR FAR*) PURE;       \
1085   STDMETHOD(InstallForm)(THIS_ ULONG ulUIParam, ULONG ulFlags,                \
1086                          LPCTSTR szCfgPathName) PURE;                         \
1087   STDMETHOD(RemoveForm)(THIS_ LPCSTR szMessageClass) PURE;                    \
1088   STDMETHOD(ResolveMessageClass) (THIS_ LPCSTR szMessageClass, ULONG ulFlags, \
1089                                   void * FAR *pforminfo) PURE;                \
1090   STDMETHOD(ResolveMultipleMessageClasses)                                    \
1091     (THIS_ LPSMESSAGECLASSARRAY pMsgClassArray, ULONG ulFlags,                \
1092      LPSMAPIFORMINFOARRAY FAR *ppfrminfoarray) PURE;                          \
1093   STDMETHOD(CalcFormPropSet)(THIS_  ULONG ulFlags,                            \
1094                              LPMAPIFORMPROPARRAY FAR *ppResults) PURE;        \
1095   STDMETHOD(GetDisplay)(THIS_ ULONG ulFlags,                                  \
1096                         LPTSTR FAR *pszDisplayName) PURE;
1097
1098
1099 EXTERN_C const IID IID_IMAPIFormContainer;
1100 #undef INTERFACE
1101 #define INTERFACE IMAPIFormContainer
1102 DECLARE_INTERFACE_(IMAPIFormContainer, IUnknown)
1103 {
1104   DECLARE_IUNKNOWN_METHODS;
1105   MY_IMAPIFORMCONTAINER_METHODS;
1106 };
1107
1108
1109 \f
1110 #undef MY_IMAPIPROP_METHODS
1111 #undef MY_IMSGSTORE_METHODS
1112 #undef MY_IMESSAGE_METHODS
1113 #undef MY_IMAPICONTAINER_METHODS
1114 #undef MY_IMAPIFOLDER_METHODS
1115 #undef MY_IMAPITABLE_METHODS
1116 #undef MY_IMAPISESSION_METHODS
1117 #undef MY_ISPOOLERHOOK_METHODS
1118 #undef MY_IMAPIFORMCONTAINER_METHODS
1119
1120
1121 \f
1122 /**** C Wrapper ****/
1123 #ifdef COBJMACROS
1124
1125 #define IMessage_CreateAttach(This,a,b,c,d) \
1126                 (This)->lpVtbl->CreateAttach ((This),(a),(b),(c),(d))
1127 #define IMessage_DeleteAttach(This,a,b,c,d) \
1128                 (This)->lpVtbl->DeleteAttach ((This),(a),(b),(c),(d))
1129 #define IMessage_SetProps(This,a,b,c) \
1130                 (This)->lpVtbl->SetProps ((This),(a),(b),(c))
1131 #define IMessage_DeleteProps(This,a,b) \
1132                 (This)->lpVtbl->DeleteProps ((This),(a),(b))
1133 #define IMessage_SaveChanges(This,a) (This)->lpVtbl->SaveChanges ((This),(a))
1134
1135 #define IAttach_Release(This)  (This)->lpVtbl->Release ((This))
1136 #define IAttach_SaveChanges(This,a) (This)->lpVtbl->SaveChanges ((This),(a))
1137 #define IAttach_OpenProperty(This,a,b,c,d,e) \
1138                 (This)->lpVtbl->OpenProperty ((This),(a),(b),(c),(d),(e))
1139
1140
1141
1142
1143 #endif /*COBJMACROS*/
1144
1145 \f
1146 /****  Function prototypes. *****/
1147
1148 ULONG   WINAPI UlAddRef(void*);
1149 ULONG   WINAPI UlRelease(void*);
1150 HRESULT WINAPI HrGetOneProp(LPMAPIPROP,ULONG,LPSPropValue*);
1151 HRESULT WINAPI HrSetOneProp(LPMAPIPROP,LPSPropValue);
1152 BOOL    WINAPI FPropExists(LPMAPIPROP,ULONG);
1153 void    WINAPI FreePadrlist(LPADRLIST);
1154 void    WINAPI FreeProws(LPSRowSet);
1155 HRESULT WINAPI HrQueryAllRows(LPMAPITABLE,LPSPropTagArray,LPSRestriction,
1156                               LPSSortOrderSet,LONG,LPSRowSet*);
1157 LPSPropValue WINAPI PpropFindProp(LPSPropValue,ULONG,ULONG);
1158
1159 HRESULT WINAPI RTFSync (LPMESSAGE, ULONG, BOOL FAR*);
1160
1161
1162 /* Memory allocation routines */
1163 typedef SCODE (WINAPI ALLOCATEBUFFER)(ULONG,LPVOID*);
1164 typedef SCODE (WINAPI ALLOCATEMORE)(ULONG,LPVOID,LPVOID*);
1165 typedef ULONG (WINAPI FREEBUFFER)(LPVOID);
1166 typedef ALLOCATEBUFFER *LPALLOCATEBUFFER;
1167 typedef ALLOCATEMORE *LPALLOCATEMORE;
1168 typedef FREEBUFFER *LPFREEBUFFER;
1169
1170 SCODE WINAPI MAPIAllocateBuffer (ULONG, LPVOID FAR *);
1171 ULONG WINAPI MAPIFreeBuffer (LPVOID);
1172
1173 void    MAPIUninitialize (void);
1174 HRESULT MAPIInitialize (LPVOID lpMapiInit);
1175
1176 #if defined (UNICODE)
1177 HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
1178                                 ULONG,LPWSTR,LPWSTR,LPSTREAM*);
1179 #else
1180 HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
1181                                 ULONG,LPSTR,LPSTR,LPSTREAM*);
1182 #endif
1183
1184 /* IMAPISecureMessage */
1185 struct IMAPISecureMessage;
1186 typedef struct IMAPISecureMessage *LPMAPISECUREMESSAGE;
1187
1188 #undef INTERFACE
1189 #define INTERFACE IMAPISecureMessage
1190
1191 DECLARE_INTERFACE_(IMAPISecureMessage, IUnknown)
1192 {
1193   DECLARE_IUNKNOWN_METHODS;
1194
1195   STDMETHOD(Unknown1)(void) PURE;
1196   STDMETHOD(Unknown2)(void) PURE;
1197   STDMETHOD(Unknown3)(void) PURE;
1198   STDMETHOD(Unknown4)(void) PURE;
1199   STDMETHOD(Unknown5)(void) PURE;
1200   STDMETHOD(GetBaseMessage)(LPMESSAGE FAR *) PURE;
1201 };
1202
1203 STDAPI MAPIOpenLocalFormContainer (LPMAPIFORMCONTAINER FAR *ppfcnt);
1204 /* IMAPIFormContainer*/
1205 struct MAPIFormMgr;
1206 typedef struct MAPIFormMgr *LPMAPIFORMMGR;
1207
1208 typedef ULONG HFRMREG;
1209 #define HFRMREG_DEFAULT  0
1210 #define HFRMREG_LOCAL    1
1211 #define HFRMREG_PERSONAL 2
1212 #define HFRMREG_FOLDER   3
1213
1214 #undef INTERFACE
1215 #define INTERFACE MAPIFormMgr
1216
1217 DECLARE_INTERFACE_(MAPIFormMgr, IUnknown)
1218 {
1219   DECLARE_IUNKNOWN_METHODS;
1220
1221   STDMETHOD(LoadForm)(void) PURE;
1222   STDMETHOD(ResolveMessageClass)(void) PURE;
1223   STDMETHOD(ResolveMultipleMessageClasses)(void) PURE;
1224   STDMETHOD(CalcFormPropSet)(void) PURE;
1225   STDMETHOD(CreateForm)(void) PURE;
1226   STDMETHOD(SelectForm)(void) PURE;
1227   STDMETHOD(SelectMultipleForms)(void) PURE;
1228   STDMETHOD(SelectFormContainer)(void) PURE;
1229   STDMETHOD(OpenFormContainer)(HFRMREG, LPUNKNOWN, LPMAPIFORMCONTAINER FAR *) PURE;
1230   STDMETHOD(PrepareForm)(void) PURE;
1231   STDMETHOD(IsInConflict)(void) PURE;
1232   STDMETHOD(GetLastError)(void) PURE;
1233 };
1234
1235 STDAPI MAPIOpenFormMgr (LPMAPISESSION, LPMAPIFORMMGR FAR *);
1236
1237 #ifdef __cplusplus
1238 }
1239 #endif
1240 #endif /* MAPI_H */