Signing with attachments does now work. w/o temp files.
[gpgol.git] / src / mymapi.h
1 /* mymapi.h - MAPI definitions required for OutlGPG and Mingw32
2  * Copyright (C) 1998 Justin Bradford
3  * Copyright (C) 2000 Fran├žois Gouget
4  * Copyright (C) 2005 g10 Code GmbH
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
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 */
31
32 #ifndef MAPI_H
33 #define MAPI_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /* Some types */
40
41 #ifndef __LHANDLE
42 #define __LHANDLE
43 typedef unsigned long           LHANDLE, *LPLHANDLE;
44 #endif
45 #define lhSessionNull           ((LHANDLE)0)
46
47 typedef unsigned long           FLAGS;
48
49 struct MapiFileDesc_s
50 {
51   ULONG ulReserved;
52   ULONG flFlags;
53   ULONG nPosition;
54   LPSTR lpszPathName;
55   LPSTR lpszFileName;
56   LPVOID lpFileType;
57 };
58 typedef struct MapiFileDesc_s MapiFileDesc;
59 typedef struct MapiFileDesc_s *lpMapiFileDesc;
60
61 struct MapiRecipDesc_s
62 {
63   ULONG ulReserved;
64   ULONG ulRecipClass;
65   LPSTR lpszName;
66   LPSTR lpszAddress;
67   ULONG ulEIDSize;
68   LPVOID lpEntryID;
69 };
70 typedef struct MapiRecipDesc_s MapiRecipDesc;
71 typedef struct MapiRecipDesc_s *lpMapiRecipDesc;
72
73 struct MapiMessage_s
74 {
75   ULONG ulReserved;
76   LPSTR lpszSubject;
77   LPSTR lpszNoteText;
78   LPSTR lpszMessageType;
79   LPSTR lpszDateReceived;
80   LPSTR lpszConversationID;
81   FLAGS flFlags;
82   lpMapiRecipDesc lpOriginator;
83   ULONG nRecipCount;
84   lpMapiRecipDesc lpRecips;
85   ULONG nFileCount;
86   lpMapiFileDesc lpFiles;
87 };
88 typedef struct MapiMessage_s MapiMessage;
89 typedef struct MapiMessage_s *lpMapiMessage;
90
91
92 /* Error codes */
93 #define MAPI_E_NO_ACCESS                   E_ACCESSDENIED
94 #define MAPI_E_NOT_FOUND                   ((SCODE)0x8004010F)
95
96
97 /* MAPILogon */
98
99 #define MAPI_LOGON_UI           0x00000001
100 #define MAPI_PASSWORD_UI        0x00020000
101 #define MAPI_NEW_SESSION        0x00000002
102 #define MAPI_FORCE_DOWNLOAD     0x00001000
103 #define MAPI_EXTENDED           0x00000020
104
105
106 /* MAPISendMail */
107
108 #define MAPI_DIALOG             0x00000008
109
110
111 /* Flags for various calls */
112 #define MAPI_MODIFY                   0x00000001U /* Object can be modified. */
113 #define MAPI_CREATE                   0x00000002U 
114 #define MAPI_ACCESS_MODIFY            MAPI_MODIFY /* Want write access. */
115 #define MAPI_ACCESS_READ              0x00000002U /* Want read access. */
116 #define MAPI_ACCESS_DELETE            0x00000004U /* Want delete access. */
117 #define MAPI_ACCESS_CREATE_HIERARCHY  0x00000008U
118 #define MAPI_ACCESS_CREATE_CONTENTS   0x00000010U
119 #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U
120 #define MAPI_UNICODE                  0x80000000U /* Strings in this
121                                                      call are Unicode. */
122
123 #define MAPI_BEST_ACCESS              0x00000010U
124
125
126 #define ATTACH_BY_VALUE       1 
127 #define ATTACH_BY_REFERENCE   2 
128 #define ATTACH_BY_REF_RESOLVE 3 
129 #define ATTACH_BY_REF_ONLY    4 
130 #define ATTACH_EMBEDDED_MSG   5
131 #define ATTACH_OLE            6  
132
133
134 #define KEEP_OPEN_READONLY            0x00000001
135 #define KEEP_OPEN_READWRITE           0x00000002
136 #define FORCE_SAVE                    0x00000004
137 #define MAPI_DEFERRED_ERRORS          0x00000008
138
139 #define SOF_UNIQUEFILENAME            0x80000000
140
141 #define RTF_SYNC_RTF_CHANGED          1
142 #define RTF_SYNC_BODY_CHANGED         2
143
144
145 #ifndef MAPI_DIM
146 # define MAPI_DIM 1 /* Default to one dimension for variable length arrays */
147 #endif
148
149 DEFINE_OLEGUID(IID_IABContainer,0x2030D,0,0);
150 DEFINE_OLEGUID(IID_IABLogon,0x20314,0,0);
151 DEFINE_OLEGUID(IID_IABProvider,0x20311,0,0);
152 DEFINE_OLEGUID(IID_IAddrBook,0x20309,0,0);
153 DEFINE_OLEGUID(IID_IAttachment,0x20308,0,0);
154 DEFINE_OLEGUID(IID_IDistList,0x2030E,0,0);
155 DEFINE_OLEGUID(IID_IEnumMAPIFormProp,0x20323,0,0);
156 DEFINE_OLEGUID(IID_IMailUser,0x2030A,0,0);
157 DEFINE_OLEGUID(IID_IMAPIAdviseSink,0x20302,0,0);
158 DEFINE_OLEGUID(IID_IMAPIContainer,0x2030B,0,0);
159 DEFINE_OLEGUID(IID_IMAPIControl,0x2031B,0,0);
160 DEFINE_OLEGUID(IID_IMAPIFolder,0x2030C,0,0);
161 DEFINE_OLEGUID(IID_IMAPIForm,0x20327,0,0);
162 DEFINE_OLEGUID(IID_IMAPIFormAdviseSink,0x2032F,0,0);
163 DEFINE_OLEGUID(IID_IMAPIFormContainer,0x2032E,0,0);
164 DEFINE_OLEGUID(IID_IMAPIFormFactory,0x20350,0,0);
165 DEFINE_OLEGUID(IID_IMAPIFormInfo,0x20324,0,0);
166 DEFINE_OLEGUID(IID_IMAPIFormMgr,0x20322,0,0);
167 DEFINE_OLEGUID(IID_IMAPIFormProp,0x2032D,0,0);
168 DEFINE_OLEGUID(IID_IMAPIMessageSite,0x20370,0,0);
169 DEFINE_OLEGUID(IID_IMAPIProgress,0x2031F,0,0);
170 DEFINE_OLEGUID(IID_IMAPIProp,0x20303,0,0);
171 DEFINE_OLEGUID(IID_IMAPIPropData,0x2031A,0,0);
172 DEFINE_OLEGUID(IID_IMAPISession,0x20300,0,0);
173 DEFINE_OLEGUID(IID_IMAPISpoolerInit,0x20317,0,0);
174 DEFINE_OLEGUID(IID_IMAPISpoolerService,0x2031E,0,0);
175 DEFINE_OLEGUID(IID_IMAPISpoolerSession,0x20318,0,0);
176 DEFINE_OLEGUID(IID_IMAPIStatus,0x20305,0,0);
177 DEFINE_OLEGUID(IID_IMAPISup,0x2030F,0,0);
178 DEFINE_OLEGUID(IID_IMAPITable,0x20301,0,0);
179 DEFINE_OLEGUID(IID_IMAPITableData,0x20316,0,0);
180 DEFINE_OLEGUID(IID_IMAPIViewAdviseSink,0x2032B,0,0);
181 DEFINE_OLEGUID(IID_IMAPIViewContext,0x20321,0,0);
182 DEFINE_OLEGUID(IID_IMessage,0x20307,0,0);
183 DEFINE_OLEGUID(IID_IMsgServiceAdmin,0x2031D,0,0);
184 DEFINE_OLEGUID(IID_IMsgStore,0x20306,0,0);
185 DEFINE_OLEGUID(IID_IMSLogon,0x20313,0,0);
186 DEFINE_OLEGUID(IID_IMSProvider,0x20310,0,0);
187 DEFINE_OLEGUID(IID_IPersistMessage,0x2032A,0,0);
188 DEFINE_OLEGUID(IID_IProfAdmin,0x2031C,0,0);
189 DEFINE_OLEGUID(IID_IProfSect,0x20304,0,0);
190 DEFINE_OLEGUID(IID_IProviderAdmin,0x20325,0,0);
191 DEFINE_OLEGUID(IID_ISpoolerHook,0x20320,0,0);
192 DEFINE_OLEGUID(IID_IStream, 0x0000c, 0, 0);
193 DEFINE_OLEGUID(IID_IStreamDocfile,0x2032C,0,0);
194 DEFINE_OLEGUID(IID_IStreamTnef,0x20330,0,0);
195 DEFINE_OLEGUID(IID_ITNEF,0x20319,0,0);
196 DEFINE_OLEGUID(IID_IXPLogon,0x20315,0,0);
197 DEFINE_OLEGUID(IID_IXPProvider,0x20312,0,0);
198 DEFINE_OLEGUID(MUID_PROFILE_INSTANCE,0x20385,0,0);
199 DEFINE_OLEGUID(PS_MAPI,0x20328,0,0);
200 DEFINE_OLEGUID(PS_PUBLIC_STRINGS,0x20329,0,0);
201 DEFINE_OLEGUID(PS_ROUTING_ADDRTYPE,0x20381,0,0);
202 DEFINE_OLEGUID(PS_ROUTING_DISPLAY_NAME,0x20382,0,0);
203 DEFINE_OLEGUID(PS_ROUTING_EMAIL_ADDRESSES,0x20380,0,0);
204 DEFINE_OLEGUID(PS_ROUTING_ENTRYID,0x20383,0,0);
205 DEFINE_OLEGUID(PS_ROUTING_SEARCH_KEY,0x20384,0,0);
206
207
208 struct _ENTRYID
209 {
210     BYTE abFlags[4];
211     BYTE ab[MAPI_DIM];
212 };
213 typedef struct _ENTRYID ENTRYID;
214 typedef struct _ENTRYID *LPENTRYID;
215
216
217 /* The property tag structure. This describes a list of columns */
218 typedef struct _SPropTagArray
219 {
220     ULONG cValues;              /* Number of elements in aulPropTag */
221     ULONG aulPropTag[MAPI_DIM]; /* Property tags */
222 } SPropTagArray, *LPSPropTagArray;
223
224 #define CbNewSPropTagArray(c) \
225                (offsetof(SPropTagArray,aulPropTag)+(c)*sizeof(ULONG))
226 #define CbSPropTagArray(p)    CbNewSPropTagArray((p)->cValues)
227 #define SizedSPropTagArray(n,id) \
228     struct _SPropTagArray_##id { ULONG cValues; ULONG aulPropTag[n]; } id
229
230
231 /* Multi-valued PT_APPTIME property value */
232 typedef struct _SAppTimeArray
233 {
234     ULONG   cValues; /* Number of doubles in lpat */
235     double *lpat;    /* Pointer to double array of length cValues */
236 } SAppTimeArray;
237
238 /* PT_BINARY property value */
239 typedef struct _SBinary
240 {
241     ULONG  cb;  /* Number of bytes in lpb */
242     LPBYTE lpb; /* Pointer to byte array of length cb */
243 } SBinary, *LPSBinary;
244
245 /* Multi-valued PT_BINARY property value */
246 typedef struct _SBinaryArray
247 {
248     ULONG    cValues; /* Number of SBinarys in lpbin */
249     SBinary *lpbin;   /* Pointer to SBinary array of length cValues */
250 } SBinaryArray;
251
252 typedef SBinaryArray ENTRYLIST, *LPENTRYLIST;
253
254 /* Multi-valued PT_CY property value */
255 typedef struct _SCurrencyArray
256 {
257     ULONG  cValues; /* Number of CYs in lpcu */
258     CY    *lpcur;   /* Pointer to CY array of length cValues */
259 } SCurrencyArray;
260
261 /* Multi-valued PT_SYSTIME property value */
262 typedef struct _SDateTimeArray
263 {
264     ULONG     cValues; /* Number of FILETIMEs in lpft */
265     FILETIME *lpft;    /* Pointer to FILETIME array of length cValues */
266 } SDateTimeArray;
267
268 /* Multi-valued PT_DOUBLE property value */
269 typedef struct _SDoubleArray
270 {
271     ULONG   cValues; /* Number of doubles in lpdbl */
272     double *lpdbl;   /* Pointer to double array of length cValues */
273 } SDoubleArray;
274
275 /* Multi-valued PT_CLSID property value */
276 typedef struct _SGuidArray
277 {
278     ULONG cValues; /* Number of GUIDs in lpguid */
279     GUID *lpguid;  /* Pointer to GUID array of length cValues */
280 } SGuidArray;
281
282 /* Multi-valued PT_LONGLONG property value */
283 typedef struct _SLargeIntegerArray
284 {
285     ULONG          cValues; /* Number of long64s in lpli */
286     LARGE_INTEGER *lpli;    /* Pointer to long64 array of length cValues */
287 } SLargeIntegerArray;
288
289 /* Multi-valued PT_LONG property value */
290 typedef struct _SLongArray
291 {
292     ULONG  cValues; /* Number of longs in lpl */
293     LONG  *lpl;     /* Pointer to long array of length cValues */
294 } SLongArray;
295
296 /* Multi-valued PT_STRING8 property value */
297 typedef struct _SLPSTRArray
298 {
299     ULONG  cValues; /* Number of Ascii strings in lppszA */
300     LPSTR *lppszA;  /* Pointer to Ascii string array of length cValues */
301 } SLPSTRArray;
302
303 /* Multi-valued PT_FLOAT property value */
304 typedef struct _SRealArray
305 {
306     ULONG cValues; /* Number of floats in lpflt */
307     float *lpflt;  /* Pointer to float array of length cValues */
308 } SRealArray;
309
310 /* Multi-valued PT_SHORT property value */
311 typedef struct _SShortArray
312 {
313     ULONG      cValues; /* Number of shorts in lpb */
314     short int *lpi;     /* Pointer to short array of length cValues */
315 } SShortArray;
316
317 /* Multi-valued PT_UNICODE property value */
318 typedef struct _SWStringArray
319 {
320     ULONG   cValues; /* Number of Unicode strings in lppszW */
321     LPWSTR *lppszW;  /* Pointer to Unicode string array of length cValues */
322 } SWStringArray;
323
324
325 /* A property value */
326 union PV_u
327 {
328     short int          i;
329     LONG               l;
330     ULONG              ul;
331     float              flt;
332     double             dbl;
333     unsigned short     b;
334     CY                 cur;
335     double             at;
336     FILETIME           ft;
337     LPSTR              lpszA;
338     SBinary            bin;
339     LPWSTR             lpszW;
340     LPGUID             lpguid;
341     LARGE_INTEGER      li;
342     SShortArray        MVi;
343     SLongArray         MVl;
344     SRealArray         MVflt;
345     SDoubleArray       MVdbl;
346     SCurrencyArray     MVcur;
347     SAppTimeArray      MVat;
348     SDateTimeArray     MVft;
349     SBinaryArray       MVbin;
350     SLPSTRArray        MVszA;
351     SWStringArray      MVszW;
352     SGuidArray         MVguid;
353     SLargeIntegerArray MVli;
354     SCODE              err;
355     LONG               x;
356 };
357 typedef union PV_u uPV;
358
359 /* Property value structure. This is essentially a mini-Variant. */
360 struct SPropValue_s
361 {
362   ULONG     ulPropTag;  /* The property type. */
363   ULONG     dwAlignPad; /* Alignment, treat as reserved. */
364   uPV       Value;      /* The property value. */
365 };
366 typedef struct SPropValue_s SPropValue;
367 typedef struct SPropValue_s *LPSPropValue;
368
369 /* Structure describing a table row (a collection of property values). */
370 struct SRow_s
371 {
372   ULONG        ulAdrEntryPad; /* Padding, treat as reserved. */
373   ULONG        cValues;       /* Count of property values in lpProbs. */
374   LPSPropValue lpProps;       /* Pointer to an array of property
375                                  values of length cValues. */
376 };
377 typedef struct SRow_s SRow;
378 typedef struct SRow_s *LPSRow;
379
380
381 /* Structure describing a set of table rows. */
382 struct SRowSet_s
383 {
384   ULONG cRows;          /* Count of rows in aRow. */
385   SRow  aRow[MAPI_DIM]; /* Array of rows of length cRows. */
386 };
387 typedef struct SRowSet_s *LPSRowSet;
388
389
390 /* Structure describing a problem with a property */
391 typedef struct _SPropProblem
392 {
393     ULONG ulIndex;   /* Index of the property */
394     ULONG ulPropTag; /* Proprty tag of the property */
395     SCODE scode;     /* Error code of the problem */
396 } SPropProblem, *LPSPropProblem;
397
398 /* A collection of property problems */
399 typedef struct _SPropProblemArray
400 {
401     ULONG        cProblem;           /* Number of problems in aProblem */
402     SPropProblem aProblem[MAPI_DIM]; /* Array of problems of length cProblem */
403 } SPropProblemArray, *LPSPropProblemArray;
404
405
406 /* Table bookmarks */
407 typedef ULONG BOOKMARK;
408
409 #define BOOKMARK_BEGINNING ((BOOKMARK)0) /* The first row */
410 #define BOOKMARK_CURRENT   ((BOOKMARK)1) /* The curent table row */
411 #define BOOKMARK_END       ((BOOKMARK)2) /* The last row */
412
413
414 /* Row restrictions */
415 typedef struct _SRestriction* LPSRestriction;
416
417
418 /* Errors. */
419 typedef struct _MAPIERROR
420 {
421     ULONG  ulVersion;       /* Mapi version */
422 #if defined (UNICODE) || defined (__WINESRC__)
423     LPWSTR lpszError;       /* Error and component strings. These are Ascii */
424     LPWSTR lpszComponent;   /* unless the MAPI_UNICODE flag is passed in */
425 #else
426     LPSTR  lpszError;
427     LPSTR  lpszComponent;
428 #endif
429     ULONG  ulLowLevelError;
430     ULONG  ulContext;
431 } MAPIERROR, *LPMAPIERROR;
432
433
434 /* Sorting */
435 #define TABLE_SORT_ASCEND  0U
436 #define TABLE_SORT_DESCEND 1U
437 #define TABLE_SORT_COMBINE 2U
438
439 typedef struct _SSortOrder
440 {
441     ULONG ulPropTag;
442     ULONG ulOrder;
443 } SSortOrder, *LPSSortOrder;
444
445 typedef struct _SSortOrderSet
446 {
447     ULONG      cSorts;
448     ULONG      cCategories;
449     ULONG      cExpanded;
450     SSortOrder aSort[MAPI_DIM];
451 } SSortOrderSet, * LPSSortOrderSet;
452
453
454
455 typedef struct _MAPINAMEID
456 {
457     LPGUID lpguid;
458     ULONG ulKind;
459     union
460     {
461         LONG lID;
462         LPWSTR lpwstrName;
463     } Kind;
464 } MAPINAMEID, *LPMAPINAMEID;
465
466 #define MNID_ID     0
467 #define MNID_STRING 1
468
469
470 typedef struct _ADRENTRY
471 {
472     ULONG        ulReserved1;
473     ULONG        cValues;
474     LPSPropValue rgPropVals;
475 } ADRENTRY, *LPADRENTRY;
476
477 typedef struct _ADRLIST
478 {
479     ULONG    cEntries;
480     ADRENTRY aEntries[MAPI_DIM];
481 } ADRLIST, *LPADRLIST;
482
483
484 \f
485 /**** Class definitions ****/
486 typedef const IID *LPCIID;
487
488
489 struct IAttach;
490 typedef struct IAttach *LPATTACH;
491
492 struct IMAPIAdviseSink;
493 typedef struct IMAPIAdviseSink *LPMAPIADVISESINK;
494
495 struct IMAPIProgress;
496 typedef struct IMAPIProgress *LPMAPIPROGRESS;
497
498 struct IMAPITable;
499 typedef struct IMAPITable *LPMAPITABLE;
500
501 struct IMAPIProp;
502 typedef struct IMAPIProp *LPMAPIPROP;
503
504 struct IMessage;
505 typedef struct IMessage *LPMESSAGE;
506
507 struct IMsgStore;
508 typedef struct IMsgStore *LPMDB;
509
510
511
512 EXTERN_C const IID IID_IMAPIProp;
513 #undef INTERFACE
514 #define INTERFACE IMAPIProp
515 DECLARE_INTERFACE_(IMAPIProp,IUnknown)
516 {
517   /*** IUnknown methods ***/
518   STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
519   STDMETHOD_(ULONG,AddRef)(THIS) PURE;
520   STDMETHOD_(ULONG,Release)(THIS) PURE;
521
522   /*** IMAPIProp methods ***/
523   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR FAR*);
524   STDMETHOD(SaveChanges)(THIS_ ULONG);
525   STDMETHOD(GetProps)(THIS_ LPSPropTagArray, ULONG, ULONG FAR*,
526                       LPSPropValue FAR*);
527   STDMETHOD(GetPropList)(THIS_ ULONG, LPSPropTagArray FAR *);
528   STDMETHOD(OpenProperty)(THIS_ ULONG, LPCIID lpiid, ULONG,
529                           ULONG, LPUNKNOWN FAR*);
530   STDMETHOD(SetProps)(THIS_ LONG, LPSPropValue, LPSPropProblemArray FAR*);
531   STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray, LPSPropProblemArray FAR *);
532   STDMETHOD(CopyTo)(THIS_ ULONG, LPCIID, LPSPropTagArray, ULONG,
533                     LPMAPIPROGRESS, LPCIID lpInterface, LPVOID,
534                     ULONG, LPSPropProblemArray FAR*);
535   STDMETHOD(CopyProps)(THIS_ LPSPropTagArray, ULONG, LPMAPIPROGRESS,
536                        LPCIID, LPVOID, ULONG, LPSPropProblemArray FAR*);  
537   STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray FAR*, LPGUID,
538                              ULONG, ULONG FAR*, LPMAPINAMEID FAR* FAR*);
539   STDMETHOD(GetIDsFromNames)(THIS_ ULONG, LPMAPINAMEID FAR*, ULONG,
540                              LPSPropTagArray FAR*);
541
542 };
543
544
545 EXTERN_C const IID IID_IMessage;
546 #undef INTERFACE
547 #define INTERFACE IMessage
548 DECLARE_INTERFACE_(IMessage,IMAPIProp)
549 {
550   /*** IUnknown methods ***/
551   STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
552   STDMETHOD_(ULONG,AddRef)(THIS) PURE;
553   STDMETHOD_(ULONG,Release)(THIS) PURE;
554
555   /*** IMAPIProp methods ***/
556   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR FAR*);
557   STDMETHOD(SaveChanges)(THIS_ ULONG);
558   STDMETHOD(GetProps)(THIS_ LPSPropTagArray, ULONG,ULONG FAR*,
559                       LPSPropValue FAR*);
560   STDMETHOD(GetPropList)(THIS_ ULONG, LPSPropTagArray FAR *);
561   STDMETHOD(OpenProperty)(THIS_ ULONG, LPCIID lpiid, ULONG,
562                           ULONG, LPUNKNOWN FAR*);
563   STDMETHOD(SetProps)(THIS_ LONG, LPSPropValue, LPSPropProblemArray FAR*);
564   STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray, LPSPropProblemArray FAR *);
565   STDMETHOD(CopyTo)(THIS_ ULONG, LPCIID, LPSPropTagArray, ULONG,
566                     LPMAPIPROGRESS, LPCIID lpInterface, LPVOID,
567                     ULONG, LPSPropProblemArray FAR*);
568   STDMETHOD(CopyProps)(THIS_ LPSPropTagArray, ULONG, LPMAPIPROGRESS,
569                        LPCIID, LPVOID, ULONG, LPSPropProblemArray FAR*);  
570   STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray FAR*, LPGUID,
571                              ULONG, ULONG FAR*, LPMAPINAMEID FAR* FAR*);
572   STDMETHOD(GetIDsFromNames)(THIS_ ULONG, LPMAPINAMEID FAR*, ULONG,
573                              LPSPropTagArray FAR*);
574
575   /*** IMessage methods ***/
576   STDMETHOD(GetAttachmentTable)(THIS_ ULONG, LPMAPITABLE FAR*);
577   STDMETHOD(OpenAttach)(THIS_ ULONG, LPCIID, ULONG, LPATTACH FAR*);
578   STDMETHOD(CreateAttach)(THIS_ LPCIID, ULONG, ULONG FAR*, LPATTACH FAR*);
579   STDMETHOD(DeleteAttach)(THIS_ ULONG, ULONG, LPMAPIPROGRESS, ULONG);
580   STDMETHOD(GetRecipientTable)(THIS_ ULONG, LPMAPITABLE FAR*);
581   STDMETHOD(ModifyRecipients)(THIS_ ULONG, LPADRLIST);
582   STDMETHOD(SubmitMessage)(THIS_ ULONG);
583   STDMETHOD(SetReadFlag)(THIS_ ULONG);
584 };
585
586
587 EXTERN_C const IID IID_IAttachment;
588 #undef INTERFACE
589 #define INTERFACE IAttach
590 DECLARE_INTERFACE_(IAttach, IMAPIProp)
591 {
592   /*** IUnknown methods ***/
593   STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
594   STDMETHOD_(ULONG,AddRef)(THIS) PURE;
595   STDMETHOD_(ULONG,Release)(THIS) PURE;
596
597   /*** IMAPIProp methods ***/
598   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR FAR*);
599   STDMETHOD(SaveChanges)(THIS_ ULONG);
600   STDMETHOD(GetProps)(THIS_ LPSPropTagArray, ULONG,ULONG FAR*,
601                       LPSPropValue FAR*);
602   STDMETHOD(GetPropList)(THIS_ ULONG, LPSPropTagArray FAR *);
603   STDMETHOD(OpenProperty)(THIS_ ULONG, LPCIID lpiid, ULONG,
604                           ULONG, LPUNKNOWN FAR*);
605   STDMETHOD(SetProps)(THIS_ LONG, LPSPropValue, LPSPropProblemArray FAR*);
606   STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray, LPSPropProblemArray FAR *);
607   STDMETHOD(CopyTo)(THIS_ ULONG, LPCIID, LPSPropTagArray, ULONG,
608                     LPMAPIPROGRESS, LPCIID lpInterface, LPVOID,
609                     ULONG, LPSPropProblemArray FAR*);
610   STDMETHOD(CopyProps)(THIS_ LPSPropTagArray, ULONG, LPMAPIPROGRESS,
611                        LPCIID, LPVOID, ULONG, LPSPropProblemArray FAR*);  
612   STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray FAR*, LPGUID,
613                              ULONG, ULONG FAR*, LPMAPINAMEID FAR* FAR*);
614   STDMETHOD(GetIDsFromNames)(THIS_ ULONG, LPMAPINAMEID FAR*, ULONG,
615                              LPSPropTagArray FAR*);
616
617   /*** IAttach methods ***/
618   /* No methods */
619 };
620
621
622 EXTERN_C const IID IID_IMAPITableData;
623 #undef INTERFACE
624 #define INTERFACE IMAPITable
625 DECLARE_INTERFACE_(IMAPITable,IUnknown)
626 {
627   /*** IUnknown methods ***/
628   STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE;
629   STDMETHOD_(ULONG,AddRef)(THIS) PURE;
630   STDMETHOD_(ULONG,Release)(THIS) PURE;
631
632   /*** IMAPITable methods ***/
633   STDMETHOD(GetLastError)(THIS_ HRESULT, ULONG, LPMAPIERROR*) PURE;
634   STDMETHOD(Advise)(THIS_ ULONG, LPMAPIADVISESINK, ULONG*) PURE;
635   STDMETHOD(Unadvise)(THIS_ ULONG ulCxn) PURE;
636   STDMETHOD(GetStatus)(THIS_ ULONG*, ULONG*) PURE;
637   STDMETHOD(SetColumns)(THIS_ LPSPropTagArray, ULONG) PURE;
638   STDMETHOD(QueryColumns)(THIS_ ULONG, LPSPropTagArray*) PURE;
639   STDMETHOD(GetRowCount)(THIS_ ULONG, ULONG *) PURE;
640   STDMETHOD(SeekRow)(THIS_ BOOKMARK, LONG, LONG*) PURE;
641   STDMETHOD(SeekRowApprox)(THIS_ ULONG, ULONG) PURE;
642   STDMETHOD(QueryPosition)(THIS_ ULONG*, ULONG*, ULONG*) PURE;
643   STDMETHOD(FindRow)(THIS_ LPSRestriction, BOOKMARK, ULONG) PURE;
644   STDMETHOD(Restrict)(THIS_ LPSRestriction, ULONG) PURE;
645   STDMETHOD(CreateBookmark)(THIS_ BOOKMARK*) PURE;
646   STDMETHOD(FreeBookmark)(THIS_ BOOKMARK) PURE;
647   STDMETHOD(SortTable)(THIS_ LPSSortOrderSet, ULONG) PURE;
648   STDMETHOD(QuerySortOrder)(THIS_ LPSSortOrderSet*) PURE;
649   STDMETHOD(QueryRows)(THIS_ LONG, ULONG, LPSRowSet*) PURE;
650   STDMETHOD(Abort)(THIS) PURE;
651   STDMETHOD(ExpandRow)(THIS_ ULONG, LPBYTE, ULONG, ULONG, 
652                        LPSRowSet*, ULONG*) PURE;
653   STDMETHOD(CollapseRow)(THIS_ ULONG, LPBYTE, ULONG, ULONG*) PURE;
654   STDMETHOD(WaitForCompletion)(THIS_ ULONG, ULONG, ULONG*) PURE;
655   STDMETHOD(GetCollapseState)(THIS_ ULONG, ULONG, LPBYTE, ULONG*,LPBYTE*) PURE;
656   STDMETHOD(SetCollapseState)(THIS_ ULONG, ULONG, LPBYTE, BOOKMARK*) PURE;
657 };
658
659
660 \f
661 /****  Function prototypes. *****/
662
663 ULONG   WINAPI UlAddRef(void*);
664 ULONG   WINAPI UlRelease(void*);
665 HRESULT WINAPI HrGetOneProp(LPMAPIPROP,ULONG,LPSPropValue*);
666 HRESULT WINAPI HrSetOneProp(LPMAPIPROP,LPSPropValue);
667 BOOL    WINAPI FPropExists(LPMAPIPROP,ULONG);
668 void    WINAPI FreePadrlist(LPADRLIST);
669 void    WINAPI FreeProws(LPSRowSet);
670 HRESULT WINAPI HrQueryAllRows(LPMAPITABLE,LPSPropTagArray,LPSRestriction,
671                               LPSSortOrderSet,LONG,LPSRowSet*);
672 LPSPropValue WINAPI PpropFindProp(LPSPropValue,ULONG,ULONG);
673
674 HRESULT WINAPI RTFSync (LPMESSAGE, ULONG, BOOL FAR*);
675
676
677 /* Memory allocation routines */
678 typedef SCODE (WINAPI ALLOCATEBUFFER)(ULONG,LPVOID*);
679 typedef SCODE (WINAPI ALLOCATEMORE)(ULONG,LPVOID,LPVOID*);
680 typedef ULONG (WINAPI FREEBUFFER)(LPVOID);
681 typedef ALLOCATEBUFFER *LPALLOCATEBUFFER;
682 typedef ALLOCATEMORE *LPALLOCATEMORE;
683 typedef FREEBUFFER *LPFREEBUFFER;
684
685 SCODE WINAPI MAPIAllocateBuffer (ULONG, LPVOID FAR *);
686 ULONG WINAPI MAPIFreeBuffer (LPVOID);
687
688
689 #if defined (UNICODE)
690 HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
691                                 ULONG,LPWSTR,LPWSTR,LPSTREAM*);
692 #else
693 HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER,LPFREEBUFFER,
694                                 ULONG,LPSTR,LPSTR,LPSTREAM*);
695 #endif
696
697 #ifdef __cplusplus
698 }
699 #endif
700 #endif /* MAPI_H */