1 /*
2  *	M A P I D E F S . H
3  *
4  *	Definitions used by MAPI clients and service providers.
5  *
6  *  Copyright (c) 2009 Microsoft Corporation. All Rights Reserved.
7  */
8 
9 #ifndef MAPIDEFS_H
10 #define MAPIDEFS_H
11 
12 #if _MSC_VER > 1000
13 #pragma once
14 #endif
15 
16 #if defined (WIN64) && !defined (_WIN64)
17 #define _WIN64
18 #endif
19 
20 /*
21  *	Under Win64 systems Win32 is also defined for backwards compatibility.
22  */
23 
24 #if defined (WIN32) && !defined (_WIN32)
25 #define _WIN32
26 #endif
27 
28 #if defined (_WIN64) || defined(_WIN32) /* Must include WINDOWS.H on Win32/Win64 */
29 #ifndef _WINDOWS_
30 #define INC_OLE2 /* Get the OLE2 stuff */
31 #define INC_RPC  /* harmless on Windows NT; Windows 95 needs it */
32 #define _INC_OLE /* Windows 95 will include OLE1 without this */
33 #include <windows.h>
34 #endif
35 
36 #ifndef _OLEERROR_H_
37 #include <winerror.h>
38 #endif
39 #ifndef _OBJBASE_H_
40 #include <objbase.h>
41 #endif
42 #endif
43 
44 #if defined (DOS)
45 #ifndef _COMPOBJ_H_
46 #include <compobj.h>
47 #endif
48 #endif
49 
50 #ifndef _INC_STDDEF
51 #include <stddef.h>
52 #endif
53 
54 /* Array dimension for structures with variable-sized arrays at the end. */
55 
56 #ifndef MAPI_DIM
57 #define MAPI_DIM	1
58 #endif
59 
60 /* Provider init type. Force to cdecl always */
61 
62 #ifndef STDMAPIINITCALLTYPE
63 #if !defined (_MAC) && (defined (_WIN64) || defined(_WIN32))
64 #define STDMAPIINITCALLTYPE		__cdecl
65 #else
66 #define STDMAPIINITCALLTYPE		STDMETHODCALLTYPE
67 #endif
68 #define	STDINITMETHODIMP		HRESULT STDMAPIINITCALLTYPE
69 #define STDINITMETHODIMP_(type)	type STDMAPIINITCALLTYPE
70 #endif
71 
72 
73 #define MAPI_NT_SERVICE     ((ULONG) 0x00010000)  /* Provider is being loaded in an NT service */
74 
75 
76 #ifdef	__cplusplus
77 extern "C" {
78 #endif
79 
80 /* Simple data types */
81 
82 #if !defined (MIDL_PASS) /* MIDL doesn't want to see these */
83 
84 #ifndef _MAC
85 typedef wchar_t WCHAR;    // wc,   16-bit UNICODE character
86 #else
87 // some Macintosh compilers don't define wchar_t in a convenient location, or define it as a char
88 typedef unsigned short WCHAR;    // wc,   16-bit UNICODE character
89 #endif
90 
91 #ifdef UNICODE
92 typedef WCHAR				TCHAR;
93 #else
94 typedef char				TCHAR;
95 #endif
96 
97 
98 #if _SAL_VERSION >= 20
99 typedef _Null_terminated_ WCHAR FAR *			LPWSTR;
100 typedef _Null_terminated_ const WCHAR FAR *	LPCWSTR;
101 #else
102 typedef WCHAR FAR *			LPWSTR;
103 typedef const WCHAR FAR *	LPCWSTR;
104 #endif
105 typedef TCHAR FAR *			LPTSTR;
106 typedef const TCHAR FAR *	LPCTSTR;
107 typedef BYTE FAR *			LPBYTE;
108 #endif /* defined MIDL_PASS */
109 
110 typedef ULONG FAR *			LPULONG;
111 
112 #ifndef __LHANDLE
113 #define __LHANDLE
114 typedef ULONG_PTR	LHANDLE, FAR * LPLHANDLE;
115 #endif
116 
117 #if !defined(_WINBASE_) && !defined(_FILETIME_)
118 #define _FILETIME_
119 typedef struct _FILETIME
120 {
121 	DWORD dwLowDateTime;
122 	DWORD dwHighDateTime;
123 } FILETIME, FAR * LPFILETIME;
124 #endif
125 
126 #ifndef BEGIN_INTERFACE
127 #define BEGIN_INTERFACE
128 #endif
129 
130 /*
131  *	This flag is used in many different MAPI calls to signify that
132  *	the object opened by the call should be modifiable (MAPI_MODIFY).
133  *  If the flag MAPI_MAX_ACCESS is set, the object returned should be
134  *  returned at the maximum access level allowed.  An additional
135  *  property available on the object (PR_ACCESS_LEVEL) uses the same
136  *  MAPI_MODIFY flag to say just what this new access level is.
137  */
138 
139 #define MAPI_MODIFY				((ULONG) 0x00000001)
140 
141 /*
142  *	The following flags are used to indicate to the client what access
143  *	level is permissible in the object. They appear in PR_ACCESS in
144  *	message and folder objects as well as in contents and associated
145  *	contents tables
146  */
147 
148 #define	MAPI_ACCESS_MODIFY					((ULONG) 0x00000001)
149 #define	MAPI_ACCESS_READ					((ULONG) 0x00000002)
150 #define	MAPI_ACCESS_DELETE					((ULONG) 0x00000004)
151 #define	MAPI_ACCESS_CREATE_HIERARCHY		((ULONG) 0x00000008)
152 #define	MAPI_ACCESS_CREATE_CONTENTS			((ULONG) 0x00000010)
153 #define	MAPI_ACCESS_CREATE_ASSOCIATED		((ULONG) 0x00000020)
154 
155 /*
156  *	The MAPI_UNICODE flag is used in many different MAPI calls to signify
157  *	that strings passed through the interface are in Unicode (a 16-bit
158  *	character set). The default is an 8-bit character set.
159  *
160  *	The value fMapiUnicode can be used as the 'normal' value for
161  *	that bit, given the application's default character set.
162  */
163 
164 #define MAPI_UNICODE			((ULONG) 0x80000000)
165 
166 #ifdef UNICODE
167 #define fMapiUnicode			MAPI_UNICODE
168 #else
169 #define fMapiUnicode			0
170 #endif
171 
172 /* successful HRESULT */
173 #define hrSuccess				0
174 
175 
176 
177 /* Recipient types */
178 #ifndef MAPI_ORIG				/* also defined in mapi.h */
179 #define MAPI_ORIG   0           /* Recipient is message originator          */
180 #define MAPI_TO     1           /* Recipient is a primary recipient         */
181 #define MAPI_CC     2           /* Recipient is a copy recipient            */
182 #define MAPI_BCC    3           /* Recipient is blind copy recipient        */
183 #define MAPI_P1		0x10000000	/* Recipient is a P1 resend recipient       */
184 #define MAPI_SUBMITTED 0x80000000 /* Recipient is already processed         */
185 /* #define MAPI_AUTHORIZE 4		   recipient is a CMC authorizing user		*/
186 /*#define MAPI_DISCRETE 0x10000000 Recipient is a P1 resend recipient       */
187 #endif
188 
189 /* Bit definitions for abFlags[0] of ENTRYID */
190 #define MAPI_SHORTTERM			0x80
191 #define MAPI_NOTRECIP			0x40
192 #define MAPI_THISSESSION		0x20
193 #define MAPI_NOW				0x10
194 #define MAPI_NOTRESERVED		0x08
195 
196 /* Bit definitions for abFlags[1] of ENTRYID */
197 #define MAPI_COMPOUND			0x80
198 
199 /* ENTRYID */
200 typedef struct
201 {
202 	BYTE	abFlags[4];
203 	BYTE	ab[MAPI_DIM];
204 } ENTRYID, FAR *LPENTRYID;
205 
206 #define CbNewENTRYID(_cb)		(offsetof(ENTRYID,ab) + (_cb))
207 #define CbENTRYID(_cb)			(offsetof(ENTRYID,ab) + (_cb))
208 #define SizedENTRYID(_cb, _name) \
209 	struct _ENTRYID_ ## _name \
210 { \
211 	BYTE	abFlags[4]; \
212 	BYTE	ab[_cb]; \
213 } _name
214 
215 /* Byte-order-independent version of GUID (world-unique identifier) */
216 typedef struct _MAPIUID
217 {
218 	BYTE ab[16];
219 } MAPIUID, FAR * LPMAPIUID;
220 
221 /* Note:  need to include C run-times (memory.h) to use this macro */
222 
223 #define IsEqualMAPIUID(lpuid1, lpuid2)	(!memcmp(lpuid1, lpuid2, sizeof(MAPIUID)))
224 
225 /*
226  * Constants for one-off entry ID:
227  * The MAPIUID that identifies the one-off provider;
228  * the flag that defines whether the embedded strings are Unicode;
229  * the flag that specifies whether the recipient gets TNEF or not.
230  */
231 
232 #define MAPI_ONE_OFF_UID { 0x81, 0x2b, 0x1f, 0xa4, 0xbe, 0xa3, 0x10, 0x19, \
233 						   0x9d, 0x6e, 0x00, 0xdd, 0x01, 0x0f, 0x54, 0x02 }
234 #define MAPI_ONE_OFF_UNICODE		0x8000
235 #define MAPI_ONE_OFF_NO_RICH_INFO	0x0001
236 
237 /* Object type */
238 
239 #define MAPI_STORE		((ULONG) 0x00000001)	/* Message Store */
240 #define MAPI_ADDRBOOK	((ULONG) 0x00000002)	/* Address Book */
241 #define MAPI_FOLDER		((ULONG) 0x00000003)	/* Folder */
242 #define MAPI_ABCONT		((ULONG) 0x00000004)	/* Address Book Container */
243 #define MAPI_MESSAGE	((ULONG) 0x00000005)	/* Message */
244 #define MAPI_MAILUSER	((ULONG) 0x00000006)	/* Individual Recipient */
245 #define MAPI_ATTACH		((ULONG) 0x00000007)	/* Attachment */
246 #define MAPI_DISTLIST	((ULONG) 0x00000008)	/* Distribution List Recipient */
247 #define MAPI_PROFSECT	((ULONG) 0x00000009)	/* Profile Section */
248 #define MAPI_STATUS		((ULONG) 0x0000000A)	/* Status Object */
249 #define MAPI_SESSION	((ULONG) 0x0000000B)	/* Session */
250 #define MAPI_FORMINFO	((ULONG) 0x0000000C)	/* Form Information */
251 
252 
253 /*
254  *	Maximum length of profile names and passwords, not including
255  *	the null termination character.
256  */
257 #ifndef cchProfileNameMax
258 #define cchProfileNameMax	64
259 #define cchProfilePassMax	64
260 #endif
261 
262 
263 /* Property Types */
264 
265 #define MV_FLAG			0x1000			/* Multi-value flag */
266 
267 #define PT_UNSPECIFIED	((ULONG)  0)	/* (Reserved for interface use) type doesn't matter to caller */
268 #define PT_NULL			((ULONG)  1)	/* NULL property value */
269 #define	PT_I2			((ULONG)  2)	/* Signed 16-bit value */
270 #define PT_LONG			((ULONG)  3)	/* Signed 32-bit value */
271 #define	PT_R4			((ULONG)  4)	/* 4-byte floating point */
272 #define PT_DOUBLE		((ULONG)  5)	/* Floating point double */
273 #define PT_CURRENCY		((ULONG)  6)	/* Signed 64-bit int (decimal w/	4 digits right of decimal pt) */
274 #define	PT_APPTIME		((ULONG)  7)	/* Application time */
275 #define PT_ERROR		((ULONG) 10)	/* 32-bit error value */
276 #define PT_BOOLEAN		((ULONG) 11)	/* 16-bit boolean (non-zero true) */
277 #define PT_OBJECT		((ULONG) 13)	/* Embedded object in a property */
278 #define	PT_I8			((ULONG) 20)	/* 8-byte signed integer */
279 #define PT_STRING8		((ULONG) 30)	/* Null terminated 8-bit character string */
280 #define PT_UNICODE		((ULONG) 31)	/* Null terminated Unicode string */
281 #define PT_SYSTIME		((ULONG) 64)	/* FILETIME 64-bit int w/ number of 100ns periods since Jan 1,1601 */
282 #define	PT_CLSID		((ULONG) 72)	/* OLE GUID */
283 #define PT_BINARY		((ULONG) 258)	/* Uninterpreted (counted byte array) */
284 #define PT_PTR			((ULONG) 259)	/* Pointer Variable, scales to the platform */
285 /* Changes are likely to these numbers, and to their structures. */
286 
287 /* Alternate property type names for ease of use */
288 #define	PT_SHORT	PT_I2
289 #define	PT_I4		PT_LONG
290 #define	PT_FLOAT	PT_R4
291 #define	PT_R8		PT_DOUBLE
292 #define	PT_LONGLONG	PT_I8
293 
294 /*
295  *	The type of a MAPI-defined string property is indirected, so
296  *	that it defaults to Unicode string on a Unicode platform and to
297  *	String8 on an ANSI or DBCS platform.
298  *
299  *	Macros are defined here both for the property type, and for the
300  *	field of the property value structure which should be
301  *	dereferenced to obtain the string pointer.
302  */
303 
304 #ifdef	UNICODE
305 #define PT_TSTRING			PT_UNICODE
306 #define PT_MV_TSTRING		(MV_FLAG|PT_UNICODE)
307 #define LPSZ				lpszW
308 #define	LPPSZ				lppszW
309 #define MVSZ				MVszW
310 #else
311 #define PT_TSTRING			PT_STRING8
312 #define PT_MV_TSTRING		(MV_FLAG|PT_STRING8)
313 #define LPSZ				lpszA
314 #define	LPPSZ				lppszA
315 #define MVSZ				MVszA
316 #endif
317 
318 
319 /* Property Tags
320  *
321  * By convention, MAPI never uses 0 or FFFF as a property ID.
322  * Use as null values, initializers, sentinels, or what have you.
323  */
324 
325 #define PROP_TYPE_MASK			((ULONG)0x0000FFFF)	/* Mask for Property type */
326 #define PROP_TYPE(ulPropTag)	(((ULONG)(ulPropTag))&PROP_TYPE_MASK)
327 #define PROP_ID(ulPropTag)		(((ULONG)(ulPropTag))>>16)
328 #define PROP_TAG(ulPropType,ulPropID)	((((ULONG)(ulPropID))<<16)|((ULONG)(ulPropType)))
329 #define PROP_ID_NULL			0
330 #define PROP_ID_INVALID			0xFFFF
331 #define PR_NULL					PROP_TAG( PT_NULL, PROP_ID_NULL)
332 #define CHANGE_PROP_TYPE(ulPropTag, ulPropType)	\
333 						(((ULONG)0xFFFF0000 & (ulPropTag)) | (ulPropType))
334 
335 
336 /* Multi-valued Property Types */
337 
338 #define	PT_MV_I2		(MV_FLAG|PT_I2)
339 #define PT_MV_LONG		(MV_FLAG|PT_LONG)
340 #define	PT_MV_R4		(MV_FLAG|PT_R4)
341 #define PT_MV_DOUBLE	(MV_FLAG|PT_DOUBLE)
342 #define PT_MV_CURRENCY	(MV_FLAG|PT_CURRENCY)
343 #define	PT_MV_APPTIME	(MV_FLAG|PT_APPTIME)
344 #define PT_MV_SYSTIME	(MV_FLAG|PT_SYSTIME)
345 #define PT_MV_STRING8	(MV_FLAG|PT_STRING8)
346 #define PT_MV_BINARY	(MV_FLAG|PT_BINARY)
347 #define PT_MV_UNICODE	(MV_FLAG|PT_UNICODE)
348 #define	PT_MV_CLSID		(MV_FLAG|PT_CLSID)
349 #define PT_MV_I8		(MV_FLAG|PT_I8)
350 
351 /* Alternate property type names for ease of use */
352 #define	PT_MV_SHORT		PT_MV_I2
353 #define	PT_MV_I4		PT_MV_LONG
354 #define	PT_MV_FLOAT		PT_MV_R4
355 #define	PT_MV_R8		PT_MV_DOUBLE
356 #define	PT_MV_LONGLONG	PT_MV_I8
357 
358 /*
359  *	Property type reserved bits
360  *
361  *	MV_INSTANCE is used as a flag in table operations to request
362  *	that a multi-valued property be presented as a single-valued
363  *	property appearing in multiple rows.
364  */
365 
366 #define MV_INSTANCE		0x2000
367 #define MVI_FLAG		(MV_FLAG | MV_INSTANCE)
368 #define MVI_PROP(tag)	((tag) | MVI_FLAG)
369 
370 /* --------------- */
371 /* Data Structures */
372 /* --------------- */
373 
374 /* Property Tag Array */
375 
376 typedef struct _SPropTagArray
377 {
378 	ULONG	cValues;
379 	ULONG	aulPropTag[MAPI_DIM];
380 } SPropTagArray, FAR * LPSPropTagArray;
381 
382 #define CbNewSPropTagArray(_ctag) \
383 	(offsetof(SPropTagArray,aulPropTag) + (_ctag)*sizeof(ULONG))
384 #define CbSPropTagArray(_lparray) \
385 	(offsetof(SPropTagArray,aulPropTag) + \
386 	(UINT)((_lparray)->cValues)*sizeof(ULONG))
387 /*	SPropTagArray */
388 #define SizedSPropTagArray(_ctag, _name) \
389 struct _SPropTagArray_ ## _name \
390 { \
391 	ULONG	cValues; \
392 	ULONG	aulPropTag[_ctag]; \
393 } _name
394 
395 /* -------------- */
396 /* Property Value */
397 /* -------------- */
398 
399 typedef struct _SPropValue	SPropValue;
400 
401 
402 /* 32-bit CURRENCY definition stolen from oaidl.h */
403 /* 16-bit CURRENCY definition stolen from variant.h */
404 
405 #ifndef _tagCY_DEFINED
406 #define _tagCY_DEFINED
407 #define _CY_DEFINED
408 #if defined (DOS) && !defined (_VARIANT_H_)
409 typedef struct FARSTRUCT tagCY {
410 #ifdef _MAC
411         long      Hi;
412         long Lo;
413 #else
414         unsigned long Lo;
415         long      Hi;
416 #endif
417 } CY;
418 #elif defined (_WIN64) || defined(_WIN32)
419 /* real definition that makes the C++ compiler happy */
420 typedef union tagCY {
421     struct {
422 #ifdef _MAC
423         long      Hi;
424         long Lo;
425 #else
426         unsigned long Lo;
427         long      Hi;
428 #endif
429     };
430     LONGLONG int64;
431 } CY;
432 #endif
433 #endif
434 			/* size is 8 */
435 typedef CY CURRENCY;
436 
437 typedef struct _SBinary
438 {
439 	ULONG		cb;
440 	LPBYTE 		lpb;
441 } SBinary, FAR *LPSBinary;
442 
443 typedef	struct _SShortArray
444 {
445 	ULONG		cValues;
446 	short int	FAR *lpi;
447 } SShortArray;
448 
449 typedef struct _SGuidArray
450 {
451 	ULONG		cValues;
452 	GUID		FAR *lpguid;
453 } SGuidArray;
454 
455 typedef	struct _SRealArray
456 {
457 	ULONG		cValues;
458 	float		FAR *lpflt;
459 } SRealArray;
460 
461 typedef struct _SLongArray
462 {
463 	ULONG		cValues;
464 	LONG 		FAR *lpl;
465 } SLongArray;
466 
467 typedef struct _SLargeIntegerArray
468 {
469 	ULONG		cValues;
470 	LARGE_INTEGER	FAR *lpli;
471 } SLargeIntegerArray;
472 
473 typedef struct _SDateTimeArray
474 {
475 	ULONG		cValues;
476 	FILETIME	FAR *lpft;
477 } SDateTimeArray;
478 
479 typedef struct _SAppTimeArray
480 {
481 	ULONG		cValues;
482 	double		FAR *lpat;
483 } SAppTimeArray;
484 
485 typedef struct _SCurrencyArray
486 {
487 	ULONG		cValues;
488 	CURRENCY	FAR *lpcur;
489 } SCurrencyArray;
490 
491 typedef struct _SBinaryArray
492 {
493 	ULONG		cValues;
494 	SBinary		FAR *lpbin;
495 } SBinaryArray;
496 
497 typedef struct _SDoubleArray
498 {
499 	ULONG		cValues;
500 	double		FAR *lpdbl;
501 } SDoubleArray;
502 
503 typedef struct _SWStringArray
504 {
505 	ULONG		cValues;
506 	LPWSTR		FAR *lppszW;
507 } SWStringArray;
508 
509 typedef struct _SLPSTRArray
510 {
511 	ULONG		cValues;
512 	LPSTR		FAR *lppszA;
513 } SLPSTRArray;
514 
515 typedef union _PV
516 {
517 	short int			i;			/* case PT_I2 */
518 	LONG				l;			/* case PT_LONG */
519 	ULONG				ul;			/* alias for PT_LONG */
520 	LPVOID				lpv;		/* alias for PT_PTR */
521 	float				flt;		/* case PT_R4 */
522 	double				dbl;		/* case PT_DOUBLE */
523 	unsigned short int	b;			/* case PT_BOOLEAN */
524 	CURRENCY			cur;		/* case PT_CURRENCY */
525 	double				at;			/* case PT_APPTIME */
526 	FILETIME			ft;			/* case PT_SYSTIME */
527 	LPSTR				lpszA;		/* case PT_STRING8 */
528 	SBinary				bin;		/* case PT_BINARY */
529 	LPWSTR				lpszW;		/* case PT_UNICODE */
530 	LPGUID				lpguid;		/* case PT_CLSID */
531 	LARGE_INTEGER		li;			/* case PT_I8 */
532 	SShortArray			MVi;		/* case PT_MV_I2 */
533 	SLongArray			MVl;		/* case PT_MV_LONG */
534 	SRealArray			MVflt;		/* case PT_MV_R4 */
535 	SDoubleArray		MVdbl;		/* case PT_MV_DOUBLE */
536 	SCurrencyArray		MVcur;		/* case PT_MV_CURRENCY */
537 	SAppTimeArray		MVat;		/* case PT_MV_APPTIME */
538 	SDateTimeArray		MVft;		/* case PT_MV_SYSTIME */
539 	SBinaryArray		MVbin;		/* case PT_MV_BINARY */
540 	SLPSTRArray			MVszA;		/* case PT_MV_STRING8 */
541 	SWStringArray		MVszW;		/* case PT_MV_UNICODE */
542 	SGuidArray			MVguid;		/* case PT_MV_CLSID */
543 	SLargeIntegerArray	MVli;		/* case PT_MV_I8 */
544 	SCODE				err;		/* case PT_ERROR */
545 	LONG				x;			/* case PT_NULL, PT_OBJECT (no usable value) */
546 } __UPV;
547 
548 typedef struct _SPropValue
549 {
550 	ULONG		ulPropTag;
551 	ULONG		dwAlignPad;
552 	union _PV	Value;
553 } SPropValue, FAR * LPSPropValue;
554 
555 
556 /* --------------------------------------------- */
557 /* Property Problem and Property Problem Arrays */
558 /* --------------------------------------------- */
559 
560 typedef struct _SPropProblem
561 {
562 	ULONG	ulIndex;
563 	ULONG	ulPropTag;
564 	SCODE	scode;
565 } SPropProblem, FAR * LPSPropProblem;
566 
567 typedef struct _SPropProblemArray
568 {
569 	ULONG			cProblem;
570 	SPropProblem	aProblem[MAPI_DIM];
571 } SPropProblemArray, FAR * LPSPropProblemArray;
572 
573 #define CbNewSPropProblemArray(_cprob) \
574 	(offsetof(SPropProblemArray,aProblem) + (_cprob)*sizeof(SPropProblem))
575 #define CbSPropProblemArray(_lparray) \
576 	(offsetof(SPropProblemArray,aProblem) + \
577 	(UINT) ((_lparray)->cProblem*sizeof(SPropProblem)))
578 #define SizedSPropProblemArray(_cprob, _name) \
579 struct _SPropProblemArray_ ## _name \
580 { \
581 	ULONG			cProblem; \
582 	SPropProblem	aProblem[_cprob]; \
583 } _name
584 
585 /*
586  *	ENTRYLIST
587  */
588 
589 typedef SBinaryArray ENTRYLIST, FAR *LPENTRYLIST;
590 
591 /*
592  *	FLATENTRYLIST
593  *	MTSID
594  *	FLATMTSIDLIST
595  */
596 
597 typedef struct {
598 	ULONG cb;
599 	BYTE abEntry[MAPI_DIM];
600 } FLATENTRY, FAR *LPFLATENTRY;
601 
602 typedef struct {
603 	ULONG		cEntries;
604 	ULONG		cbEntries;
605 	BYTE		abEntries[MAPI_DIM];
606 } FLATENTRYLIST, FAR *LPFLATENTRYLIST;
607 
608 typedef struct {
609 	ULONG		cb;
610 	BYTE		ab[MAPI_DIM];
611 } MTSID, FAR *LPMTSID;
612 
613 typedef struct {
614 	ULONG		cMTSIDs;
615 	ULONG		cbMTSIDs;
616 	BYTE		abMTSIDs[MAPI_DIM];
617 } FLATMTSIDLIST, FAR *LPFLATMTSIDLIST;
618 
619 #define CbNewFLATENTRY(_cb)		(offsetof(FLATENTRY,abEntry) + (_cb))
620 #define CbFLATENTRY(_lpentry)	(offsetof(FLATENTRY,abEntry) + (_lpentry)->cb)
621 #define CbNewFLATENTRYLIST(_cb)	(offsetof(FLATENTRYLIST,abEntries) + (_cb))
622 #define CbFLATENTRYLIST(_lplist) (offsetof(FLATENTRYLIST,abEntries) + (_lplist)->cbEntries)
623 #define CbNewMTSID(_cb)			(offsetof(MTSID,ab) + (_cb))
624 #define CbMTSID(_lpentry)		(offsetof(MTSID,ab) + (_lpentry)->cb)
625 #define CbNewFLATMTSIDLIST(_cb)	(offsetof(FLATMTSIDLIST,abMTSIDs) + (_cb))
626 #define CbFLATMTSIDLIST(_lplist) (offsetof(FLATMTSIDLIST,abMTSIDs) + (_lplist)->cbMTSIDs)
627 /* No SizedXXX macros for these types. */
628 
629 /* ------------------------------ */
630 /* ADRENTRY, ADRLIST */
631 
632 typedef struct _ADRENTRY
633 {
634 	ULONG			ulReserved1;	/* Never used */
635 	ULONG			cValues;
636 	LPSPropValue	rgPropVals;
637 } ADRENTRY, FAR * LPADRENTRY;
638 
639 typedef struct _ADRLIST
640 {
641 	ULONG			cEntries;
642 	ADRENTRY		aEntries[MAPI_DIM];
643 } ADRLIST, FAR * LPADRLIST;
644 
645 #define CbNewADRLIST(_centries) \
646 	(offsetof(ADRLIST,aEntries) + (_centries)*sizeof(ADRENTRY))
647 #define CbADRLIST(_lpadrlist) \
648 	(offsetof(ADRLIST,aEntries) + (UINT)(_lpadrlist)->cEntries*sizeof(ADRENTRY))
649 #define SizedADRLIST(_centries, _name) \
650 struct _ADRLIST_ ## _name \
651 { \
652 	ULONG			cEntries; \
653 	ADRENTRY		aEntries[_centries]; \
654 } _name
655 
656 /* ------------------------------ */
657 /* SRow, SRowSet */
658 
659 typedef struct _SRow
660 {
661 	ULONG			ulAdrEntryPad;	/* Pad so SRow's can map to ADRENTRY's */
662 	ULONG			cValues;		/* Count of property values */
663 	LPSPropValue	lpProps;		/* Property value array */
664 } SRow, FAR * LPSRow;
665 
666 typedef struct _SRowSet
667 {
668 	ULONG			cRows;			/* Count of rows */
669 	SRow			aRow[MAPI_DIM];	/* Array of rows */
670 } SRowSet, FAR * LPSRowSet;
671 
672 #define CbNewSRowSet(_crow)		(offsetof(SRowSet,aRow) + (_crow)*sizeof(SRow))
673 #define CbSRowSet(_lprowset)	(offsetof(SRowSet,aRow) + \
674 									(UINT)((_lprowset)->cRows*sizeof(SRow)))
675 #define SizedSRowSet(_crow, _name) \
676 struct _SRowSet_ ## _name \
677 { \
678 	ULONG			cRows; \
679 	SRow			aRow[_crow]; \
680 } _name
681 
682 /* MAPI Allocation Routines ------------------------------------------------ */
683 
684 typedef SCODE (STDMETHODCALLTYPE ALLOCATEBUFFER)(
685 	ULONG			cbSize,
686 	LPVOID FAR *	lppBuffer
687 );
688 
689 typedef SCODE (STDMETHODCALLTYPE ALLOCATEMORE)(
690 	ULONG			cbSize,
691 	LPVOID			lpObject,
692 	LPVOID FAR *	lppBuffer
693 );
694 
695 typedef ULONG (STDAPICALLTYPE FREEBUFFER)(
696 	LPVOID			lpBuffer
697 );
698 
699 typedef ALLOCATEBUFFER FAR *LPALLOCATEBUFFER;
700 typedef ALLOCATEMORE FAR *	LPALLOCATEMORE;
701 typedef FREEBUFFER FAR *	LPFREEBUFFER;
702 
703 /* MAPI Component Object Model Macros -------------------------------------- */
704 
705 #if defined(MAPI_IF) && (!defined(__cplusplus) || defined(CINTERFACE))
706 #define DECLARE_MAPI_INTERFACE(iface)                                   \
707 		typedef struct iface##Vtbl iface##Vtbl, FAR * iface;			\
708 		struct iface##Vtbl
709 #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
710 		DECLARE_MAPI_INTERFACE(iface)
711 #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
712 		typedef struct iface##Vtbl iface##Vtbl, FAR * iface, FAR * FAR * piface;
713 #else
714 #define DECLARE_MAPI_INTERFACE(iface)                                   \
715 		DECLARE_INTERFACE(iface)
716 #define DECLARE_MAPI_INTERFACE_(iface, baseiface)                       \
717 		DECLARE_INTERFACE_(iface, baseiface)
718 #ifdef __cplusplus
719 #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
720 		interface iface; typedef iface FAR * piface
721 #else
722 #define DECLARE_MAPI_INTERFACE_PTR(iface, piface)                       \
723 		typedef interface iface iface, FAR * piface
724 #endif
725 #endif
726 
727 #define MAPIMETHOD(method)				MAPIMETHOD_(HRESULT, method)
728 #define MAPIMETHOD_(type, method)		STDMETHOD_(type, method)
729 #define MAPIMETHOD_DECLARE(type, method, prefix) \
730 		STDMETHODIMP_(type) prefix##method
731 #define MAPIMETHOD_TYPEDEF(type, method, prefix) \
732 		typedef type (STDMETHODCALLTYPE prefix##method##_METHOD)
733 
734 #define MAPI_IUNKNOWN_METHODS(IPURE)									\
735 	MAPIMETHOD(QueryInterface)											\
736 		(THIS_ REFIID riid, LPVOID FAR * ppvObj) IPURE;					\
737 	MAPIMETHOD_(ULONG,AddRef)  (THIS) IPURE;							\
738 	MAPIMETHOD_(ULONG,Release) (THIS) IPURE;							\
739 
740 #undef	IMPL
741 #define IMPL
742 
743 /* Pointers to MAPI Interfaces --------------------------------------------- */
744 
745 typedef const IID FAR * LPCIID;
746 
747 DECLARE_MAPI_INTERFACE_PTR(IMsgStore,		LPMDB);
748 DECLARE_MAPI_INTERFACE_PTR(IMAPIFolder,		LPMAPIFOLDER);
749 DECLARE_MAPI_INTERFACE_PTR(IMessage,		LPMESSAGE);
750 DECLARE_MAPI_INTERFACE_PTR(IAttach,			LPATTACH);
751 DECLARE_MAPI_INTERFACE_PTR(IAddrBook,		LPADRBOOK);
752 DECLARE_MAPI_INTERFACE_PTR(IABContainer,	LPABCONT);
753 DECLARE_MAPI_INTERFACE_PTR(IMailUser,		LPMAILUSER);
754 DECLARE_MAPI_INTERFACE_PTR(IDistList,		LPDISTLIST);
755 DECLARE_MAPI_INTERFACE_PTR(IMAPIStatus,		LPMAPISTATUS);
756 DECLARE_MAPI_INTERFACE_PTR(IMAPITable,		LPMAPITABLE);
757 DECLARE_MAPI_INTERFACE_PTR(IProfSect,		LPPROFSECT);
758 DECLARE_MAPI_INTERFACE_PTR(IMAPIProp,		LPMAPIPROP);
759 DECLARE_MAPI_INTERFACE_PTR(IMAPIContainer,	LPMAPICONTAINER);
760 DECLARE_MAPI_INTERFACE_PTR(IMAPIAdviseSink, LPMAPIADVISESINK);
761 DECLARE_MAPI_INTERFACE_PTR(IMAPIProgress,	LPMAPIPROGRESS);
762 DECLARE_MAPI_INTERFACE_PTR(IProviderAdmin,	LPPROVIDERADMIN);
763 
764 /* Extended MAPI Error Information ----------------------------------------- */
765 
766 typedef struct _MAPIERROR
767 {
768 	ULONG	ulVersion;
769 	LPTSTR	lpszError;
770 	LPTSTR	lpszComponent;
771 	ULONG	ulLowLevelError;
772 	ULONG	ulContext;
773 
774 } MAPIERROR, FAR * LPMAPIERROR;
775 
776 
777 /* IMAPIAdviseSink Interface ----------------------------------------------- */
778 
779 /*
780  *	Notification event types. The event types can be combined in a bitmask
781  *	for filtering. Each one has a parameter structure associated with it:
782  *
783  *		fnevCriticalError		ERROR_NOTIFICATION
784  *		fnevNewMail				NEWMAIL_NOTIFICATION
785  *		fnevObjectCreated		OBJECT_NOTIFICATION
786  *		fnevObjectDeleted		OBJECT_NOTIFICATION
787  *		fnevObjectModified		OBJECT_NOTIFICATION
788  *		fnevObjectCopied		OBJECT_NOTIFICATION
789  *		fnevSearchComplete		OBJECT_NOTIFICATION
790  *		fnevTableModified		TABLE_NOTIFICATION
791  *		fnevStatusObjectModified ?
792  *
793  *		fnevExtended			EXTENDED_NOTIFICATION
794  */
795 
796 #define fnevCriticalError			((ULONG) 0x00000001)
797 #define fnevNewMail					((ULONG) 0x00000002)
798 #define fnevObjectCreated			((ULONG) 0x00000004)
799 #define fnevObjectDeleted			((ULONG) 0x00000008)
800 #define fnevObjectModified			((ULONG) 0x00000010)
801 #define fnevObjectMoved				((ULONG) 0x00000020)
802 #define fnevObjectCopied			((ULONG) 0x00000040)
803 #define fnevSearchComplete			((ULONG) 0x00000080)
804 #define fnevTableModified			((ULONG) 0x00000100)
805 #define	fnevStatusObjectModified	((ULONG) 0x00000200)
806 #define	fnevReservedForMapi			((ULONG) 0x40000000)
807 #define fnevExtended				((ULONG) 0x80000000)
808 
809 /* TABLE_NOTIFICATION event types passed in ulTableEvent */
810 
811 #define TABLE_CHANGED		1
812 #define	TABLE_ERROR			2
813 #define	TABLE_ROW_ADDED		3
814 #define	TABLE_ROW_DELETED	4
815 #define	TABLE_ROW_MODIFIED	5
816 #define	TABLE_SORT_DONE		6
817 #define	TABLE_RESTRICT_DONE	7
818 #define	TABLE_SETCOL_DONE	8
819 #define TABLE_RELOAD		9
820 
821 /* Event Structures */
822 
823 typedef struct _ERROR_NOTIFICATION
824 {
825 	ULONG		cbEntryID;
826 	LPENTRYID	lpEntryID;
827 	SCODE		scode;
828 	ULONG		ulFlags;			/* 0 or MAPI_UNICODE */
829 	LPMAPIERROR	lpMAPIError;		/* Detailed error information */
830 } ERROR_NOTIFICATION;
831 
832 typedef struct _NEWMAIL_NOTIFICATION
833 {
834 	ULONG		cbEntryID;
835 	LPENTRYID	lpEntryID;			/* identifies the new message */
836 	ULONG		cbParentID;
837 	LPENTRYID	lpParentID;			/* identifies the folder it lives in */
838 	ULONG		ulFlags;			/* 0 or MAPI_UNICODE */
839 	LPTSTR		lpszMessageClass;	/* message class (UNICODE or string8) */
840 	ULONG		ulMessageFlags;		/* copy of PR_MESSAGE_FLAGS */
841 } NEWMAIL_NOTIFICATION;
842 
843 typedef struct _OBJECT_NOTIFICATION
844 {
845 	ULONG				cbEntryID;
846 	LPENTRYID			lpEntryID;		/* EntryID of object */
847 	ULONG				ulObjType;		/* Type of object */
848 	ULONG				cbParentID;
849 	LPENTRYID			lpParentID;		/* EntryID of parent object */
850 	ULONG				cbOldID;
851 	LPENTRYID			lpOldID;		/* EntryID of old object */
852 	ULONG				cbOldParentID;
853 	LPENTRYID			lpOldParentID;	/* EntryID of old parent */
854 	LPSPropTagArray		lpPropTagArray;
855 } OBJECT_NOTIFICATION;
856 
857 typedef struct _TABLE_NOTIFICATION
858 {
859 	ULONG				ulTableEvent;	/* Identifies WHICH table event */
860 	HRESULT				hResult;		/* Value for TABLE_ERROR */
861 	SPropValue			propIndex;		/* This row's "index property" */
862 	SPropValue			propPrior;		/* Preceding row's "index property" */
863 	SRow				row;			/* New data of added/modified row */
864 	ULONG				ulPad;			/* Force to 8-byte boundary */
865 } TABLE_NOTIFICATION;
866 
867 typedef struct _EXTENDED_NOTIFICATION
868 {
869 	ULONG		ulEvent;					/* extended event code */
870 	ULONG		cb;							/* size of event parameters */
871 	LPBYTE		pbEventParameters;			/* event parameters */
872 } EXTENDED_NOTIFICATION;
873 
874 typedef struct
875 {
876 	ULONG			cbEntryID;
877 	LPENTRYID		lpEntryID;
878 	ULONG			cValues;
879 	LPSPropValue	lpPropVals;
880 } STATUS_OBJECT_NOTIFICATION;
881 
882 typedef struct _NOTIFICATION
883 {
884 	ULONG	ulEventType;		/* notification type, i.e. fnevSomething */
885 	ULONG	ulAlignPad;			/* Force to 8-byte boundary */
886 	union
887 	{
888 		ERROR_NOTIFICATION			err;
889 		NEWMAIL_NOTIFICATION		newmail;
890 		OBJECT_NOTIFICATION			obj;
891 		TABLE_NOTIFICATION			tab;
892 		EXTENDED_NOTIFICATION		ext;
893 		STATUS_OBJECT_NOTIFICATION	statobj;
894 	} info;
895 } NOTIFICATION, FAR * LPNOTIFICATION;
896 
897 
898 /* Interface used for registering and issuing notification callbacks. */
899 
900 #define MAPI_IMAPIADVISESINK_METHODS(IPURE)								\
901 	MAPIMETHOD_(ULONG, OnNotify)										\
902 		(THIS_	ULONG						cNotif,						\
903 				LPNOTIFICATION				lpNotifications) IPURE;		\
904 
905 #undef		 INTERFACE
906 #define		 INTERFACE  IMAPIAdviseSink
DECLARE_MAPI_INTERFACE_(IMAPIAdviseSink,IUnknown)907 DECLARE_MAPI_INTERFACE_(IMAPIAdviseSink, IUnknown)
908 {
909 	BEGIN_INTERFACE
910 	MAPI_IUNKNOWN_METHODS(PURE)
911 	MAPI_IMAPIADVISESINK_METHODS(PURE)
912 };
913 
914 /* Callback function type for MAPIAllocAdviseSink */
915 
916 typedef long (STDAPICALLTYPE NOTIFCALLBACK) (
917 	LPVOID			lpvContext,
918 	ULONG			cNotification,
919 	LPNOTIFICATION	lpNotifications);
920 typedef NOTIFCALLBACK FAR * LPNOTIFCALLBACK;
921 
922 /*
923  *	Message name for the 16-bit MAPI notififcation engine.
924  *	This can be used in 16-bit applications to force processing
925  *	of notification callbacks.
926  */
927 
928 #define szMAPINotificationMsg "MAPI Notify window message"
929 
930 
931 /* IMAPIProgress Interface ------------------------------------------------- */
932 
933 /* Flag values for the progress indicator */
934 
935 #define MAPI_TOP_LEVEL		((ULONG) 0x00000001)
936 
937 #define MAPI_IMAPIPROGRESS_METHODS(IPURE)								\
938 	MAPIMETHOD(Progress)												\
939 		(THIS_	ULONG						ulValue,					\
940 				ULONG						ulCount,					\
941 				ULONG						ulTotal) IPURE;				\
942 	MAPIMETHOD(GetFlags)												\
943 		(THIS_	ULONG FAR *					lpulFlags) IPURE;			\
944 	MAPIMETHOD(GetMax)													\
945 		(THIS_	ULONG FAR *					lpulMax) IPURE;				\
946 	MAPIMETHOD(GetMin)													\
947 		(THIS_	ULONG FAR *					lpulMin) IPURE;				\
948 	MAPIMETHOD(SetLimits)												\
949 		(THIS_	LPULONG						lpulMin,					\
950 				LPULONG						lpulMax,					\
951 				LPULONG						lpulFlags) IPURE;			\
952 
953 #undef		INTERFACE
954 #define		INTERFACE	IMAPIProgress
DECLARE_MAPI_INTERFACE_(IMAPIProgress,IUnknown)955 DECLARE_MAPI_INTERFACE_(IMAPIProgress, IUnknown)
956 {
957 	BEGIN_INTERFACE
958 	MAPI_IUNKNOWN_METHODS(PURE)
959 	MAPI_IMAPIPROGRESS_METHODS(PURE)
960 };
961 
962 
963 /* IMAPIProp Interface ----------------------------------------------------- */
964 
965 /* GetLastError */
966 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
967 
968 /*
969  *  Version:
970  */
971 #define MAPI_ERROR_VERSION		0x00000000L
972 
973 /* GetPropList */
974 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
975 
976 /* GetProps */
977 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
978 
979 /* SaveChanges */
980 
981 #define KEEP_OPEN_READONLY		((ULONG) 0x00000001)
982 #define KEEP_OPEN_READWRITE		((ULONG) 0x00000002)
983 #define FORCE_SAVE				((ULONG) 0x00000004)
984 /* define MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
985 
986 /* OpenProperty  - ulFlags */
987 /******	MAPI_MODIFY				((ULONG) 0x00000001) above */
988 #define	MAPI_CREATE				((ULONG) 0x00000002)
989 #define STREAM_APPEND			((ULONG) 0x00000004)
990 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
991 
992 /* OpenProperty  - ulInterfaceOptions, IID_IMAPITable */
993 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
994 
995 /* CopyTo, CopyProps */
996 
997 #define MAPI_MOVE				((ULONG) 0x00000001)
998 #define MAPI_NOREPLACE			((ULONG) 0x00000002)
999 #define MAPI_DECLINE_OK			((ULONG) 0x00000004)
1000 
1001 #ifndef MAPI_DIALOG				/* also defined in mapi.h */
1002 #define MAPI_DIALOG				((ULONG) 0x00000008)
1003 #endif
1004 
1005 #ifndef MAPI_USE_DEFAULT		/* also defined in mapi.h */
1006 #define MAPI_USE_DEFAULT		0x00000040	/* Use default profile in logon */
1007 #endif
1008 
1009 /* Flags used in GetIDsFromNames  */
1010 /******	MAPI_CREATE				((ULONG) 0x00000002) above */
1011 
1012 /* Flags used in GetNamesFromIDs  (bit fields) */
1013 #define MAPI_NO_STRINGS			((ULONG) 0x00000001)
1014 #define MAPI_NO_IDS				((ULONG) 0x00000002)
1015 
1016 /*  Union discriminator  */
1017 #define MNID_ID					0
1018 #define MNID_STRING				1
1019 typedef struct _MAPINAMEID
1020 {
1021 	LPGUID lpguid;
1022 	ULONG ulKind;
1023 	union {
1024 		LONG_PTR	lID_Reserved;
1025 		LONG 		lID;
1026 		LPWSTR 		lpwstrName;
1027 	} Kind;
1028 
1029 } MAPINAMEID, FAR * LPMAPINAMEID;
1030 
1031 #define MAPI_IMAPIPROP_METHODS(IPURE)									\
1032 	MAPIMETHOD(GetLastError)											\
1033 		(THIS_	HRESULT						hResult,					\
1034 				ULONG						ulFlags,					\
1035 				LPMAPIERROR FAR *			lppMAPIError) IPURE;		\
1036 	MAPIMETHOD(SaveChanges)												\
1037 		(THIS_ ULONG						ulFlags) IPURE;				\
1038 	MAPIMETHOD(GetProps)												\
1039 		(THIS_	LPSPropTagArray				lpPropTagArray,				\
1040 				ULONG						ulFlags,					\
1041 				ULONG FAR *					lpcValues,					\
1042 				LPSPropValue FAR *			lppPropArray) IPURE;		\
1043 	MAPIMETHOD(GetPropList)												\
1044 		(THIS_	ULONG						ulFlags,					\
1045 				LPSPropTagArray FAR *		lppPropTagArray) IPURE;		\
1046 	MAPIMETHOD(OpenProperty)											\
1047 		(THIS_	ULONG						ulPropTag,					\
1048 				LPCIID						lpiid,						\
1049 				ULONG						ulInterfaceOptions,			\
1050 				ULONG						ulFlags,					\
1051 				LPUNKNOWN FAR *				lppUnk) IPURE;				\
1052 	MAPIMETHOD(SetProps)												\
1053 		(THIS_	ULONG						cValues,					\
1054 				LPSPropValue				lpPropArray,				\
1055 				LPSPropProblemArray FAR *	lppProblems) IPURE;			\
1056 	MAPIMETHOD(DeleteProps)												\
1057 		(THIS_	LPSPropTagArray				lpPropTagArray,				\
1058 				LPSPropProblemArray FAR *	lppProblems) IPURE;			\
1059 	MAPIMETHOD(CopyTo)													\
1060 		(THIS_	ULONG						ciidExclude,				\
1061 				LPCIID						rgiidExclude,				\
1062 				LPSPropTagArray				lpExcludeProps,				\
1063 				ULONG_PTR					ulUIParam,					\
1064 				LPMAPIPROGRESS 				lpProgress,					\
1065 				LPCIID						lpInterface,				\
1066 				LPVOID						lpDestObj,					\
1067 				ULONG						ulFlags,					\
1068 				LPSPropProblemArray FAR *	lppProblems) IPURE;			\
1069 	MAPIMETHOD(CopyProps)												\
1070 		(THIS_	LPSPropTagArray				lpIncludeProps,				\
1071 				ULONG_PTR					ulUIParam,					\
1072 				LPMAPIPROGRESS 				lpProgress,					\
1073 				LPCIID						lpInterface,				\
1074 				LPVOID						lpDestObj,					\
1075 				ULONG						ulFlags,					\
1076 				LPSPropProblemArray FAR *	lppProblems) IPURE;			\
1077 	MAPIMETHOD(GetNamesFromIDs)											\
1078 		(THIS_	LPSPropTagArray FAR *		lppPropTags,				\
1079 				LPGUID						lpPropSetGuid,				\
1080 				ULONG						ulFlags,					\
1081 				ULONG FAR *					lpcPropNames,				\
1082 				LPMAPINAMEID FAR * FAR *	lpppPropNames) IPURE;		\
1083 	MAPIMETHOD(GetIDsFromNames)											\
1084 		(THIS_	ULONG						cPropNames,					\
1085 				LPMAPINAMEID FAR *			lppPropNames,				\
1086 				ULONG						ulFlags,					\
1087 				LPSPropTagArray FAR *		lppPropTags) IPURE;			\
1088 
1089 #undef		 INTERFACE
1090 #define		 INTERFACE	IMAPIProp
DECLARE_MAPI_INTERFACE_(IMAPIProp,IUnknown)1091 DECLARE_MAPI_INTERFACE_(IMAPIProp, IUnknown)
1092 {
1093 	BEGIN_INTERFACE
1094 	MAPI_IUNKNOWN_METHODS(PURE)
1095 	MAPI_IMAPIPROP_METHODS(PURE)
1096 };
1097 
1098 /* IMAPITable Interface ---------------------------------------------------- */
1099 
1100 /* Table status */
1101 
1102 #define TBLSTAT_COMPLETE			((ULONG) 0)
1103 #define TBLSTAT_QCHANGED			((ULONG) 7)
1104 #define TBLSTAT_SORTING				((ULONG) 9)
1105 #define TBLSTAT_SORT_ERROR			((ULONG) 10)
1106 #define TBLSTAT_SETTING_COLS		((ULONG) 11)
1107 #define TBLSTAT_SETCOL_ERROR		((ULONG) 13)
1108 #define TBLSTAT_RESTRICTING			((ULONG) 14)
1109 #define TBLSTAT_RESTRICT_ERROR		((ULONG) 15)
1110 
1111 
1112 /* Table Type */
1113 
1114 #define TBLTYPE_SNAPSHOT			((ULONG) 0)
1115 #define TBLTYPE_KEYSET				((ULONG) 1)
1116 #define TBLTYPE_DYNAMIC				((ULONG) 2)
1117 
1118 
1119 /* Sort order */
1120 
1121 /* bit 0: set if descending, clear if ascending */
1122 
1123 #define TABLE_SORT_ASCEND		((ULONG) 0x00000000)
1124 #define TABLE_SORT_DESCEND		((ULONG) 0x00000001)
1125 #define TABLE_SORT_COMBINE		((ULONG) 0x00000002)
1126 
1127 
1128 /* Data structures */
1129 
1130 typedef struct _SSortOrder
1131 {
1132 	ULONG	ulPropTag;			/* Column to sort on */
1133 	ULONG	ulOrder;			/* Ascending, descending, combine to left */
1134 } SSortOrder, FAR * LPSSortOrder;
1135 
1136 typedef struct _SSortOrderSet
1137 {
1138 	ULONG			cSorts;		/* Number of sort columns in aSort below*/
1139 	ULONG			cCategories;	/* 0 for non-categorized, up to cSorts */
1140 	ULONG			cExpanded;		/* 0 if no categories start expanded, */
1141 									/*		up to cExpanded */
1142 	SSortOrder		aSort[MAPI_DIM];	/* The sort orders */
1143 } SSortOrderSet, FAR * LPSSortOrderSet;
1144 
1145 #define CbNewSSortOrderSet(_csort) \
1146 	(offsetof(SSortOrderSet,aSort) + (_csort)*sizeof(SSortOrder))
1147 #define CbSSortOrderSet(_lpset) \
1148 	(offsetof(SSortOrderSet,aSort) + \
1149 	(UINT)((_lpset)->cSorts*sizeof(SSortOrder)))
1150 #define SizedSSortOrderSet(_csort, _name) \
1151 struct _SSortOrderSet_ ## _name \
1152 { \
1153 	ULONG	  		cSorts;			\
1154 	ULONG			cCategories;	\
1155 	ULONG			cExpanded;		\
1156 	SSortOrder		aSort[_csort];	\
1157 } _name
1158 
1159 typedef ULONG_PTR 		BOOKMARK;
1160 
1161 #define BOOKMARK_BEGINNING	((BOOKMARK) 0)		/* Before first row */
1162 #define BOOKMARK_CURRENT	((BOOKMARK) 1)		/* Before current row */
1163 #define BOOKMARK_END		((BOOKMARK) 2)		/* After last row */
1164 
1165 /* Fuzzy Level */
1166 
1167 #define FL_FULLSTRING		((ULONG) 0x00000000)
1168 #define FL_SUBSTRING		((ULONG) 0x00000001)
1169 #define FL_PREFIX			((ULONG) 0x00000002)
1170 
1171 #define FL_IGNORECASE		((ULONG) 0x00010000)
1172 #define FL_IGNORENONSPACE	((ULONG) 0x00020000)
1173 #define FL_LOOSE			((ULONG) 0x00040000)
1174 
1175 /* Restrictions */
1176 
1177 typedef struct _SRestriction	FAR * LPSRestriction;
1178 
1179 /* Restriction types */
1180 
1181 #define RES_AND				((ULONG) 0x00000000)
1182 #define RES_OR				((ULONG) 0x00000001)
1183 #define RES_NOT				((ULONG) 0x00000002)
1184 #define RES_CONTENT			((ULONG) 0x00000003)
1185 #define RES_PROPERTY		((ULONG) 0x00000004)
1186 #define RES_COMPAREPROPS	((ULONG) 0x00000005)
1187 #define RES_BITMASK			((ULONG) 0x00000006)
1188 #define RES_SIZE			((ULONG) 0x00000007)
1189 #define RES_EXIST			((ULONG) 0x00000008)
1190 #define RES_SUBRESTRICTION	((ULONG) 0x00000009)
1191 #define RES_COMMENT			((ULONG) 0x0000000A)
1192 #define RES_COUNT			((ULONG) 0x0000000B)	// OFFICEDEV: Count restriction to CAP results
1193 #define RES_ANNOTATION		((ULONG) 0x0000000C)	// OFFICEDEV: Annotation restriction to pass information like LCID, etc.
1194 
1195 /* Relational operators. These apply to all property comparison restrictions. */
1196 
1197 #define RELOP_LT		((ULONG) 0)		/* <  */
1198 #define RELOP_LE		((ULONG) 1)		/* <= */
1199 #define RELOP_GT		((ULONG) 2)		/* >  */
1200 #define RELOP_GE		((ULONG) 3)		/* >= */
1201 #define RELOP_EQ		((ULONG) 4)		/* == */
1202 #define RELOP_NE		((ULONG) 5)		/* != */
1203 #define RELOP_RE		((ULONG) 6)		/* LIKE (Regular expression) */
1204 
1205 /* Bitmask operators, for RES_BITMASK only. */
1206 
1207 #define BMR_EQZ		((ULONG) 0)		/* ==0 */
1208 #define BMR_NEZ		((ULONG) 1)		/* !=0 */
1209 
1210 /* Subobject identifiers for RES_SUBRESTRICTION only. See MAPITAGS.H. */
1211 
1212 /* #define PR_MESSAGE_RECIPIENTS  PROP_TAG(PT_OBJECT,0x0E12) */
1213 /* #define PR_MESSAGE_ATTACHMENTS PROP_TAG(PT_OBJECT,0x0E13) */
1214 
1215 typedef struct _SAndRestriction
1216 {
1217 	ULONG			cRes;
1218 	LPSRestriction 	lpRes;
1219 } SAndRestriction;
1220 
1221 typedef struct _SOrRestriction
1222 {
1223 	ULONG			cRes;
1224 	LPSRestriction 	lpRes;
1225 } SOrRestriction;
1226 
1227 typedef struct _SNotRestriction
1228 {
1229 	ULONG			ulReserved;
1230 	LPSRestriction 	lpRes;
1231 } SNotRestriction;
1232 
1233 typedef struct _SContentRestriction
1234 {
1235 	ULONG			ulFuzzyLevel;
1236 	ULONG			ulPropTag;
1237 	LPSPropValue	lpProp;
1238 } SContentRestriction;
1239 
1240 typedef struct _SBitMaskRestriction
1241 {
1242 	ULONG			relBMR;
1243 	ULONG			ulPropTag;
1244 	ULONG			ulMask;
1245 } SBitMaskRestriction;
1246 
1247 typedef struct _SPropertyRestriction
1248 {
1249 	ULONG			relop;
1250 	ULONG			ulPropTag;
1251 	LPSPropValue	lpProp;
1252 } SPropertyRestriction;
1253 
1254 typedef struct _SComparePropsRestriction
1255 {
1256 	ULONG			relop;
1257 	ULONG			ulPropTag1;
1258 	ULONG			ulPropTag2;
1259 } SComparePropsRestriction;
1260 
1261 typedef struct _SSizeRestriction
1262 {
1263 	ULONG			relop;
1264 	ULONG			ulPropTag;
1265 	ULONG			cb;
1266 } SSizeRestriction;
1267 
1268 typedef struct _SExistRestriction
1269 {
1270 	ULONG			ulReserved1;
1271 	ULONG			ulPropTag;
1272 	ULONG			ulReserved2;
1273 } SExistRestriction;
1274 
1275 typedef struct _SSubRestriction
1276 {
1277 	ULONG			ulSubObject;
1278 	LPSRestriction	lpRes;
1279 } SSubRestriction;
1280 
1281 typedef struct _SCommentRestriction
1282 {
1283 	ULONG			cValues; /* # of properties in lpProp */
1284 	LPSRestriction	lpRes;
1285 	LPSPropValue	lpProp;
1286 } SCommentRestriction;
1287 
1288 // OFFICEDEV: The following two restrictions are new to Office 12 and are not
1289 // backwards compatible with older clients.
1290 typedef struct _SAnnotationRestriction
1291 {
1292 	ULONG			cValues; /* # of properties in lpProp */
1293 	LPSRestriction	lpRes;
1294 	LPSPropValue	lpProp;
1295 } SAnnotationRestriction;
1296 
1297 typedef struct _SCountRestriction
1298 {
1299 	ULONG			ulCount;
1300 	LPSRestriction 	lpRes;
1301 } SCountRestriction;
1302 
1303 typedef struct _SRestriction
1304 {
1305 	ULONG	rt;			/* Restriction type */
1306 	union
1307 	{
1308 		SComparePropsRestriction	resCompareProps;	/* first */
1309 		SAndRestriction				resAnd;
1310 		SOrRestriction				resOr;
1311 		SNotRestriction				resNot;
1312 		SContentRestriction			resContent;
1313 		SPropertyRestriction		resProperty;
1314 		SBitMaskRestriction			resBitMask;
1315 		SSizeRestriction			resSize;
1316 		SExistRestriction			resExist;
1317 		SSubRestriction				resSub;
1318 		SCommentRestriction			resComment;
1319 		SAnnotationRestriction		resAnnotation;	// OFFICEDEV: not backwards compatible with Office 11 and older
1320 		SCountRestriction			resCount;		// OFFICEDEV: not backwards compatible with Office 11 and older
1321 	} res;
1322 } SRestriction;
1323 
1324 /* SComparePropsRestriction is first in the union so that */
1325 /* static initializations of 3-value restriction work.    */
1326 
1327 /* Flags of the methods of IMAPITable */
1328 
1329 /* QueryColumn */
1330 
1331 #define TBL_ALL_COLUMNS		((ULONG) 0x00000001)
1332 
1333 /* QueryRows */
1334 /* Possible values for PR_ROW_TYPE (for categorization) */
1335 
1336 #define TBL_LEAF_ROW			((ULONG) 1)
1337 #define TBL_EMPTY_CATEGORY		((ULONG) 2)
1338 #define TBL_EXPANDED_CATEGORY	((ULONG) 3)
1339 #define TBL_COLLAPSED_CATEGORY	((ULONG) 4)
1340 
1341 /* Table wait flag */
1342 
1343 #define TBL_NOWAIT			((ULONG) 0x00000001)
1344 /* alternative name for TBL_NOWAIT */
1345 #define TBL_ASYNC			((ULONG) 0x00000001)
1346 #define TBL_BATCH			((ULONG) 0x00000002)
1347 
1348 /* FindRow */
1349 
1350 #define DIR_BACKWARD		((ULONG) 0x00000001)
1351 
1352 /* Table cursor states */
1353 
1354 #define TBL_NOADVANCE		((ULONG) 0x00000001)
1355 
1356 #define MAPI_IMAPITABLE_METHODS(IPURE)									\
1357 	MAPIMETHOD(GetLastError)											\
1358 		(THIS_	HRESULT						hResult,					\
1359 				ULONG						ulFlags,					\
1360 				LPMAPIERROR FAR *			lppMAPIError) IPURE;		\
1361 	MAPIMETHOD(Advise)													\
1362 		(THIS_	ULONG						ulEventMask,				\
1363 				LPMAPIADVISESINK			lpAdviseSink,				\
1364 				ULONG_PTR FAR *				lpulConnection) IPURE;		\
1365 	MAPIMETHOD(Unadvise)												\
1366 		(THIS_	ULONG_PTR					ulConnection) IPURE;		\
1367 	MAPIMETHOD(GetStatus)												\
1368 		(THIS_	ULONG FAR *					lpulTableStatus,			\
1369 				ULONG FAR *					lpulTableType) IPURE;		\
1370 	MAPIMETHOD(SetColumns)												\
1371 		(THIS_	LPSPropTagArray				lpPropTagArray,				\
1372 				ULONG						ulFlags) IPURE;				\
1373 	MAPIMETHOD(QueryColumns)											\
1374 		(THIS_	ULONG						ulFlags,					\
1375 				LPSPropTagArray FAR *		lpPropTagArray) IPURE;		\
1376 	MAPIMETHOD(GetRowCount)												\
1377 		(THIS_	ULONG						ulFlags,					\
1378 				ULONG FAR *					lpulCount) IPURE;			\
1379 	MAPIMETHOD(SeekRow)													\
1380 		(THIS_	BOOKMARK					bkOrigin,					\
1381 				LONG						lRowCount,					\
1382 				LONG FAR *					lplRowsSought) IPURE;		\
1383 	MAPIMETHOD(SeekRowApprox)											\
1384 		(THIS_	ULONG						ulNumerator,				\
1385 				ULONG						ulDenominator) IPURE;		\
1386 	MAPIMETHOD(QueryPosition)											\
1387 		(THIS_	ULONG FAR *					lpulRow,					\
1388 				ULONG FAR *					lpulNumerator,				\
1389 				ULONG FAR *					lpulDenominator) IPURE;		\
1390 	MAPIMETHOD(FindRow)													\
1391 		(THIS_	LPSRestriction				lpRestriction,				\
1392 				BOOKMARK					bkOrigin,					\
1393 				ULONG						ulFlags) IPURE;				\
1394 	MAPIMETHOD(Restrict)												\
1395 		(THIS_	LPSRestriction				lpRestriction,				\
1396 				ULONG						ulFlags) IPURE;				\
1397 	MAPIMETHOD(CreateBookmark)											\
1398 		(THIS_	BOOKMARK FAR *				lpbkPosition) IPURE;		\
1399 	MAPIMETHOD(FreeBookmark)											\
1400 		(THIS_	BOOKMARK					bkPosition) IPURE;			\
1401 	MAPIMETHOD(SortTable)												\
1402 		(THIS_	LPSSortOrderSet				lpSortCriteria,				\
1403 				ULONG						ulFlags) IPURE;				\
1404 	MAPIMETHOD(QuerySortOrder)											\
1405 		(THIS_	LPSSortOrderSet FAR *		lppSortCriteria) IPURE;		\
1406 	MAPIMETHOD(QueryRows)												\
1407 		(THIS_	LONG						lRowCount,					\
1408 				ULONG						ulFlags,					\
1409 				LPSRowSet FAR *				lppRows) IPURE;				\
1410 	MAPIMETHOD(Abort) (THIS) IPURE;										\
1411 	MAPIMETHOD(ExpandRow)												\
1412 		(THIS_	ULONG						cbInstanceKey,				\
1413 				LPBYTE						pbInstanceKey,				\
1414 				ULONG						ulRowCount,					\
1415 				ULONG						ulFlags,					\
1416 				LPSRowSet FAR *				lppRows,					\
1417 				ULONG FAR *					lpulMoreRows) IPURE;		\
1418 	MAPIMETHOD(CollapseRow)												\
1419 		(THIS_	ULONG						cbInstanceKey,				\
1420 				LPBYTE						pbInstanceKey,				\
1421 				ULONG						ulFlags,					\
1422 				ULONG FAR *					lpulRowCount) IPURE;		\
1423 	MAPIMETHOD(WaitForCompletion)										\
1424 		(THIS_	ULONG						ulFlags,					\
1425 				ULONG						ulTimeout,					\
1426 				ULONG FAR *					lpulTableStatus) IPURE;		\
1427 	MAPIMETHOD(GetCollapseState)										\
1428 		(THIS_	ULONG						ulFlags,					\
1429 				ULONG						cbInstanceKey,				\
1430 				LPBYTE						lpbInstanceKey,				\
1431 				ULONG FAR *					lpcbCollapseState,			\
1432 				LPBYTE FAR *				lppbCollapseState) IPURE;	\
1433 	MAPIMETHOD(SetCollapseState)										\
1434 		(THIS_	ULONG						ulFlags,					\
1435 				ULONG						cbCollapseState,			\
1436 				LPBYTE						pbCollapseState,			\
1437 				BOOKMARK FAR *				lpbkLocation) IPURE;		\
1438 
1439 #undef		 INTERFACE
1440 #define		 INTERFACE  IMAPITable
DECLARE_MAPI_INTERFACE_(IMAPITable,IUnknown)1441 DECLARE_MAPI_INTERFACE_(IMAPITable, IUnknown)
1442 {
1443 	BEGIN_INTERFACE
1444 	MAPI_IUNKNOWN_METHODS(PURE)
1445 	MAPI_IMAPITABLE_METHODS(PURE)
1446 };
1447 
1448 /* IProfSect Interface ----------------------------------------------------- */
1449 
1450 /* Standard section for public profile properties */
1451 
1452 #define PS_PROFILE_PROPERTIES_INIT \
1453 { 	0x98, 0x15, 0xAC, 0x08, 0xAA, 0xB0, 0x10, 0x1A, \
1454 	0x8C, 0x93, 0x08, 0x00, 0x2B, 0x2A, 0x56, 0xC2  }
1455 
1456 
1457 #define MAPI_IPROFSECT_METHODS(IPURE)
1458 
1459 #undef		 INTERFACE
1460 #define		 INTERFACE  IProfSect
DECLARE_MAPI_INTERFACE_(IProfSect,IMAPIProp)1461 DECLARE_MAPI_INTERFACE_(IProfSect, IMAPIProp)
1462 {
1463 	BEGIN_INTERFACE
1464 	MAPI_IUNKNOWN_METHODS(PURE)
1465 	MAPI_IMAPIPROP_METHODS(PURE)
1466 	MAPI_IPROFSECT_METHODS(PURE)
1467 };
1468 
1469 /* IMAPIStatus Interface --------------------------------------------------- */
1470 
1471 /* Values for PR_RESOURCE_TYPE, _METHODS, _FLAGS */
1472 
1473 #define MAPI_STORE_PROVIDER		((ULONG) 33)	/* Message Store */
1474 #define MAPI_AB					((ULONG) 34)	/* Address Book */
1475 #define MAPI_AB_PROVIDER		((ULONG) 35)	/* Address Book Provider */
1476 #define MAPI_TRANSPORT_PROVIDER	((ULONG) 36)	/* Transport Provider */
1477 #define MAPI_SPOOLER			((ULONG) 37)	/* Message Spooler */
1478 #define MAPI_PROFILE_PROVIDER	((ULONG) 38)	/* Profile Provider */
1479 #define MAPI_SUBSYSTEM			((ULONG) 39)	/* Overall Subsystem Status */
1480 #define MAPI_HOOK_PROVIDER		((ULONG) 40)	/* Spooler Hook */
1481 
1482 #define STATUS_VALIDATE_STATE	((ULONG) 0x00000001)
1483 #define STATUS_SETTINGS_DIALOG	((ULONG) 0x00000002)
1484 #define STATUS_CHANGE_PASSWORD	((ULONG) 0x00000004)
1485 #define STATUS_FLUSH_QUEUES		((ULONG) 0x00000008)
1486 
1487 #define STATUS_DEFAULT_OUTBOUND	((ULONG) 0x00000001)
1488 #define STATUS_DEFAULT_STORE	((ULONG) 0x00000002)
1489 #define STATUS_PRIMARY_IDENTITY	((ULONG) 0x00000004)
1490 #define STATUS_SIMPLE_STORE		((ULONG) 0x00000008)
1491 #define STATUS_XP_PREFER_LAST	((ULONG) 0x00000010)
1492 #define STATUS_NO_PRIMARY_IDENTITY ((ULONG) 0x00000020)
1493 #define STATUS_NO_DEFAULT_STORE	((ULONG) 0x00000040)
1494 #define STATUS_TEMP_SECTION		((ULONG) 0x00000080)
1495 #define STATUS_OWN_STORE		((ULONG) 0x00000100)
1496 /****** HOOK_INBOUND			((ULONG) 0x00000200) Defined in MAPIHOOK.H */
1497 /****** HOOK_OUTBOUND			((ULONG) 0x00000400) Defined in MAPIHOOK.H */
1498 #define STATUS_NEED_IPM_TREE	((ULONG) 0x00000800)
1499 #define	STATUS_PRIMARY_STORE	((ULONG) 0x00001000)
1500 #define	STATUS_SECONDARY_STORE	((ULONG) 0x00002000)
1501 
1502 
1503 /*
1504  * PR_STATUS_CODE bit. Low 16 bits for common values; High 16 bits
1505  * for provider type-specific values. (DCR 304)
1506  */
1507 
1508 #define	STATUS_AVAILABLE		((ULONG) 0x00000001)
1509 #define STATUS_OFFLINE			((ULONG) 0x00000002)
1510 #define STATUS_FAILURE			((ULONG) 0x00000004)
1511 
1512 /* Transport values of PR_STATUS_CODE */
1513 
1514 #define STATUS_INBOUND_ENABLED	((ULONG) 0x00010000)
1515 #define STATUS_INBOUND_ACTIVE	((ULONG) 0x00020000)
1516 #define STATUS_INBOUND_FLUSH	((ULONG) 0x00040000)
1517 #define STATUS_OUTBOUND_ENABLED	((ULONG) 0x00100000)
1518 #define STATUS_OUTBOUND_ACTIVE	((ULONG) 0x00200000)
1519 #define STATUS_OUTBOUND_FLUSH	((ULONG) 0x00400000)
1520 #define	STATUS_REMOTE_ACCESS	((ULONG) 0x00800000)
1521 
1522 /* ValidateState flags */
1523 
1524 #define SUPPRESS_UI					((ULONG) 0x00000001)
1525 #define	REFRESH_XP_HEADER_CACHE		((ULONG) 0x00010000)
1526 #define	PROCESS_XP_HEADER_CACHE 	((ULONG) 0x00020000)
1527 #define	FORCE_XP_CONNECT			((ULONG) 0x00040000)
1528 #define FORCE_XP_DISCONNECT			((ULONG) 0x00080000)
1529 #define CONFIG_CHANGED				((ULONG) 0x00100000)
1530 #define ABORT_XP_HEADER_OPERATION	((ULONG) 0x00200000)
1531 #define SHOW_XP_SESSION_UI			((ULONG) 0x00400000)
1532 
1533 /* SettingsDialog flags */
1534 
1535 #define UI_READONLY		((ULONG) 0x00000001)
1536 
1537 /* FlushQueues flags */
1538 
1539 #define FLUSH_UPLOAD		((ULONG) 0x00000002)
1540 #define FLUSH_DOWNLOAD		((ULONG) 0x00000004)
1541 #define FLUSH_FORCE			((ULONG) 0x00000008)
1542 #define FLUSH_NO_UI			((ULONG) 0x00000010)
1543 #define FLUSH_ASYNC_OK		((ULONG) 0x00000020)
1544 
1545 #define MAPI_IMAPISTATUS_METHODS(IPURE)									\
1546 	MAPIMETHOD(ValidateState)											\
1547 		(THIS_	ULONG_PTR					ulUIParam,					\
1548 				ULONG						ulFlags) IPURE;				\
1549 	MAPIMETHOD(SettingsDialog)											\
1550 		(THIS_	ULONG_PTR					ulUIParam,					\
1551 				ULONG						ulFlags) IPURE;				\
1552 	MAPIMETHOD(ChangePassword)											\
1553 		(THIS_	LPTSTR						lpOldPass,					\
1554 				LPTSTR						lpNewPass,					\
1555 				ULONG						ulFlags) IPURE;				\
1556 	MAPIMETHOD(FlushQueues)												\
1557 		(THIS_	ULONG_PTR					ulUIParam,					\
1558 				ULONG						cbTargetTransport,			\
1559 				LPENTRYID					lpTargetTransport,			\
1560 				ULONG						ulFlags) IPURE;				\
1561 
1562 #undef		 INTERFACE
1563 #define		 INTERFACE  IMAPIStatus
DECLARE_MAPI_INTERFACE_(IMAPIStatus,IMAPIProp)1564 DECLARE_MAPI_INTERFACE_(IMAPIStatus, IMAPIProp)
1565 {
1566 	BEGIN_INTERFACE
1567 	MAPI_IUNKNOWN_METHODS(PURE)
1568 	MAPI_IMAPIPROP_METHODS(PURE)
1569 	MAPI_IMAPISTATUS_METHODS(PURE)
1570 };
1571 
1572 /* IMAPIContainer Interface ------------------------------------------------ */
1573 
1574 /* Flags for OpenEntry() */
1575 
1576 /****** MAPI_MODIFY				((ULONG) 0x00000001) above */
1577 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1578 #define MAPI_BEST_ACCESS		((ULONG) 0x00000010)
1579 
1580 /* GetContentsTable() */
1581 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1582 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1583 /****** MAPI_ASSOCIATED			((ULONG) 0x00000040) below */
1584 
1585 /* GetHierarchyTable() */
1586 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1587 #define CONVENIENT_DEPTH		((ULONG) 0x00000001)
1588 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1589 
1590 /* GetSearchCriteria */
1591 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1592 #define SEARCH_RUNNING			((ULONG) 0x00000001)
1593 #define SEARCH_REBUILD			((ULONG) 0x00000002)
1594 #define SEARCH_RECURSIVE		((ULONG) 0x00000004)
1595 #define SEARCH_FOREGROUND		((ULONG) 0x00000008)
1596 
1597 /* SetSearchCriteria */
1598 #define STOP_SEARCH				((ULONG) 0x00000001)
1599 #define RESTART_SEARCH			((ULONG) 0x00000002)
1600 #define RECURSIVE_SEARCH		((ULONG) 0x00000004)
1601 #define SHALLOW_SEARCH			((ULONG) 0x00000008)
1602 #define FOREGROUND_SEARCH		((ULONG) 0x00000010)
1603 #define BACKGROUND_SEARCH		((ULONG) 0x00000020)
1604 
1605 #define MAPI_IMAPICONTAINER_METHODS(IPURE)								\
1606 	MAPIMETHOD(GetContentsTable)										\
1607 		(THIS_	ULONG						ulFlags,					\
1608 				LPMAPITABLE FAR *			lppTable) IPURE;			\
1609 	MAPIMETHOD(GetHierarchyTable)										\
1610 		(THIS_	ULONG						ulFlags,					\
1611 				LPMAPITABLE FAR *			lppTable) IPURE;			\
1612 	MAPIMETHOD(OpenEntry)												\
1613 		(THIS_	ULONG						cbEntryID,					\
1614 				LPENTRYID					lpEntryID,					\
1615 				LPCIID						lpInterface,				\
1616 				ULONG						ulFlags,					\
1617 				ULONG FAR *					lpulObjType,				\
1618 				LPUNKNOWN FAR *				lppUnk) IPURE;				\
1619 	MAPIMETHOD(SetSearchCriteria)										\
1620 		(THIS_	LPSRestriction				lpRestriction,				\
1621 				LPENTRYLIST					lpContainerList,			\
1622 				ULONG						ulSearchFlags) IPURE;		\
1623 	MAPIMETHOD(GetSearchCriteria)										\
1624 		(THIS_	ULONG						ulFlags,					\
1625 				LPSRestriction FAR *		lppRestriction,				\
1626 				LPENTRYLIST FAR *			lppContainerList,			\
1627 				ULONG FAR *					lpulSearchState)IPURE;		\
1628 
1629 #undef		 INTERFACE
1630 #define		 INTERFACE  IMAPIContainer
DECLARE_MAPI_INTERFACE_(IMAPIContainer,IMAPIProp)1631 DECLARE_MAPI_INTERFACE_(IMAPIContainer, IMAPIProp)
1632 {
1633 	BEGIN_INTERFACE
1634 	MAPI_IUNKNOWN_METHODS(PURE)
1635 	MAPI_IMAPIPROP_METHODS(PURE)
1636 	MAPI_IMAPICONTAINER_METHODS(PURE)
1637 };
1638 
1639 /* IABContainer Interface -------------------------------------------------- */
1640 
1641 /*
1642  *	IABContainer PR_CONTAINER_FLAGS values
1643  *	If AB_UNMODIFIABLE and AB_MODIFIABLE are both set, it means the container
1644  *	doesn't know if it's modifiable or not, and the client should
1645  *  try to modify the contents but we won't expect it to work.
1646  *	If the AB_RECIPIENTS flag is set and neither AB_MODIFIABLE or AB_UNMODIFIABLE
1647  *  bits are set, it is an error.
1648  */
1649 
1650 typedef struct _flaglist
1651 {
1652 	ULONG cFlags;
1653 	ULONG ulFlag[MAPI_DIM];
1654 } FlagList, FAR * LPFlagList;
1655 
1656 
1657 /*
1658  *  Container flags
1659  */
1660 #define AB_RECIPIENTS			((ULONG) 0x00000001)
1661 #define AB_SUBCONTAINERS		((ULONG) 0x00000002)
1662 #define AB_MODIFIABLE			((ULONG) 0x00000004)
1663 #define AB_UNMODIFIABLE			((ULONG) 0x00000008)
1664 #define AB_FIND_ON_OPEN			((ULONG) 0x00000010)
1665 #define AB_NOT_DEFAULT			((ULONG) 0x00000020)
1666 
1667 /* CreateEntry() */
1668 
1669 #define CREATE_CHECK_DUP_STRICT	((ULONG) 0x00000001)
1670 #define CREATE_CHECK_DUP_LOOSE	((ULONG) 0x00000002)
1671 #define CREATE_REPLACE			((ULONG) 0x00000004)
1672 
1673 /* ResolveNames() - ulFlags */
1674 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1675 
1676 /* ResolveNames() - rgulFlags */
1677 #define MAPI_UNRESOLVED			((ULONG) 0x00000000)
1678 #define MAPI_AMBIGUOUS			((ULONG) 0x00000001)
1679 #define MAPI_RESOLVED			((ULONG) 0x00000002)
1680 
1681 
1682 #define MAPI_IABCONTAINER_METHODS(IPURE)								\
1683 	MAPIMETHOD(CreateEntry)												\
1684 		(THIS_	ULONG						cbEntryID,					\
1685 				LPENTRYID					lpEntryID,					\
1686 				ULONG						ulCreateFlags,				\
1687 				LPMAPIPROP FAR	*			lppMAPIPropEntry) IPURE;	\
1688 	MAPIMETHOD(CopyEntries)												\
1689 		(THIS_	LPENTRYLIST					lpEntries,					\
1690 				ULONG_PTR					ulUIParam,					\
1691 				LPMAPIPROGRESS				lpProgress,					\
1692 				ULONG						ulFlags) IPURE;				\
1693 	MAPIMETHOD(DeleteEntries)											\
1694 		(THIS_	LPENTRYLIST					lpEntries,					\
1695 				ULONG						ulFlags) IPURE;				\
1696 	MAPIMETHOD(ResolveNames)											\
1697 		(THIS_	LPSPropTagArray				lpPropTagArray,				\
1698 				ULONG						ulFlags,					\
1699 				LPADRLIST					lpAdrList,					\
1700 				LPFlagList					lpFlagList) IPURE;			\
1701 
1702 #undef		 INTERFACE
1703 #define		 INTERFACE  IABContainer
DECLARE_MAPI_INTERFACE_(IABContainer,IMAPIContainer)1704 DECLARE_MAPI_INTERFACE_(IABContainer, IMAPIContainer)
1705 {
1706 	BEGIN_INTERFACE
1707 	MAPI_IUNKNOWN_METHODS(PURE)
1708 	MAPI_IMAPIPROP_METHODS(PURE)
1709 	MAPI_IMAPICONTAINER_METHODS(PURE)
1710 	MAPI_IABCONTAINER_METHODS(PURE)
1711 };
1712 
1713 /* IMailUser Interface ----------------------------------------------------- */
1714 
1715 /*  Any call which can create a one-off entryID (i.e. MAPISupport::CreateOneOff
1716     or IAdrBook::CreateOneOff) can encode the value for PR_SEND_RICH_INFO by
1717 	passing in the following flag in the ulFlags parameter.  Setting this flag
1718 	indicates that PR_SEND_RICH_INFO will be FALSE.
1719 */
1720 #define MAPI_SEND_NO_RICH_INFO		((ULONG) 0x00010000)
1721 
1722 
1723 
1724 
1725 /* Values of PR_NDR_DIAG_CODE */
1726 
1727 #define MAPI_DIAG(_code)	((LONG) _code)
1728 
1729 #define MAPI_DIAG_NO_DIAGNOSTIC						MAPI_DIAG( -1 )
1730 #define MAPI_DIAG_OR_NAME_UNRECOGNIZED				MAPI_DIAG( 0 )
1731 #define MAPI_DIAG_OR_NAME_AMBIGUOUS					MAPI_DIAG( 1 )
1732 #define MAPI_DIAG_MTS_CONGESTED						MAPI_DIAG( 2 )
1733 #define MAPI_DIAG_LOOP_DETECTED						MAPI_DIAG( 3 )
1734 #define MAPI_DIAG_RECIPIENT_UNAVAILABLE				MAPI_DIAG( 4 )
1735 #define MAPI_DIAG_MAXIMUM_TIME_EXPIRED				MAPI_DIAG( 5 )
1736 #define MAPI_DIAG_EITS_UNSUPPORTED					MAPI_DIAG( 6 )
1737 #define MAPI_DIAG_CONTENT_TOO_LONG					MAPI_DIAG( 7 )
1738 #define MAPI_DIAG_IMPRACTICAL_TO_CONVERT			MAPI_DIAG( 8 )
1739 #define MAPI_DIAG_PROHIBITED_TO_CONVERT				MAPI_DIAG( 9 )
1740 #define MAPI_DIAG_CONVERSION_UNSUBSCRIBED			MAPI_DIAG( 10 )
1741 #define MAPI_DIAG_PARAMETERS_INVALID				MAPI_DIAG( 11 )
1742 #define MAPI_DIAG_CONTENT_SYNTAX_IN_ERROR			MAPI_DIAG( 12 )
1743 #define MAPI_DIAG_LENGTH_CONSTRAINT_VIOLATD			MAPI_DIAG( 13 )
1744 #define MAPI_DIAG_NUMBER_CONSTRAINT_VIOLATD			MAPI_DIAG( 14 )
1745 #define MAPI_DIAG_CONTENT_TYPE_UNSUPPORTED			MAPI_DIAG( 15 )
1746 #define MAPI_DIAG_TOO_MANY_RECIPIENTS				MAPI_DIAG( 16 )
1747 #define MAPI_DIAG_NO_BILATERAL_AGREEMENT			MAPI_DIAG( 17 )
1748 #define MAPI_DIAG_CRITICAL_FUNC_UNSUPPORTED			MAPI_DIAG( 18 )
1749 #define MAPI_DIAG_CONVERSION_LOSS_PROHIB			MAPI_DIAG( 19 )
1750 #define MAPI_DIAG_LINE_TOO_LONG						MAPI_DIAG( 20 )
1751 #define MAPI_DIAG_PAGE_TOO_LONG						MAPI_DIAG( 21 )
1752 #define MAPI_DIAG_PICTORIAL_SYMBOL_LOST				MAPI_DIAG( 22 )
1753 #define MAPI_DIAG_PUNCTUATION_SYMBOL_LOST			MAPI_DIAG( 23 )
1754 #define MAPI_DIAG_ALPHABETIC_CHARACTER_LOST			MAPI_DIAG( 24 )
1755 #define MAPI_DIAG_MULTIPLE_INFO_LOSSES				MAPI_DIAG( 25 )
1756 #define MAPI_DIAG_REASSIGNMENT_PROHIBITED			MAPI_DIAG( 26 )
1757 #define MAPI_DIAG_REDIRECTION_LOOP_DETECTED			MAPI_DIAG( 27 )
1758 #define MAPI_DIAG_EXPANSION_PROHIBITED				MAPI_DIAG( 28 )
1759 #define MAPI_DIAG_SUBMISSION_PROHIBITED				MAPI_DIAG( 29 )
1760 #define MAPI_DIAG_EXPANSION_FAILED					MAPI_DIAG( 30 )
1761 #define MAPI_DIAG_RENDITION_UNSUPPORTED				MAPI_DIAG( 31 )
1762 #define MAPI_DIAG_MAIL_ADDRESS_INCORRECT			MAPI_DIAG( 32 )
1763 #define MAPI_DIAG_MAIL_OFFICE_INCOR_OR_INVD			MAPI_DIAG( 33 )
1764 #define MAPI_DIAG_MAIL_ADDRESS_INCOMPLETE			MAPI_DIAG( 34 )
1765 #define MAPI_DIAG_MAIL_RECIPIENT_UNKNOWN			MAPI_DIAG( 35 )
1766 #define MAPI_DIAG_MAIL_RECIPIENT_DECEASED			MAPI_DIAG( 36 )
1767 #define MAPI_DIAG_MAIL_ORGANIZATION_EXPIRED			MAPI_DIAG( 37 )
1768 #define MAPI_DIAG_MAIL_REFUSED						MAPI_DIAG( 38 )
1769 #define MAPI_DIAG_MAIL_UNCLAIMED					MAPI_DIAG( 39 )
1770 #define MAPI_DIAG_MAIL_RECIPIENT_MOVED				MAPI_DIAG( 40 )
1771 #define MAPI_DIAG_MAIL_RECIPIENT_TRAVELLING			MAPI_DIAG( 41 )
1772 #define MAPI_DIAG_MAIL_RECIPIENT_DEPARTED			MAPI_DIAG( 42 )
1773 #define MAPI_DIAG_MAIL_NEW_ADDRESS_UNKNOWN			MAPI_DIAG( 43 )
1774 #define MAPI_DIAG_MAIL_FORWARDING_UNWANTED			MAPI_DIAG( 44 )
1775 #define MAPI_DIAG_MAIL_FORWARDING_PROHIB			MAPI_DIAG( 45 )
1776 #define MAPI_DIAG_SECURE_MESSAGING_ERROR			MAPI_DIAG( 46 )
1777 #define MAPI_DIAG_DOWNGRADING_IMPOSSIBLE			MAPI_DIAG( 47 )
1778 
1779 /* Values of PR_DELIVERY_POINT (MH_T_DELIVERY_POINT) */
1780 
1781 #define MAPI_MH_DP_PUBLIC_UA						((ULONG) 0)
1782 #define MAPI_MH_DP_PRIVATE_UA						((ULONG) 1)
1783 #define MAPI_MH_DP_MS								((ULONG) 2)
1784 #define MAPI_MH_DP_ML								((ULONG) 3)
1785 #define MAPI_MH_DP_PDAU								((ULONG) 4)
1786 #define MAPI_MH_DP_PDS_PATRON						((ULONG) 5)
1787 #define MAPI_MH_DP_OTHER_AU							((ULONG) 6)
1788 
1789 
1790 #define MAPI_IMAILUSER_METHODS(IPURE)
1791 
1792 #undef		 INTERFACE
1793 #define		 INTERFACE  IMailUser
DECLARE_MAPI_INTERFACE_(IMailUser,IMAPIProp)1794 DECLARE_MAPI_INTERFACE_(IMailUser, IMAPIProp)
1795 {
1796 	BEGIN_INTERFACE
1797 	MAPI_IUNKNOWN_METHODS(PURE)
1798 	MAPI_IMAPIPROP_METHODS(PURE)
1799 	MAPI_IMAILUSER_METHODS(PURE)
1800 };
1801 
1802 /* IDistList Interface ----------------------------------------------------- */
1803 
1804 #define MAPI_IDISTLIST_METHODS(IPURE)									\
1805 	MAPIMETHOD(CreateEntry)												\
1806 		(THIS_	ULONG						cbEntryID,					\
1807 				LPENTRYID					lpEntryID,					\
1808 				ULONG						ulCreateFlags,				\
1809 				LPMAPIPROP FAR	*			lppMAPIPropEntry) IPURE;	\
1810 	MAPIMETHOD(CopyEntries)												\
1811 		(THIS_	LPENTRYLIST					lpEntries,					\
1812 				ULONG_PTR					ulUIParam,					\
1813 				LPMAPIPROGRESS				lpProgress,					\
1814 				ULONG						ulFlags) IPURE;				\
1815 	MAPIMETHOD(DeleteEntries)											\
1816 		(THIS_	LPENTRYLIST					lpEntries,					\
1817 				ULONG						ulFlags) IPURE;				\
1818 	MAPIMETHOD(ResolveNames)											\
1819 		(THIS_	LPSPropTagArray				lpPropTagArray,				\
1820 				ULONG						ulFlags,					\
1821 				LPADRLIST					lpAdrList,					\
1822 				LPFlagList					lpFlagList) IPURE;			\
1823 
1824 #undef		 INTERFACE
1825 #define		 INTERFACE  IDistList
DECLARE_MAPI_INTERFACE_(IDistList,IMAPIContainer)1826 DECLARE_MAPI_INTERFACE_(IDistList, IMAPIContainer)
1827 {
1828 	BEGIN_INTERFACE
1829 	MAPI_IUNKNOWN_METHODS(PURE)
1830 	MAPI_IMAPIPROP_METHODS(PURE)
1831 	MAPI_IMAPICONTAINER_METHODS(PURE)
1832 	MAPI_IDISTLIST_METHODS(PURE)
1833 };
1834 
1835 /* IMAPIFolder Interface --------------------------------------------------- */
1836 
1837 /* IMAPIFolder folder type (enum) */
1838 
1839 #define FOLDER_ROOT				((ULONG) 0x00000000)
1840 #define FOLDER_GENERIC			((ULONG) 0x00000001)
1841 #define FOLDER_SEARCH			((ULONG) 0x00000002)
1842 
1843 /* CreateMessage */
1844 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1845 /****** MAPI_ASSOCIATED			((ULONG) 0x00000040) below */
1846 
1847 /* CopyMessages */
1848 
1849 #define MESSAGE_MOVE			((ULONG) 0x00000001)
1850 #define MESSAGE_DIALOG			((ULONG) 0x00000002)
1851 /****** MAPI_DECLINE_OK			((ULONG) 0x00000004) above */
1852 
1853 /* CreateFolder */
1854 
1855 #define OPEN_IF_EXISTS			((ULONG) 0x00000001)
1856 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1857 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1858 
1859 /* DeleteFolder */
1860 
1861 #define DEL_MESSAGES			((ULONG) 0x00000001)
1862 #define FOLDER_DIALOG			((ULONG) 0x00000002)
1863 #define DEL_FOLDERS				((ULONG) 0x00000004)
1864 
1865 /* EmptyFolder */
1866 #define DEL_ASSOCIATED			((ULONG) 0x00000008)
1867 
1868 /* CopyFolder */
1869 
1870 #define FOLDER_MOVE				((ULONG) 0x00000001)
1871 /****** FOLDER_DIALOG			((ULONG) 0x00000002) above */
1872 /****** MAPI_DECLINE_OK			((ULONG) 0x00000004) above */
1873 #define COPY_SUBFOLDERS			((ULONG) 0x00000010)
1874 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
1875 
1876 
1877 /* SetReadFlags */
1878 
1879 /****** SUPPRESS_RECEIPT		((ULONG) 0x00000001) below */
1880 /****** FOLDER_DIALOG			((ULONG) 0x00000002) above */
1881 /****** CLEAR_READ_FLAG			((ULONG) 0x00000004) below */
1882 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
1883 /******	GENERATE_RECEIPT_ONLY	((ULONG) 0x00000010) below */
1884 /****** CLEAR_RN_PENDING		((ULONG) 0x00000020) below */
1885 /****** CLEAR_NRN_PENDING		((ULONG) 0x00000040) below */
1886 
1887 
1888 /* GetMessageStatus */
1889 
1890 #define MSGSTATUS_HIGHLIGHTED	((ULONG) 0x00000001)
1891 #define MSGSTATUS_TAGGED		((ULONG) 0x00000002)
1892 #define MSGSTATUS_HIDDEN		((ULONG) 0x00000004)
1893 #define MSGSTATUS_DELMARKED		((ULONG) 0x00000008)
1894 
1895 /* Bits for remote message status */
1896 
1897 #define	MSGSTATUS_REMOTE_DOWNLOAD	((ULONG) 0x00001000)
1898 #define	MSGSTATUS_REMOTE_DELETE		((ULONG) 0x00002000)
1899 
1900 /* SaveContentsSort */
1901 
1902 #define RECURSIVE_SORT			((ULONG) 0x00000002)
1903 
1904 /* PR_STATUS property */
1905 
1906 #define FLDSTATUS_HIGHLIGHTED	((ULONG) 0x00000001)
1907 #define FLDSTATUS_TAGGED		((ULONG) 0x00000002)
1908 #define FLDSTATUS_HIDDEN		((ULONG) 0x00000004)
1909 #define FLDSTATUS_DELMARKED		((ULONG) 0x00000008)
1910 
1911 #define MAPI_IMAPIFOLDER_METHODS(IPURE)									\
1912 	MAPIMETHOD(CreateMessage)											\
1913 		(THIS_	LPCIID						lpInterface,				\
1914 				ULONG						ulFlags,					\
1915 				LPMESSAGE FAR *				lppMessage) IPURE;			\
1916 	MAPIMETHOD(CopyMessages)											\
1917 		(THIS_	LPENTRYLIST					lpMsgList,					\
1918 			   	LPCIID						lpInterface,				\
1919 				LPVOID						lpDestFolder,				\
1920 				ULONG_PTR					ulUIParam,					\
1921 				LPMAPIPROGRESS				lpProgress,					\
1922 				ULONG						ulFlags) IPURE;				\
1923 	MAPIMETHOD(DeleteMessages)											\
1924 		(THIS_	LPENTRYLIST					lpMsgList,					\
1925 				ULONG_PTR					ulUIParam,					\
1926 				LPMAPIPROGRESS				lpProgress,					\
1927 				ULONG						ulFlags) IPURE;				\
1928 	MAPIMETHOD(CreateFolder)											\
1929 		(THIS_	ULONG						ulFolderType,				\
1930 				LPTSTR						lpszFolderName,				\
1931 				LPTSTR						lpszFolderComment,			\
1932 				LPCIID						lpInterface,				\
1933 				ULONG						ulFlags,					\
1934 				LPMAPIFOLDER FAR *			lppFolder) IPURE;			\
1935 	MAPIMETHOD(CopyFolder)												\
1936 		(THIS_	ULONG						cbEntryID,					\
1937 				LPENTRYID					lpEntryID,					\
1938 			   	LPCIID						lpInterface,				\
1939 				LPVOID						lpDestFolder,				\
1940 				LPTSTR						lpszNewFolderName,			\
1941 				ULONG_PTR					ulUIParam,					\
1942 				LPMAPIPROGRESS				lpProgress,					\
1943 				ULONG						ulFlags) IPURE;				\
1944 	MAPIMETHOD(DeleteFolder)											\
1945 		(THIS_	ULONG						cbEntryID,					\
1946 				LPENTRYID					lpEntryID,					\
1947 				ULONG_PTR					ulUIParam,					\
1948 				LPMAPIPROGRESS				lpProgress,					\
1949 				ULONG						ulFlags) IPURE;				\
1950 	MAPIMETHOD(SetReadFlags)											\
1951 		(THIS_	LPENTRYLIST					lpMsgList,					\
1952 				ULONG_PTR					ulUIParam,					\
1953 				LPMAPIPROGRESS				lpProgress,					\
1954 				ULONG						ulFlags) IPURE;				\
1955 	MAPIMETHOD(GetMessageStatus)										\
1956 		(THIS_	ULONG						cbEntryID,					\
1957 				LPENTRYID					lpEntryID,					\
1958 				ULONG						ulFlags,					\
1959 				ULONG FAR *					lpulMessageStatus) IPURE;	\
1960 	MAPIMETHOD(SetMessageStatus)										\
1961 		(THIS_	ULONG						cbEntryID,					\
1962 				LPENTRYID					lpEntryID,					\
1963 				ULONG						ulNewStatus,				\
1964 				ULONG						ulNewStatusMask,			\
1965 				ULONG FAR *					lpulOldStatus) IPURE;		\
1966 	MAPIMETHOD(SaveContentsSort)										\
1967 		(THIS_	LPSSortOrderSet				lpSortCriteria,				\
1968 				ULONG						ulFlags) IPURE;				\
1969 	MAPIMETHOD(EmptyFolder)												\
1970 		(THIS_	ULONG_PTR					ulUIParam,					\
1971 				LPMAPIPROGRESS				lpProgress,					\
1972 				ULONG						ulFlags) IPURE;				\
1973 
1974 #undef		 INTERFACE
1975 #define		 INTERFACE  IMAPIFolder
DECLARE_MAPI_INTERFACE_(IMAPIFolder,IMAPIContainer)1976 DECLARE_MAPI_INTERFACE_(IMAPIFolder, IMAPIContainer)
1977 {
1978 	BEGIN_INTERFACE
1979 	MAPI_IUNKNOWN_METHODS(PURE)
1980 	MAPI_IMAPIPROP_METHODS(PURE)
1981 	MAPI_IMAPICONTAINER_METHODS(PURE)
1982 	MAPI_IMAPIFOLDER_METHODS(PURE)
1983 };
1984 
1985 /* IMsgStore Interface ----------------------------------------------------- */
1986 
1987 /*  PR_STORE_SUPPORT_MASK bits */
1988 #define STORE_ENTRYID_UNIQUE	((ULONG) 0x00000001)
1989 #define STORE_READONLY			((ULONG) 0x00000002)
1990 #define STORE_SEARCH_OK			((ULONG) 0x00000004)
1991 #define STORE_MODIFY_OK			((ULONG) 0x00000008)
1992 #define STORE_CREATE_OK			((ULONG) 0x00000010)
1993 #define STORE_ATTACH_OK			((ULONG) 0x00000020)
1994 #define STORE_OLE_OK			((ULONG) 0x00000040)
1995 #define STORE_SUBMIT_OK			((ULONG) 0x00000080)
1996 #define STORE_NOTIFY_OK			((ULONG) 0x00000100)
1997 #define STORE_MV_PROPS_OK		((ULONG) 0x00000200)
1998 #define STORE_CATEGORIZE_OK		((ULONG) 0x00000400)
1999 #define STORE_RTF_OK			((ULONG) 0x00000800)
2000 #define STORE_RESTRICTION_OK	((ULONG) 0x00001000)
2001 #define STORE_SORT_OK			((ULONG) 0x00002000)
2002 #define	STORE_PUBLIC_FOLDERS	((ULONG) 0x00004000)
2003 #define	STORE_UNCOMPRESSED_RTF	((ULONG) 0x00008000)
2004 
2005 /* PR_STORE_STATE bits, try not to collide with PR_STORE_SUPPORT_MASK */
2006 
2007 #define STORE_HAS_SEARCHES		((ULONG) 0x01000000)
2008 
2009 
2010 /* OpenEntry() */
2011 
2012 /****** MAPI_MODIFY				((ULONG) 0x00000001) above */
2013 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
2014 /****** MAPI_BEST_ACCESS		((ULONG) 0x00000010) above */
2015 
2016 /* SetReceiveFolder() */
2017 
2018 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
2019 
2020 /* GetReceiveFolder() */
2021 
2022 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
2023 
2024 /* GetReceiveFolderTable() */
2025 
2026 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
2027 
2028 /* StoreLogoff() */
2029 
2030 #define	LOGOFF_NO_WAIT			((ULONG) 0x00000001)
2031 #define	LOGOFF_ORDERLY			((ULONG) 0x00000002)
2032 #define	LOGOFF_PURGE			((ULONG) 0x00000004)
2033 #define LOGOFF_ABORT			((ULONG) 0x00000008)
2034 #define LOGOFF_QUIET			((ULONG) 0x00000010)
2035 
2036 #define LOGOFF_COMPLETE			((ULONG) 0x00010000)
2037 #define	LOGOFF_INBOUND			((ULONG) 0x00020000)
2038 #define LOGOFF_OUTBOUND			((ULONG) 0x00040000)
2039 #define LOGOFF_OUTBOUND_QUEUE	((ULONG) 0x00080000)
2040 
2041 /* SetLockState() */
2042 
2043 #define MSG_LOCKED				((ULONG) 0x00000001)
2044 #define MSG_UNLOCKED			((ULONG) 0x00000000)
2045 
2046 /* Flag bits for PR_VALID_FOLDER_MASK */
2047 
2048 #define	FOLDER_IPM_SUBTREE_VALID		((ULONG) 0x00000001)
2049 #define	FOLDER_IPM_INBOX_VALID			((ULONG) 0x00000002)
2050 #define	FOLDER_IPM_OUTBOX_VALID			((ULONG) 0x00000004)
2051 #define	FOLDER_IPM_WASTEBASKET_VALID	((ULONG) 0x00000008)
2052 #define	FOLDER_IPM_SENTMAIL_VALID		((ULONG) 0x00000010)
2053 #define	FOLDER_VIEWS_VALID				((ULONG) 0x00000020)
2054 #define	FOLDER_COMMON_VIEWS_VALID		((ULONG) 0x00000040)
2055 #define	FOLDER_FINDER_VALID				((ULONG) 0x00000080)
2056 
2057 #define MAPI_IMSGSTORE_METHODS(IPURE)									\
2058 	MAPIMETHOD(Advise)													\
2059 		(THIS_	ULONG						cbEntryID,					\
2060 				LPENTRYID					lpEntryID,					\
2061 				ULONG						ulEventMask,				\
2062 				LPMAPIADVISESINK			lpAdviseSink,				\
2063 				ULONG_PTR FAR *				lpulConnection) IPURE;		\
2064 	MAPIMETHOD(Unadvise)												\
2065 		(THIS_	ULONG_PTR					ulConnection) IPURE;		\
2066 	MAPIMETHOD(CompareEntryIDs)											\
2067 		(THIS_	ULONG						cbEntryID1,					\
2068 				LPENTRYID					lpEntryID1,					\
2069 				ULONG						cbEntryID2,					\
2070 				LPENTRYID					lpEntryID2,					\
2071 				ULONG						ulFlags,					\
2072 				ULONG FAR *					lpulResult) IPURE;			\
2073 	MAPIMETHOD(OpenEntry)												\
2074 		(THIS_	ULONG						cbEntryID,					\
2075 				LPENTRYID					lpEntryID,					\
2076 				LPCIID						lpInterface,				\
2077 				ULONG						ulFlags,					\
2078 				ULONG FAR *					lpulObjType,				\
2079 				LPUNKNOWN FAR *				lppUnk) IPURE;				\
2080 	MAPIMETHOD(SetReceiveFolder)										\
2081 		(THIS_	LPTSTR						lpszMessageClass,			\
2082 				ULONG						ulFlags,					\
2083 				ULONG						cbEntryID,					\
2084 				LPENTRYID					lpEntryID) IPURE;			\
2085 	MAPIMETHOD(GetReceiveFolder)										\
2086 		(THIS_	LPTSTR						lpszMessageClass,			\
2087 				ULONG						ulFlags,					\
2088 				ULONG FAR *					lpcbEntryID,				\
2089 				LPENTRYID FAR *				lppEntryID,					\
2090 				LPTSTR FAR *				lppszExplicitClass) IPURE;	\
2091 	MAPIMETHOD(GetReceiveFolderTable)									\
2092 		(THIS_	ULONG						ulFlags,					\
2093 				LPMAPITABLE FAR *			lppTable) IPURE;			\
2094 	MAPIMETHOD(StoreLogoff)												\
2095 		(THIS_	ULONG FAR *					lpulFlags) IPURE;			\
2096 	MAPIMETHOD(AbortSubmit)												\
2097 		(THIS_	ULONG						cbEntryID,					\
2098 				LPENTRYID					lpEntryID,					\
2099 				ULONG						ulFlags) IPURE;				\
2100 	MAPIMETHOD(GetOutgoingQueue)										\
2101 		(THIS_	ULONG						ulFlags,					\
2102 				LPMAPITABLE FAR *			lppTable) IPURE;			\
2103 	MAPIMETHOD(SetLockState)											\
2104 		(THIS_	LPMESSAGE					lpMessage,					\
2105 				ULONG						ulLockState) IPURE;			\
2106 	MAPIMETHOD(FinishedMsg)												\
2107 		(THIS_	ULONG						ulFlags,					\
2108 				ULONG						cbEntryID,					\
2109 				LPENTRYID					lpEntryID) IPURE;			\
2110 	MAPIMETHOD(NotifyNewMail)											\
2111 		(THIS_	LPNOTIFICATION				lpNotification) IPURE;		\
2112 
2113 #undef		 INTERFACE
2114 #define		 INTERFACE  IMsgStore
DECLARE_MAPI_INTERFACE_(IMsgStore,IMAPIProp)2115 DECLARE_MAPI_INTERFACE_(IMsgStore, IMAPIProp)
2116 {
2117 	BEGIN_INTERFACE
2118 	MAPI_IUNKNOWN_METHODS(PURE)
2119 	MAPI_IMAPIPROP_METHODS(PURE)
2120 	MAPI_IMSGSTORE_METHODS(PURE)
2121 };
2122 
2123 /* IMessage Interface ------------------------------------------------------ */
2124 
2125 /* SubmitMessage */
2126 
2127 #define FORCE_SUBMIT				((ULONG) 0x00000001)
2128 
2129 /* Flags defined in PR_MESSAGE_FLAGS */
2130 
2131 #define MSGFLAG_READ			((ULONG) 0x00000001)
2132 #define MSGFLAG_UNMODIFIED		((ULONG) 0x00000002)
2133 #define MSGFLAG_SUBMIT			((ULONG) 0x00000004)
2134 #define MSGFLAG_UNSENT			((ULONG) 0x00000008)
2135 #define MSGFLAG_HASATTACH		((ULONG) 0x00000010)
2136 #define MSGFLAG_FROMME			((ULONG) 0x00000020)
2137 #define MSGFLAG_ASSOCIATED		((ULONG) 0x00000040)
2138 #define MSGFLAG_RESEND			((ULONG) 0x00000080)
2139 #define MSGFLAG_RN_PENDING		((ULONG) 0x00000100)
2140 #define MSGFLAG_NRN_PENDING		((ULONG) 0x00000200)
2141 
2142 /* Flags defined in PR_SUBMIT_FLAGS */
2143 
2144 #define SUBMITFLAG_LOCKED		((ULONG) 0x00000001)
2145 #define SUBMITFLAG_PREPROCESS	((ULONG) 0x00000002)
2146 
2147 /* GetAttachmentTable() */
2148 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
2149 
2150 /* GetRecipientTable() */
2151 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
2152 
2153 /* ModifyRecipients */
2154 
2155 /* ((ULONG) 0x00000001 is not a valid flag on ModifyRecipients. */
2156 #define MODRECIP_ADD			((ULONG) 0x00000002)
2157 #define MODRECIP_MODIFY			((ULONG) 0x00000004)
2158 #define MODRECIP_REMOVE			((ULONG) 0x00000008)
2159 
2160 /* SetReadFlag */
2161 
2162 #define SUPPRESS_RECEIPT		((ULONG) 0x00000001)
2163 #define CLEAR_READ_FLAG			((ULONG) 0x00000004)
2164 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) below */
2165 #define	GENERATE_RECEIPT_ONLY	((ULONG) 0x00000010)
2166 #define CLEAR_RN_PENDING		((ULONG) 0x00000020)
2167 #define CLEAR_NRN_PENDING		((ULONG) 0x00000040)
2168 
2169 /* DeleteAttach */
2170 
2171 #define ATTACH_DIALOG			((ULONG) 0x00000001)
2172 
2173 /* PR_SECURITY values */
2174 #define SECURITY_SIGNED			((ULONG) 0x00000001)
2175 #define SECURITY_ENCRYPTED		((ULONG) 0x00000002)
2176 
2177 /* PR_PRIORITY values */
2178 #define PRIO_URGENT				((long)  1)
2179 #define PRIO_NORMAL				((long)  0)
2180 #define PRIO_NONURGENT			((long) -1)
2181 
2182 /* PR_SENSITIVITY values */
2183 #define SENSITIVITY_NONE					((ULONG) 0x00000000)
2184 #define SENSITIVITY_PERSONAL				((ULONG) 0x00000001)
2185 #define SENSITIVITY_PRIVATE					((ULONG) 0x00000002)
2186 #define SENSITIVITY_COMPANY_CONFIDENTIAL	((ULONG) 0x00000003)
2187 
2188 /* PR_IMPORTANCE values */
2189 #define IMPORTANCE_LOW			((long) 0)
2190 #define IMPORTANCE_NORMAL		((long) 1)
2191 #define IMPORTANCE_HIGH			((long) 2)
2192 
2193 #define MAPI_IMESSAGE_METHODS(IPURE)									\
2194 	MAPIMETHOD(GetAttachmentTable)										\
2195 		(THIS_	ULONG						ulFlags,					\
2196 				LPMAPITABLE FAR *			lppTable) IPURE;			\
2197 	MAPIMETHOD(OpenAttach)												\
2198 		(THIS_	ULONG						ulAttachmentNum,			\
2199 				LPCIID						lpInterface,				\
2200 				ULONG						ulFlags,					\
2201 				LPATTACH FAR *				lppAttach) IPURE;			\
2202 	MAPIMETHOD(CreateAttach)											\
2203 		(THIS_	LPCIID						lpInterface,				\
2204 				ULONG						ulFlags,					\
2205 				ULONG FAR *					lpulAttachmentNum,			\
2206 				LPATTACH FAR *				lppAttach) IPURE;			\
2207 	MAPIMETHOD(DeleteAttach)											\
2208 		(THIS_	ULONG						ulAttachmentNum,			\
2209 				ULONG_PTR					ulUIParam,					\
2210 				LPMAPIPROGRESS				lpProgress,					\
2211 				ULONG						ulFlags) IPURE;				\
2212 	MAPIMETHOD(GetRecipientTable)										\
2213 		(THIS_	ULONG						ulFlags,					\
2214 				LPMAPITABLE FAR *			lppTable) IPURE;			\
2215 	MAPIMETHOD(ModifyRecipients)										\
2216 		(THIS_	ULONG						ulFlags,					\
2217 				LPADRLIST					lpMods) IPURE;				\
2218 	MAPIMETHOD(SubmitMessage)											\
2219 		(THIS_	ULONG						ulFlags) IPURE;				\
2220 	MAPIMETHOD(SetReadFlag)												\
2221 		(THIS_	ULONG						ulFlags) IPURE;				\
2222 
2223 #undef		 INTERFACE
2224 #define		 INTERFACE  IMessage
DECLARE_MAPI_INTERFACE_(IMessage,IMAPIProp)2225 DECLARE_MAPI_INTERFACE_(IMessage, IMAPIProp)
2226 {
2227 	BEGIN_INTERFACE
2228 	MAPI_IUNKNOWN_METHODS(PURE)
2229 	MAPI_IMAPIPROP_METHODS(PURE)
2230 	MAPI_IMESSAGE_METHODS(PURE)
2231 };
2232 
2233 /* IAttach Interface ------------------------------------------------------- */
2234 
2235 /* IAttach attachment methods: PR_ATTACH_METHOD values */
2236 
2237 #define NO_ATTACHMENT			((ULONG) 0x00000000)
2238 #define ATTACH_BY_VALUE			((ULONG) 0x00000001)
2239 #define ATTACH_BY_REFERENCE		((ULONG) 0x00000002)
2240 #define ATTACH_BY_REF_RESOLVE	((ULONG) 0x00000003)
2241 #define ATTACH_BY_REF_ONLY		((ULONG) 0x00000004)
2242 #define ATTACH_EMBEDDED_MSG		((ULONG) 0x00000005)
2243 #define ATTACH_OLE				((ULONG) 0x00000006)
2244 
2245 #define MAPI_IATTACH_METHODS(IPURE)
2246 
2247 #undef		 INTERFACE
2248 #define		 INTERFACE  IAttach
DECLARE_MAPI_INTERFACE_(IAttach,IMAPIProp)2249 DECLARE_MAPI_INTERFACE_(IAttach, IMAPIProp)
2250 {
2251 	BEGIN_INTERFACE
2252 	MAPI_IUNKNOWN_METHODS(PURE)
2253 	MAPI_IMAPIPROP_METHODS(PURE)
2254 	MAPI_IATTACH_METHODS(PURE)
2255 };
2256 
2257 /* --------------------------------- */
2258 /* Address Book interface definition */
2259 
2260 /* ADRPARM ulFlags - top 4 bits used for versioning */
2261 
2262 #define GET_ADRPARM_VERSION(ulFlags)  (((ULONG)ulFlags) & 0xF0000000)
2263 #define SET_ADRPARM_VERSION(ulFlags, ulVersion)  (((ULONG)ulVersion) | (((ULONG)ulFlags) & 0x0FFFFFFF))
2264 
2265 /*  Current versions of ADRPARM  */
2266 #define ADRPARM_HELP_CTX		((ULONG) 0x00000000)
2267 
2268 
2269 /*  ulFlags   - bit fields */
2270 #define DIALOG_MODAL			((ULONG) 0x00000001)
2271 #define DIALOG_SDI				((ULONG) 0x00000002)
2272 #define DIALOG_OPTIONS			((ULONG) 0x00000004)
2273 #define ADDRESS_ONE				((ULONG) 0x00000008)
2274 #define AB_SELECTONLY			((ULONG) 0x00000010)
2275 #define AB_RESOLVE				((ULONG) 0x00000020)
2276 
2277 /* --------------------------------- */
2278 /*  PR_DISPLAY_TYPEs                 */
2279 /*
2280  *  These standard display types are
2281  *  by default handled by MAPI.
2282  *  They have default icons associated
2283  *  with them.
2284  */
2285 
2286 /*  For address book contents tables */
2287 #define DT_MAILUSER			((ULONG) 0x00000000)
2288 #define DT_DISTLIST			((ULONG) 0x00000001)
2289 #define DT_FORUM			((ULONG) 0x00000002)
2290 #define DT_AGENT			((ULONG) 0x00000003)
2291 #define DT_ORGANIZATION		((ULONG) 0x00000004)
2292 #define DT_PRIVATE_DISTLIST	((ULONG) 0x00000005)
2293 #define DT_REMOTE_MAILUSER	((ULONG) 0x00000006)
2294 
2295 /*  For address book hierarchy tables */
2296 #define DT_MODIFIABLE		((ULONG) 0x00010000)
2297 #define DT_GLOBAL			((ULONG) 0x00020000)
2298 #define DT_LOCAL			((ULONG) 0x00030000)
2299 #define DT_WAN				((ULONG) 0x00040000)
2300 #define DT_NOT_SPECIFIC		((ULONG) 0x00050000)
2301 
2302 /*  For folder hierarchy tables */
2303 #define DT_FOLDER			((ULONG) 0x01000000)
2304 #define DT_FOLDER_LINK		((ULONG) 0x02000000)
2305 #define DT_FOLDER_SPECIAL	((ULONG) 0x04000000)
2306 
2307 /*  Accelerator callback for DIALOG_SDI form of AB UI */
2308 typedef BOOL (STDMETHODCALLTYPE ACCELERATEABSDI)(ULONG_PTR ulUIParam,
2309 												LPVOID lpvmsg);
2310 typedef ACCELERATEABSDI FAR * LPFNABSDI;
2311 
2312 /*  Callback to application telling it that the DIALOG_SDI form of the */
2313 /*  AB UI has been dismissed.  This is so that the above LPFNABSDI     */
2314 /*  function doesn't keep being called.                                */
2315 typedef void (STDMETHODCALLTYPE DISMISSMODELESS)(ULONG_PTR ulUIParam,
2316 												LPVOID lpvContext);
2317 typedef DISMISSMODELESS FAR * LPFNDISMISS;
2318 
2319 /*
2320  * Prototype for the client function hooked to an optional button on
2321  * the address book dialog
2322  */
2323 
2324 typedef SCODE (STDMETHODCALLTYPE FAR * LPFNBUTTON)(
2325 	ULONG_PTR			ulUIParam,
2326 	LPVOID				lpvContext,
2327 	ULONG				cbEntryID,
2328 	LPENTRYID			lpSelection,
2329 	ULONG				ulFlags
2330 );
2331 
2332 
2333 /* Parameters for the address book dialog */
2334 typedef struct _ADRPARM
2335 {
2336 	ULONG			cbABContEntryID;
2337 	LPENTRYID		lpABContEntryID;
2338 	ULONG			ulFlags;
2339 
2340 	LPVOID			lpReserved;
2341 	ULONG			ulHelpContext;
2342 	LPTSTR			lpszHelpFileName;
2343 
2344 	LPFNABSDI		lpfnABSDI;
2345 	LPFNDISMISS		lpfnDismiss;
2346 	LPVOID			lpvDismissContext;
2347 	LPTSTR			lpszCaption;
2348 	LPTSTR			lpszNewEntryTitle;
2349 	LPTSTR			lpszDestWellsTitle;
2350 	ULONG			cDestFields;
2351 	ULONG			nDestFieldFocus;
2352 	LPTSTR FAR *	lppszDestTitles;
2353 	ULONG FAR *		lpulDestComps;
2354 	LPSRestriction	lpContRestriction;
2355 	LPSRestriction	lpHierRestriction;
2356 } ADRPARM, FAR * LPADRPARM;
2357 
2358 
2359 /* ------------ */
2360 /* Random flags */
2361 
2362 /* Flag for deferred error */
2363 #define MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008)
2364 
2365 /* Flag for creating and using Folder Associated Information Messages */
2366 #define MAPI_ASSOCIATED			((ULONG) 0x00000040)
2367 
2368 /* Flags for OpenMessageStore() */
2369 
2370 #define MDB_NO_DIALOG			((ULONG) 0x00000001)
2371 #define MDB_WRITE				((ULONG) 0x00000004)
2372 /****** MAPI_DEFERRED_ERRORS	((ULONG) 0x00000008) above */
2373 /****** MAPI_BEST_ACCESS		((ULONG) 0x00000010) above */
2374 #define	MDB_TEMPORARY			((ULONG) 0x00000020)
2375 #define MDB_NO_MAIL				((ULONG) 0x00000080)
2376 
2377 /* Flags for OpenAddressBook */
2378 
2379 #define AB_NO_DIALOG			((ULONG) 0x00000001)
2380 
2381 /* IMAPIControl Interface -------------------------------------------------- */
2382 
2383 /* Interface used in controls (particularly the button) defined by */
2384 /* Display Tables. */
2385 
2386 /*  Flags for GetState */
2387 
2388 #define  MAPI_ENABLED		((ULONG) 0x00000000)
2389 #define  MAPI_DISABLED		((ULONG) 0x00000001)
2390 
2391 #define MAPI_IMAPICONTROL_METHODS(IPURE)								\
2392 	MAPIMETHOD(GetLastError)											\
2393 		(THIS_	HRESULT						hResult,					\
2394 				ULONG						ulFlags,					\
2395 				LPMAPIERROR FAR *			lppMAPIError) IPURE;		\
2396 	MAPIMETHOD(Activate)												\
2397 		(THIS_	ULONG						ulFlags,					\
2398 				ULONG_PTR					ulUIParam) IPURE;			\
2399 	MAPIMETHOD(GetState)												\
2400 		(THIS_	ULONG						ulFlags,					\
2401 				ULONG FAR *					lpulState) IPURE;			\
2402 
2403 #undef		 INTERFACE
2404 #define		 INTERFACE  IMAPIControl
DECLARE_MAPI_INTERFACE_(IMAPIControl,IUnknown)2405 DECLARE_MAPI_INTERFACE_(IMAPIControl, IUnknown)
2406 {
2407 	BEGIN_INTERFACE
2408 	MAPI_IUNKNOWN_METHODS(PURE)
2409 	MAPI_IMAPICONTROL_METHODS(PURE)
2410 };
2411 
2412 DECLARE_MAPI_INTERFACE_PTR(IMAPIControl, LPMAPICONTROL);
2413 
2414 /* Display Tables ---------------------------------------------------------- */
2415 
2416 /* Flags used in display tables - that is, PR_CONTROL_FLAGS */
2417 
2418 #define DT_MULTILINE		((ULONG) 0x00000001)
2419 #define DT_EDITABLE			((ULONG) 0x00000002)
2420 #define DT_REQUIRED			((ULONG) 0x00000004)
2421 #define DT_SET_IMMEDIATE	((ULONG) 0x00000008)
2422 #define DT_PASSWORD_EDIT	((ULONG) 0x00000010)
2423 #define DT_ACCEPT_DBCS		((ULONG) 0x00000020)
2424 #define DT_SET_SELECTION	((ULONG) 0x00000040)
2425 
2426 /* Display Table structures */
2427 
2428 #define DTCT_LABEL			((ULONG) 0x00000000)
2429 #define DTCT_EDIT			((ULONG) 0x00000001)
2430 #define DTCT_LBX			((ULONG) 0x00000002)
2431 #define DTCT_COMBOBOX		((ULONG) 0x00000003)
2432 #define DTCT_DDLBX			((ULONG) 0x00000004)
2433 #define DTCT_CHECKBOX		((ULONG) 0x00000005)
2434 #define DTCT_GROUPBOX		((ULONG) 0x00000006)
2435 #define DTCT_BUTTON			((ULONG) 0x00000007)
2436 #define DTCT_PAGE			((ULONG) 0x00000008)
2437 #define DTCT_RADIOBUTTON	((ULONG) 0x00000009)
2438 #define DTCT_MVLISTBOX		((ULONG) 0x0000000B)
2439 #define DTCT_MVDDLBX		((ULONG) 0x0000000C)
2440 
2441 /* Labels */
2442 /* Valid ulFlags:
2443  *   MAPI_UNICODE
2444  */
2445 typedef struct _DTBLLABEL
2446 {
2447 	ULONG ulbLpszLabelName;
2448 	ULONG ulFlags;
2449 } DTBLLABEL, FAR * LPDTBLLABEL;
2450 #define SizedDtblLabel(n,u) \
2451 struct _DTBLLABEL_ ## u \
2452 { \
2453 	DTBLLABEL	dtbllabel; \
2454 	TCHAR		lpszLabelName[n]; \
2455 } u
2456 
2457 
2458 /*  Simple Text Edits  */
2459 /* Valid ulFlags:
2460  *   MAPI_UNICODE
2461  */
2462 typedef struct _DTBLEDIT
2463 {
2464 	ULONG ulbLpszCharsAllowed;
2465 	ULONG ulFlags;
2466 	ULONG ulNumCharsAllowed;
2467 	ULONG ulPropTag;
2468 } DTBLEDIT, FAR * LPDTBLEDIT;
2469 #define SizedDtblEdit(n,u) \
2470 struct _DTBLEDIT_ ## u \
2471 { \
2472 	DTBLEDIT	dtbledit; \
2473 	TCHAR		lpszCharsAllowed[n]; \
2474 } u
2475 
2476 /*  List Box  */
2477 /* Valid ulFlags:
2478  */
2479 #define MAPI_NO_HBAR		((ULONG) 0x00000001)
2480 #define MAPI_NO_VBAR		((ULONG) 0x00000002)
2481 
2482 typedef struct _DTBLLBX
2483 {
2484 	ULONG ulFlags;
2485 	ULONG ulPRSetProperty;
2486 	ULONG ulPRTableName;
2487 } DTBLLBX, FAR * LPDTBLLBX;
2488 
2489 
2490 /*  Combo Box   */
2491 /* Valid ulFlags:
2492  *   MAPI_UNICODE
2493  */
2494 typedef struct _DTBLCOMBOBOX
2495 {
2496 	ULONG ulbLpszCharsAllowed;
2497 	ULONG ulFlags;
2498 	ULONG ulNumCharsAllowed;
2499 	ULONG ulPRPropertyName;
2500 	ULONG ulPRTableName;
2501 } DTBLCOMBOBOX, FAR * LPDTBLCOMBOBOX;
2502 #define SizedDtblComboBox(n,u) \
2503 struct _DTBLCOMBOBOX_ ## u \
2504 { \
2505 	DTBLCOMBOBOX	dtblcombobox; \
2506 	TCHAR			lpszCharsAllowed[n]; \
2507 } u
2508 
2509 
2510 /*  Drop Down   */
2511 /* Valid ulFlags:
2512  *   none
2513  */
2514 typedef struct _DTBLDDLBX
2515 {
2516 	ULONG ulFlags;
2517 	ULONG ulPRDisplayProperty;
2518 	ULONG ulPRSetProperty;
2519 	ULONG ulPRTableName;
2520 } DTBLDDLBX, FAR * LPDTBLDDLBX;
2521 
2522 
2523 /*  Check Box   */
2524 /* Valid ulFlags:
2525  *   MAPI_UNICODE
2526  */
2527 typedef struct _DTBLCHECKBOX
2528 {
2529 	ULONG ulbLpszLabel;
2530 	ULONG ulFlags;
2531 	ULONG ulPRPropertyName;
2532 } DTBLCHECKBOX, FAR * LPDTBLCHECKBOX;
2533 #define SizedDtblCheckBox(n,u) \
2534 struct _DTBLCHECKBOX_ ## u \
2535 { \
2536 	DTBLCHECKBOX	dtblcheckbox; \
2537 	TCHAR		lpszLabel[n]; \
2538 } u
2539 
2540 
2541 
2542 /*  Group Box   */
2543 /* Valid ulFlags:
2544  *   MAPI_UNICODE
2545  */
2546 typedef struct _DTBLGROUPBOX
2547 {
2548 	ULONG ulbLpszLabel;
2549 	ULONG ulFlags;
2550 } DTBLGROUPBOX, FAR * LPDTBLGROUPBOX;
2551 #define SizedDtblGroupBox(n,u) \
2552 struct _DTBLGROUPBOX_ ## u \
2553 { \
2554 	DTBLGROUPBOX	dtblgroupbox; \
2555 	TCHAR			lpszLabel[n]; \
2556 } u
2557 
2558 /*  Button control   */
2559 /* Valid ulFlags:
2560  *   MAPI_UNICODE
2561  */
2562 typedef struct _DTBLBUTTON
2563 {
2564 	ULONG ulbLpszLabel;
2565 	ULONG ulFlags;
2566 	ULONG ulPRControl;
2567 } DTBLBUTTON, FAR * LPDTBLBUTTON;
2568 #define SizedDtblButton(n,u) \
2569 struct _DTBLBUTTON_ ## u \
2570 { \
2571 	DTBLBUTTON	dtblbutton; \
2572 	TCHAR		lpszLabel[n]; \
2573 } u
2574 
2575 /*  Pages   */
2576 /* Valid ulFlags:
2577  *   MAPI_UNICODE
2578  */
2579 typedef struct _DTBLPAGE
2580 {
2581 	ULONG ulbLpszLabel;
2582 	ULONG ulFlags;
2583 	ULONG ulbLpszComponent;
2584 	ULONG ulContext;
2585 } DTBLPAGE, FAR * LPDTBLPAGE;
2586 #define SizedDtblPage(n,n1,u) \
2587 struct _DTBLPAGE_ ## u \
2588 { \
2589 	DTBLPAGE	dtblpage; \
2590 	TCHAR		lpszLabel[n]; \
2591 	TCHAR		lpszComponent[n1]; \
2592 } u
2593 
2594 /*  Radio button   */
2595 /* Valid ulFlags:
2596  *   MAPI_UNICODE
2597  */
2598 typedef struct _DTBLRADIOBUTTON
2599 {
2600 	ULONG ulbLpszLabel;
2601 	ULONG ulFlags;
2602 	ULONG ulcButtons;
2603 	ULONG ulPropTag;
2604 	long lReturnValue;
2605 } DTBLRADIOBUTTON, FAR * LPDTBLRADIOBUTTON;
2606 #define SizedDtblRadioButton(n,u) \
2607 struct _DTBLRADIOBUTTON_ ## u \
2608 { \
2609 	DTBLRADIOBUTTON dtblradiobutton; \
2610 	TCHAR			lpszLabel[n]; \
2611 } u
2612 
2613 
2614 /*  MultiValued listbox */
2615 /* Valid ulFlags:
2616  *   none
2617  */
2618 typedef struct _DTBLMVLISTBOX
2619 {
2620 	ULONG ulFlags;
2621 	ULONG ulMVPropTag;
2622 } DTBLMVLISTBOX, FAR * LPDTBLMVLISTBOX;
2623 
2624 
2625 /*  MultiValued dropdown */
2626 /* Valid ulFlags:
2627  *   none
2628  */
2629 typedef struct _DTBLMVDDLBX
2630 {
2631 	ULONG ulFlags;
2632 	ULONG ulMVPropTag;
2633 } DTBLMVDDLBX, FAR * LPDTBLMVDDLBX;
2634 
2635 
2636 
2637 
2638 
2639 /* IProviderAdmin Interface ---------------------------------------------- */
2640 
2641 /* Flags for ConfigureMsgService */
2642 
2643 #define UI_SERVICE					0x00000002
2644 #define SERVICE_UI_ALWAYS  			0x00000002		/* Duplicate UI_SERVICE for consistency and compatibility */
2645 #define SERVICE_UI_ALLOWED 			0x00000010
2646 #define UI_CURRENT_PROVIDER_FIRST	0x00000004
2647 /* MSG_SERVICE_UI_READ_ONLY 		0x00000008 - in MAPISPI.H */
2648 
2649 /* GetProviderTable() */
2650 /****** MAPI_UNICODE			((ULONG) 0x80000000) above */
2651 
2652 /* Values for PR_RESOURCE_FLAGS in message service table */
2653 
2654 #define MAPI_IPROVIDERADMIN_METHODS(IPURE)								\
2655 	MAPIMETHOD(GetLastError)											\
2656 		(THIS_	HRESULT						hResult,					\
2657 				ULONG						ulFlags,					\
2658 				LPMAPIERROR FAR *			lppMAPIError) IPURE;		\
2659 	MAPIMETHOD(GetProviderTable)										\
2660 		(THIS_	ULONG						ulFlags,					\
2661 				LPMAPITABLE FAR *			lppTable) IPURE;			\
2662 	MAPIMETHOD(CreateProvider)											\
2663 		(THIS_	LPTSTR						lpszProvider,				\
2664 				ULONG						cValues,					\
2665 				LPSPropValue				lpProps,					\
2666 				ULONG_PTR					ulUIParam,					\
2667 				ULONG						ulFlags,					\
2668 				MAPIUID FAR *				lpUID) IPURE;				\
2669 	MAPIMETHOD(DeleteProvider)											\
2670 		(THIS_	LPMAPIUID					lpUID) IPURE;				\
2671 	MAPIMETHOD(OpenProfileSection)										\
2672 		(THIS_	LPMAPIUID					lpUID,						\
2673 				LPCIID						lpInterface,				\
2674 				ULONG						ulFlags,					\
2675 				LPPROFSECT FAR *			lppProfSect) IPURE;			\
2676 
2677 
2678 #undef 		 INTERFACE
2679 #define 	 INTERFACE	IProviderAdmin
DECLARE_MAPI_INTERFACE_(IProviderAdmin,IUnknown)2680 DECLARE_MAPI_INTERFACE_(IProviderAdmin, IUnknown)
2681 {
2682 	BEGIN_INTERFACE
2683 	MAPI_IUNKNOWN_METHODS(PURE)
2684 	MAPI_IPROVIDERADMIN_METHODS(PURE)
2685 };
2686 
2687 
2688 
2689 /* IMAPIClientShutdown Interface ----------------------------------------- */
2690 DECLARE_MAPI_INTERFACE_PTR(IMAPIClientShutdown,	LPMAPICLIENTSHUTDOWN);
2691 
2692 #define MAPI_IMAPICLIENTSHUTDOWN_METHODS(IPURE)								\
2693 	MAPIMETHOD(QueryFastShutdown)											\
2694 		(THIS) IPURE;														\
2695 	MAPIMETHOD(NotifyProcessShutdown)										\
2696 		(THIS) IPURE;														\
2697 	MAPIMETHOD(DoFastShutdown)												\
2698 		(THIS) IPURE;														\
2699 
2700 #undef		 INTERFACE
2701 #define		 INTERFACE  IMAPIClientShutdown
DECLARE_MAPI_INTERFACE_(IMAPIClientShutdown,IUnknown)2702 DECLARE_MAPI_INTERFACE_(IMAPIClientShutdown, IUnknown)
2703 {
2704 	BEGIN_INTERFACE
2705 	MAPI_IUNKNOWN_METHODS(PURE)
2706 	MAPI_IMAPICLIENTSHUTDOWN_METHODS(PURE)
2707 };
2708 
2709 
2710 /* IMAPIProviderShutdown Interface --------------------------------------- */
2711 DECLARE_MAPI_INTERFACE_PTR(IMAPIProviderShutdown,	LPMAPIPROVIDERSHUTDOWN);
2712 
2713 #define MAPI_IMAPIPROVIDERSHUTDOWN_METHODS(IPURE)							\
2714 	MAPIMETHOD(QueryFastShutdown)											\
2715 		(THIS) IPURE;														\
2716 	MAPIMETHOD(NotifyProcessShutdown)										\
2717 		(THIS) IPURE;														\
2718 	MAPIMETHOD(DoFastShutdown)												\
2719 		(THIS) IPURE;														\
2720 
2721 #undef		 INTERFACE
2722 #define		 INTERFACE  IMAPIProviderShutdown
DECLARE_MAPI_INTERFACE_(IMAPIProviderShutdown,IUnknown)2723 DECLARE_MAPI_INTERFACE_(IMAPIProviderShutdown, IUnknown)
2724 {
2725 	BEGIN_INTERFACE
2726 	MAPI_IUNKNOWN_METHODS(PURE)
2727 	MAPI_IMAPIPROVIDERSHUTDOWN_METHODS(PURE)
2728 };
2729 
2730 
2731 
2732 #ifdef	__cplusplus
2733 }		/*	extern "C" */
2734 #endif
2735 
2736 #endif /* MAPIDEFS_H */
2737