23d4528532d4948a6807c34fa06a75ef2dd157cd
[jelmer/openchange.git] / exchange.idl
1 #include "idl_types.h"
2
3 cpp_quote("#include <gen_ndr/ndr_misc.h>")
4
5 /*
6    http://support.microsoft.com/default.aspx?scid=KB;en-us;q159298
7    Any UUID starting with:
8    A4 - store
9    F5 - directory
10  */
11
12 [
13   uuid("99e64010-b032-11d0-97a4-00c04fd6551d"),
14   pointer_default(unique),
15   version(3.0)
16 ] interface exchange_store_admin3
17 {
18         void ec_store_admin3_dummy();
19 }
20
21
22 [
23   uuid("89742ace-a9ed-11cf-9c0c-08002be7ae86"),
24   pointer_default(unique),
25   version(2.0)
26 ] interface exchange_store_admin2
27 {
28         void ec_store_admin2_dummy();
29 }
30
31 [
32   uuid("a4f1db00-ca47-1067-b31e-00dd010662da"),
33   pointer_default(unique),
34   version(1.0)
35 ] interface exchange_store_admin1
36 {
37         void ec_store_admin1_dummy();
38 }
39
40
41 [
42   uuid("1544f5e0-613c-11d1-93df-00c04fd7bd09"),
43   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]","ncacn_ip_tcp:[]"),
44   pointer_default(unique),
45   version(1.0),
46   helpstring("Exchange 2003 Directory Request For Response")
47 ] interface exchange_ds_rfr
48 {
49
50 #include "properties_enum.h"
51 #include "mapicodes_enum.h"
52
53         /*****************/
54         /* Function 0x00 */
55         MAPISTATUS RfrGetNewDSA(
56                 [in]                                    uint32  ulFlags,
57                 [in,string,charset(DOS)]                uint8   *pUserDN,
58                 [in,out,unique,string,charset(DOS)]     uint8   **ppszUnused,
59                 [in,out,unique,string,charset(DOS)]     uint8   **ppszServer
60                 );
61         
62         /*****************/
63         /* Function 0x01 */
64         MAPISTATUS RfrGetFQDNFromLegacyDN(
65                 [in]                                                    uint32  ulFlags,
66                 [in,range(10,1024)]                                     uint32  cbMailboxServerDN,
67                 [in,string,charset(DOS),size_is(cbMailboxServerDN)]     uint8   *szMailboxServerDN,
68                 [out,ref,string,charset(DOS)]                           uint8   **ppszServerFQDN
69                 );
70 }
71
72 [
73   uuid("f930c514-1215-11d3-99a5-00a0c9b61b04"),
74   helpstring("System Attendant Cluster Interface"),
75   pointer_default(unique),
76   version(1.0)
77 ] interface exchange_sysatt_cluster
78 {
79         void sysatt_cluster_dummy();
80 }
81
82 /*
83 [83d72bf0-0d89-11ce-b13f-00aa003bac6c] MS Exchange
84 System Attendant Private Interface
85 */
86
87 [
88   uuid("469d6ec0-0d87-11ce-b13f-00aa003bac6c"),
89   pointer_default(unique),
90   helpstring("Exchange 5.5 System Attendant Request for Response")
91 ] interface exchange_system_attendant
92 {
93         void sysatt_dummy();
94 }
95
96 [
97   uuid("9e8ee830-4559-11ce-979b-00aa005ffebe"),
98   pointer_default(unique),
99   version(2.0),
100   helpstring("Exchange 5.5 MTA")
101 ] interface exchange_mta
102 {
103         /*****************/
104         /* Function 0x00 */
105         void MtaBind();
106
107         /*****************/
108         /* Function 0x01 */
109         void MtaBindAck();
110 }
111
112 [
113   uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"),
114   pointer_default(unique),
115   version(21.0),
116   helpstring("Exchange 5.5 DRS")
117 ] interface exchange_drs
118 {
119         /*****************/
120         /* Function 0x00 */
121         void ds_abandon();
122
123         /*****************/
124         /* Function 0x01 */
125         void ds_add_entry();
126
127         void ds_bind();
128         void ds_compare();
129         void ds_list();
130         void ds_modify_entry();
131         void ds_modify_rdn();
132         void ds_read();
133         void ds_receive_result();
134         void ds_remove_entry();
135         void ds_search();
136         void ds_unbind();
137         void ds_wait();
138         void dra_replica_add();
139         void dra_replica_delete();
140         void dra_replica_synchronize();
141         void dra_reference_update();
142         void dra_authorize_replica();
143         void dra_unauthorize_replica();
144         void dra_adopt();
145         void dra_set_status();
146         void dra_modify_entry();
147         void dra_delete_subref();
148 }
149
150 [
151   uuid("f5cc5a7c-4264-101a-8c59-08002b2f8426"),
152   version(21.0),
153   pointer_default(unique),
154   helpstring("Exchange 5.5 XDS")
155 ] interface exchange_xds
156 {
157         void xds_dummy();
158 }
159
160 [
161   uuid("38a94e72-a9bc-11d2-8faf-00c04fa378ff"),
162   pointer_default(unique),
163   version(1.0)
164 ] interface exchange_mta_qadmin
165 {
166         void exchange_mta_qadmin();
167 }
168
169
170 [
171   uuid("0e4a0156-dd5d-11d2-8c2f-00c04fb6bcde"),
172   pointer_default(unique),
173   version(1.0)
174 ] interface exchange_store_information
175 {
176         void exchange_store_information_dummy();
177 }
178
179 [
180   uuid("f5cc5a18-4264-101a-8c59-08002b2f8426"),
181   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]","ncacn_ip_tcp:[]"),
182   pointer_default(unique),
183   version(56.0),
184   helpstring("Exchange 5.5 Name Service Provider")
185 ] interface exchange_nsp
186 {
187
188 #define PT_UNSPECIFIED  0x0000
189 #define PT_NULL         0x0001
190 #define PT_I2           0x0002
191 #define PT_LONG         0x0003
192 #define PT_R4           0x0004
193 #define PT_DOUBLE       0x0005
194 #define PT_CURRENCY     0x0006
195 #define PT_APPTIME      0x0007
196 #define PT_ERROR        0x000a /* means the given attr contains no value */
197 #define PT_BOOLEAN      0x000b
198 #define PT_OBJECT       0x000d
199 #define PT_I8           0x0014
200 #define PT_STRING8      0x001e
201 #define PT_UNICODE      0x001f
202 #define PT_SYSTIME      0x0040
203 #define PT_CLSID        0x0048
204 #define PT_SVREID       0x00fb
205 #define PT_SRESTRICT    0x00fd
206 #define PT_ACTIONS      0x00fe
207 #define PT_BINARY       0x0102
208 /* Multi-valued properties */
209 #define PT_MV_I2        0x1002
210 #define PT_MV_LONG      0x1003
211 #define PT_MV_R4        0x1004
212 #define PT_MV_DOUBLE    0x1005
213 #define PT_MV_CURRENCY  0x1006
214 #define PT_MV_APPTIME   0x1007
215 #define PT_MV_I8        0x1014
216 #define PT_MV_STRING8   0x101e
217 #define PT_MV_TSTRING   0x101e
218 #define PT_MV_UNICODE   0x101f
219 #define PT_MV_SYSTIME   0x1040
220 #define PT_MV_CLSID     0x1048
221 #define PT_MV_BINARY    0x1102
222
223         typedef [v1_enum] enum {
224                 SortTypeDisplayName             = 0x00000000,
225                 SortTypePhoneticDisplayName     = 0x00000003,
226                 SortTypeDisplayName_RO          = 0x000003E8,
227                 SortTypeDisplayName_W           = 0x000003E9
228         } TableSortOrders;
229
230         typedef [flag(NDR_NOALIGN)] struct {
231                 TableSortOrders SortType;
232                 uint32          ContainerID;
233                 uint32          CurrentRec;
234                 uint32          Delta;
235                 uint32          NumPos;
236                 uint32          TotalRecs;
237                 uint32          CodePage;
238                 uint32          TemplateLocale;
239                 uint32          SortLocale;
240         } STAT;
241
242         typedef struct {
243                 uint8 ab[16];
244         } FlatUID_r;
245
246         /* like a SPropTagArray, but without the "value is a an enum MAPITAGS" semantics */
247         typedef struct {
248                 [range(0,100000)] uint32                        cValues;
249                 [size_is(cValues+1), length_is(cValues)] uint32 aulPropTag[];
250         } PropertyTagArray_r;
251     
252         typedef struct {
253                 FlatUID_r       *lpguid;
254                 uint32          ulReserved;
255                 uint32          lID;
256         } PropertyName_r;
257
258         typedef struct {
259                 [range(0,100000)] uint32                cNames;
260                 [size_is(cNames)] PropertyName_r        aNames[];
261         } PropertyNameSet_r;
262
263         typedef struct {
264                 [range(0,100000)] uint32                        cValues;
265                 [string,size_is(cValues),charset(DOS)] uint8    **lppszA;
266         } StringArray_r;
267
268         typedef struct {
269                 [range(0,100000)] uint32                        Count;
270                 [string,size_is(Count),charset(DOS)] uint8      *Strings[];
271         } StringsArray_r;
272
273         typedef struct {
274                 [range(0,100000)] uint32                        cValues;
275                 [string,size_is(cValues),charset(UTF16)] uint16 **lppszW;
276         } WStringArray_r;
277
278         typedef struct {
279                 [range(0,100000)] uint32                        Count;
280                 [string,size_is(Count),charset(UTF16)] uint16   *Strings[];
281         } WStringsArray_r;
282
283         typedef struct {
284                 [range(0,100001)] uint32                                cValues;
285                 [size_is(cValues+1),length_is(cValues)] MAPITAGS        aulPropTag[];
286         } SPropTagArray;
287
288         typedef [public] struct {
289                 [range(0,2097152)] uint32       cb;
290                 [size_is(cb)] uint8             *lpb;
291         } Binary_r;
292
293         typedef [public] struct {
294                 uint32 dwLowDateTime;
295                 uint32 dwHighDateTime;
296         } FILETIME;
297
298         typedef struct {
299                 [range(0,100000)] uint32        cValues;
300                 [size_is(cValues)] uint16       *lpi;
301         } ShortArray_r;
302
303         typedef struct {
304                 [range(0,100000)] uint32        cValues;
305                 [size_is(cValues)] uint32       *lpl; 
306         } LongArray_r;
307
308         typedef struct {
309                 [range(0,100000)] uint32        cValues;
310                 [size_is(cValues)] Binary_r     *lpbin;
311         } BinaryArray_r;
312
313         typedef [flag(NDR_NOALIGN)] struct {
314                 [range(0,100000)]uint32         cValues;
315                 [size_is(cValues)] FlatUID_r    **lpguid; 
316         } FlatUIDArray_r;
317
318         typedef struct {
319                 [range(0,100000)] uint32        cValues;
320                 [size_is(cValues)] FILETIME     *lpft;
321         } DateTimeArray_r;
322
323         typedef [switch_type(uint32)] union {
324                 [case(PT_I2)]                   uint16                  i;
325                 [case(PT_LONG)]                 uint32                  l;
326                 [case(PT_DOUBLE)]               dlong                   dbl;
327                 [case(PT_BOOLEAN)]              uint8                   b;
328                 [case(PT_I8)]                   dlong                   d;
329                 [case(PT_STRING8)][unique][string,charset(DOS)] uint8   *lpszA;
330                 [case(PT_BINARY)]               Binary_r                bin;
331                 [case(PT_SVREID)]               Binary_r                bin;
332                 [case(PT_UNICODE)][string,charset(UTF16)] uint16        *lpszW;
333                 [case(PT_CLSID)]                FlatUID_r               *lpguid;
334                 [case(PT_SYSTIME)]              FILETIME                ft;
335                 [case(PT_ERROR)]                MAPISTATUS              err;
336                 [case(PT_MV_I2)]                ShortArray_r            MVi;
337                 [case(PT_MV_LONG)]              LongArray_r             MVl;
338                 [case(PT_MV_STRING8)]           StringArray_r           MVszA;
339                 [case(PT_MV_BINARY)]            BinaryArray_r           MVbin;
340                 [case(PT_MV_CLSID)]             FlatUIDArray_r          MVguid;
341                 [case(PT_MV_UNICODE)]           WStringArray_r          MVszW;
342                 [case(PT_MV_SYSTIME)]           DateTimeArray_r         MVft;
343                 [case(PT_NULL)]                 uint32                  null;
344                 [case(PT_OBJECT)]               uint32                  object;
345         } SPropValue_CTR;
346
347         typedef [public]struct {
348                 MAPITAGS ulPropTag;
349                 uint32 dwAlignPad;
350                 [switch_is(ulPropTag & 0xFFFF)] SPropValue_CTR value; 
351         } SPropValue;
352         
353         typedef struct {
354                 uint32                          ulAdrEntryPad;
355                 [range(0,100000)] uint32        cValues;
356                 [size_is(cValues)]SPropValue    *lpProps;
357         } SRow;
358
359
360         typedef [public] struct {
361                 [range(0,100000)] uint32        cRows;
362                 [size_is(cRows)] SRow           aRow[];
363         } SRowSet;
364         
365         typedef struct {
366                 [range(0,100000)] uint32                cRes;
367                 [size_is(cRes)] Restriction_r           *lpRes;
368         } AndRestriction_r;
369
370         typedef struct {
371                 [range(0,100000)] uint32                cRes;
372                 [size_is(cRes)] Restriction_r           *lpRes;
373         } OrRestriction_r;
374
375         typedef struct {
376                 Restriction_r                           *lpRes;
377         } NotRestriction_r;
378
379         typedef struct {
380                 uint32                                  ulFuzzyLevel;
381                 MAPITAGS                                ulPropTag;
382                 SPropValue                              *lpProp;
383         } ContentRestriction_r;
384
385         typedef struct {
386                 uint32                                  relop;
387                 MAPITAGS                                ulPropTag;
388                 SPropValue                              *lpProp;
389         } PropertyRestriction_r;
390
391         typedef struct {
392                 uint32                                  relop;
393                 MAPITAGS                                ulPropTag1;
394                 MAPITAGS                                ulPropTag2;
395         } ComparePropsRestriction_r;
396
397         typedef struct {
398                 uint32                                  relMBR;
399                 MAPITAGS                                ulPropTag;
400                 uint32                                  ulMask;
401         } BitMaskRestriction_r;
402
403         typedef struct {
404                 uint32                                  relop;
405                 MAPITAGS                                ulPropTag;
406                 uint32                                  cb;
407         } SizeRestriction_r;
408
409         typedef struct {
410                 uint32                                  ulReserved1;
411                 MAPITAGS                                ulPropTag;
412                 uint32                                  ulReserved2;
413         } ExistRestriction_r;
414
415         typedef struct {
416                 uint32                                  ulSubObject;
417                 Restriction_r                           *lpRes;
418         } SubRestriction_r;
419
420         typedef [v1_enum] enum {
421                 RES_AND                 = 0x0,
422                 RES_OR                  = 0x1,
423                 RES_NOT                 = 0x2,
424                 RES_CONTENT             = 0x3,
425                 RES_PROPERTY            = 0x4,
426                 RES_COMPAREPROPS        = 0x5,
427                 RES_BITMASK             = 0x6,
428                 RES_SIZE                = 0x7,
429                 RES_EXIST               = 0x8,
430                 RES_SUBRESTRICTION      = 0x9,
431                 RES_COMMENT             = 0xA
432         } RestrictionType_r;
433
434         typedef [switch_type(uint32)] union {
435                 [case(RES_AND)]                 AndRestriction_r                resAnd;
436                 [case(RES_OR)]                  OrRestriction_r                 resOr;
437                 [case(RES_NOT)]                 NotRestriction_r                resNot;
438                 [case(RES_CONTENT)]             ContentRestriction_r            resContent;
439                 [case(RES_PROPERTY)]            PropertyRestriction_r           resProperty;
440                 [case(RES_COMPAREPROPS)]        ComparePropsRestriction_r       resCompareProps;
441                 [case(RES_BITMASK)]             BitMaskRestriction_r            resBitMask;
442                 [case(RES_SIZE)]                SizeRestriction_r               resSize;
443                 [case(RES_EXIST)]               ExistRestriction_r              resExist;
444                 [case(RES_SUBRESTRICTION)]      SubRestriction_r                resSub;
445         } RestrictionUnion_r;
446
447         typedef [public] struct _Restriction_r{
448                 RestrictionType_r                       rt;
449                 [switch_is(rt)] RestrictionUnion_r      res;
450         } Restriction_r;
451
452         /*****************/
453         /* Function 0x00 */
454         typedef [bitmap32bit] bitmap {
455                 fAnonymousLogin = 0x00000020
456         } NspiBind_dwFlags;
457
458         MAPISTATUS NspiBind(
459                 [in] NspiBind_dwFlags   dwFlags,
460                 [in] STAT               *pStat,
461                 [in,out,unique] GUID    *mapiuid,
462                 [out] policy_handle     *handle
463                 );
464
465         /*****************/
466         /* Function 0x01 */
467         MAPISTATUS NspiUnbind(
468                 [in, out] policy_handle *handle,
469                 [in] uint32             Reserved
470                 );
471
472         /*****************/
473         /* Function 0x02 */
474         MAPISTATUS NspiUpdateStat(
475                 [in] policy_handle      *handle,
476                 [in] uint32             Reserved,
477                 [in,out] STAT           *pStat,
478                 [in,out,unique] uint32  *plDelta
479                 );
480
481         /*****************/
482         /* Function 0x03 */
483         typedef [bitmap32bit] bitmap {
484                 fSkipObjects    = 0x00000001,
485                 fEphID          = 0x00000002
486         } NspiQueryRows_dwFlags;
487
488         MAPISTATUS NspiQueryRows(
489                 [in]                                    policy_handle                   *handle,
490                 [in]                                    NspiQueryRows_dwFlags           dwFlags,
491                 [in,out]                                STAT                            *pStat,
492                 [in,range(0,100000)]                    uint32                          dwETableCount,
493                 [in,unique,size_is(dwETableCount)]      uint32                          *lpETable,
494                 [in]                                    uint32                          Count,
495                 [in,unique]                             SPropTagArray                   *pPropTags,
496                 [out]                                   SRowSet                         **ppRows
497                 );
498
499         /*****************/
500         /* Function 0x04 */
501         MAPISTATUS NspiSeekEntries(
502                 [in]            policy_handle   *handle,
503                 [in]            uint32          Reserved,
504                 [in,out]        STAT            *pStat,
505                 [in]            SPropValue      *pTarget,
506                 [in,unique]     SPropTagArray   *lpETable,
507                 [in,unique]     SPropTagArray   *pPropTags,
508                 [out]           SRowSet         **pRows
509                 );
510
511         /*****************/
512         /* Function 0x05 */
513         MAPISTATUS NspiGetMatches(
514                 [in]            policy_handle   *handle,
515                 [in]            uint32          Reserved,
516                 [in,out]        STAT            *pStat,
517                 [in][unique]    SPropTagArray   *pReserved,
518                 [in]            uint32          Reserved2,
519                 [in][unique]    Restriction_r   *Filter,
520                 [in][unique]    PropertyName_r  *lpPropName,
521                 [in]            uint32          ulRequested,
522                 [out]           SPropTagArray   **ppOutMIds,
523                 [in][unique]    SPropTagArray   *pPropTags,
524                 [out]           SRowSet         **ppRows
525                 );
526
527         /*****************/
528         /* Function 0x06 */
529         MAPISTATUS NspiResortRestriction(
530                 [in] policy_handle      *handle,
531                 [in] uint32             Reserved,
532                 [in,out] STAT           *pStat,
533                 [in] SPropTagArray      *pInMIds,
534                 [in,out] SPropTagArray  **ppMIds
535                 );
536
537         /*****************/
538         /* Function 0x07 */
539         MAPISTATUS NspiDNToMId(
540                 [in] policy_handle      *handle,
541                 [in] uint32             Reserved,
542                 [in] StringsArray_r     *pNames,
543                 [out] SPropTagArray     **ppMIds
544                 );
545
546         /*****************/
547         /* Function 0x08 */
548         MAPISTATUS NspiGetPropList(
549                 [in] policy_handle      *handle,
550                 [in] uint32             dwFlags,
551                 [in] uint32             dwMId,
552                 [in] uint32             CodePage,
553                 [out] SPropTagArray     **ppPropTags
554                 );
555
556         /*****************/
557         /* Function 0x09 */
558         MAPISTATUS NspiGetProps(
559                 [in]    policy_handle                   *handle,
560                 [in]    uint32                          dwFlags,
561                 [in]    STAT                            *pStat,
562                 [in,unique] SPropTagArray               *pPropTags,
563                 [out]   SRow                            **ppRows
564                 );
565
566         /*****************/
567         /* Funcion 0xa   */
568         MAPISTATUS NspiCompareMIds(
569                 [in] policy_handle      *handle,
570                 [in] uint32             Reserved,
571                 [in] STAT               *pStat,
572                 [in] uint32             MId1,
573                 [in] uint32             MId2,
574                 [out] uint32            *plResult
575                 );
576
577         /*****************/
578         /* Function 0xb  */
579         MAPISTATUS NspiModProps(
580                 [in] policy_handle              *handle,
581                 [in] uint32                     Reserved,
582                 [in] STAT                       *pStat,
583                 [in,unique] SPropTagArray       *pPropTags,
584                 [in] SRow                       *pRow
585                 );
586
587         /*****************/
588         /* Function 0x0c */
589         typedef [bitmap32bit] bitmap {
590                 NspiAddressCreationTemplates    = 0x00000002,
591                 NspiUnicodeStrings              = 0x00000004
592         } NspiGetSpecialTable_dwFlags;
593
594         MAPISTATUS NspiGetSpecialTable(
595                 [in] policy_handle                      *handle,
596                 [in] NspiGetSpecialTable_dwFlags        dwFlags,
597                 [in] STAT                               *pStat,
598                 [in,out] uint32                         *lpVersion,
599                 [out] SRowSet                           **ppRows
600                 );
601
602         /*******************/
603         /* Function 0x0d   */
604         typedef [bitmap32bit] bitmap {
605                 TI_TEMPLATE             = 0x00000001,
606                 TI_SCRIPT               = 0x00000004,
607                 TI_EMT                  = 0x00000010,
608                 TI_HELPFILE_NAME        = 0x00000020,
609                 TI_HELPFILE_CONTENTS    = 0x00000040
610         } TI_dwFlags;
611
612         MAPISTATUS NspiGetTemplateInfo(
613                 [in] policy_handle                      *handle,
614                 [in] TI_dwFlags                         dwFlags,
615                 [in] uint32                             ulType,
616                 [in,unique,string,charset(DOS)] uint8   *pDN,
617                 [in] uint32                             dwCodePage,
618                 [in] uint32                             dwLocaleID,
619                 [out] SRow                              **ppData
620                 );
621
622         /*******************/
623         /* Function 0x0e   */
624         MAPISTATUS NspiModLinkAtt(
625                 [in] policy_handle                      *handle,
626                 [in] uint32                             dwFlags,
627                 [in] uint32                             ulPropTag,
628                 [in] uint32                             MId,
629                 [in] BinaryArray_r                      *lpEntryIds
630                 );
631
632         /*************************************/
633         /* Function 0x0f: Not used on wire   */
634         MAPISTATUS NspiDeleteEntries(
635                 [in] policy_handle                      *Reserved1,
636                 [in] uint32                             Reserved2,
637                 [in] uint32                             Reserved3,
638                 [in] BinaryArray_r                      *Reserved4
639                 );
640
641         /*******************/
642         /* Function 0x10   */
643         typedef [bitmap32bit] bitmap {
644                 NspiUnicodeProptypes    = 0x80000000
645         } NspiQueryColumns_dwFlags;
646
647         MAPISTATUS NspiQueryColumns(
648                 [in] policy_handle                      *handle,
649                 [in] uint32                             Reserved,
650                 [in] NspiQueryColumns_dwFlags           dwFlags,
651                 [out] SPropTagArray                     **ppColumns
652                 );
653
654         /*******************/
655         /* Function 0x11   */
656         MAPISTATUS NspiGetNamesFromIDs(
657                 [in] policy_handle                      *handle,
658                 [in] uint32                             Reserved,
659                 [in,unique] FlatUID_r                   *lpGuid,
660                 [in,unique] SPropTagArray               *pPropTags,
661                 [out] SPropTagArray                     **ppReturnedPropTags,
662                 [out] PropertyNameSet_r                 **ppNames
663                 );
664
665         /*******************/
666         /* Function 0x12   */
667         MAPISTATUS NspiGetIDsFromNames(
668                 [in] policy_handle                      *handle,
669                 [in] uint32                             Reserved,
670                 [in] uint32                             dwFlags,
671                 [in,range(0,100000)] uint32             cPropNames,
672                 [in,size_is(cPropNames)] PropertyName_r **ppNames,
673                 [out] SPropTagArray                     **ppPropTags
674                 );
675
676         /*****************/
677         /* Function 0x13 */
678         MAPISTATUS NspiResolveNames(
679                 [in] policy_handle              *handle,
680                 [in] uint32                     Reserved,
681                 [in] STAT                       *pStat,
682                 [in,unique] SPropTagArray       *pPropTags,
683                 [in] StringsArray_r             *paStr,
684                 [out] PropertyTagArray_r        **ppMIds,
685                 [out] SRowSet                   **ppRows
686         );
687
688         /*****************/
689         /* Function 0x14 */
690         MAPISTATUS NspiResolveNamesW(
691                 [in] policy_handle              *handle,
692                 [in] uint32                     Reserved,
693                 [in] STAT                       *pStat,
694                 [in,unique] SPropTagArray       *pPropTags,
695                 [in] WStringsArray_r            *paWStr,
696                 [out] PropertyTagArray_r        **ppMIds,
697                 [out] SRowSet                   **ppRows
698                 );
699 }
700
701 [
702   uuid("a4f1db00-ca47-1067-b31f-00dd010662da"),
703   pointer_default(unique),
704   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]","ncacn_ip_tcp:"),
705   //version(0.81),
706   version(5308416),
707   helpstring("Exchange 5.5 EMSMDB")
708 ] interface exchange_emsmdb
709 {
710         /*****************/
711         /* Function 0x00 */
712
713         MAPISTATUS EcDoConnect(
714                 [out]                           policy_handle   *handle,
715                 [in,string,charset(DOS)]        uint8           szUserDN[],
716                 [in]                            uint32          ulFlags,
717                 [in]                            uint32          ulConMod,
718                 [in]                            uint32          cbLimit,
719                 [in]                            uint32          ulCpid,
720                 [in]                            uint32          ulLcidString,
721                 [in]                            uint32          ulLcidSort,
722                 [in]                            uint32          ulIcxrLink,
723                 [in]                            uint16          usFCanConvertCodePages,
724                 [out]                           uint32          *pcmsPollsMax,
725                 [out]                           uint32          *pcRetry,
726                 [out]                           uint32          *pcmsRetryDelay,
727                 [out]                           uint32          *picxr,
728                 [out,ref,string,charset(DOS)]uint8              **szDNPrefix,
729                 [out,ref,string,charset(DOS)]uint8              **szDisplayName,
730                 [out]                           uint16          rgwServerVersion[3],
731                 [in,out]                        uint16          rgwClientVersion[3],
732                 [in,out]                        uint32          *pullTimeStamp
733                 );
734
735         /*****************/
736         /* Function 0x01 */
737         MAPISTATUS EcDoDisconnect(
738                 [in,out]   policy_handle   *handle
739                 );
740
741         /*****************/
742         /* Function 0x02 */
743
744         /*
745           EcDoRpc opnums
746         */
747
748         typedef [public, enum8bit, flag(NDR_PAHEX)] enum 
749                 {
750                         MAPI_STORE      = 0x1,
751                         MAPI_ADDRBOOK   = 0x2,
752                         MAPI_FOLDER     = 0x3,
753                         MAPI_ABCONT     = 0x4,
754                         MAPI_MESSAGE    = 0x5,
755                         MAPI_MAILUSER   = 0x6, /* Individual Recipient */
756                         MAPI_ATTACH     = 0x7,
757                         MAPI_DISTLIST   = 0x8,
758                         MAPI_PROFSECT   = 0x9,
759                         MAPI_STATUS     = 0xA,
760                         MAPI_SESSION    = 0xB,
761                         MAPI_FORMINFO   = 0xC
762                 } MAPI_OBJTYPE;
763
764         typedef [public, v1_enum, flag(NDR_PAHEX)] enum 
765                 {
766                         RightsNone              = 0x00000000,
767                         RightsReadItems         = 0x00000001,
768                         RightsCreateItems       = 0x00000002,
769                         RightsEditOwn           = 0x00000008,
770                         RightsDeleteOwn         = 0x00000010,
771                         RightsEditAll           = 0x00000020,
772                         RightsDeleteAll         = 0x00000040,
773                         RightsCreateSubfolders  = 0x00000080,
774                         RightsFolderOwner       = 0x00000100,
775                         RightsFolderContact     = 0x00000200,
776                         RoleNone                = 0x00000400,
777                         RoleReviewer            = 0x00000401,
778                         RoleContributor         = 0x00000402,
779                         RoleNoneditingAuthor    = 0x00000413,
780                         RoleAuthor              = 0x0000041B,
781                         RoleEditor              = 0x0000047B,
782                         RolePublishAuthor       = 0x0000049B,
783                         RolePublishEditor       = 0x000004FB,
784                         RightsAll               = 0x000005FB,
785                         RoleOwner               = 0x000007FB
786                 } ACLRIGHTS;
787
788         typedef [public, enum8bit, flag(NDR_PAHEX)] enum
789                 {
790                         op_MAPI_Release                         = 0x1,
791                         op_MAPI_OpenFolder                      = 0x2,
792                         op_MAPI_OpenMessage                     = 0x3,
793                         op_MAPI_GetHierarchyTable               = 0x4,
794                         op_MAPI_GetContentsTable                = 0x5,
795                         op_MAPI_CreateMessage                   = 0x6,
796                         op_MAPI_GetProps                        = 0x7,
797                         op_MAPI_GetPropsAll                     = 0x8,
798                         op_MAPI_GetPropList                     = 0x9,
799                         op_MAPI_SetProps                        = 0xa,
800                         op_MAPI_DeleteProps                     = 0xb,
801                         op_MAPI_SaveChangesMessage              = 0xc,
802                         op_MAPI_RemoveAllRecipients             = 0xd,
803                         op_MAPI_ModifyRecipients                = 0xe,
804                         op_MAPI_ReadRecipients                  = 0xf,
805                         op_MAPI_ReloadCachedInformation         = 0x10,
806                         op_MAPI_SetMessageReadFlag              = 0x11,
807                         op_MAPI_SetColumns                      = 0x12,
808                         op_MAPI_SortTable                       = 0x13,
809                         op_MAPI_Restrict                        = 0x14,
810                         op_MAPI_QueryRows                       = 0x15,
811                         op_MAPI_GetStatus                       = 0x16,
812                         op_MAPI_QueryPosition                   = 0x17,
813                         op_MAPI_SeekRow                         = 0x18,
814                         op_MAPI_SeekRowBookmark                 = 0x19,
815                         op_MAPI_SeekRowApprox                   = 0x1a,
816                         op_MAPI_CreateBookmark                  = 0x1b,
817                         op_MAPI_CreateFolder                    = 0x1c,
818                         op_MAPI_DeleteFolder                    = 0x1d,
819                         op_MAPI_DeleteMessages                  = 0x1e,
820                         op_MAPI_GetMessageStatus                = 0x1f,
821                         op_MAPI_SetMessageStatus                = 0x20,
822                         op_MAPI_GetAttachmentTable              = 0x21,
823                         op_MAPI_OpenAttach                      = 0x22,
824                         op_MAPI_CreateAttach                    = 0x23,
825                         op_MAPI_DeleteAttach                    = 0x24,
826                         op_MAPI_SaveChangesAttachment           = 0x25,
827                         op_MAPI_SetReceiveFolder                = 0x26,
828                         op_MAPI_GetReceiveFolder                = 0x27,
829                         op_MAPI_RegisterNotification            = 0x29,
830                         op_MAPI_Notify                          = 0x2a,
831                         op_MAPI_OpenStream                      = 0x2b,
832                         op_MAPI_ReadStream                      = 0x2c,
833                         op_MAPI_WriteStream                     = 0x2d,
834                         op_MAPI_SeekStream                      = 0x2e,
835                         op_MAPI_SetStreamSize                   = 0x2f,
836                         op_MAPI_SetSearchCriteria               = 0x30,
837                         op_MAPI_GetSearchCriteria               = 0x31,
838                         op_MAPI_SubmitMessage                   = 0x32,
839                         op_MAPI_MoveCopyMessages                = 0x33,
840                         op_MAPI_AbortSubmit                     = 0x34,
841                         op_MAPI_MoveFolder                      = 0x35,
842                         op_MAPI_CopyFolder                      = 0x36,
843                         op_MAPI_QueryColumnsAll                 = 0x37,
844                         op_MAPI_Abort                           = 0x38,
845                         op_MAPI_CopyTo                          = 0x39,
846                         op_MAPI_CopyToStream                    = 0x3a,
847                         op_MAPI_CloneStream                     = 0x3b,
848                         op_MAPI_GetPermissionsTable             = 0x3e,
849                         op_MAPI_GetRulesTable                   = 0x3f,
850                         op_MAPI_ModifyPermissions               = 0x40,
851                         op_MAPI_ModifyRules                     = 0x41,
852                         op_MAPI_GetOwningServers                = 0x42,
853                         op_MAPI_LongTermIdFromId                = 0x43,
854                         op_MAPI_IdFromLongTermId                = 0x44,
855                         op_MAPI_PublicFolderIsGhosted           = 0x45,
856                         op_MAPI_OpenEmbeddedMessage             = 0x46,
857                         op_MAPI_SetSpooler                      = 0x47,
858                         op_MAPI_SpoolerLockMessage              = 0x48,
859                         op_MAPI_AddressTypes                    = 0x49,
860                         op_MAPI_TransportSend                   = 0x4a,
861                         op_MAPI_FastTransferSourceCopyMessages  = 0x4b,
862                         op_MAPI_FastTransferSourceCopyFolder    = 0x4c,
863                         op_MAPI_FastTransferSourceCopyTo        = 0x4d,
864                         op_MAPI_FastTransferSourceGetBuffer     = 0x4e,
865                         op_MAPI_FindRow                         = 0x4f,
866                         op_MAPI_Progress                        = 0x50,
867                         op_MAPI_TransportNewMail                = 0x51,
868                         op_MAPI_GetValidAttachments             = 0x52,
869                         op_MAPI_FastTransferDestConfigure       = 0x53,
870                         op_MAPI_FastTransferDestPutBuffer       = 0x54,
871                         op_MAPI_GetNamesFromIDs                 = 0x55,
872                         op_MAPI_GetIDsFromNames                 = 0x56,
873                         op_MAPI_UpdateDeferredActionMessages    = 0x57,
874                         op_MAPI_EmptyFolder                     = 0x58,
875                         op_MAPI_ExpandRow                       = 0x59,
876                         op_MAPI_CollapseRow                     = 0x5a,
877                         op_MAPI_LockRegionStream                = 0x5b,
878                         op_MAPI_UnlockRegionStream              = 0x5c,
879                         op_MAPI_CommitStream                    = 0x5d,
880                         op_MAPI_GetStreamSize                   = 0x5e,
881                         op_MAPI_QueryNamedProperties            = 0x5f,
882                         op_MAPI_GetPerUserLongTermIds           = 0x60,
883                         op_MAPI_GetPerUserGuid                  = 0x61,
884                         op_MAPI_ReadPerUserInformation          = 0x63,
885                         op_MAPI_WritePerUserInformation         = 0x64,
886                         op_MAPI_SetReadFlags                    = 0x66,
887                         op_MAPI_CopyProperties                  = 0x67,
888                         op_MAPI_GetReceiveFolderTable           = 0x68,
889                         op_MAPI_FastTransferSourceCopyProps     = 0x69,
890                         op_MAPI_GetCollapseState                = 0x6b,
891                         op_MAPI_SetCollapseState                = 0x6c,
892                         op_MAPI_GetTransportFolder              = 0x6d,
893                         op_MAPI_Pending                         = 0x6e,
894                         op_MAPI_OptionsData                     = 0x6f,
895                         op_MAPI_SyncConfigure                   = 0x70,
896                         op_MAPI_SyncImportMessageChange         = 0x72,
897                         op_MAPI_SyncImportHierarchyChange       = 0x73,
898                         op_MAPI_SyncImportDeletes               = 0x74,
899                         op_MAPI_SyncUploadStateStreamBegin      = 0x75,
900                         op_MAPI_SyncUploadStateStreamContinue   = 0x76,
901                         op_MAPI_SyncUploadStateStreamEnd        = 0x77,
902                         op_MAPI_SyncImportMessageMove           = 0x78,
903                         op_MAPI_SetPropertiesNoReplicate        = 0x79,
904                         op_MAPI_DeletePropertiesNoReplicate     = 0x7a,
905                         op_MAPI_GetStoreState                   = 0x7b,
906                         op_MAPI_SyncOpenCollector               = 0x7e,
907                         op_MAPI_GetLocalReplicaIds              = 0x7f,
908                         op_MAPI_SyncImportReadStateChanges      = 0x80,
909                         op_MAPI_ResetTable                      = 0x81,
910                         op_MAPI_SyncGetTransferState            = 0x82,
911                         op_MAPI_TellVersion                     = 0x86,
912                         op_MAPI_OpenPublicFolderByName          = 0x87,
913                         op_MAPI_SetSyncNotificationGuid         = 0x88,
914                         op_MAPI_FreeBookmark                    = 0x89,
915                         op_MAPI_WriteAndCommitStream            = 0x90,
916                         op_MAPI_HardDeleteMessages              = 0x91,
917                         op_MAPI_HardDeleteMessagesAndSubfolders = 0x92,
918                         op_MAPI_Logon                           = 0xfe,
919                         /****** custom MAPI opnum for mapiproxy ******/
920                         op_MAPI_proxypack                       = 0xa5
921                 } MAPI_OPNUM;
922
923
924         typedef [public,noprint,flag(NDR_NOALIGN)] struct {
925                 uint16                          cb;
926                 [flag(NDR_BUFFERS)]uint8        lpb[cb];
927         } SBinary_short;
928
929         typedef [public] struct {
930                 uint32 cValues;
931                 uint32 lpl[cValues]; 
932         } mapi_MV_LONG_STRUCT;
933
934         typedef [public] struct {
935                 astring lppszA;
936         } mapi_LPSTR;
937
938         typedef [public] struct {
939                 uint32 cValues;
940                 mapi_LPSTR strings[cValues]; 
941         } mapi_SLPSTRArray;
942
943         typedef struct {
944                 [flag(STR_NULLTERM)] string lppszW;
945         } mapi_LPWSTR;
946
947         typedef struct {
948                 uint32 cValues;
949                 mapi_LPWSTR strings[cValues];
950         } mapi_SPLSTRArrayW;
951         
952         typedef [public] struct {
953                 uint32          cValues;
954                 SBinary_short   bin[cValues];
955         } mapi_SBinaryArray;
956
957         typedef struct {
958                 uint32          cValues;
959                 GUID            lpguid[cValues];
960         } mapi_SGuidArray;
961
962         /******* part of the no-pointer deep recursion hack *******/
963         typedef [nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
964                 uint8 wrap[0x8000];
965         } mapi_SRestriction_wrap;
966
967         typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
968                 uint8   wrap[0x8000];
969         } mapi_SPropValue_wrap;
970
971         typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
972                 uint8   wrap[0x8000];
973         } mapi_SPropValue_array_wrap;
974         /**********************************************************/    
975
976         typedef [enum8bit] enum {
977                 ActionType_OP_MOVE              = 0x1,
978                 ActionType_OP_COPY              = 0x2,
979                 ActionType_OP_REPLY             = 0x3,
980                 ActionType_OP_OOF_REPLY         = 0x4,
981                 ActionType_OP_DEFER_ACTION      = 0x5,
982                 ActionType_OP_BOUNCE            = 0x6,
983                 ActionType_OP_FORWARD           = 0x7,
984                 ActionType_OP_DELEGATE          = 0x8,
985                 ActionType_OP_TAG               = 0x9,
986                 ActionType_OP_DELETE            = 0xA,
987                 ActionType_OP_MARK_AS_READ      = 0xB
988         } ActionType;
989
990         typedef [flag(NDR_NOALIGN)] struct {
991                 boolean8                FolderInThisStore;
992                 SBinary_short           StoreEID;
993                 SBinary_short           FolderEID;
994         } MoveCopy_Action;
995
996         typedef [flag(NDR_NOALIGN)] struct {
997                 hyper                   ReplyTemplateFID;
998                 hyper                   ReplyTemplateMID;
999                 GUID                    ReplyTemplateGUID;                      
1000         } ReplyOOF_Action;
1001
1002         typedef [flag(NDR_NOALIGN)] struct {
1003                 uint8                           Reserved;
1004                 mapi_SPropValue_array_wrap      PropertyValue;
1005         } RecipientBlock;
1006
1007         typedef [flag(NDR_NOALIGN)] enum {
1008                 BOUNCE_MESSAGE_TOO_LARGE        = 0x0000000d,
1009                 BOUNCE_MESSAGE_NOT_DISPLAYED    = 0x0000001f,
1010                 BOUNCE_MESSAGE_DENIED           = 0x00000026
1011         } BounceCode;
1012
1013         typedef [flag(NDR_NOALIGN)] struct {
1014                 uint16                  RecipientCount;
1015                 RecipientBlock          RecipientBlock[RecipientCount];
1016         } ForwardDelegate_Action;
1017
1018         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1019                 [case(ActionType_OP_MOVE)]              MoveCopy_Action                 MoveAction;
1020                 [case(ActionType_OP_COPY)]              MoveCopy_Action                 CopyAction;
1021                 [case(ActionType_OP_REPLY)]             ReplyOOF_Action                 ReplyAction;
1022                 [case(ActionType_OP_OOF_REPLY)]         ReplyOOF_Action                 ReplyOOFAction;
1023                 [case(ActionType_OP_DEFER_ACTION)][flag(NDR_REMAINING)] DATA_BLOB       DeferAction;
1024                 [case(ActionType_OP_BOUNCE)]            BounceCode                      BounceCode;
1025                 [case(ActionType_OP_TAG)]               mapi_SPropValue_wrap            PropValue;
1026                 [case(ActionType_OP_FORWARD)]           ForwardDelegate_Action          ForwardAction;
1027                 [case(ActionType_OP_DELEGATE)]          ForwardDelegate_Action          DelegateAction;
1028                 [case(ActionType_OP_DELETE)];
1029                 [case(ActionType_OP_MARK_AS_READ)];
1030         } ActionData;
1031
1032         typedef [flag(NDR_NOALIGN)] struct {
1033                 ActionType                              ActionType;
1034                 uint32                                  ActionFlavor;
1035                 uint32                                  ActionFlags;
1036                 [switch_is(ActionType)] ActionData      ActionDataBuffer;
1037         } ActionBlockData;
1038
1039         typedef [flag(NDR_NOALIGN)] struct {
1040                 uint16                                  ActionLength;
1041                 [subcontext(0),subcontext_size(ActionLength),flag(NDR_REMAINING)] ActionBlockData ActionBlockData;
1042         } ActionBlock;
1043
1044         typedef [flag(NDR_NOALIGN)] struct {
1045                 uint16          count;
1046                 ActionBlock     ActionBlock[count];
1047         } RuleAction;
1048
1049         typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
1050                 [case(PT_I2)]           uint16                  i;
1051                 [case(PT_LONG)]         uint32                  l;
1052                 [case(PT_DOUBLE)]       double                  dbl;
1053                 [case(PT_ERROR)]        uint32                  err;
1054                 [case(PT_BOOLEAN)]      uint8                   b;
1055                 [case(PT_I8)]           dlong                   d;
1056                 [case(PT_STRING8)]      astring                 lpszA;
1057                 [case(PT_UNICODE)][flag(STR_NULLTERM)] string   lpszW;
1058                 [case(PT_SYSTIME)]      FILETIME                ft;
1059                 [case(PT_CLSID)]        GUID                    lpguid;
1060                 [case(PT_SRESTRICT)]    mapi_SRestriction_wrap  Restrictions;
1061                 [case(PT_ACTIONS)]      RuleAction              RuleAction;
1062                 [case(PT_BINARY)]       SBinary_short           bin;
1063                 [case(PT_SVREID)]       SBinary_short           bin;
1064                 [case(PT_MV_LONG)]      mapi_MV_LONG_STRUCT     MVl;    
1065                 [case(PT_MV_STRING8)]   mapi_SLPSTRArray        MVszA;
1066                 [case(PT_MV_UNICODE)]   mapi_SPLSTRArrayW       MVszW;
1067                 [case(PT_MV_CLSID)]     mapi_SGuidArray         MVguid;
1068                 [case(PT_MV_BINARY)]    mapi_SBinaryArray       MVbin;
1069         } mapi_SPropValue_CTR;
1070
1071         typedef [public,flag(NDR_NOALIGN)] struct {
1072                 MAPITAGS ulPropTag;
1073                 [switch_is(ulPropTag & 0xFFFF)] mapi_SPropValue_CTR value; 
1074         } mapi_SPropValue;
1075
1076         typedef [public,flag(NDR_NOALIGN)] struct {
1077                 uint16                                  cValues;
1078                 [flag(NDR_REMAINING)]mapi_SPropValue    lpProps[cValues];
1079         } mapi_SPropValue_array;
1080
1081         typedef [flag(NDR_NOALIGN)] struct {
1082                 uint16                                  cValues;
1083                 MAPITAGS                                aulPropTag[cValues];
1084         } mapi_SPropTagArray;
1085
1086         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1087                 ROW_ADD         =       0x1,
1088                 ROW_MODIFY      =       0x2,
1089                 ROW_REMOVE      =       0x4
1090         } ulRowFlags;
1091
1092         /**************************/
1093         /* EcDoRpc Function 0x1   */
1094         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1095         } Release_req;
1096
1097         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1098         } Release_repl;
1099
1100         /**************************/
1101         /* EcDoRpc Function 0x2   */
1102         typedef [enum8bit] enum {
1103                 OpenModeFlags_Folder            = 0x0,
1104                 OpenModeFlags_SoftDeleted       = 0x4
1105         } OpenFolder_OpenModeFlags;
1106
1107         typedef [flag(NDR_NOALIGN)] struct {
1108                 uint8                           handle_idx;
1109                 hyper                           folder_id;
1110                 OpenFolder_OpenModeFlags        OpenModeFlags;
1111         } OpenFolder_req;
1112
1113         typedef [flag(NDR_NOALIGN)] struct {
1114                 uint16          ServerCount;
1115                 uint16          CheapServerCount;
1116                 astring         Servers[ServerCount];
1117         } OpenFolder_Replicas;
1118
1119         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1120                 [case(0x0)];
1121                 [case(0x1)] OpenFolder_Replicas Replicas;
1122         } IsGhosted;
1123
1124         typedef [flag(NDR_NOALIGN)] struct {
1125                 boolean8                                HasRules;
1126                 boolean8                                IsGhosted;
1127                 [switch_is(IsGhosted)] IsGhosted        Ghost;
1128         } OpenFolder_repl;
1129         
1130         /**************************/
1131         /* EcDoRpc Function 0x3   */
1132         typedef [enum8bit] enum {
1133                 StringType_NONE                 = 0x0,
1134                 StringType_EMPTY                = 0x1,
1135                 StringType_STRING8              = 0x2,
1136                 StringType_UNICODE_REDUCED      = 0x3,
1137                 StringType_UNICODE              = 0x4
1138         } StringType;
1139
1140         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1141                 [case(0x0)];
1142                 [case(0x1)];
1143                 [case(0x2)] astring                     lpszA;
1144                 [case(0x3)] astring                     lpszW_reduced;
1145                 [case(0x4)] [flag(STR_NULLTERM)] string lpszW;
1146         } String;
1147
1148         typedef [flag(NDR_NOALIGN)] struct {
1149                 StringType                      StringType;
1150                 [switch_is(StringType)] String  String;
1151         } TypedString;
1152
1153         typedef [enum8bit] enum {
1154                 ReadOnly        = 0x0,
1155                 ReadWrite       = 0x1,
1156                 Create          = 0x3,
1157                 OpenSoftDelete  = 0x4
1158         } OpenMessage_OpenModeFlags;
1159
1160         typedef [flag(NDR_NOALIGN)] struct {
1161                 uint8                           handle_idx;
1162                 uint16                          CodePageId;
1163                 hyper                           FolderId;
1164                 OpenMessage_OpenModeFlags       OpenModeFlags;
1165                 hyper                           MessageId;
1166         } OpenMessage_req;
1167
1168         typedef [enum16bit, flag(NDR_PAHEX)] enum {
1169                 CP_USASCII      = 0x04E4,
1170                 CP_UNICODE      = 0x04B0,
1171                 CP_JAUTODETECT  = 0xC6F4,
1172                 CP_KAUTODETECT  = 0xC705,
1173                 CP_ISO2022JPESC = 0xC42D,
1174                 CP_ISO2022JPSIO = 0xC42E
1175         } CODEPAGEID;
1176
1177         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1178                 MAPI_ORIG               = 0x0,
1179                 MAPI_TO                 = 0x1,
1180                 MAPI_CC                 = 0x2,
1181                 MAPI_BCC                = 0x3
1182         } ulRecipClass;
1183
1184         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1185                 SINGLE_RECIPIENT        = 0x0,
1186                 DISTRIBUTION_LIST       = 0x1
1187         } addr_type;
1188
1189         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1190                 [case(0x1)] uint8       prefix_size;
1191                 [default];
1192         } recipient_AddressPrefixUsed;
1193
1194         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1195                 [case(0x1)] addr_type   display_type;
1196                 [default];
1197         } recipient_DisplayType;
1198
1199         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1200                 [case(0x1)] astring     recipient_x500name;
1201                 [default];
1202         } recipient_X500DN;
1203
1204         /* We're covering the PersonalDistributionList1 (0x0006) and PersonalDistributionList2
1205            (0x0007) variations here, since we mask off the low bit in the switch. */
1206         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1207                 [case(0x6)] SBinary_short                       entryid;
1208                 [default];
1209         } recipient_EntryId;
1210
1211         /* We're covering the PersonalDistributionList1 (0x0006) and PersonalDistributionList2
1212            (0x0007) variations here, since we mask off the low bit in the switch. */
1213         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1214                 [case(0x6)] SBinary_short                       searchkey;
1215                 [default];
1216         } recipient_SearchKey;
1217
1218         /* Present if the Type field is set to NoType (0x0) and the O flag (0x8000) is set */
1219         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1220                 [case(0x8000)] astring                          lpszA;
1221                 [default];
1222         } recipient_AddressType;
1223
1224         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1225                 [case(0x400)] astring                           lpszA;
1226                 [case(0x600)][flag(STR_NULLTERM)] string        lpszW;
1227                 [default];
1228         } recipient_SimpleDisplayName;
1229
1230         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1231                 [case(0x20)] astring                            lpszA;
1232                 [case(0x220)][flag(STR_NULLTERM)] string        lpszW;
1233                 [default];
1234         } recipient_TransmittableDisplayName;
1235
1236         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1237                 [case(0x10)] astring                            lpszA;
1238                 [case(0x210)][flag(STR_NULLTERM)] string        lpszW;
1239                 [default];
1240         } recipient_DisplayName;
1241
1242         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1243                 [case(0x8)] astring                             lpszA;
1244                 [case(0x208)][flag(STR_NULLTERM)] string        lpszW;
1245                 [default];
1246         } recipient_EmailAddress;
1247
1248         typedef [flag(NDR_NOALIGN)] struct {
1249                 uint16                                                                  RecipientFlags;
1250                 [switch_is(RecipientFlags & 0x0007)] recipient_AddressPrefixUsed        AddressPrefixUsed;
1251                 [switch_is(RecipientFlags & 0x0007)] recipient_DisplayType              DisplayType;
1252                 [switch_is(RecipientFlags & 0x0007)] recipient_X500DN                   X500DN;
1253                 [switch_is(RecipientFlags & 0x0006)] recipient_EntryId                  EntryId;
1254                 [switch_is(RecipientFlags & 0x0006)] recipient_SearchKey                SearchKey;
1255                 [switch_is(RecipientFlags & 0x8007)] recipient_AddressType              AddressType;
1256                 [switch_is(RecipientFlags & 0x0208)] recipient_EmailAddress             EmailAddress;
1257                 [switch_is(RecipientFlags & 0x0210)] recipient_DisplayName              DisplayName;
1258                 [switch_is(RecipientFlags & 0x0600)] recipient_SimpleDisplayName        SimpleDisplayName;
1259                 [switch_is(RecipientFlags & 0x0220)] recipient_TransmittableDisplayName TransmittableDisplayName;
1260                 uint16                                                                  prop_count;
1261 // TODO: figure out if "layout" can go
1262                 uint8                                                                   layout;
1263 // TODO: convert this to a proper structure - see if we already have one.
1264                 [flag(NDR_REMAINING)] DATA_BLOB                                         prop_values;
1265         } RecipientRow;
1266
1267         typedef [flag(NDR_NOALIGN)] struct {
1268                 ulRecipClass    RecipClass;
1269                 CODEPAGEID      codepage;
1270                 uint16          Reserved;
1271                 [subcontext(2)] RecipientRow    RecipientRow;
1272         } OpenMessage_recipients;
1273
1274         typedef [flag(NDR_NOALIGN)] struct {
1275                 boolean8                HasNamedProperties;
1276                 TypedString             SubjectPrefix;
1277                 TypedString             NormalizedSubject;
1278                 uint16                  RecipientCount;
1279                 mapi_SPropTagArray      RecipientColumns;
1280                 uint8                   RowCount;
1281                 OpenMessage_recipients  recipients[RowCount];
1282         } OpenMessage_repl;
1283
1284         /**************************/
1285         /* EcDoRpc Function 0x4   */
1286         typedef [bitmap8bit] bitmap {
1287                 TableFlags_Associated                   = 0x2, /* only for GetContentsTable */
1288                 TableFlags_Depth                        = 0x4, /* only for GetHierarchyTable */
1289                 TableFlags_DeferredErrors               = 0x8,
1290                 TableFlags_NoNotifications              = 0x10,
1291                 TableFlags_SoftDeletes                  = 0x20,
1292                 TableFlags_UseUnicode                   = 0x40,
1293                 TableFlags_SuppressNotifications        = 0x80
1294         } TableFlags;
1295
1296         typedef [flag(NDR_NOALIGN)] struct {
1297                 uint8           handle_idx;
1298                 TableFlags      TableFlags;
1299         } GetHierarchyTable_req;
1300
1301         typedef [flag(NDR_NOALIGN)] struct {
1302                 uint32          RowCount;
1303         } GetHierarchyTable_repl;
1304
1305         /**************************/
1306         /* EcDoRpc Function 0x5   */
1307         typedef [flag(NDR_NOALIGN)] struct {
1308                 uint8           handle_idx;
1309                 TableFlags      TableFlags;
1310         } GetContentsTable_req;
1311
1312         typedef [flag(NDR_NOALIGN)] struct {
1313                 uint32          RowCount;
1314         } GetContentsTable_repl;
1315
1316         /**************************/
1317         /* EcDoRpc Function 0x6   */
1318         typedef [flag(NDR_NOALIGN)] struct {
1319                 uint8           handle_idx;
1320                 uint16          CodePageId;
1321                 hyper           FolderId;
1322                 boolean8        AssociatedFlag;
1323         } CreateMessage_req;
1324
1325         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1326                 [case(0x0)];
1327                 [case(0x1)] hyper       MessageId;
1328         } CreateMessage_MessageId;
1329
1330         typedef [flag(NDR_NOALIGN)] struct {
1331                 boolean8                                                HasMessageId;
1332                 [switch_is(HasMessageId)] CreateMessage_MessageId       MessageId;
1333         } CreateMessage_repl;
1334
1335         /*************************/
1336         /* EcDoRpc Function 0x7  */
1337         typedef [flag(NDR_NOALIGN)] struct {
1338                 uint16          PropertySizeLimit;
1339                 uint16          WantUnicode;
1340                 uint16          prop_count;
1341                 MAPITAGS        properties[prop_count];
1342         } GetProps_req;
1343
1344         typedef [flag(NDR_NOALIGN)] struct {
1345                 uint8           layout;
1346                 [flag(NDR_REMAINING)] DATA_BLOB prop_data;
1347         } GetProps_repl;
1348
1349         /*************************/
1350         /* EcDoRpc Function 0x8  */
1351         typedef [flag(NDR_NOALIGN)] struct {
1352                 uint16          PropertySizeLimit;
1353                 uint16          WantUnicode;
1354         } GetPropsAll_req;
1355
1356         typedef [flag(NDR_NOALIGN)] struct {
1357                 mapi_SPropValue_array   properties;
1358         } GetPropsAll_repl;
1359
1360         /*************************/
1361         /* EcDoRpc Function 0x9  */
1362         typedef [flag(NDR_NOALIGN)] struct {
1363         } GetPropList_req;
1364
1365         typedef [flag(NDR_NOALIGN)] struct {
1366                 uint16          count;
1367                 MAPITAGS        tags[count];
1368         } GetPropList_repl;
1369
1370         /*************************/
1371         /* EcDoRpc Function 0xa  */
1372         typedef [flag(NDR_NOALIGN)] struct {
1373                 uint32          index;          /* index into array of property tags */
1374                 MAPITAGS        property_tag;   /* property for which there was an error */
1375                 MAPISTATUS      error_code;     /* the error that occurred for this property */
1376         } PropertyProblem;
1377
1378         typedef [flag(NDR_NOALIGN)] struct {
1379                 [subcontext(2)] mapi_SPropValue_array values;
1380         } SetProps_req;
1381
1382         typedef [flag(NDR_NOALIGN)] struct {
1383                 uint16          PropertyProblemCount;
1384                 PropertyProblem PropertyProblem[PropertyProblemCount];          
1385         } SetProps_repl;
1386
1387         /*************************/
1388         /* EcDoRpc Function 0xb  */
1389         typedef [flag(NDR_NOALIGN)] struct {
1390                 uint16          count;
1391                 MAPITAGS        tags[count];
1392         } DeleteProps_req;
1393
1394         typedef [flag(NDR_NOALIGN)] struct {
1395                 uint16          PropertyProblemCount;
1396                 PropertyProblem PropertyProblem[PropertyProblemCount];
1397         } DeleteProps_repl;
1398
1399         /*************************/
1400         /* EcDoRpc Function 0xc  */
1401         typedef [enum8bit] enum {
1402                 KeepOpenReadOnly        = 0x9,
1403                 KeepOpenReadWrite       = 0xA,
1404                 ForceSave               = 0xC
1405         } SaveFlags;
1406
1407         typedef [flag(NDR_NOALIGN)] struct {
1408                 uint8           handle_idx;
1409                 uint8           SaveFlags;
1410         } SaveChangesMessage_req;
1411
1412         typedef [flag(NDR_NOALIGN)] struct {
1413                 uint8           handle_idx;
1414                 hyper           MessageId;
1415         } SaveChangesMessage_repl;
1416
1417         /*************************/
1418         /* EcDoRpc Function 0xd  */
1419         typedef [flag(NDR_NOALIGN)] struct {
1420                 uint32          ulReserved;
1421         } RemoveAllRecipients_req;
1422
1423         typedef [flag(NDR_NOALIGN)] struct {
1424
1425         } RemoveAllRecipients_repl;
1426
1427         /*************************/
1428         /* EcDoRpc Function 0xe  */
1429
1430         /* 
1431          * MODRECIP_NULL and INVALID are not part of the msdn flags
1432          * but are added for printing support 
1433          */
1434         typedef [enum8bit,flag(NDR_PAHEX)] enum {
1435                 MODRECIP_NULL           = 0x0,
1436                 MODRECIP_INVALID        = 0x1,
1437                 MODRECIP_ADD            = 0x2,
1438                 MODRECIP_MODIFY         = 0x4,
1439                 MODRECIP_REMOVE         = 0x8
1440         } modrecip;
1441
1442         typedef [flag(NDR_NOALIGN)]struct {
1443                 uint32          idx;
1444                 ulRecipClass    RecipClass;             
1445                 [subcontext(2),flag(NDR_REMAINING)] RecipientRow RecipientRow;
1446         } ModifyRecipientRow;
1447
1448         typedef [flag(NDR_NOALIGN)] struct {
1449                 uint16                          prop_count;
1450                 MAPITAGS                        properties[prop_count];
1451                 uint16                          cValues;
1452                 ModifyRecipientRow              RecipientRow[cValues];
1453         } ModifyRecipients_req;
1454
1455         typedef [flag(NDR_NOALIGN)] struct {
1456
1457         } ModifyRecipients_repl;
1458
1459         /*************************/
1460         /* EcDoRpc Function 0xf  */
1461         typedef [flag(NDR_NOALIGN)] struct {
1462                 uint32          RowId;
1463                 uint16          ulReserved;
1464         } ReadRecipients_req;
1465
1466         typedef [flag(NDR_NOALIGN)] struct {
1467                 uint32                          RowId;
1468                 ulRecipClass                    RecipientType;
1469                 uint16                          CodePageId;
1470                 uint16                          ulReserved;
1471                 [subcontext(2)] RecipientRow    RecipientRow;
1472         } ReadRecipientRow;
1473
1474         typedef [flag(NDR_NOALIGN)] struct {
1475                 uint8                   RowCount;
1476                 ReadRecipientRow        RecipientRows[RowCount];
1477         } ReadRecipients_repl;
1478
1479         /*************************/
1480         /* EcDoRpc Function 0x10 */
1481         typedef [flag(NDR_NOALIGN)] struct {
1482                 ulRecipClass            RecipientType;
1483                 uint16                  CodePageId;
1484                 uint16                  Reserved;
1485                 uint16                  RecipientRowSize;
1486                 [subcontext(0),subcontext_size(RecipientRowSize),flag(NDR_REMAINING)]RecipientRow       RecipientRow;
1487         } OpenRecipientRow;
1488
1489         typedef [flag(NDR_NOALIGN)] struct {
1490                 uint16          Reserved;
1491         } ReloadCachedInformation_req;
1492
1493         typedef [flag(NDR_NOALIGN)] struct {
1494                 boolean8                HasNamedProperties;
1495                 TypedString             SubjectPrefix;
1496                 TypedString             NormalizedSubject;
1497                 uint16                  RecipientCount;
1498                 mapi_SPropTagArray      RecipientColumns;
1499                 uint8                   RowCount;
1500                 OpenRecipientRow        RecipientRows[RowCount];
1501         } ReloadCachedInformation_repl;
1502
1503         /*************************/
1504         /* EcDoRpc Function 0x11 */
1505
1506         typedef [bitmap8bit] bitmap {
1507                 SUPPRESS_RECEIPT        = 0x01,
1508                 CLEAR_READ_FLAG         = 0x04,
1509                 GENERATE_RECEIPT_ONLY   = 0x10,
1510                 CLEAR_RN_PENDING        = 0x20,
1511                 CLEAR_NRN_PENDING       = 0x40
1512         } MSGFLAG_READ;
1513
1514         /* TODO: there is a variation that can provide "client data"
1515            here clientdata is a uint8 ClientData[24], but its
1516            existence within the request depends on flags associated to
1517            logon_id: it the private flag set or not
1518          */
1519         typedef [flag(NDR_NOALIGN)] struct {
1520                 uint8                           handle_idx;
1521                 MSGFLAG_READ                    flags;
1522                 [flag(NDR_REMAINING)] DATA_BLOB clientdata;
1523         } SetMessageReadFlag_req;
1524
1525         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1526                 [case(0x0)];
1527                 [case(0x1)] uint8       LogonId;
1528         } SetMessageReadFlag_LogonId;
1529
1530         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1531                 [case(0x0)];
1532                 [case(0x1)] uint8       ClientData[24];
1533         } SetMessageReadFlag_ClientData;
1534
1535         typedef [flag(NDR_NOALIGN)] struct {
1536                 boolean8                                                        ReadStatusChanged;
1537                 [switch_is(ReadStatusChanged)] SetMessageReadFlag_LogonId       LogonId;
1538                 [switch_is(ReadStatusChanged)] SetMessageReadFlag_ClientData    ClientData;
1539         } SetMessageReadFlag_repl;
1540
1541         /*************************/
1542         /* EcDoRpc Function 0x12 */
1543         typedef [enum8bit] enum {
1544                 SetColumns_TBL_SYNC     = 0x0,
1545                 SetColumns_TBL_ASYNC    = 0x1
1546         } SetColumnsFlags;
1547         
1548         typedef [enum8bit] enum {
1549                 TBLSTAT_COMPLETE        = 0x0,
1550                 TBLSTAT_SORTING         = 0x9,
1551                 TBLSTAT_SORT_ERROR      = 0xA,
1552                 TBLSTAT_SETTING_COLS    = 0xB,
1553                 TBLSTAT_SETCOL_ERROR    = 0xD,
1554                 TBLSTAT_RESTRICTING     = 0xE,
1555                 TBLSTAT_RESTRICT_ERROR  = 0xF
1556         } TableStatus;
1557
1558         typedef [flag(NDR_NOALIGN)] struct {
1559                 SetColumnsFlags SetColumnsFlags;
1560                 uint16          prop_count;
1561                 MAPITAGS        properties[prop_count];
1562         } SetColumns_req;
1563
1564         typedef [flag(NDR_NOALIGN)] struct {
1565                 TableStatus     TableStatus;
1566         } SetColumns_repl;
1567
1568         /**************************/
1569         /* EcDoRpc Function 0x13  */
1570         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1571                 TBL_ASYNC = 0x1,
1572                 TBL_BATCH = 0x2
1573         } TBL_FLAGS;
1574         
1575         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1576                 TABLE_SORT_ASCEND = 0x0,
1577                 TABLE_SORT_COMBINE = 0x1,
1578                 TABLE_SORT_DESCEND = 0x2
1579         } TABLE_SORT;
1580
1581         typedef [public, flag(NDR_NOALIGN)] struct _SSortOrder{
1582                 MAPITAGS ulPropTag;
1583                 TABLE_SORT ulOrder;
1584         } SSortOrder;
1585
1586         typedef [public, flag(NDR_NOALIGN)] struct _SSortOrderSet {
1587                 uint16          cSorts;
1588                 uint16          cCategories;
1589                 uint16          cExpanded;
1590                 SSortOrder      aSort[cSorts];
1591         } SSortOrderSet;
1592
1593         typedef [flag(NDR_NOALIGN)] struct {
1594                 uint8           SortTableFlags;
1595                 SSortOrderSet   lpSortCriteria;
1596         } SortTable_req;
1597
1598         typedef [flag(NDR_NOALIGN)] struct {
1599                 TableStatus     TableStatus;
1600         } SortTable_repl;
1601
1602         /**************************/
1603         /* EcDoRpc Function 0x14  */
1604         typedef [flag(NDR_NOALIGN)] struct {
1605                 uint16                  cRes;
1606                 mapi_SRestriction_and   res[cRes];
1607         } mapi_SAndRestriction;
1608
1609         typedef [flag(NDR_NOALIGN)] struct {
1610                 uint16  cRes;
1611                 mapi_SRestriction_or    res[cRes];
1612         } mapi_SOrRestriction;
1613
1614         typedef [flag(NDR_NOALIGN)] struct {
1615                 mapi_SRestriction_wrap  res;
1616         } mapi_SNotRestriction;
1617
1618         typedef [noprint, bitmap32bit] bitmap {
1619                 FL_FULLSTRING           = 0x00000,
1620                 FL_SUBSTRING            = 0x00001,
1621                 FL_PREFIX               = 0x00002,
1622                 FL_IGNORECASE           = 0x10000,
1623                 FL_IGNORENONSPACE       = 0x20000,
1624                 FL_LOOSE                = 0x40000
1625         } fuzzyLevel;
1626
1627         typedef [flag(NDR_NOALIGN)] struct {
1628                 fuzzyLevel      fuzzy;
1629                 MAPITAGS        ulPropTag;
1630                 mapi_SPropValue lpProp;
1631         } mapi_SContentRestriction;
1632
1633         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1634                 BMR_EQZ = 0x0,
1635                 BMR_NEZ = 0x1
1636         } relMBR;
1637
1638         typedef [flag(NDR_NOALIGN)] struct {
1639                 relMBR          relMBR;
1640                 MAPITAGS        ulPropTag;
1641                 uint32          ulMask;
1642         } mapi_SBitmaskRestriction;
1643
1644         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1645                 RELOP_LT = 0x0,         /* <  */
1646                 RELOP_LE = 0x1,         /* <= */
1647                 RELOP_GT = 0x2,         /* >  */
1648                 RELOP_GE = 0x3,         /* >= */
1649                 RELOP_EQ = 0x4,         /* == */
1650                 RELOP_NE = 0x5,         /* != */
1651                 RELOP_RE = 0x6          /* LIKE (Regular expression) */
1652         } CompareRelop;
1653
1654         typedef [flag(NDR_NOALIGN)] struct {
1655                 CompareRelop    relop;
1656                 MAPITAGS        ulPropTag;
1657                 uint32          size;
1658         } mapi_SSizeRestriction;
1659
1660         typedef [flag(NDR_NOALIGN)] struct {
1661                 uint8           relop;
1662                 MAPITAGS        ulPropTag;
1663                 mapi_SPropValue lpProp;
1664         } mapi_SPropertyRestriction;
1665
1666         typedef [flag(NDR_NOALIGN)] struct {
1667                 CompareRelop    relop;
1668                 MAPITAGS        ulPropTag1;
1669                 MAPITAGS        ulPropTag2;
1670         } mapi_SCompareProps;
1671
1672         typedef [flag(NDR_NOALIGN)] struct {
1673                 MAPITAGS        ulPropTag;
1674         } mapi_SExistRestriction;
1675
1676         typedef [flag(NDR_NOALIGN)] struct {
1677                 MAPITAGS                ulSubObject;
1678                 mapi_SRestriction_sub   res[ulSubObject - ulSubObject + 1]; /* nasty hack - generates fake pointer */
1679         } mapi_SSubRestriction;
1680
1681         typedef [nopush,nopull,noprint,nodiscriminant] union {
1682                 [case(0x0)];
1683                 [case(0x1)] mapi_SRestriction_comment *res;
1684         } RestrictionVariable;
1685
1686         typedef [flag(NDR_NOALIGN)] struct {
1687                 uint8                           TaggedValuesCount;
1688                 mapi_SPropValue                 TaggedValues[TaggedValuesCount];
1689                 boolean8                        RestrictionPresent;
1690                 [switch_is(RestrictionPresent)] RestrictionVariable Restriction;
1691         } mapi_SCommentRestriction;
1692
1693         typedef [public,nodiscriminant] union {
1694                 [case(RES_AND)]                 mapi_SAndRestriction            resAnd;
1695                 [case(RES_OR)]                  mapi_SOrRestriction             resOr;
1696                 [case(RES_NOT)]                 mapi_SNotRestriction            resNot;
1697                 [case(RES_CONTENT)]             mapi_SContentRestriction        resContent;
1698                 [case(RES_PROPERTY)]            mapi_SPropertyRestriction       resProperty;
1699                 [case(RES_COMPAREPROPS)]        mapi_SCompareProps              resCompareProps;
1700                 [case(RES_BITMASK)]             mapi_SBitmaskRestriction        resBitmask;
1701                 [case(RES_SIZE)]                mapi_SSizeRestriction           resSize;
1702                 [case(RES_EXIST)]               mapi_SExistRestriction          resExist;
1703                 [case(RES_SUBRESTRICTION)]      mapi_SSubRestriction            resSub;
1704                 [case(RES_COMMENT)]             mapi_SCommentRestriction        resComment;
1705                 [default];
1706         } mapi_SRestriction_CTR;
1707
1708         typedef [public,flag(NDR_NOALIGN)] struct {
1709                 uint8 rt;
1710                 [switch_is(rt)] mapi_SRestriction_CTR res;
1711         } mapi_SRestriction;
1712
1713         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1714                 uint8 rt;
1715                 [switch_is(rt)] mapi_SRestriction_CTR res;
1716         } mapi_SRestriction_and;
1717
1718         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1719                 uint8 rt;
1720                 [switch_is(rt)] mapi_SRestriction_CTR res;
1721         } mapi_SRestriction_or;
1722
1723         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1724                 uint8 rt;
1725                 [switch_is(rt)] mapi_SRestriction_CTR res;
1726         } mapi_SRestriction_sub;
1727
1728         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1729                 uint8 rt;
1730                 [switch_is(rt)] mapi_SRestriction_CTR res;
1731         } mapi_SRestriction_comment;
1732
1733         typedef [flag(NDR_NOALIGN)] struct {
1734                 uint8 handle_idx;
1735                 [subcontext(2)] mapi_SRestriction  restrictions;
1736         } Restrict_req;
1737
1738         typedef [flag(NDR_NOALIGN)] struct {
1739                 TableStatus     TableStatus;
1740         } Restrict_repl;
1741
1742         /**************************/
1743         /* EcDoRpc Function 0x15  */
1744         typedef [enum8bit] enum {
1745                 TBL_ADVANCE             = 0x0,
1746                 TBL_NOADVANCE           = 0x1,
1747                 TBL_ENABLEPACKEDBUFFERS = 0x2
1748         } QueryRowsFlags;
1749
1750         typedef [flag(NDR_NOALIGN)] struct {
1751                 QueryRowsFlags  QueryRowsFlags;
1752                 uint8           ForwardRead;
1753                 uint16          RowCount;
1754         } QueryRows_req;
1755
1756         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1757                 uint8           Origin;
1758                 uint16          RowCount;
1759                 [flag(NDR_REMAINING)]DATA_BLOB  RowData;
1760         } QueryRows_repl;
1761
1762         /**************************/
1763         /* EcDoRpc Function 0x16  */
1764         typedef [flag(NDR_NOALIGN)] struct {
1765         } GetStatus_req;
1766
1767         typedef [flag(NDR_NOALIGN)] struct {
1768                 TableStatus     TableStatus;
1769         } GetStatus_repl;
1770
1771         /**************************/
1772         /* EcDoRpc Function 0x17  */
1773         typedef [flag(NDR_NOALIGN)] struct {
1774         } QueryPosition_req;
1775
1776         typedef [flag(NDR_NOALIGN)] struct {
1777                 uint32  Numerator;
1778                 uint32  Denominator;
1779         } QueryPosition_repl;
1780
1781         /**************************/
1782         /* EcDoRpc Function 0x18  */
1783         typedef [enum8bit] enum {
1784                 BOOKMARK_BEGINNING      = 0x0,
1785                 BOOKMARK_CURRENT        = 0x1,
1786                 BOOKMARK_END            = 0x2,
1787                 BOOKMARK_USER           = 0x3
1788         } BOOKMARK;
1789
1790         typedef [flag(NDR_NOALIGN)] struct {
1791                 BOOKMARK        origin;
1792                 int32           offset;
1793                 boolean8        WantRowMovedCount;
1794         } SeekRow_req;
1795
1796         typedef [flag(NDR_NOALIGN)] struct {
1797                 boolean8        HasSoughtLess;
1798                 uint32          RowsSought;
1799         } SeekRow_repl;
1800
1801         /**************************/
1802         /* EcDoRpc Function 0x19  */
1803         typedef [flag(NDR_NOALIGN)] struct {
1804                 SBinary_short   Bookmark;
1805                 uint32          RowCount;
1806                 boolean8        WantRowMovedCount;
1807         } SeekRowBookmark_req;
1808
1809         typedef [flag(NDR_NOALIGN)] struct {
1810                 boolean8        RowNoLongerVisible;
1811                 boolean8        HasSoughtLess;
1812                 uint32          RowsSought;
1813         } SeekRowBookmark_repl;
1814
1815         /**************************/
1816         /* EcDoRpc Function 0x1a  */
1817         typedef [flag(NDR_NOALIGN)] struct {
1818                 uint32          ulNumerator;
1819                 uint32          ulDenominator;
1820         } SeekRowApprox_req;
1821
1822         typedef [flag(NDR_NOALIGN)] struct {
1823         } SeekRowApprox_repl;
1824         
1825         /**************************/
1826         /* EcDoRpc Function 0x1b  */
1827         typedef [flag(NDR_NOALIGN)] struct {
1828         } CreateBookmark_req;
1829
1830         typedef [flag(NDR_NOALIGN)] struct {
1831                 SBinary_short   bookmark;
1832         } CreateBookmark_repl;
1833
1834         /**************************/
1835         /* EcDoRpc Function 0x1c  */
1836         typedef [enum8bit] enum {
1837                 FOLDER_GENERIC  = 0x1,
1838                 FOLDER_SEARCH   = 0x2
1839         } FOLDER_TYPE;
1840
1841         typedef [enum8bit] enum {
1842                 MAPI_FOLDER_ANSI        = 0x0,
1843                 MAPI_FOLDER_UNICODE     = 0x1
1844         } FOLDER_STRING;
1845
1846         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1847                 [case(MAPI_FOLDER_ANSI)] astring                        lpszA;
1848                 [case(MAPI_FOLDER_UNICODE)][flag(STR_NULLTERM)] string  lpszW;
1849         } LPTSTR;
1850
1851         typedef [enum16bit] enum {
1852                 NONE            = 0x0000,
1853                 OPEN_IF_EXISTS  = 0x0001
1854         } FOLDER_FLAGS;
1855
1856         typedef [flag(NDR_NOALIGN)] struct {
1857                 uint8                           handle_idx;
1858                 FOLDER_TYPE                     ulFolderType;
1859                 FOLDER_STRING                   ulType;
1860                 FOLDER_FLAGS                    ulFlags;
1861                 [switch_is(ulType)] LPTSTR      FolderName;
1862                 [switch_is(ulType)] LPTSTR      FolderComment;
1863         } CreateFolder_req;
1864
1865         typedef [flag(NDR_NOALIGN)] struct {
1866                 boolean8                                HasRules;
1867                 boolean8                                IsGhosted;
1868                 [switch_is(IsGhosted)] IsGhosted        Ghost;
1869         } CreateFolder_GhostInfo;
1870
1871         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1872                 [case(0x0)];
1873                 [case(0x1)] CreateFolder_GhostInfo      GhostInfo;
1874         } CreateFolder_GhostUnion;
1875
1876         typedef [flag(NDR_NOALIGN)] struct {
1877                 hyper                                                   folder_id;
1878                 boolean8                                                IsExistingFolder;
1879                 [switch_is(IsExistingFolder)]   CreateFolder_GhostUnion GhostUnion;
1880         } CreateFolder_repl;
1881
1882         /**************************/
1883         /* EcDoRpc Function 0x1d  */
1884         typedef [bitmap8bit] bitmap {
1885                 DEL_MESSAGES            = 0x1,
1886                 DEL_FOLDERS             = 0x4,
1887                 DELETE_HARD_DELETE      = 0x10
1888         } DeleteFolderFlags;
1889
1890         typedef [flag(NDR_NOALIGN)] struct {
1891                 DeleteFolderFlags       DeleteFolderFlags;
1892                 hyper                   FolderId;
1893         } DeleteFolder_req;
1894
1895         typedef [flag(NDR_NOALIGN)] struct {
1896                 boolean8                PartialCompletion;
1897         } DeleteFolder_repl;
1898
1899         /**************************/
1900         /* EcDoRpc Function 0x1e  */
1901         typedef [flag(NDR_NOALIGN)] struct {
1902                 boolean8        WantAsynchronous;
1903                 boolean8        NotifyNonRead;
1904                 uint16          cn_ids;
1905                 hyper           message_ids[cn_ids];
1906         } DeleteMessages_req;
1907
1908         typedef [flag(NDR_NOALIGN)] struct {
1909                 boolean8        PartialCompletion;
1910         } DeleteMessages_repl;
1911
1912         /**************************/
1913         /* EcDoRpc Function 0x1f  */
1914         typedef [flag(NDR_NOALIGN)] struct {
1915                 hyper           msgid;
1916         } GetMessageStatus_req;
1917
1918         /**************************/
1919         /* EcDoRpc Function 0x20  */
1920         typedef [bitmap32bit] bitmap {
1921                 MSGSTATUS_HIGHLIGHTED           = 0x1,
1922                 MSGSTATUS_TAGGED                = 0x2,
1923                 MSGSTATUS_HIDDEN                = 0x4,
1924                 MSGSTATUS_DELMARKED             = 0x8,
1925                 MSGSTATUS_REMOTE_DOWNLOAD       = 0x1000,
1926                 MSGSTATUS_REMOTE_DELETE         = 0x2000
1927         } ulMessageStatus;
1928
1929
1930         typedef [flag(NDR_NOALIGN)] struct {
1931                 hyper           msgid;
1932                 uint32          ulNewStatus;
1933                 ulMessageStatus ulNewStatusMask;
1934         } SetMessageStatus_req;
1935
1936         typedef [flag(NDR_NOALIGN)] struct {
1937                 ulMessageStatus ulOldStatus;
1938         } SetMessageStatus_repl;
1939
1940         /**************************/
1941         /* EcDoRpc Function 0x21  */
1942         typedef [flag(NDR_NOALIGN)] struct {
1943                 uint8           handle_idx;
1944                 TableFlags      TableFlags;
1945         } GetAttachmentTable_req;
1946
1947         typedef [flag(NDR_NOALIGN)] struct {
1948         } GetAttachmentTable_repl;
1949
1950         /*************************/
1951         /* EcDoRpc Function 0x22 */
1952         typedef [enum8bit] enum {
1953                 OpenAttachmentFlags_ReadOnly    = 0x0,
1954                 OpenAttachmentFlags_ReadWrite   = 0x1,
1955                 OpenAttachmentFlags_BestAccess  = 0x3
1956         } OpenAttachmentFlags;
1957
1958         typedef [flag(NDR_NOALIGN)] struct {
1959                 uint8                   handle_idx;
1960                 OpenAttachmentFlags     OpenAttachmentFlags;
1961                 uint32                  AttachmentID;
1962         } OpenAttach_req;
1963
1964         typedef [flag(NDR_NOALIGN)] struct {
1965         } OpenAttach_repl;
1966
1967         /*************************/
1968         /* EcDoRpc Function 0x23 */
1969         typedef [flag(NDR_NOALIGN)] struct {
1970                 uint8   handle_idx;
1971         } CreateAttach_req;
1972
1973         typedef [flag(NDR_NOALIGN)] struct {
1974                 uint32  AttachmentID;
1975         } CreateAttach_repl;
1976
1977         /*************************/
1978         /* EcDoRpc Function 0x24 */
1979         typedef [flag(NDR_NOALIGN)] struct {
1980                 uint32          AttachmentID;
1981         } DeleteAttach_req;
1982
1983
1984         typedef [flag(NDR_NOALIGN)] struct {
1985         } DeleteAttach_repl;
1986
1987         /*************************/
1988         /* EcDoRpc Function 0x25 */
1989         typedef [flag(NDR_NOALIGN)] struct {
1990                 uint8           handle_idx;
1991                 SaveFlags       SaveFlags;
1992         } SaveChangesAttachment_req;
1993
1994         typedef [flag(NDR_NOALIGN)] struct {
1995         } SaveChangesAttachment_repl;
1996
1997         /*************************/
1998         /* EcDoRpc Function 0x26 */
1999         typedef [flag(NDR_NOALIGN)] struct {
2000                 hyper           fid;
2001                 astring         lpszMessageClass;
2002         } SetReceiveFolder_req;
2003
2004         typedef [flag(NDR_NOALIGN)] struct {
2005         } SetReceiveFolder_repl;
2006
2007         /*************************/
2008         /* EcDoRpc Function 0x27 */
2009         typedef [flag(NDR_NOALIGN)] struct {
2010                 astring         MessageClass;
2011         } GetReceiveFolder_req;
2012
2013         typedef [flag(NDR_NOALIGN)] struct {
2014                 hyper           folder_id;
2015                 astring         MessageClass;
2016         } GetReceiveFolder_repl;
2017
2018         /*************************/
2019         /* EcDoRpc Function 0x29 */
2020         typedef [bitmap16bit] bitmap {
2021                 fnevCriticalError               = 0x0001,
2022                 fnevNewMail                     = 0x0002,
2023                 fnevObjectCreated               = 0x0004,
2024                 fnevObjectDeleted               = 0x0008,
2025                 fnevObjectModified              = 0x0010,
2026                 fnevObjectMoved                 = 0x0020,
2027                 fnevObjectCopied                = 0x0040,
2028                 fnevSearchComplete              = 0x0080,
2029                 fnevTableModified               = 0x0100,
2030                 fnevStatusObjectModified        = 0x0200,
2031                 fnevReserved                    = 0x0400,
2032                 fnevTbit                        = 0x1000,
2033                 fnevUbit                        = 0x2000,
2034                 fnevSbit                        = 0x4000,
2035                 fnevMbit                        = 0x8000
2036         } NotificationFlags;
2037
2038         typedef [nodiscriminant,flag(NDR_NOALIGN)] union {
2039                 [case(0x0)] hyper       ID;
2040                 [case(0x1)];
2041         } hyperbool;
2042
2043         typedef [flag(NDR_NOALIGN)] struct {
2044                 uint8                                   handle_idx;
2045                 NotificationFlags                       NotificationFlags;
2046                 boolean8                                WantWholeStore;
2047                 [switch_is(WantWholeStore)] hyperbool   FolderId;
2048                 [switch_is(WantWholeStore)] hyperbool   MessageId;
2049         } RegisterNotification_req;
2050
2051         typedef [flag(NDR_NOALIGN)] struct {
2052         } RegisterNotification_repl;
2053
2054         /*************************/
2055         /* EcDoRpc Function 0x2a */
2056         typedef [bitmap32bit] bitmap {
2057                 MSGFLAG_READ            = 0x1,
2058                 MSGFLAG_UNMODIFIED      = 0x2,
2059                 MSGFLAG_SUBMIT          = 0x4,
2060                 MSGFLAG_UNSENT          = 0x8,
2061                 MSGFLAG_HASATTACH       = 0x10,
2062                 MSGFLAG_FROMME          = 0x20,
2063                 MSGFLAG_ASSOCIATED      = 0x40,
2064                 MSGFLAG_RESEND          = 0x80,
2065                 MSGFLAG_RN_PENDING      = 0x100,
2066                 MSGFLAG_NRN_PENDING     = 0x200
2067         } MsgFlags;
2068
2069         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2070                 [case(0x0)] astring                     lpszA;
2071                 [case(0x1)][flag(STR_NULLTERM)] string  lpszW;
2072         } MessageClass;
2073
2074         typedef [flag(NDR_NOALIGN)] struct {
2075                 GUID            DatabaseGUID;
2076                 uint8           GlobalCounter[6];
2077         } GID;
2078
2079         typedef [enum16bit] enum {
2080                 TABLE_CHANGED           =       0x1,
2081                 TABLE_ROW_ADDED         =       0x3,
2082                 TABLE_ROW_DELETED       =       0x4,
2083                 TABLE_ROW_MODIFIED      =       0x5,
2084                 TABLE_RESTRICT_DONE     =       0x7
2085         } RichTableNotificationType;
2086
2087         /* NewMailNotification: case 0x2 and 0x8002 */
2088         typedef [flag(NDR_NOALIGN)] struct {
2089                 hyper                                   FID;
2090                 hyper                                   MID;
2091                 MsgFlags                                MessageFlags;
2092                 boolean8                                UnicodeFlag;
2093                 [switch_is(UnicodeFlag)] MessageClass   MessageClass;
2094         } NewMailNotification;
2095
2096         /* FolderCreatedNotification: case 0x4 */
2097         typedef [flag(NDR_NOALIGN)] struct {
2098                 hyper                                   FID;
2099                 hyper                                   ParentFID;
2100                 uint16                                  TagCount;
2101                 MAPITAGS                                Tags[TagCount];
2102         } FolderCreatedNotification;
2103
2104         /* FolderDeletedNotification: case 0x8 */
2105         typedef [flag(NDR_NOALIGN)] struct {
2106                 hyper                                   FID;
2107                 hyper                                   ParentFID;
2108         } FolderDeletedNotification;
2109
2110         /* FolderModifiedNotification: case 0x10 */
2111         typedef [flag(NDR_NOALIGN)] struct {
2112                 hyper                   FID;
2113                 uint16                  TagCount;
2114                 MAPITAGS                Tags[TagCount];
2115         } FolderModifiedNotification_10;
2116
2117         /* FolderMoveCopyNotification: case 0x20 and 0x40 */
2118         typedef [flag(NDR_NOALIGN)] struct {
2119                 hyper                   FID;
2120                 hyper                   ParentFID;
2121                 hyper                   OldFID;
2122                 hyper                   OldParentFID;
2123         } FolderMoveCopyNotification;
2124
2125         /* SearchCompleteNotification: case 0x80 */
2126         typedef [flag(NDR_NOALIGN)] struct {
2127                 hyper                   FID;
2128         } SearchCompleteNotification;
2129
2130         /* HierarchyTable: case 0x100 */
2131         typedef [flag(NDR_NOALIGN)] struct {
2132                 hyper                           FID;
2133                 hyper                           InsertAfterFID;
2134                 [subcontext(2)] DATA_BLOB       Columns;
2135         } HierarchyRowAddedNotification;
2136
2137         typedef [flag(NDR_NOALIGN)] struct {
2138                 hyper                           FID;
2139         } HierarchyRowDeletedNotification;
2140         
2141         typedef [flag(NDR_NOALIGN)] struct {
2142                 hyper                           FID;
2143                 hyper                           InsertAfterFID;
2144                 [subcontext(2)] DATA_BLOB       Columns;
2145         } HierarchyRowModifiedNotification;
2146
2147         typedef [nodiscriminant] union {
2148                 [case(TABLE_ROW_ADDED)] HierarchyRowAddedNotification           HierarchyRowAddedNotification;
2149                 [case(TABLE_ROW_DELETED)] HierarchyRowDeletedNotification       HierarchyRowDeletedNotification;
2150                 [case(TABLE_ROW_MODIFIED)] HierarchyRowModifiedNotification     HierarchyRowModifiedNotification;
2151                 [default];
2152         } HierarchyTableChangeUnion;
2153
2154         typedef [flag(NDR_NOALIGN)] struct {
2155                 RichTableNotificationType                               TableEvent;
2156                 [switch_is(TableEvent)] HierarchyTableChangeUnion       HierarchyTableChangeUnion;
2157         } HierarchyTableChange;
2158
2159         /* IcsNotification: case 0x200 */
2160         typedef [flag(NDR_NOALIGN)] struct {
2161                 boolean8                HierChanged;
2162                 uint32                  GIDCount;
2163                 GID                     GID[GIDCount];
2164         } IcsNotification;
2165
2166         /* FolderModifiedNotification: case 0x1010 */
2167         typedef [flag(NDR_NOALIGN)] struct {
2168                 hyper                   FID;
2169                 uint16                  TagCount;
2170                 MAPITAGS                Tags[TagCount];
2171                 uint32                  TotalMessageCount;
2172         } FolderModifiedNotification_1010;
2173
2174         /* FolderModifiedNotification: case 0x2010 */
2175         typedef [flag(NDR_NOALIGN)] struct {
2176                 hyper                   FID;
2177                 uint16                  TagCount;
2178                 MAPITAGS                Tags[TagCount];
2179                 uint32                  UnreadMessageCount;
2180         } FolderModifiedNotification_2010;
2181
2182         /* FolderModifiedNotification: case 0x3010 */
2183         typedef [flag(NDR_NOALIGN)] struct {
2184                 hyper                   FID;
2185                 uint16                  TagCount;
2186                 MAPITAGS                Tags[TagCount];
2187                 uint32                  TotalMessageCount;
2188                 uint32                  UnreadMessageCount;
2189         } FolderModifiedNotification_3010;
2190
2191         /* MessageCreatedNotification: case 0x8004 */
2192         typedef [flag(NDR_NOALIGN)] struct {
2193                 hyper                                   FID;
2194                 hyper                                   MID;
2195                 uint16                                  TagCount;
2196                 MAPITAGS                                Tags[TagCount];
2197         } MessageCreatedNotification;
2198
2199         /* MessageDeletedNotification: case 0x8008 */
2200         typedef [flag(NDR_NOALIGN)] struct {
2201                 hyper                                   FID;
2202                 hyper                                   MID;
2203         } MessageDeletedNotification;
2204
2205         /* MessageModifiedNotification: case 0x8010 */
2206         typedef [flag(NDR_NOALIGN)] struct {
2207                 hyper                                   FID;
2208                 hyper                                   MID;
2209                 uint16                                  TagCount;
2210                 MAPITAGS                                Tags[TagCount];
2211         } MessageModifiedNotification;
2212
2213         /* MessageMoveCopyNotification: case 0x8020 and 0x8040 */
2214         typedef [flag(NDR_NOALIGN)] struct {
2215                 hyper                   FID;
2216                 hyper                   MID;
2217                 hyper                   OldFID;
2218                 hyper                   OldMID;
2219         } MessageMoveCopyNotification;  
2220
2221         /* ContentsTableChange: case 0x8100 and 0xc100 */
2222         typedef [flag(NDR_NOALIGN)] struct {
2223                 hyper                           FID;
2224                 hyper                           MID;
2225                 uint32                          Instance;
2226                 hyper                           InsertAfterFID;
2227                 hyper                           InsertAfterMID;
2228                 uint32                          InsertAfterInstance;
2229                 [subcontext(2)] DATA_BLOB       Columns;
2230         } ContentsRowAddedNotification;
2231
2232         typedef [flag(NDR_NOALIGN)] struct {
2233                 hyper                           FID;
2234                 hyper                           MID;
2235                 uint32                          Instance;
2236         } ContentsRowDeletedNotification;
2237
2238         typedef [flag(NDR_NOALIGN)] struct {
2239                 hyper                           FID;
2240                 hyper                           MID;
2241                 uint32                          Instance;
2242                 hyper                           InsertAfterFID;
2243                 hyper                           InsertAfterMID;
2244                 uint32                          InsertAfterInstance;
2245                 [subcontext(2)] DATA_BLOB       Columns;
2246         } ContentsRowModifiedNotification;
2247
2248         typedef [nodiscriminant] union {
2249                 [case(TABLE_ROW_ADDED)] ContentsRowAddedNotification            ContentsRowAddedNotification;
2250                 [case(TABLE_ROW_DELETED)] ContentsRowDeletedNotification        ContentsRowDeletedNotification;
2251                 [case(TABLE_ROW_MODIFIED)] ContentsRowModifiedNotification      ContentsRowModifiedNotification;
2252                 [default];
2253         } ContentsTableChangeUnion;
2254
2255         typedef [flag(NDR_NOALIGN)] struct {
2256                 RichTableNotificationType                               TableEvent;
2257                 [switch_is(TableEvent)] ContentsTableChangeUnion        ContentsTableChangeUnion;
2258         } ContentsTableChange;
2259
2260         /* SearchMessageCreatedNotification: case 0xc004 */
2261         typedef [flag(NDR_NOALIGN)] struct {
2262                 hyper                                   FID;
2263                 hyper                                   MID;
2264                 hyper                                   SearchFID;
2265                 uint16                                  TagCount;
2266                 MAPITAGS                                Tags[TagCount];
2267         } SearchMessageCreatedNotification;
2268
2269         /* SearchMessageRemovedNotification: case 0xc008 */
2270         typedef [flag(NDR_NOALIGN)] struct {
2271                 hyper                                   FID;
2272                 hyper                                   MID;
2273                 hyper                                   SearchFID;
2274         } SearchMessageRemovedNotification;
2275
2276         /* SearchMessageModifiedNotification: 0xc010 */
2277         typedef [flag(NDR_NOALIGN)] struct {
2278                 hyper                                   FID;
2279                 hyper                                   MID;
2280                 uint16                                  TagCount;
2281                 MAPITAGS                                Tags[TagCount];
2282         } SearchMessageModifiedNotification;
2283
2284         typedef [nodiscriminant] union {
2285                 [case(0x0002)] NewMailNotification                      NewMailNotification;
2286                 [case(0x0004)] FolderCreatedNotification                FolderCreatedNotification;
2287                 [case(0x0008)] FolderDeletedNotification                FolderDeletedNotification;
2288                 [case(0x0010)] FolderModifiedNotification_10            FolderModifiedNotification_10;
2289                 [case(0x0020)] FolderMoveCopyNotification               FolderMoveNotification;
2290                 [case(0x0040)] FolderMoveCopyNotification               FolderCopyNotification;
2291                 [case(0x0080)] SearchCompleteNotification               SearchCompleteNotification;
2292                 [case(0x0100)] HierarchyTableChange                     HierarchyTableChange;
2293                 [case(0x0200)] IcsNotification                          IcsNotification;
2294                 [case(0x1010)] FolderModifiedNotification_1010          FolderModifiedNotification_1010;
2295                 [case(0x2010)] FolderModifiedNotification_2010          FolderModifiedNotification_2010;
2296                 [case(0x3010)] FolderModifiedNotification_3010          FolderModifiedNotification_3010;
2297                 [case(0x8002)] NewMailNotification                      NewMessageNotification;
2298                 [case(0x8004)] MessageCreatedNotification               MessageCreatedNotification;
2299                 [case(0x8008)] MessageDeletedNotification               MessageDeletedNotification;
2300                 [case(0x8010)] MessageModifiedNotification              MessageModifiedNotification;
2301                 [case(0x8020)] MessageMoveCopyNotification              MessageMoveNotification;
2302                 [case(0x8040)] MessageMoveCopyNotification              MessageCopyNotification;
2303                 [case(0x8100)] ContentsTableChange                      ContentsTableChange;
2304                 [case(0xc004)] SearchMessageCreatedNotification         SearchMessageCreatedNotification;
2305                 [case(0xc008)] SearchMessageRemovedNotification         SearchMessageRemovedNotification;
2306                 [case(0xc010)] SearchMessageModifiedNotification        SearchMessageModifiedNotification;
2307                 [case(0xc100)] ContentsTableChange                      SearchTableChange;
2308         } NotificationData;
2309
2310         typedef [flag(NDR_NOALIGN)] struct {
2311                 uint32                                          NotificationHandle;
2312                 uint8                                           LogonId;
2313                 NotificationFlags                               NotificationType;
2314                 [switch_is(NotificationType)] NotificationData  NotificationData;
2315         } Notify_repl;
2316
2317         /*************************/
2318         /* EcDoRpc Function 0x2b */
2319         typedef [enum8bit] enum {
2320                 OpenStream_ReadOnly     = 0x0,
2321                 OpenStream_ReadWrite    = 0x1,
2322                 OpenStream_Create       = 0x2,
2323                 OpenStream_BestAccess   = 0x3
2324         } OpenStream_OpenModeFlags;
2325
2326         typedef [flag(NDR_NOALIGN)] struct {
2327                 uint8                           handle_idx;
2328                 MAPITAGS                        PropertyTag;
2329                 OpenStream_OpenModeFlags        OpenModeFlags;
2330         } OpenStream_req;
2331
2332         typedef [flag(NDR_NOALIGN)] struct {
2333                 uint32          StreamSize;
2334         } OpenStream_repl;
2335
2336         /*************************/
2337         /* EcDoRpc Function 0x2c */
2338         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2339                 [case(0xBABE)] uint32   value;
2340                 [default];
2341         } MaximumByteCount;
2342
2343         typedef [flag(NDR_NOALIGN)] struct {
2344                 uint16                                          ByteCount;
2345                 [switch_is(ByteCount)]  MaximumByteCount        MaximumByteCount;
2346         } ReadStream_req;
2347
2348         typedef [flag(NDR_ALIGN2)] struct {
2349                 [subcontext(2), flag(NDR_REMAINING)] DATA_BLOB data;
2350         } ReadStream_repl;
2351
2352         /*************************/
2353         /* EcDoRpc Function 0x2d */
2354         typedef [flag(NDR_NOALIGN)] struct {
2355                 [subcontext(2), flag(NDR_REMAINING)] DATA_BLOB  data;
2356         } WriteStream_req;
2357
2358
2359         typedef [flag(NDR_NOALIGN)] struct {
2360                 uint16          WrittenSize;
2361         } WriteStream_repl;
2362
2363         /*************************/
2364         /* EcDoRpc Function 0x2e */
2365         typedef [flag(NDR_NOALIGN)] struct {
2366                 uint8           Origin;
2367                 hyper           Offset;
2368         } SeekStream_req;
2369
2370         typedef [flag(NDR_NOALIGN)] struct {
2371                 hyper           NewPosition;
2372         } SeekStream_repl;
2373
2374         /*************************/
2375         /* EcDoRpc Function 0x2f */
2376         typedef [flag(NDR_NOALIGN)] struct {
2377                 hyper           SizeStream;
2378         } SetStreamSize_req;
2379
2380         typedef [flag(NDR_NOALIGN)] struct {
2381         } SetStreamSize_repl;
2382
2383         /*************************/
2384         /* EcDoRpc Function 0x30 */
2385         typedef [public, bitmap32bit, flag(NDR_PAHEX)] bitmap {
2386                 STOP_SEARCH                     = 0x00000001,
2387                 RESTART_SEARCH                  = 0x00000002,
2388                 RECURSIVE_SEARCH                = 0x00000004,
2389                 SHALLOW_SEARCH                  = 0x00000008,
2390                 FOREGROUND_SEARCH               = 0x00000010,
2391                 BACKGROUND_SEARCH               = 0x00000020,
2392                 CONTENT_INDEXED_SEARCH          = 0x00010000,
2393                 NON_CONTENT_INDEXED_SEARCH      = 0x00020000,
2394                 STATIC_SEARCH                   = 0x00040000
2395         } SearchFlags;
2396
2397         typedef [flag(NDR_NOALIGN)] struct {
2398                 [subcontext(2)] mapi_SRestriction       res;
2399                 uint16                                  FolderIdCount;
2400                 hyper                                   FolderIds[FolderIdCount];
2401                 SearchFlags                             SearchFlags;
2402         } SetSearchCriteria_req;
2403
2404         typedef [flag(NDR_NOALIGN)] struct {
2405         } SetSearchCriteria_repl;
2406
2407         /*************************/
2408         /* EcDoRpc Function 0x31 */
2409         typedef [flag(NDR_NOALIGN)] struct {
2410                 boolean8        UseUnicode;
2411                 boolean8        IncludeRestriction;
2412                 boolean8        IncludeFolders;
2413         } GetSearchCriteria_req;
2414
2415         typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
2416                 uint16                                  RestrictionDataSize;
2417                 [subcontext(0),subcontext_size(RestrictionDataSize)] mapi_SRestriction  RestrictionData;
2418                 uint8                                   LogonId;
2419                 uint16                                  FolderIdCount;
2420                 hyper                                   FolderIds[FolderIdCount];
2421                 SearchFlags                             SearchFlags;
2422         } GetSearchCriteria_repl;
2423
2424         /*************************/
2425         /* EcDoRpc Function 0x32 */
2426         typedef [enum8bit] enum {
2427                 None            = 0x0,  /* None */
2428                 PreProcess      = 0x1,  /* Needs to be preprocessed by the server */
2429                 NeedsSpooler    = 0x2   /* Is to be processed by a client spooler */
2430         } SubmitFlags;
2431
2432         typedef [flag(NDR_NOALIGN)] struct {
2433                 SubmitFlags     SubmitFlags;
2434         } SubmitMessage_req;
2435
2436         typedef [flag(NDR_NOALIGN)] struct {
2437         } SubmitMessage_repl;
2438
2439         /*************************/
2440         /* EcDoRpc Function 0x33 */
2441         typedef [flag(NDR_NOALIGN)] struct {
2442                 uint8           handle_idx;
2443                 uint16          count;
2444                 hyper           message_id[count];
2445                 boolean8        WantAsynchronous;
2446                 boolean8        WantCopy;
2447         } MoveCopyMessages_req;
2448
2449         typedef [flag(NDR_NOALIGN)] struct {
2450                 boolean8        PartialCompletion;
2451         } MoveCopyMessages_repl;
2452
2453         /*************************/
2454         /* EcDoRpc Function 0x34 */
2455         typedef [flag(NDR_NOALIGN)] struct {
2456                 hyper           FolderId;
2457                 hyper           MessageId;
2458         } AbortSubmit_req;
2459
2460         typedef [flag(NDR_NOALIGN)] struct {
2461         } AbortSubmit_repl;
2462
2463         /*************************/
2464         /* EcDoRpc Function 0x35 */
2465         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2466                 [case(0x0)] astring                     lpszA;
2467                 [case(0x1)][flag(STR_NULLTERM)] string  lpszW;
2468         } Folder_name;
2469
2470         typedef [flag(NDR_NOALIGN)] struct {
2471                 uint8                                   handle_idx;
2472                 boolean8                                WantAsynchronous;
2473                 boolean8                                UseUnicode;
2474                 hyper                                   FolderId;
2475                 [switch_is(UseUnicode)] Folder_name     NewFolderName;
2476         } MoveFolder_req;
2477
2478         typedef [flag(NDR_NOALIGN)] struct {
2479                 boolean8                                PartialCompletion;
2480         } MoveFolder_repl;
2481
2482         /*************************/
2483         /* EcDoRpc Function 0x36 */
2484         typedef [flag(NDR_NOALIGN)] struct {
2485                 uint8                                   handle_idx;
2486                 boolean8                                WantAsynchronous;
2487                 boolean8                                WantRecursive;
2488                 boolean8                                UseUnicode;
2489                 hyper                                   FolderId;
2490                 [switch_is(UseUnicode)] Folder_name     NewFolderName;
2491         } CopyFolder_req;
2492
2493         typedef [flag(NDR_NOALIGN)] struct {
2494                 boolean8                                PartialCompletion;
2495         } CopyFolder_repl;
2496
2497         /*************************/
2498         /* EcDoRpc Function 0x37 */
2499         typedef [flag(NDR_NOALIGN)] struct {
2500         } QueryColumnsAll_req;
2501
2502         typedef [flag(NDR_NOALIGN)] struct {
2503                 uint16          PropertyTagCount;
2504                 MAPITAGS        PropertyTags[PropertyTagCount];
2505         } QueryColumnsAll_repl;
2506
2507         /*************************/
2508         /* EcDoRpc Function 0x38 */
2509         typedef [flag(NDR_NOALIGN)] struct {
2510         } Abort_req;
2511
2512         typedef [flag(NDR_NOALIGN)] struct {
2513                 TableStatus     TableStatus;
2514         } Abort_repl;
2515
2516         /*************************/
2517         /* EcDoRpc Function 0x39 */
2518         typedef [bitmap8bit] bitmap {
2519                 CopyFlagsMove           = 0x1,  /* Move properties */
2520                 CopyFlagsNoOverwrite    = 0x2   /* Do not overwrite existing properties */
2521         } CopyFlags;
2522
2523         typedef [flag(NDR_NOALIGN)] struct {
2524                 uint8                   handle_idx;
2525                 boolean8                WantAsynchronous;
2526                 boolean8                WantSubObjects;
2527                 CopyFlags               CopyFlags;
2528                 mapi_SPropTagArray      ExcludedTags;
2529         } CopyTo_req;
2530
2531         typedef [flag(NDR_NOALIGN)] struct {
2532                 uint16          PropertyProblemCount;
2533                 PropertyProblem PropertyProblem[PropertyProblemCount];
2534         } CopyTo_repl;
2535
2536         /*************************/
2537         /* EcDoRpc Function 0x3a */
2538         typedef [flag(NDR_NOALIGN)] struct {
2539                 uint8           handle_idx;
2540                 hyper           ByteCount;
2541         } CopyToStream_req;
2542
2543         typedef [flag(NDR_NOALIGN)] struct {
2544                 hyper           ReadByteCount;
2545                 hyper           WrittenByteCount;
2546         } CopyToStream_repl;
2547
2548         /*************************/
2549         /* EcDoRpc Function 0x3b */
2550         typedef [flag(NDR_NOALIGN)] struct {
2551                 uint8           handle_idx;
2552         } CloneStream_req;
2553
2554         typedef [flag(NDR_NOALIGN)] struct {
2555         } CloneStream_repl;
2556
2557         /*************************/
2558         /* EcDoRpc Function 0x3e */
2559         typedef [bitmap8bit] bitmap {
2560                 IncludeFreeBusy = 0x02
2561         } PermissionsTableFlags;
2562
2563         typedef [flag(NDR_NOALIGN)] struct {
2564                 uint8                   handle_idx;
2565                 PermissionsTableFlags   TableFlags;
2566         } GetPermissionsTable_req;
2567
2568         typedef [flag(NDR_NOALIGN)] struct {
2569         } GetPermissionsTable_repl;
2570
2571         /*************************/
2572         /* EcDoRpc Function 0x3f */
2573         typedef [bitmap8bit] bitmap {
2574                 RulesTableFlags_Unicode = 0x40
2575         } RulesTableFlags;
2576
2577         typedef [flag(NDR_NOALIGN)] struct {
2578                 uint8           handle_idx;
2579                 RulesTableFlags TableFlags;
2580         } GetRulesTable_req;
2581
2582         typedef [flag(NDR_NOALIGN)] struct {
2583         } GetRulesTable_repl;
2584
2585         /*************************/
2586         /* EcDoRpc Function 0x40 */
2587         typedef [bitmap8bit] bitmap {
2588                 ModifyPerms_IncludeFreeBusy     = 0x02,
2589                 ModifyPerms_ReplaceRows         = 0x01
2590         } ModifyPermissionsFlags;
2591
2592         typedef [flag(NDR_NOALIGN)] struct {
2593                 ulRowFlags              PermissionDataFlags;
2594                 mapi_SPropValue_array   lpProps;
2595         } PermissionData;
2596
2597         typedef [flag(NDR_NOALIGN)] struct {
2598                 ModifyPermissionsFlags  ModifyFlags;
2599                 uint16                  ModifyCount;
2600                 PermissionData          PermissionsData[ModifyCount];
2601         } mapi_PermissionsData;
2602
2603         typedef [flag(NDR_NOALIGN)] struct {
2604                 mapi_PermissionsData    rowList;
2605         } ModifyPermissions_req;
2606
2607         typedef [flag(NDR_NOALIGN)] struct {
2608         } ModifyPermissions_repl;
2609
2610         /*************************/
2611         /* EcDoRpc Function 0x41 */
2612         typedef [flag(NDR_NOALIGN)] struct {
2613                 ulRowFlags              RuleDataFlags;
2614                 mapi_SPropValue_array   PropertyValues;
2615         } RuleData;
2616
2617         typedef [bitmap8bit] bitmap {
2618                 ModifyRulesFlag_Replace = 0x01
2619         } ModifyRulesFlag;
2620
2621         typedef [flag(NDR_NOALIGN)] struct {
2622                 ModifyRulesFlag ModifyRulesFlags;
2623                 uint16          RulesCount;
2624                 RuleData        RulesData[RulesCount];
2625         } ModifyRules_req;
2626
2627         typedef [flag(NDR_NOALIGN)] struct {
2628         } ModifyRules_repl;
2629
2630         /*************************/
2631         /* EcDoRpc Function 0x42 */
2632         typedef [flag(NDR_NOALIGN)] struct {
2633                 hyper           FolderId;
2634         } GetOwningServers_req;
2635
2636         typedef [flag(NDR_NOALIGN)] struct {
2637                 uint16          OwningServersCount;
2638                 uint16          CheapServersCount;
2639                 astring         OwningServers[OwningServersCount];
2640         } GetOwningServers_repl;
2641
2642         /*************************/
2643         /* EcDoRpc Function 0x43 */
2644         typedef [flag(NDR_NOALIGN)] struct {
2645                 hyper   Id;
2646         } LongTermIdFromId_req;
2647
2648         typedef [flag(NDR_NOALIGN)] struct {
2649                 GUID    DatabaseGuid;
2650                 uint8   GlobalCounter[6];
2651                 uint16  padding;
2652         } LongTermId;
2653
2654         typedef [flag(NDR_NOALIGN)] struct {
2655                 LongTermId      LongTermId;
2656         } LongTermIdFromId_repl;
2657
2658         /*************************/
2659         /* EcDoRpc Function 0x44 */
2660         typedef [flag(NDR_NOALIGN)] struct {
2661                 LongTermId      LongTermId;
2662         } IdFromLongTermId_req;
2663
2664         typedef [flag(NDR_NOALIGN)] struct {
2665                 hyper           Id;
2666         } IdFromLongTermId_repl;
2667
2668         /*************************/
2669         /* EcDoRpc Function 0x45 */
2670         typedef [flag(NDR_NOALIGN)] struct {
2671                 hyper           FolderId;
2672         } PublicFolderIsGhosted_req;
2673
2674         typedef [flag(NDR_NOALIGN)] struct {
2675                 boolean8                                IsGhosted;
2676                 [switch_is(IsGhosted)] IsGhosted        Ghost;
2677         } PublicFolderIsGhosted_repl;
2678
2679         /*************************/
2680         /* EcDoRpc Function 0x46 */
2681         typedef [enum8bit, flag(NDR_PAHEX)] enum {
2682                 MAPI_READONLY   = 0x0,
2683                 MAPI_READWRITE  = 0x1,
2684                 MAPI_CREATE     = 0x2
2685         } OpenEmbeddedMessage_OpenModeFlags;
2686
2687         typedef [flag(NDR_NOALIGN)] struct {
2688                 uint8                                   handle_idx;
2689                 uint16                                  CodePageId;
2690                 OpenEmbeddedMessage_OpenModeFlags       OpenModeFlags;
2691         } OpenEmbeddedMessage_req;
2692
2693         typedef [flag(NDR_NOALIGN)] struct {
2694                 uint8                   Reserved;
2695                 hyper                   MessageId;
2696                 boolean8                HasNamedProperties;
2697                 TypedString             SubjectPrefix;
2698                 TypedString             NormalizedSubject;
2699                 uint16                  RecipientCount;
2700                 uint16                  ColumnCount;
2701                 MAPITAGS                RecipientColumns[ColumnCount];
2702                 uint8                   RowCount;
2703                 OpenRecipientRow        RecipientRows[RowCount];
2704         } OpenEmbeddedMessage_repl;
2705
2706         /*************************/
2707         /* EcDoRpc Function 0x47 */
2708         typedef [flag(NDR_NOALIGN)] struct {
2709         } SetSpooler_req;
2710
2711         typedef [flag(NDR_NOALIGN)] struct {
2712         } SetSpooler_repl;
2713
2714         /*************************/
2715         /* EcDoRpc Function 0x48 */
2716         typedef [enum8bit] enum {
2717                 LockState_1stLock       = 0x0,
2718                 LockState_1stUnlock     = 0x1,
2719                 LockState_1stFinished   = 0x2
2720         } LockState;
2721
2722         typedef [flag(NDR_NOALIGN)] struct {
2723                 hyper           MessageId;
2724                 LockState       LockState;
2725         } SpoolerLockMessage_req;
2726
2727         typedef [flag(NDR_NOALIGN)] struct {
2728         } SpoolerLockMessage_repl;
2729
2730         /*************************/
2731         /* EcDoRpc Function 0x49 */
2732         typedef [flag(NDR_NOALIGN)] struct {
2733         } AddressTypes_req;
2734
2735         typedef [flag(NDR_NOALIGN)] struct {
2736                 uint16          cValues;
2737                 uint16          size;
2738                 mapi_LPSTR      transport[cValues];
2739         } AddressTypes_repl;
2740
2741         /**************************/
2742         /* EcDoRpc Function 0x4a  */
2743         typedef [flag(NDR_NOALIGN)] struct {
2744         } TransportSend_req;
2745
2746         typedef [nodiscriminant] union {
2747                 [case(0x0)] mapi_SPropValue_array       lpProps;
2748                 [case(0x1)];
2749         } TransportSend_lpProps;
2750
2751         typedef [flag(NDR_NOALIGN)] struct {
2752                 boolean8                                                NoPropertiesReturned;
2753                 [switch_is(NoPropertiesReturned)] TransportSend_lpProps properties;
2754         } TransportSend_repl;
2755
2756         /**************************/
2757         /* EcDoRpc Function 0x4b  */
2758         typedef [bitmap8bit] bitmap {
2759                 FastTransferCopyMessage_Move            = 0x01,
2760                 FastTransferCopyMessage_Unknown1        = 0x02,
2761                 FastTransferCopyMessage_Unknown2        = 0x04,
2762                 FastTransferCopyMessage_Unknown3        = 0x08,
2763                 FastTransferCopyMessage_BestBody        = 0x10,
2764                 FastTransferCopyMessage_SendEntryId     = 0x20
2765         } FastCopyMessagesCopyFlags;
2766
2767         /* this one is used in a few ROPs */
2768         typedef [bitmap8bit] bitmap {
2769                 FastTransfer_Unicode            = 0x01,
2770                 FastTransfer_UseCpid            = 0x02,
2771                 FastTransfer_ForUpload          = FastTransfer_Unicode | FastTransfer_UseCpid,
2772                 FastTransfer_RecoverMode        = 0x04,
2773                 FastTransfer_ForceUnicode       = 0x08,
2774                 FastTransfer_PartialItem        = 0x10
2775         } FastCopySendOptions;
2776
2777         typedef [flag(NDR_NOALIGN)] struct {
2778                 uint8                           handle_idx;
2779                 uint16                          MessageIdCount;
2780                 hyper                           MessageIds[MessageIdCount];
2781                 FastCopyMessagesCopyFlags       CopyFlags;
2782                 FastCopySendOptions             SendOptions;
2783         } FastTransferSourceCopyMessages_req;
2784
2785         typedef [flag(NDR_NOALIGN)] struct {
2786         } FastTransferSourceCopyMessages_repl;
2787
2788         /**************************/
2789         /* EcDoRpc Function 0x4c  */
2790         typedef [bitmap8bit] bitmap {
2791                 FastTransferCopyFolder_Move             = 0x01,
2792                 FastTransferCopyFolder_Unused1          = 0x02,
2793                 FastTransferCopyFolder_Unused2          = 0x04,
2794                 FastTransferCopyFolder_Unused3          = 0x08,
2795                 FastTransferCopyFolder_CopySubfolders   = 0x10,
2796                 FastTransferCopyFolder_NoGhostedContent = 0x20
2797         } FastCopyFolderCopyFlags;
2798
2799         typedef [flag(NDR_NOALIGN)] struct {
2800                 uint8                           handle_idx;
2801                 FastCopyFolderCopyFlags         CopyFlags;
2802                 FastCopySendOptions             SendOptions;
2803         } FastTransferSourceCopyFolder_req;
2804
2805         typedef [flag(NDR_NOALIGN)] struct {
2806         } FastTransferSourceCopyFolder_repl;
2807
2808         /**************************/
2809         /* EcDoRpc Function 0x4d  */
2810         typedef [bitmap32bit] bitmap {
2811                 FastTransferCopyTo_Move         = 0x00000001,
2812                 FastTransferCopyToUnused1       = 0x00000002,
2813                 FastTransferCopyToUnused2       = 0x00000004,
2814                 FastTransferCopyToUnused3       = 0x00000008,
2815                 FastTransferCopyToUnused4       = 0x00000200,
2816                 FastTransferCopyToUnused5       = 0x00000400,
2817                 FastTransferCopyTo_BestBody     = 0x00002000
2818         } FastCopyToCopyFlags;
2819
2820         typedef [flag(NDR_NOALIGN)] struct {
2821                 uint8                   handle_idx;
2822                 uint8                   Level;
2823                 FastCopyToCopyFlags     CopyFlags;
2824                 FastCopySendOptions     SendOptions;
2825                 mapi_SPropTagArray      PropertyTags;
2826         } FastTransferSourceCopyTo_req;
2827
2828         typedef [flag(NDR_NOALIGN)] struct {
2829         } FastTransferSourceCopyTo_repl;
2830
2831         /**************************/
2832         /* EcDoRpc Function 0x4e  */
2833         typedef [nodiscriminant] union {
2834                 [case(0xBABE)] uint16   MaximumBufferSize;
2835                 [default];
2836         } FastTransferSourceGetBuffer_MaxBufferSize;
2837
2838         typedef [flag(NDR_NOALIGN)] struct {
2839                 uint16                                                            BufferSize;
2840                 [switch_is(BufferSize)] FastTransferSourceGetBuffer_MaxBufferSize MaximumBufferSize;
2841         } FastTransferSourceGetBuffer_req;
2842
2843         typedef [enum16bit] enum {
2844                 TransferStatus_Error    = 0x0000,
2845                 TransferStatus_Partial  = 0x0001,
2846                 TransferStatus_NoRoom   = 0x0002,
2847                 TransferStatus_Done     = 0x0003
2848         } TransferStatus;
2849
2850         typedef [flag(NDR_NOALIGN)] struct {
2851                 TransferStatus  TransferStatus;
2852                 uint16          InProgressCount;
2853                 uint16          TotalStepCount;
2854                 uint8           Reserved;
2855                 uint16          TransferBufferSize;
2856                 [subcontext(0),subcontext_size(TransferBufferSize),flag(NDR_REMAINING)] DATA_BLOB TransferBuffer;
2857         } FastTransferSourceGetBuffer_repl;
2858
2859         /**************************/
2860         /* EcDoRpc Function 0x4f  */
2861         typedef [enum8bit] enum {
2862                 DIR_FORWARD  = 0x0,
2863                 DIR_BACKWARD = 0x1
2864         } FindRow_ulFlags;
2865
2866         typedef [flag(NDR_NOALIGN)] struct {
2867                 FindRow_ulFlags ulFlags;
2868                 [subcontext(2)] mapi_SRestriction res;
2869                 BOOKMARK        origin;
2870                 SBinary_short   bookmark;
2871         } FindRow_req;
2872
2873         typedef [flag(NDR_NOALIGN)] struct {
2874                 uint8           RowNoLongerVisible;
2875                 uint8           HasRowData;
2876                 [flag(NDR_NOALIGN)] DATA_BLOB row;
2877         } FindRow_repl;
2878
2879         /**************************/
2880         /* EcDoRpc Function 0x50  */
2881         typedef [flag(NDR_NOALIGN)] struct {
2882                 boolean8        WantCancel;
2883         } Progress_req;
2884
2885         typedef [flag(NDR_NOALIGN)] struct {
2886                 uint32          CompletedTaskCount;
2887                 uint32          TotalTaskCount;
2888         } Progress_repl;
2889
2890         /**************************/
2891         /* EcDoRpc Function 0x51  */
2892         typedef [flag(NDR_NOALIGN)] struct {
2893                 hyper           MessageId;
2894                 hyper           FolderId;
2895                 astring         MessageClass;
2896                 uint32          MessageFlags;
2897         } TransportNewMail_req;
2898
2899         typedef [flag(NDR_NOALIGN)] struct {
2900         } TransportNewMail_repl;
2901
2902         /**************************/
2903         /* EcDoRpc Function 0x52  */
2904         typedef [flag(NDR_NOALIGN)] struct {
2905         } GetValidAttachments_req;
2906
2907         typedef [flag(NDR_NOALIGN)] struct {
2908                 uint16          AttachmentIdCount;
2909                 uint32          AttachmentIdArray[AttachmentIdCount];
2910         } GetValidAttachments_repl;
2911
2912         /**************************/
2913         /* EcDoRpc Function 0x53  */
2914         typedef [enum8bit] enum {
2915                 FastTransferDest_CopyTo         = 0x1,
2916                 FastTransferDest_CopyProperties = 0x2,
2917                 FastTransferDest_CopyMessages   = 0x3,
2918                 FastTransferDest_CopyFolder     = 0x4
2919         } FastTransferDestConfig_SourceOperation;
2920
2921         typedef [bitmap8bit] bitmap {
2922                 FastTransferDest_Move           = 0x01
2923         } FastTransferDestConfig_CopyFlags;
2924
2925         typedef [flag(NDR_NOALIGN)] struct {
2926                 uint8                                   handle_idx;
2927                 FastTransferDestConfig_SourceOperation  SourceOperation;
2928                 FastTransferDestConfig_CopyFlags        CopyFlags;
2929         } FastTransferDestinationConfigure_req;
2930
2931         typedef [flag(NDR_NOALIGN)] struct {
2932         } FastTransferDestinationConfigure_repl;
2933
2934         /**************************/
2935         /* EcDoRpc Function 0x54  */
2936         typedef [flag(NDR_NOALIGN)] struct {
2937                 uint16          TransferBufferSize;
2938                 [subcontext(0),subcontext_size(TransferBufferSize),flag(NDR_REMAINING)] DATA_BLOB TransferBuffer;
2939         } FastTransferDestinationPutBuffer_req;
2940
2941         typedef [flag(NDR_NOALIGN)] struct {
2942                 TransferStatus  TransferStatus;
2943                 uint16          InProgressCount;
2944                 uint16          TotalStepCount;
2945                 uint8           Reserved;
2946                 uint16          BufferUsedCount;
2947         } FastTransferDestinationPutBuffer_repl;
2948
2949         /*************************/
2950         /* EcDoRpc Function 0x55 */
2951         typedef [enum8bit] enum {
2952                 MNID_ID = 0,
2953                 MNID_STRING = 1
2954         } ulKind;
2955
2956         typedef [flag(NDR_NOALIGN)] struct {
2957                 uint8                           NameSize;
2958                 [flag(STR_NULLTERM)] string     Name;
2959         } mapi_name;
2960
2961         typedef [nodiscriminant] union {
2962                 [case(MNID_ID)] uint32          lid;
2963                 [case(MNID_STRING)] mapi_name   lpwstr;
2964         } Kind;
2965         
2966         typedef [flag(NDR_NOALIGN)] struct {
2967                 ulKind                          ulKind;
2968                 GUID                            lpguid;
2969                 [switch_is(ulKind)] Kind        kind;
2970         } MAPINAMEID;
2971
2972         typedef [flag(NDR_NOALIGN)] struct {
2973                 uint16          PropertyIdCount;
2974                 uint16          PropertyIds[PropertyIdCount];
2975         } GetNamesFromIDs_req;
2976
2977         typedef [flag(NDR_NOALIGN)] struct {
2978                 uint16          count;
2979                 MAPINAMEID      nameid[count];
2980         } GetNamesFromIDs_repl;
2981
2982         /*************************/
2983         /* EcDoRpc Function 0x56 */
2984         typedef [flag(NDR_NOALIGN)] struct {
2985                 uint8           ulFlags;
2986                 uint16          count;
2987                 MAPINAMEID      nameid[count];
2988         } GetIDsFromNames_req;
2989
2990         typedef [flag(NDR_NOALIGN)] struct {
2991                 uint16          count;
2992                 uint16          propID[count];
2993         } GetIDsFromNames_repl;
2994
2995         /*************************/
2996         /* EcDoRpc Function 0x57 */
2997         typedef [flag(NDR_NOALIGN)] struct {
2998                 SBinary_short   ServerEntryId;
2999                 SBinary_short   ClientEntryId;
3000         } UpdateDeferredActionMessages_req;
3001
3002         typedef [flag(NDR_NOALIGN)] struct {
3003         } UpdateDeferredActionMessages_repl;
3004
3005         /*************************/
3006         /* EcDoRpc Function 0x58 */
3007         typedef [flag(NDR_NOALIGN)] struct {
3008                 boolean8        WantAsynchronous;
3009                 boolean8        WantDeleteAssociated;
3010         } EmptyFolder_req;
3011
3012         typedef [flag(NDR_NOALIGN)] struct {
3013                 boolean8        PartialCompletion;
3014         } EmptyFolder_repl;
3015
3016         /*************************/
3017         /* EcDoRpc Function 0x59 */
3018         typedef [flag(NDR_NOALIGN)] struct {
3019                 uint16          MaxRowCount;
3020                 hyper           CategoryId;
3021         } ExpandRow_req;
3022
3023         typedef [flag(NDR_NOALIGN)] struct {
3024                 uint32          ExpandedRowCount;
3025                 uint16          RowCount;
3026                 [flag(NDR_REMAINING)]DATA_BLOB  RowData;
3027         } ExpandRow_repl;
3028
3029         /*************************/
3030         /* EcDoRpc Function 0x5a */
3031         typedef [flag(NDR_NOALIGN)] struct {
3032                 hyper           CategoryId;
3033         } CollapseRow_req;
3034
3035         typedef [flag(NDR_NOALIGN)] struct {
3036                 uint32          CollapsedRowCount;
3037         } CollapseRow_repl;
3038
3039         /*************************/
3040         /* EcDoRpc Function 0x5b */
3041         typedef [flag(NDR_NOALIGN)] struct {
3042                 hyper           RegionOffset;
3043                 hyper           RegionSize;
3044                 uint32          LockFlags;
3045         } LockRegionStream_req;
3046
3047         typedef [flag(NDR_NOALIGN)] struct {
3048         } LockRegionStream_repl;
3049
3050         /*************************/
3051         /* EcDoRpc Function 0x5c */
3052         typedef [flag(NDR_NOALIGN)] struct {
3053                 hyper           RegionOffset;
3054                 hyper           RegionSize;
3055                 uint32          LockFlags;
3056         } UnlockRegionStream_req;
3057
3058         typedef [flag(NDR_NOALIGN)] struct {
3059         } UnlockRegionStream_repl;
3060
3061         /*************************/
3062         /* EcDoRpc Function 0x5d */
3063         typedef [flag(NDR_NOALIGN)] struct {
3064         } CommitStream_req;
3065
3066         typedef [flag(NDR_NOALIGN)] struct {
3067         } CommitStream_repl;
3068
3069         /*************************/
3070         /* EcDoRpc Function 0x5e */
3071         typedef [flag(NDR_NOALIGN)] struct {
3072         } GetStreamSize_req;
3073
3074         typedef [flag(NDR_NOALIGN)] struct {
3075                 uint32          StreamSize;
3076         } GetStreamSize_repl;
3077
3078         /*************************/
3079         /* EcDoRpc Function 0x5f */
3080         typedef [bitmap8bit] bitmap {
3081                 NoStrings       = 0x01,
3082                 NoIds           = 0x02
3083         } QueryFlags;
3084
3085         typedef [nodiscriminant] union {
3086                 [case(0x0)];
3087                 [case(0x1)] GUID guid;
3088         } QueryNamedProperties_guid;
3089
3090         typedef [flag(NDR_NOALIGN)] struct {
3091                 QueryFlags              QueryFlags;
3092                 boolean8                HasGuid;
3093                 [switch_is(HasGuid)]    QueryNamedProperties_guid PropertyGuid;
3094         } QueryNamedProperties_req;
3095
3096         typedef [flag(NDR_NOALIGN)] struct {
3097                 uint16          IdCount;
3098                 uint16          PropertyIds[IdCount];
3099                 MAPINAMEID      PropertyNames[IdCount];
3100         } QueryNamedProperties_repl;
3101   
3102         /*************************/
3103         /* EcDoRpc Function 0x60 */
3104         typedef [flag(NDR_NOALIGN)] struct {
3105                 GUID    DatabaseGuid;
3106         } GetPerUserLongTermIds_req;
3107
3108         typedef [flag(NDR_NOALIGN)] struct {
3109                 uint16          LongTermIdCount;
3110                 LongTermId      LongTermIds[LongTermIdCount];
3111         } GetPerUserLongTermIds_repl;
3112
3113         /*************************/
3114         /* EcDoRpc Function 0x61 */
3115         typedef [flag(NDR_NOALIGN)] struct {
3116                 LongTermId      LongTermId;
3117         } GetPerUserGuid_req;
3118
3119         typedef [flag(NDR_NOALIGN)] struct {
3120                 GUID            DatabaseGuid;
3121         } GetPerUserGuid_repl;
3122
3123         /*************************/
3124         /* EcDoRpc Function 0x63 */
3125         typedef [flag(NDR_NOALIGN)] struct {
3126                 uint8           FolderId[24];
3127                 boolean8        WhatIfChanged;
3128                 uint32          DataOffset;
3129                 uint16          MaxDataSize;
3130         } ReadPerUserInformation_req;
3131
3132         typedef [flag(NDR_NOALIGN)] struct {
3133                 boolean8        HasFinished;
3134                 uint16          DataSize;
3135                 [subcontext(0), subcontext_size(DataSize), flag(NDR_REMAINING)] DATA_BLOB Data;
3136         } ReadPerUserInformation_repl;
3137
3138         /*************************/
3139         /* EcDoRpc Function 0x64 */
3140         typedef [flag(NDR_NOALIGN)] struct {
3141                 LongTermId      FolderId;
3142                 boolean8        HasFinished;
3143                 uint32          DataOffset;
3144                 uint16          DataSize;
3145                 [subcontext(0), subcontext_size(DataSize), flag(NDR_REMAINING)] DATA_BLOB Data;
3146                 GUID            ReplGuid;       /* Note: ReplGuid gets only included under specific circumstances */
3147         } WritePerUserInformation_req;
3148
3149         typedef [flag(NDR_NOALIGN)] struct {
3150         } WritePerUserInformation_repl;
3151
3152         /*************************/
3153         /* EcDoRpc Function 0x66 */
3154         typedef [flag(NDR_NOALIGN)] struct {
3155                 boolean8        WantAsynchronous;
3156                 MSGFLAG_READ    ReadFlags;
3157                 uint16          MessageIdCount;
3158                 hyper           MessageIds[MessageIdCount];
3159         } SetReadFlags_req;
3160
3161         typedef [flag(NDR_NOALIGN)] struct {
3162                 boolean8        PartialCompletion;
3163         } SetReadFlags_repl;
3164
3165         /*************************/
3166         /* EcDoRpc Function 0x67 */
3167         typedef [flag(NDR_NOALIGN)] struct {
3168                 uint8                   handle_idx;
3169                 boolean8                WantAsynchronous;
3170                 CopyFlags               CopyFlags;
3171                 mapi_SPropTagArray      PropertyTags;
3172         } CopyProperties_req;
3173
3174         typedef [flag(NDR_NOALIGN)] struct {
3175                 uint16          PropertyProblemCount;
3176                 PropertyProblem PropertyProblem[PropertyProblemCount];
3177         } CopyProperties_repl;
3178
3179         /*************************/
3180         /* EcDoRpc Function 0x68 */
3181         typedef [flag(NDR_NOALIGN)] struct {
3182                 uint8           unknown;
3183                 hyper           fid;
3184                 astring         lpszMessageClass;
3185                 FILETIME        modiftime;
3186         } ReceiveFolder;
3187
3188         typedef [flag(NDR_NOALIGN)] struct {
3189         } GetReceiveFolderTable_req;
3190
3191         typedef [flag(NDR_NOALIGN)] struct {
3192                 uint32          cValues;
3193                 ReceiveFolder   entries[cValues];
3194         } GetReceiveFolderTable_repl;
3195
3196         /**************************/
3197         /* EcDoRpc Function 0x69  */
3198         typedef [bitmap8bit] bitmap {
3199                 FastTransferCopyProperties_Move         = 0x01,
3200                 FastTransferCopyProperties_Unused1      = 0x02,
3201                 FastTransferCopyProperties_Unused2      = 0x04,
3202                 FastTransferCopyProperties_Unused3      = 0x08
3203         } FastCopyPropertiesCopyFlags;
3204
3205         typedef [flag(NDR_NOALIGN)] struct {
3206                 uint8                           handle_idx;
3207                 uint8                           Level;
3208                 FastCopyPropertiesCopyFlags     CopyFlags;
3209                 FastCopySendOptions             SendOptions;
3210                 mapi_SPropTagArray              PropertyTags;
3211         } FastTransferSourceCopyProperties_req;
3212
3213         typedef [flag(NDR_NOALIGN)] struct {
3214         } FastTransferSourceCopyProperties_repl;
3215
3216         /*************************/
3217         /* EcDoRpc Function 0x6b */
3218         typedef [flag(NDR_NOALIGN)] struct {
3219                 hyper           RowId;
3220                 uint32          RowInstanceNumber;
3221         } GetCollapseState_req;
3222
3223         typedef [flag(NDR_NOALIGN)] struct {
3224                 SBinary_short   CollapseState;
3225         } GetCollapseState_repl;
3226
3227         /*************************/
3228         /* EcDoRpc Function 0x6c */
3229         typedef [flag(NDR_NOALIGN)] struct {
3230                 SBinary_short   CollapseState;
3231         } SetCollapseState_req;
3232
3233         typedef [flag(NDR_NOALIGN)] struct {
3234                 SBinary_short   bookmark;
3235         } SetCollapseState_repl;
3236
3237         /*************************/
3238         /* EcDoRpc Function 0x6d */
3239         typedef [flag(NDR_NOALIGN)] struct {
3240         } GetTransportFolder_req;
3241
3242         typedef [flag(NDR_NOALIGN)] struct {
3243                 hyper           FolderId;
3244         } GetTransportFolder_repl;
3245
3246         /*************************/
3247         /* EcDoRpc Function 0x6e */
3248         typedef [flag(NDR_NOALIGN)] struct {
3249                 uint16  SessionIndex;
3250         } Pending_repl;
3251
3252         /*************************/
3253         /* EcDoRpc Function 0x6f */
3254         typedef [flag(NDR_NOALIGN)] struct {
3255                 astring         AddressType;
3256                 boolean8        WantWin32;
3257         } OptionsData_req;
3258
3259         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
3260                 [case(0x0)];
3261                 [default]  astring      HelpFileName;
3262         } OptionsData_HelpFileName;
3263
3264         typedef [flag(NDR_NOALIGN)] struct {
3265                 uint8                                                   Reserved;
3266                 SBinary_short                                           OptionsInfo;
3267                 uint16                                                  HelpFileSize;
3268                 uint8                                                   HelpFile[HelpFileSize];
3269                 [switch_is(HelpFileSize)] OptionsData_HelpFileName      HelpFileName;
3270         } OptionsData_repl;
3271
3272         /*************************/
3273         /* EcDoRpc Function 0x70 */
3274         typedef [enum8bit] enum {
3275                 SynchronizationType_Contents    = 0x1,
3276                 SynchronizationType_Hierarchy   = 0x2
3277         } SynchronizationType;
3278
3279         typedef [bitmap16bit] bitmap {
3280                 SynchronizationFlag_Unicode                     = 0x0001,
3281                 SynchronizationFlag_NoDeletions                 = 0x0002,
3282                 SynchronizationFlag_IgnoreNoLongerInScope       = 0x0004,
3283                 SynchronizationFlag_ReadState                   = 0x0008,
3284                 SynchronizationFlag_FAI                         = 0x0010,
3285                 SynchronizationFlag_Normal                      = 0x0020,
3286                 SynchronizationFlag_OnlySpecifiedProperties     = 0x0080,
3287                 SynchronizationFlag_NoForeignIdentifiers        = 0x0100,
3288                 SynchronizationFlag_Reserved                    = 0x1000,
3289                 SynchronizationFlag_BestBody                    = 0x2000,
3290                 SynchronizationFlag_IgnoreSpecifiedOnFAI        = 0x4000,
3291                 SynchronizationFlag_Progress                    = 0x8000
3292         } SynchronizationFlag;
3293
3294         typedef [bitmap32bit] bitmap {
3295                 SynchronizationExtraFlag_Eid                    = 0x00000001,
3296                 SynchronizationExtraFlag_MessageSize            = 0x00000002,
3297                 SynchronizationExtraFlag_Cn                     = 0x00000004,
3298                 SynchronizationExtraFlag_OrderByDeliveryTime    = 0x00000008
3299         } SynchronizationExtraFlags;
3300
3301         typedef [flag(NDR_NOALIGN)] struct {
3302                 uint8                                   handle_idx;
3303                 SynchronizationType                     SynchronizationType;
3304                 FastCopySendOptions                     SendOptions;
3305                 SynchronizationFlag                     SynchronizationFlags;
3306                 uint16                                  RestrictionSize;
3307                 [subcontext(0),subcontext_size(RestrictionSize),flag(NDR_REMAINING)] DATA_BLOB  RestrictionData;
3308                 SynchronizationExtraFlags               SynchronizationExtraFlags;
3309                 mapi_SPropTagArray                      PropertyTags;
3310         } SyncConfigure_req;
3311
3312         typedef [flag(NDR_NOALIGN)] struct {
3313         } SyncConfigure_repl;
3314
3315         /*************************/
3316         /* EcDoRpc Function 0x72 */
3317         typedef [bitmap8bit] bitmap {
3318                 ImportFlag_Associated           = 0x10,
3319                 ImportFlag_FailOnConflict       = 0x40
3320         } ImportFlag;
3321
3322         typedef [flag(NDR_NOALIGN)] struct {
3323                 uint8                   handle_idx;
3324                 ImportFlag              ImportFlag;
3325                 mapi_SPropValue_array   PropertyValues;
3326         } SyncImportMessageChange_req;
3327
3328         typedef [flag(NDR_NOALIGN)] struct {
3329                 hyper           MessageId;
3330         } SyncImportMessageChange_repl;
3331
3332         /*************************/
3333         /* EcDoRpc Function 0x73 */
3334         typedef [flag(NDR_NOALIGN)] struct {
3335                 mapi_SPropValue_array   HierarchyValues;
3336                 mapi_SPropValue_array   PropertyValues;
3337         } SyncImportHierarchyChange_req;
3338
3339         typedef [flag(NDR_NOALIGN)] struct {
3340                 hyper                   FolderId;
3341         } SyncImportHierarchyChange_repl;
3342
3343         /*************************/
3344         /* EcDoRpc Function 0x74 */
3345         typedef [flag(NDR_NOALIGN)] struct {
3346                 boolean8                IsHierarchy;
3347                 mapi_SPropValue_array   PropertyValues;
3348         } SyncImportDeletes_req;
3349
3350         typedef [flag(NDR_NOALIGN)] struct {
3351         } SyncImportDeletes_repl;
3352
3353         /*************************/
3354         /* EcDoRpc Function 0x75 */
3355         typedef [v1_enum,flag(NDR_PAHEX)] enum {
3356                 SP_PidTagIdsetGiven     = 0x40170003,
3357                 SP_PidTagCnsetSeen      = 0x67960102,
3358                 SP_PidTagCnsetSeenFAI   = 0x67da0102,
3359                 SP_PidTagCnsetRead      = 0x67d20102
3360         } StateProperty;
3361
3362         typedef [flag(NDR_NOALIGN)] struct {
3363                 StateProperty           StateProperty;
3364                 uint32                  TransferBufferSize;
3365         } SyncUploadStateStreamBegin_req;
3366
3367         typedef [flag(NDR_NOALIGN)] struct {
3368         } SyncUploadStateStreamBegin_repl;
3369
3370         /*************************/
3371         /* EcDoRpc Function 0x76 */
3372         typedef [flag(NDR_NOALIGN)] struct {
3373                 uint32                  StreamDataSize;
3374                 uint8                   StreamData[StreamDataSize];
3375         } SyncUploadStateStreamContinue_req;
3376
3377         typedef [flag(NDR_NOALIGN)] struct {
3378         } SyncUploadStateStreamContinue_repl;
3379
3380         /*************************/
3381         /* EcDoRpc Function 0x77 */
3382         typedef [flag(NDR_NOALIGN)] struct {
3383         } SyncUploadStateStreamEnd_req;
3384
3385         typedef [flag(NDR_NOALIGN)] struct {
3386         } SyncUploadStateStreamEnd_repl;
3387
3388         /*************************/
3389         /* EcDoRpc Function 0x78 */
3390         typedef [flag(NDR_NOALIGN)] struct {
3391                 uint32          SourceFolderIdSize;
3392                 uint8           SourceFolderId[SourceFolderIdSize];
3393                 uint32          SourceMessageIdSize;
3394                 uint8           SourceMessageId[SourceMessageIdSize];
3395                 uint32          PredecessorChangeListSize;
3396                 uint8           PredecessorChangeList[PredecessorChangeListSize];
3397                 uint32          DestinationMessageIdSize;
3398                 uint8           DestinationMessageId[DestinationMessageIdSize];
3399                 uint32          ChangeNumberSize;
3400                 uint8           ChangeNumber[ChangeNumberSize];
3401         } SyncImportMessageMove_req;
3402
3403         typedef [flag(NDR_NOALIGN)] struct {
3404                 hyper           MessageId;
3405         } SyncImportMessageMove_repl;
3406
3407         /*************************/
3408         /* EcDoRpc Function 0x79 */
3409         typedef [flag(NDR_NOALIGN)] struct {
3410                 [subcontext(2)] mapi_SPropValue_array   values;
3411         } SetPropertiesNoReplicate_req;
3412
3413         typedef [flag(NDR_NOALIGN)] struct {
3414                 uint16          PropertyProblemCount;
3415                 PropertyProblem PropertyProblem[PropertyProblemCount];
3416         } SetPropertiesNoReplicate_repl;
3417
3418         /*************************/
3419         /* EcDoRpc Function 0x7a */
3420         typedef [flag(NDR_NOALIGN)] struct {
3421                 mapi_SPropTagArray      PropertyTags;
3422         } DeletePropertiesNoReplicate_req;
3423
3424         typedef [flag(NDR_NOALIGN)] struct {
3425                 uint16          PropertyProblemCount;
3426                 PropertyProblem PropertyProblem[PropertyProblemCount];
3427         } DeletePropertiesNoReplicate_repl;
3428
3429         /*************************/
3430         /* EcDoRpc Function 0x7b */
3431         typedef [public,bitmap32bit] bitmap {
3432                 STORE_HAS_SEARCHES              = 0x010000000
3433         } StoreState;
3434
3435         typedef [flag(NDR_NOALIGN)] struct {
3436         } GetStoreState_req;
3437
3438         typedef [flag(NDR_NOALIGN)] struct {
3439                 StoreState      StoreState;
3440         } GetStoreState_repl;
3441
3442         /*************************/
3443         /* EcDoRpc Function 0x7e */
3444         typedef [flag(NDR_NOALIGN)] struct {
3445                 uint8           handle_idx;
3446                 boolean8        IsContentsCollector;
3447         } SyncOpenCollector_req;
3448
3449         typedef [flag(NDR_NOALIGN)] struct {
3450         } SyncOpenCollector_repl;
3451
3452         /*************************/
3453         /* EcDoRpc Function 0x7f */
3454         typedef [flag(NDR_NOALIGN)] struct {
3455                 uint32          IdCount;
3456         } GetLocalReplicaIds_req;
3457
3458         typedef [flag(NDR_NOALIGN)] struct {
3459                 GUID            ReplGuid;
3460                 uint8           GlobalCount[6];
3461         } GetLocalReplicaIds_repl;
3462
3463         /*************************/
3464         /* EcDoRpc Function 0x80 */
3465 //      typedef [flag(NDR_NOALIGN)] struct {
3466 //              uint16          MessageSize;
3467 //              uint8           MessageId[MessageSize];
3468 //              boolean8        MarkAsRead;
3469 //      } MessageReadStates;
3470
3471         typedef [flag(NDR_NOALIGN)] struct {
3472                 uint16          MessageReadStateSize;
3473                 [subcontext(0),subcontext_size(MessageReadStateSize),flag(NDR_REMAINING)] DATA_BLOB MessageStates;
3474         } SyncImportReadStateChanges_req;
3475
3476         typedef [flag(NDR_NOALIGN)] struct {
3477         } SyncImportReadStateChanges_repl;
3478
3479         /*************************/
3480         /* EcDoRpc Function 0x81 */
3481         typedef [flag(NDR_NOALIGN)] struct {
3482         } ResetTable_req;
3483
3484         typedef [flag(NDR_NOALIGN)] struct {
3485         } ResetTable_repl;
3486
3487         /*************************/
3488         /* EcDoRpc Function 0x82 */
3489         typedef [flag(NDR_NOALIGN)] struct {
3490                 uint8           handle_idx;
3491         } SyncGetTransferState_req;
3492
3493         typedef [flag(NDR_NOALIGN)] struct {
3494         } SyncGetTransferState_repl;
3495
3496         /*************************/
3497         /* EcDoRpc Function 0x86 */
3498         typedef [flag(NDR_NOALIGN)] struct {
3499                 uint16          version[3];
3500         } TellVersion_req;
3501
3502         typedef [flag(NDR_NOALIGN)] struct {
3503         } TellVersion_repl;
3504
3505         /*************************/
3506         /* EcDoRpc Function 0x87 */
3507         typedef [flag(NDR_NOALIGN)] struct {
3508                 uint8           handle_idx;
3509                 asclstr         name;
3510         } OpenPublicFolderByName_req; 
3511
3512         typedef [flag(NDR_NOALIGN)] struct {
3513                 boolean8                                HasRules;
3514                 boolean8                                IsGhosted;
3515                 [switch_is(IsGhosted)] IsGhosted        Ghost;
3516         } OpenPublicFolderByName_repl;
3517
3518         /*************************/
3519         /* EcDoRpc Function 0x88 */
3520         typedef [flag(NDR_NOALIGN)] struct {
3521                 GUID    NotificationGuid;
3522         } SetSyncNotificationGuid_req;
3523
3524         typedef [flag(NDR_NOALIGN)] struct {
3525         } SetSyncNotificationGuid_repl;
3526
3527         /*************************/
3528         /* EcDoRpc Function 0x89 */
3529         typedef [flag(NDR_NOALIGN)] struct {
3530                 SBinary_short   bookmark;
3531         } FreeBookmark_req;
3532
3533         typedef [flag(NDR_NOALIGN)] struct {
3534         } FreeBookmark_repl;
3535
3536         /*************************/
3537         /* EcDoRpc Function 0x90 */
3538         typedef [flag(NDR_NOALIGN)] struct {
3539                 [subcontext(2), flag(NDR_REMAINING)] DATA_BLOB  data;
3540         } WriteAndCommitStream_req;
3541
3542
3543         typedef [flag(NDR_NOALIGN)] struct {
3544                 uint16          WrittenSize;
3545         } WriteAndCommitStream_repl;
3546
3547         /**************************/
3548         /* EcDoRpc Function 0x91  */
3549         typedef [flag(NDR_NOALIGN)] struct {
3550                 boolean8        WantAsynchronous;
3551                 boolean8        NotifyNonRead;
3552                 uint16          MessageIdCount;
3553                 hyper           MessageIds[MessageIdCount];
3554         } HardDeleteMessages_req;
3555
3556         typedef [flag(NDR_NOALIGN)] struct {
3557                 boolean8        PartialCompletion;
3558         } HardDeleteMessages_repl;
3559
3560         /*************************/
3561         /* EcDoRpc Function 0x92 */
3562         typedef [flag(NDR_NOALIGN)] struct {
3563                 boolean8        WantAsynchronous;
3564                 boolean8        WantDeleteAssociated;
3565         } HardDeleteMessagesAndSubfolders_req;
3566
3567         typedef [flag(NDR_NOALIGN)] struct {
3568                 boolean8        PartialCompletion;
3569         } HardDeleteMessagesAndSubfolders_repl;
3570
3571         /*************************/
3572         /* EcDoRpc Function 0xFE */
3573         typedef [public,bitmap8bit] bitmap {
3574                 LogonPrivate    = 0x1,
3575                 UnderCover      = 0x2,
3576                 Ghosted         = 0x4,
3577                 SpIProcess      = 0x8
3578         } LogonFlags;
3579
3580         typedef [public,bitmap32bit] bitmap {
3581                 PUBLIC                          = 0x2,
3582                 HOME_LOGON                      = 0x4,
3583                 TAKE_OWNERSHIP                  = 0x8,
3584                 ALTERNATE_SERVER                = 0x100,
3585                 IGNORE_HOME_MDB                 = 0x200,
3586                 NO_MAIL                         = 0x400,
3587                 USE_PER_MDB_REPLID_MAPPING      = 0x010000000
3588         } OpenFlags;
3589
3590         typedef [enum8bit] enum {
3591                 DayOfWeek_Sunday        = 0x0,
3592                 DayOfWeek_Monday        = 0x1,
3593                 DayOfWeek_Tuesday       = 0x2,
3594                 DayOfWeek_Wednesday     = 0x3,
3595                 DayOfWeek_Thursday      = 0x4,
3596                 DayOfWeek_Friday        = 0x5,
3597                 DayOfWeek_Saturday      = 0x6
3598         } DayOfWeek;
3599
3600         typedef [flag(NDR_NOALIGN)] struct {
3601                 uint8           Seconds;
3602                 uint8           Minutes;
3603                 uint8           Hour;
3604                 DayOfWeek       DayOfWeek;
3605                 uint8           Day;
3606                 uint8           Month;
3607                 uint16          Year;
3608         } LogonTime;
3609
3610         typedef [bitmap8bit] bitmap {
3611                 ResponseFlags_Reserved          = 0x1,
3612                 ResponseFlags_OwnerRight        = 0x2,
3613                 ResponseFlags_SendAsRight       = 0x4,
3614                 ResponseFlags_OOF               = 0x10
3615         } ResponseFlags;
3616
3617         typedef [flag(NDR_NOALIGN)] struct {
3618                 hyper                   FolderIds[13];
3619                 uint16                  ReplId;
3620                 GUID                    Guid;
3621                 GUID                    PerUserGuid;
3622         } store_pf;
3623
3624         typedef [flag(NDR_NOALIGN)] struct {
3625                 hyper                   FolderIds[13];
3626                 ResponseFlags           ResponseFlags;
3627                 GUID                    MailboxGuid;
3628                 uint16                  ReplId;
3629                 GUID                    ReplGUID;
3630                 LogonTime               LogonTime;
3631                 hyper                   GwartTime;
3632                 StoreState              StoreState;
3633         } store_mailbox;
3634
3635         typedef [nodiscriminant] union {
3636                 [case(0x0)]             store_pf        store_pf;
3637                 [case(0x3)]             store_mailbox   store_mailbox;
3638                 [case(0x9)]             store_mailbox   store_mailbox;
3639                 [case(0x19)]            store_mailbox   store_mailbox;
3640                 [case(LogonPrivate)]    store_mailbox   store_mailbox;
3641         } LogonType;
3642
3643         typedef [nopush,flag(NDR_NOALIGN)] struct {
3644                 LogonFlags      LogonFlags;
3645                 OpenFlags       OpenFlags;
3646                 StoreState      StoreState;
3647                 ascstr3         EssDN;
3648         } Logon_req;
3649
3650         typedef [flag(NDR_NOALIGN)] struct {
3651                 LogonFlags                              LogonFlags;
3652                 [switch_is(LogonFlags)] LogonType       LogonType;
3653         } Logon_repl;
3654
3655         /* Logon redirect response buffer (error_code == ecWrongServer) */
3656         typedef [public,flag(NDR_NOALIGN)] struct {
3657                 LogonFlags      LogonFlags;
3658                 uint8           ServerNameSize;
3659                 astring         ServerName;
3660         } Logon_redirect;
3661
3662         /*************************/
3663         /* EcDoRpc Function 0xA5 */
3664         typedef [flag(NDR_NOALIGN)] struct {
3665                 SBinary_short   bin;
3666         } proxypack_req;
3667
3668         typedef [flag(NDR_NOALIGN)] struct {
3669                 SBinary_short   bin;
3670         } proxypack_repl;
3671
3672         typedef [public, nodiscriminant] union {
3673                 [case(op_MAPI_Release)] Release_req mapi_Release;
3674                 [case(op_MAPI_OpenFolder)] OpenFolder_req mapi_OpenFolder;
3675                 [case(op_MAPI_OpenMessage)] OpenMessage_req mapi_OpenMessage;
3676                 [case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_req mapi_GetHierarchyTable;
3677                 [case(op_MAPI_GetContentsTable)] GetContentsTable_req mapi_GetContentsTable;
3678                 [case(op_MAPI_CreateMessage)] CreateMessage_req mapi_CreateMessage;
3679                 [case(op_MAPI_GetProps)] GetProps_req mapi_GetProps;
3680                 [case(op_MAPI_GetPropsAll)] GetPropsAll_req mapi_GetPropsAll;
3681                 [case(op_MAPI_GetPropList)] GetPropList_req mapi_GetPropList;
3682                 [case(op_MAPI_SetProps)] SetProps_req mapi_SetProps;
3683                 [case(op_MAPI_DeleteProps)] DeleteProps_req mapi_DeleteProps;
3684                 [case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_req mapi_SaveChangesMessage;
3685                 [case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_req mapi_SetMessageReadFlag;
3686                 [case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_req mapi_ReloadCachedInformation;
3687                 [case(op_MAPI_SetColumns)] SetColumns_req mapi_SetColumns;
3688                 [case(op_MAPI_SortTable)] SortTable_req mapi_SortTable;
3689                 [case(op_MAPI_Restrict)] Restrict_req mapi_Restrict;
3690                 [case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_req mapi_RemoveAllRecipients;
3691                 [case(op_MAPI_ModifyRecipients)] ModifyRecipients_req mapi_ModifyRecipients;
3692                 [case(op_MAPI_ReadRecipients)] ReadRecipients_req mapi_ReadRecipients;
3693                 [case(op_MAPI_QueryRows)] QueryRows_req mapi_QueryRows;
3694                 [case(op_MAPI_GetStatus)] GetStatus_req mapi_GetStatus;
3695                 [case(op_MAPI_QueryPosition)] QueryPosition_req mapi_QueryPosition;
3696                 [case(op_MAPI_SeekRow)] SeekRow_req mapi_SeekRow;
3697                 [case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_req mapi_SeekRowBookmark;
3698                 [case(op_MAPI_SeekRowApprox)] SeekRowApprox_req mapi_SeekRowApprox;
3699                 [case(op_MAPI_CreateBookmark)] CreateBookmark_req mapi_CreateBookmark;
3700                 [case(op_MAPI_CreateFolder)] CreateFolder_req mapi_CreateFolder;
3701                 [case(op_MAPI_DeleteFolder)] DeleteFolder_req mapi_DeleteFolder;
3702                 [case(op_MAPI_DeleteMessages)] DeleteMessages_req mapi_DeleteMessages;
3703                 [case(op_MAPI_GetMessageStatus)] GetMessageStatus_req mapi_GetMessageStatus;
3704                 [case(op_MAPI_SetMessageStatus)] SetMessageStatus_req mapi_SetMessageStatus;
3705                 [case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_req mapi_GetAttachmentTable;
3706                 [case(op_MAPI_OpenAttach)] OpenAttach_req mapi_OpenAttach;
3707                 [case(op_MAPI_CreateAttach)] CreateAttach_req mapi_CreateAttach;
3708                 [case(op_MAPI_DeleteAttach)] DeleteAttach_req mapi_DeleteAttach;
3709                 [case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_req mapi_SaveChangesAttachment;
3710                 [case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_req mapi_SetReceiveFolder;
3711                 [case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_req mapi_GetReceiveFolder;
3712                 [case(op_MAPI_RegisterNotification)] RegisterNotification_req mapi_RegisterNotification;
3713                 [case(op_MAPI_OpenStream)] OpenStream_req mapi_OpenStream;
3714                 [case(op_MAPI_ReadStream)] ReadStream_req mapi_ReadStream;
3715                 [case(op_MAPI_WriteStream)] WriteStream_req mapi_WriteStream;
3716                 [case(op_MAPI_SeekStream)] SeekStream_req mapi_SeekStream;
3717                 [case(op_MAPI_SetStreamSize)] SetStreamSize_req mapi_SetStreamSize;
3718                 [case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_req mapi_SetSearchCriteria;
3719                 [case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_req mapi_GetSearchCriteria;
3720                 [case(op_MAPI_SubmitMessage)] SubmitMessage_req mapi_SubmitMessage;
3721                 [case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_req mapi_MoveCopyMessages;
3722                 [case(op_MAPI_AbortSubmit)] AbortSubmit_req mapi_AbortSubmit;
3723                 [case(op_MAPI_MoveFolder)] MoveFolder_req mapi_MoveFolder;
3724                 [case(op_MAPI_CopyFolder)] CopyFolder_req mapi_CopyFolder;
3725                 [case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_req mapi_QueryColumnsAll;
3726                 [case(op_MAPI_Abort)] Abort_req mapi_Abort;
3727                 [case(op_MAPI_CopyTo)] CopyTo_req mapi_CopyTo;
3728                 [case(op_MAPI_CopyToStream)] CopyToStream_req mapi_CopyToStream;
3729                 [case(op_MAPI_CloneStream)] CloneStream_req mapi_CloneStream;
3730                 [case(op_MAPI_GetPermissionsTable)] GetPermissionsTable_req mapi_GetPermissionsTable;
3731                 [case(op_MAPI_GetRulesTable)] GetRulesTable_req mapi_GetRulesTable;
3732                 [case(op_MAPI_ModifyPermissions)] ModifyPermissions_req mapi_ModifyPermissions;
3733                 [case(op_MAPI_ModifyRules)] ModifyRules_req mapi_ModifyRules;
3734                 [case(op_MAPI_GetOwningServers)] GetOwningServers_req mapi_GetOwningServers;
3735                 [case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_req mapi_LongTermIdFromId;
3736                 [case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_req mapi_IdFromLongTermId;
3737                 [case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_req mapi_PublicFolderIsGhosted;
3738                 [case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_req mapi_OpenEmbeddedMessage;
3739                 [case(op_MAPI_SetSpooler)] SetSpooler_req mapi_SetSpooler;
3740                 [case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_req mapi_SpoolerLockMessage;
3741                 [case(op_MAPI_AddressTypes)] AddressTypes_req mapi_AddressTypes;
3742                 [case(op_MAPI_TransportSend)] TransportSend_req mapi_TransportSend;
3743                 [case(op_MAPI_FastTransferSourceCopyMessages)] FastTransferSourceCopyMessages_req mapi_FastTransferSourceCopyMessages;
3744                 [case(op_MAPI_FastTransferSourceCopyFolder)] FastTransferSourceCopyFolder_req mapi_FastTransferSourceCopyFolder;
3745                 [case(op_MAPI_FastTransferSourceCopyTo)] FastTransferSourceCopyTo_req mapi_FastTransferSourceCopyTo;
3746                 [case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_req mapi_FastTransferSourceGetBuffer;
3747                 [case(op_MAPI_FindRow)] FindRow_req mapi_FindRow;
3748                 [case(op_MAPI_Progress)] Progress_req mapi_Progress;
3749                 [case(op_MAPI_TransportNewMail)] TransportNewMail_req mapi_TransportNewMail;
3750                 [case(op_MAPI_GetValidAttachments)] GetValidAttachments_req mapi_GetValidAttachments;
3751                 [case(op_MAPI_FastTransferDestConfigure)] FastTransferDestinationConfigure_req mapi_FastTransferDestinationConfigure;
3752                 [case(op_MAPI_FastTransferDestPutBuffer)] FastTransferDestinationPutBuffer_req mapi_FastTransferDestinationPutBuffer;
3753                 [case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_req mapi_GetNamesFromIDs;
3754                 [case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_req mapi_GetIDsFromNames;
3755                 [case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_req mapi_UpdateDeferredActionMessages;
3756                 [case(op_MAPI_EmptyFolder)] EmptyFolder_req mapi_EmptyFolder;
3757                 [case(op_MAPI_ExpandRow)] ExpandRow_req mapi_ExpandRow;
3758                 [case(op_MAPI_CollapseRow)] CollapseRow_req mapi_CollapseRow;
3759                 [case(op_MAPI_LockRegionStream)] LockRegionStream_req mapi_LockRegionStream;
3760                 [case(op_MAPI_UnlockRegionStream)] UnlockRegionStream_req mapi_UnlockRegionStream;
3761                 [case(op_MAPI_CommitStream)] CommitStream_req mapi_CommitStream;
3762                 [case(op_MAPI_GetStreamSize)] GetStreamSize_req mapi_GetStreamSize;
3763                 [case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_req mapi_QueryNamedProperties;
3764                 [case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_req mapi_GetPerUserLongTermIds;
3765                 [case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_req mapi_GetPerUserGuid;
3766                 [case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_req mapi_ReadPerUserInformation;
3767                 [case(op_MAPI_WritePerUserInformation)] WritePerUserInformation_req mapi_WritePerUserInformation;
3768                 [case(op_MAPI_SetReadFlags)] SetReadFlags_req mapi_SetReadFlags;
3769                 [case(op_MAPI_CopyProperties)] CopyProperties_req mapi_CopyProperties;
3770                 [case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_req mapi_GetReceiveFolderTable;
3771                 [case(op_MAPI_FastTransferSourceCopyProps)] FastTransferSourceCopyProperties_req mapi_FastTransferSourceCopyProperties;
3772                 [case(op_MAPI_GetCollapseState)] GetCollapseState_req mapi_GetCollapseState;
3773                 [case(op_MAPI_SetCollapseState)] SetCollapseState_req mapi_SetCollapseState;
3774                 [case(op_MAPI_GetTransportFolder)] GetTransportFolder_req mapi_GetTransportFolder;
3775                 [case(op_MAPI_OptionsData)] OptionsData_req mapi_OptionsData;
3776                 [case(op_MAPI_SyncConfigure)] SyncConfigure_req mapi_SyncConfigure;
3777                 [case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_req mapi_SyncImportMessageChange;
3778                 [case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_req mapi_SyncImportHierarchyChange;
3779                 [case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_req mapi_SyncImportDeletes;
3780                 [case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_req mapi_SyncUploadStateStreamBegin;
3781                 [case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_req mapi_SyncUploadStateStreamContinue;
3782                 [case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_req mapi_SyncUploadStateStreamEnd;
3783                 [case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_req mapi_SyncImportMessageMove;
3784                 [case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_req mapi_SetPropertiesNoReplicate;
3785                 [case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_req mapi_DeletePropertiesNoReplicate;
3786                 [case(op_MAPI_GetStoreState)] GetStoreState_req mapi_GetStoreState;
3787                 [case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_req mapi_SyncOpenCollector;
3788                 [case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_req mapi_GetLocalReplicaIds;
3789                 [case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_req mapi_SyncImportReadStateChanges;
3790                 [case(op_MAPI_ResetTable)] ResetTable_req mapi_ResetTable;
3791                 [case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_req mapi_SyncGetTransferState;
3792                 [case(op_MAPI_TellVersion)] TellVersion_req mapi_TellVersion;
3793                 [case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_req mapi_OpenPublicFolderByName;
3794                 [case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_req mapi_SetSyncNotificationGuid;
3795                 [case(op_MAPI_FreeBookmark)] FreeBookmark_req mapi_FreeBookmark;
3796                 [case(op_MAPI_WriteAndCommitStream)] WriteAndCommitStream_req mapi_WriteAndCommitStream;
3797                 [case(op_MAPI_HardDeleteMessages)] HardDeleteMessages_req mapi_HardDeleteMessages;
3798                 [case(op_MAPI_HardDeleteMessagesAndSubfolders)] HardDeleteMessagesAndSubfolders_req mapi_HardDeleteMessagesAndSubfolders;
3799                 [case(op_MAPI_Logon)] Logon_req mapi_Logon;
3800                 [case(op_MAPI_proxypack)] proxypack_req mapi_proxypack;
3801         } EcDoRpc_MAPI_REQ_UNION;
3802
3803         typedef [public, nodiscriminant] union {
3804                 [case(op_MAPI_Release)] Release_repl mapi_Release;
3805                 [case(op_MAPI_OpenFolder)] OpenFolder_repl mapi_OpenFolder;
3806                 [case(op_MAPI_OpenMessage)] OpenMessage_repl mapi_OpenMessage;
3807                 [case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_repl mapi_GetHierarchyTable;
3808                 [case(op_MAPI_GetContentsTable)] GetContentsTable_repl mapi_GetContentsTable;
3809                 [case(op_MAPI_CreateMessage)] CreateMessage_repl mapi_CreateMessage;
3810                 [case(op_MAPI_GetProps)] GetProps_repl mapi_GetProps;
3811                 [case(op_MAPI_GetPropsAll)] GetPropsAll_repl mapi_GetPropsAll;
3812                 [case(op_MAPI_GetPropList)] GetPropList_repl mapi_GetPropList;
3813                 [case(op_MAPI_SetProps)] SetProps_repl mapi_SetProps;
3814                 [case(op_MAPI_DeleteProps)] DeleteProps_repl mapi_DeleteProps;
3815                 [case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_repl mapi_SaveChangesMessage;
3816                 [case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_repl mapi_RemoveAllRecipients;
3817                 [case(op_MAPI_ModifyRecipients)] ModifyRecipients_repl mapi_ModifyRecipients;
3818                 [case(op_MAPI_ReadRecipients)] ReadRecipients_repl mapi_ReadRecipients;
3819                 [case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_repl mapi_SetMessageReadFlag;
3820                 [case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_repl mapi_ReloadCachedInformation;
3821                 [case(op_MAPI_SetColumns)] SetColumns_repl mapi_SetColumns;
3822                 [case(op_MAPI_SortTable)] SortTable_repl mapi_SortTable;
3823                 [case(op_MAPI_Restrict)] Restrict_repl mapi_Restrict;
3824                 [case(op_MAPI_QueryRows)] QueryRows_repl mapi_QueryRows;
3825                 [case(op_MAPI_GetStatus)] GetStatus_repl mapi_GetStatus;
3826                 [case(op_MAPI_QueryPosition)] QueryPosition_repl mapi_QueryPosition;
3827                 [case(op_MAPI_SeekRow)] SeekRow_repl mapi_SeekRow;
3828                 [case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_repl mapi_SeekRowBookmark;
3829                 [case(op_MAPI_SeekRowApprox)] SeekRowApprox_repl mapi_SeekRowApprox;
3830                 [case(op_MAPI_CreateBookmark)] CreateBookmark_repl mapi_CreateBookmark;
3831                 [case(op_MAPI_CreateFolder)] CreateFolder_repl mapi_CreateFolder;
3832                 [case(op_MAPI_DeleteFolder)] DeleteFolder_repl mapi_DeleteFolder;
3833                 [case(op_MAPI_DeleteMessages)] DeleteMessages_repl mapi_DeleteMessages;
3834                 [case(op_MAPI_SetMessageStatus)] SetMessageStatus_repl mapi_SetMessageStatus;
3835                 [case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_repl mapi_GetAttachmentTable;
3836                 [case(op_MAPI_OpenAttach)] OpenAttach_repl mapi_OpenAttach;
3837                 [case(op_MAPI_CreateAttach)] CreateAttach_repl mapi_CreateAttach;
3838                 [case(op_MAPI_DeleteAttach)] DeleteAttach_repl mapi_DeleteAttach;
3839                 [case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_repl mapi_SaveChangesAttachment;
3840                 [case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_repl mapi_SetReceiveFolder;
3841                 [case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_repl mapi_GetReceiveFolder;
3842                 [case(op_MAPI_RegisterNotification)] RegisterNotification_repl mapi_RegisterNotification;
3843                 [case(op_MAPI_Notify)] Notify_repl mapi_Notify;
3844                 [case(op_MAPI_OpenStream)] OpenStream_repl mapi_OpenStream;
3845                 [case(op_MAPI_ReadStream)] ReadStream_repl mapi_ReadStream;
3846                 [case(op_MAPI_WriteStream)] WriteStream_repl mapi_WriteStream;
3847                 [case(op_MAPI_SeekStream)] SeekStream_repl mapi_SeekStream;
3848                 [case(op_MAPI_SetStreamSize)] SetStreamSize_repl mapi_SetStreamSize;
3849                 [case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_repl mapi_SetSearchCriteria;
3850                 [case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_repl mapi_GetSearchCriteria;
3851                 [case(op_MAPI_SubmitMessage)] SubmitMessage_repl mapi_SubmitMessage;
3852                 [case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_repl mapi_MoveCopyMessages;
3853                 [case(op_MAPI_AbortSubmit)] AbortSubmit_repl mapi_AbortSubmit;
3854                 [case(op_MAPI_MoveFolder)] MoveFolder_repl mapi_MoveFolder;
3855                 [case(op_MAPI_CopyFolder)] CopyFolder_repl mapi_CopyFolder;
3856                 [case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_repl mapi_QueryColumnsAll;
3857                 [case(op_MAPI_Abort)] Abort_repl mapi_Abort;
3858                 [case(op_MAPI_CopyTo)] CopyTo_repl mapi_CopyTo;
3859                 [case(op_MAPI_CopyToStream)] CopyToStream_repl mapi_CopyToStream;
3860                 [case(op_MAPI_CloneStream)] CloneStream_repl mapi_CloneStream;
3861                 [case(op_MAPI_GetPermissionsTable)] GetPermissionsTable_repl mapi_GetPermissionsTable;
3862                 [case(op_MAPI_GetRulesTable)] GetRulesTable_repl mapi_GetRulesTable;
3863                 [case(op_MAPI_ModifyPermissions)] ModifyPermissions_repl mapi_ModifyPermissions;
3864                 [case(op_MAPI_ModifyRules)] ModifyRules_repl mapi_ModifyRules;
3865                 [case(op_MAPI_GetOwningServers)] GetOwningServers_repl mapi_GetOwningServers;
3866                 [case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_repl mapi_LongTermIdFromId;
3867                 [case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_repl mapi_IdFromLongTermId;
3868                 [case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_repl mapi_PublicFolderIsGhosted;
3869                 [case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_repl mapi_OpenEmbeddedMessage;
3870                 [case(op_MAPI_SetSpooler)] SetSpooler_repl mapi_SetSpooler;
3871                 [case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_repl mapi_SpoolerLockMessage;
3872                 [case(op_MAPI_AddressTypes)] AddressTypes_repl mapi_AddressTypes;
3873                 [case(op_MAPI_TransportSend)] TransportSend_repl mapi_TransportSend;
3874                 [case(op_MAPI_FastTransferSourceCopyMessages)] FastTransferSourceCopyMessages_repl mapi_FastTransferSourceCopyMessages;
3875                 [case(op_MAPI_FastTransferSourceCopyFolder)] FastTransferSourceCopyFolder_repl mapi_FastTransferSourceCopyFolder;
3876                 [case(op_MAPI_FastTransferSourceCopyTo)] FastTransferSourceCopyTo_repl mapi_FastTransferSourceCopyTo;
3877                 [case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_repl mapi_FastTransferSourceGetBuffer;
3878                 [case(op_MAPI_FindRow)] FindRow_repl mapi_FindRow;
3879                 [case(op_MAPI_Progress)] Progress_repl mapi_Progress;
3880                 [case(op_MAPI_TransportNewMail)] TransportNewMail_repl mapi_TransportNewMail;
3881                 [case(op_MAPI_GetValidAttachments)] GetValidAttachments_repl mapi_GetValidAttachments;
3882                 [case(op_MAPI_FastTransferDestConfigure)] FastTransferDestinationConfigure_repl mapi_FastTransferDestinationConfigure;
3883                 [case(op_MAPI_FastTransferDestPutBuffer)] FastTransferDestinationPutBuffer_repl mapi_FastTransferDestinationPutBuffer;
3884                 [case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_repl mapi_GetNamesFromIDs;
3885                 [case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_repl mapi_GetIDsFromNames;
3886                 [case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_repl mapi_UpdateDeferredActionMessages;
3887                 [case(op_MAPI_EmptyFolder)] EmptyFolder_repl mapi_EmptyFolder;
3888                 [case(op_MAPI_ExpandRow)] ExpandRow_repl mapi_ExpandRow;
3889                 [case(op_MAPI_CollapseRow)] CollapseRow_repl mapi_CollapseRow;
3890                 [case(op_MAPI_LockRegionStream)] LockRegionStream_repl mapi_LockRegionStream;
3891                 [case(op_MAPI_UnlockRegionStream)] UnlockRegionStream_repl mapi_UnlockRegionStream;
3892                 [case(op_MAPI_CommitStream)] CommitStream_repl mapi_CommitStream;
3893                 [case(op_MAPI_GetStreamSize)] GetStreamSize_repl mapi_GetStreamSize;
3894                 [case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_repl mapi_QueryNamedProperties;
3895                 [case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_repl mapi_GetPerUserLongTermIds;
3896                 [case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_repl mapi_GetPerUserGuid;
3897                 [case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_repl mapi_ReadPerUserInformation;
3898                 [case(op_MAPI_WritePerUserInformation)] WritePerUserInformation_repl mapi_WritePerUserInformation;
3899                 [case(op_MAPI_SetReadFlags)] SetReadFlags_repl mapi_SetReadFlags;
3900                 [case(op_MAPI_CopyProperties)] CopyProperties_repl mapi_CopyProperties;
3901                 [case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_repl mapi_GetReceiveFolderTable;
3902                 [case(op_MAPI_Pending)] Pending_repl mapi_Pending;
3903                 [case(op_MAPI_FastTransferSourceCopyProps)] FastTransferSourceCopyProperties_repl mapi_FastTransferSourceCopyProperties;
3904                 [case(op_MAPI_GetCollapseState)] GetCollapseState_repl mapi_GetCollapseState;
3905                 [case(op_MAPI_SetCollapseState)] SetCollapseState_repl mapi_SetCollapseState;
3906                 [case(op_MAPI_GetTransportFolder)] GetTransportFolder_repl mapi_GetTransportFolder;
3907                 [case(op_MAPI_OptionsData)] OptionsData_repl mapi_OptionsData;
3908                 [case(op_MAPI_SyncConfigure)] SyncConfigure_repl mapi_SyncConfigure;
3909                 [case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_repl mapi_SyncImportMessageChange;
3910                 [case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_repl mapi_SyncImportHierarchyChange;
3911                 [case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_repl mapi_SyncImportDeletes;
3912                 [case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_repl mapi_SyncUploadStateStreamBegin;
3913                 [case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_repl mapi_SyncUploadStateStreamContinue;
3914                 [case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_repl mapi_SyncUploadStateStreamEnd;
3915                 [case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_repl mapi_SyncImportMessageMove;
3916                 [case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_repl mapi_SetPropertiesNoReplicate;
3917                 [case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_repl mapi_DeletePropertiesNoReplicate;
3918                 [case(op_MAPI_GetStoreState)] GetStoreState_repl mapi_GetStoreState;
3919                 [case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_repl mapi_SyncOpenCollector;
3920                 [case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_repl mapi_GetLocalReplicaIds;
3921                 [case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_repl mapi_SyncImportReadStateChanges;
3922                 [case(op_MAPI_ResetTable)] ResetTable_repl mapi_ResetTable;
3923                 [case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_repl mapi_SyncGetTransferState;
3924                 [case(op_MAPI_TellVersion)] TellVersion_repl mapi_TellVersion;
3925                 [case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_repl mapi_OpenPublicFolderByName;
3926                 [case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_repl mapi_SetSyncNotificationGuid;
3927                 [case(op_MAPI_FreeBookmark)] FreeBookmark_repl mapi_FreeBookmark;
3928                 [case(op_MAPI_WriteAndCommitStream)] WriteAndCommitStream_repl mapi_WriteAndCommitStream;
3929                 [case(op_MAPI_HardDeleteMessages)] HardDeleteMessages_repl mapi_HardDeleteMessages;
3930                 [case(op_MAPI_HardDeleteMessagesAndSubfolders)] HardDeleteMessagesAndSubfolders_repl mapi_HardDeleteMessagesAndSubfolders;
3931                 [case(op_MAPI_Logon)] Logon_repl mapi_Logon;
3932                 [case(op_MAPI_proxypack)] proxypack_repl mapi_proxypack;
3933
3934         } EcDoRpc_MAPI_REPL_UNION;
3935
3936         typedef [public, nodiscriminant] union {
3937                 [case(op_MAPI_Logon)] Logon_redirect mapi_Logon;
3938                 [default];
3939         } EcDoRpc_MAPI_REPL_UNION_SPECIAL;
3940
3941         typedef [public,flag(NDR_NOALIGN)] struct {
3942                 uint8           opnum;
3943                 uint8           logon_id;
3944                 uint8           handle_idx;
3945                 [switch_is(opnum)] EcDoRpc_MAPI_REQ_UNION u;
3946         } EcDoRpc_MAPI_REQ;
3947
3948         typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
3949                 uint8           opnum;
3950                 uint8           handle_idx;
3951                 MAPISTATUS      error_code;
3952                 [switch_is(opnum)] EcDoRpc_MAPI_REPL_UNION u;
3953                 [switch_is(opnum)] EcDoRpc_MAPI_REPL_UNION_SPECIAL us;
3954         } EcDoRpc_MAPI_REPL;
3955
3956
3957         /*
3958           Abstract way to represent MAPI content
3959         */
3960
3961         typedef [public,nopull,nopush,noprint] struct {
3962                 uint32                  mapi_len;       /* whole mapi_data length */
3963                 uint16                  length;         /* content length */
3964                 EcDoRpc_MAPI_REQ        *mapi_req;
3965                 uint32                  *handles;       /* handles id array */
3966         } mapi_request;
3967
3968         typedef [public,nopull,nopush,noprint] struct {
3969                 uint32                  mapi_len;
3970                 uint16                  length;
3971                 EcDoRpc_MAPI_REPL       *mapi_repl;
3972                 uint32                  *handles;
3973         } mapi_response;
3974         
3975
3976         [public,nopull,nopush] MAPISTATUS EcDoRpc(
3977                 [in,out]                                                policy_handle   *handle,
3978                 [in,out]                                                uint32          size,
3979                 [in,out]                                                uint32          offset,
3980                 [in] [subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]    mapi_request    *mapi_request,
3981                 [out][subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]    mapi_response   *mapi_response,
3982                 [in,out]                                                uint16          *length,
3983                 [in]                                                    uint16          max_data
3984                 );
3985
3986         /*****************/
3987         /* Function 0x03 */
3988         void EcGetMoreRpc();
3989
3990         /*****************/
3991         /* Function 0x04 */
3992
3993         /*
3994           we could directly use a NOTIFKEY structure rather than
3995           a uint8 array, but this makes the IDL more robust
3996         
3997           sockaddr array is made of: 
3998            - family (unsigned short in) sa_family_t
3999            - address data sa_data[14];
4000          */
4001
4002         typedef struct {
4003                 uint16          cb;
4004                 uint8           ab[cb];
4005         } NOTIFKEY;
4006
4007         MAPISTATUS EcRRegisterPushNotification(
4008                [in,out] policy_handle                   *handle,
4009                [in] NotificationFlags                   ulEventMask,
4010                [in,size_is(cbContext)] uint8            rgbContext[*],
4011                [in] uint16                              cbContext,
4012                [in] uint32                              grbitAdviseBits,
4013                [in,size_is(cbCallbackAddress)] uint8    rgCallbackAddress[*],
4014                [in] uint16                              cbCallbackAddress,
4015                [out,ref] uint32                         *hNotification
4016                 );
4017
4018         /*****************/
4019         /* Function 0x05 */
4020         MAPISTATUS EcRUnregisterPushNotification(
4021                 [in,out]        policy_handle           *handle,
4022                 [in]            uint32                  unknown[2]
4023                 );
4024
4025         /*****************/
4026         /* Function 0x06 */
4027         void EcDummyRpc();
4028
4029         /*****************/
4030         /* Function 0x07 */
4031         void EcRGetDCName();
4032
4033         /*****************/
4034         /* Function 0x08 */
4035         void EcRNetGetDCName();
4036
4037         /*****************/
4038         /* Function 0x09 */
4039         void EcDoRpcExt();
4040
4041         /*****************/
4042         /* Function 0xa  */
4043         typedef [public,bitmap16bit] bitmap {
4044                 RHEF_Compressed         = 0x0001,
4045                 RHEF_XorMagic           = 0x0002,
4046                 RHEF_Last               = 0x0004
4047         } RPC_HEADER_EXT_Flags;
4048
4049         typedef [public] struct {
4050                 uint16                  Version;
4051                 RPC_HEADER_EXT_Flags    Flags;
4052                 uint16                  Size;
4053                 uint16                  SizeActual;
4054         } RPC_HEADER_EXT;
4055
4056         typedef [enum8bit,flag(NDR_PAHEX)] enum {
4057                 AUX_TYPE_PERF_REQUESTID         = 0x01,
4058                 AUX_TYPE_PERF_CLIENTDINFO       = 0x02,
4059                 AUX_TYPE_PERF_SERVERINFO        = 0x03,
4060                 AUX_TYPE_PERF_SESSIONINFO       = 0x04,
4061                 AUX_TYPE_PERF_DEFMDB_SUCCESS    = 0x05,
4062                 AUX_TYPE_PERF_DEFGC_SUCCESS     = 0x06,
4063                 AUX_TYPE_PERF_MDB_SUCCESS       = 0x07,
4064                 AUX_TYPE_PERF_GC_SUCCESS        = 0x08,
4065                 AUX_TYPE_PERF_FAILURE           = 0x09,
4066                 AUX_TYPE_CLIENT_CONTROL         = 0x0A,
4067                 AUX_TYPE_PERF_PROCESSINFO       = 0x0B,
4068                 AUX_TYPE_PERF_BG_DEFMDB_SUCCESS = 0x0C,
4069                 AUX_TYPE_PERF_BG_DEFGC_SUCCESS  = 0x0D,
4070                 AUX_TYPE_PERF_BG_MDB_SUCCESS    = 0x0E,
4071                 AUX_TYPE_PERF_BG_GC_SUCCESS     = 0x0F,
4072                 AUX_TYPE_PERF_BG_FAILURE        = 0x10,
4073                 AUX_TYPE_PERF_FG_DEFMDB_SUCCESS = 0x11,
4074                 AUX_TYPE_PERF_FG_DEFGC_SUCCESS  = 0x12,
4075                 AUX_TYPE_PERF_FG_MDB_SUCCESS    = 0x13,
4076                 AUX_TYPE_PERF_FG_GC_SUCCESS     = 0x14,
4077                 AUX_TYPE_PERF_FG_FAILURE        = 0x15,
4078                 AUX_TYPE_OSVERSIONINFO          = 0x16,
4079                 AUX_TYPE_EXORGINFO              = 0x17
4080         } AUX_HEADER_TYPE_1;
4081         
4082         typedef [enum8bit,flag(NDR_PAHEX)] enum {
4083                 AUX_TYPE_PERF_SESSIONINFO_2     = 0x04,
4084                 AUX_TYPE_PERF_MDB_SUCCESS_2     = 0x07,
4085                 AUX_TYPE_PERF_GC_SUCCESS_2      = 0x08,
4086                 AUX_TYPE_PERF_FAILURE_2         = 0x09
4087         } AUX_HEADER_TYPE_2;
4088
4089         typedef [public,enum8bit,flag(NDR_PAHEX)] enum {
4090                 AUX_VERSION_1   = 0x1,
4091                 AUX_VERSION_2   = 0x2
4092         } AUX_VERSION;
4093
4094         typedef [public,switch_type(uint8)] union {
4095                 [case(AUX_VERSION_1)] AUX_HEADER_TYPE_1 Type;
4096                 [case(AUX_VERSION_2)] AUX_HEADER_TYPE_2 Type_2;
4097                 [default];
4098         } AUX_HEADER_TYPE_ENUM;
4099
4100         /*************************/
4101         /* AUX_HEADER case (0x1) */
4102         typedef [flag(NDR_NOALIGN)] struct {
4103                 uint16          SessionID;
4104                 uint16          RequestID;
4105         } AUX_PERF_REQUESTID;
4106         
4107         /*************************/
4108         /* AUX_HEADER case (0x2) */
4109         typedef [public,enum16bit, flag(NDR_PAHEX)] enum {
4110                 CLIENTMODE_UNKNOWN      =       0x0,
4111                 CLIENTMODE_CLASSIC      =       0x1,
4112                 CLIENTMODE_CACHED       =       0x2
4113         } ClientMode;
4114
4115         typedef [public,flag(NDR_NOALIGN)] struct {
4116                 uint32          AdapterSpeed;
4117                 uint16          ClientID;
4118                 uint16          MachineNameOffset;
4119                 uint16          UserNameOffset;
4120                 uint16          ClientIPSize;
4121                 uint16          ClientIPOffset;
4122                 uint16          ClientIPMaskSize;
4123                 uint16          ClientIPMaskOffset;
4124                 uint16          AdapterNameOffset;
4125                 uint16          MacAddressSize;
4126                 uint16          MacAddressOffset;
4127                 ClientMode      ClientMode;
4128                 uint16          Reserved;
4129                 uint8           MacAddress[MacAddressSize];
4130                 uint8           ClientIP[ClientIPSize];
4131                 uint8           ClientIPMask[ClientIPMaskSize];
4132                 nstring         MachineName;
4133                 nstring         UserName;
4134                 nstring         AdapterName;
4135         } AUX_PERF_CLIENTINFO;
4136
4137         /*************************/
4138         /* AUX_HEADER case (0x3) */
4139         typedef [enum16bit,flag(NDR_PAHEX)] enum {
4140                 SERVERTYPE_UNKNOWN              = 0x0,
4141                 SERVERTYPE_PRIVATE              = 0x1,
4142                 SERVERTYPE_PUBLIC               = 0x2,
4143                 SERVERTYPE_DIRECTORY            = 0x3,
4144                 SERVERTYPE_REFERRAL             = 0x4
4145         } SERVERINFO_ServerType;
4146
4147         typedef [flag(NDR_NOALIGN)] struct {
4148                 uint16                  ServerID;
4149                 SERVERINFO_ServerType   ServerType;
4150                 uint16                  ServerDNOffset;
4151                 uint16                  ServerNameOffset;
4152                 nstring                 ServerDN;
4153                 nstring                 ServerName;
4154         } AUX_PERF_SERVERINFO;
4155
4156         /*************************/
4157         /* AUX_HEADER case (0x4) */
4158         typedef [flag(NDR_NOALIGN)] struct {
4159                 uint16          SessionID;
4160                 uint16          Reserved;
4161                 GUID            SessionGuid;
4162         } AUX_PERF_SESSIONINFO;
4163
4164         typedef [flag(NDR_NOALIGN)] struct {
4165                 uint16          SessionID;
4166                 uint16          Reserved;
4167                 GUID            SessionGuid;
4168                 uint32          ConnectionID;
4169         } AUX_PERF_SESSIONINFO_V2;
4170
4171         /**************************/
4172         /* AUX_HEADER case (0x5)  */
4173         /* AUX_HEADER case (0xC)  */
4174         /* AUX_HEADER case (0x11) */
4175         typedef [flag(NDR_NOALIGN)] struct {
4176                 uint32          TimeSinceRequest;
4177                 uint32          TimeToCompleteRequest;
4178                 uint16          RequestID;
4179                 uint16          Reserved;
4180         } AUX_PERF_DEFMDB_SUCCESS;
4181
4182         /**************************/
4183         /* AUX_HEADER case (0x6)  */
4184         /* AUX_HEADER case (0xD)  */
4185         typedef [flag(NDR_NOALIGN)] struct {
4186                 uint16          ServerID;
4187                 uint16          SessionID;
4188                 uint32          TimeSinceRequest;
4189                 uint32          TimeToCompleteRequest;
4190                 uint8           RequestOperation;
4191                 uint8           Reserved[3];
4192         } AUX_PERF_DEFGC_SUCCESS;
4193         
4194         /**************************/
4195         /* AUX_HEADER case (0x7)  */
4196         /* AUX_HEADER case (0xE)  */
4197         /* AUX_HEADER case (0x13) */
4198         typedef [flag(NDR_NOALIGN)] struct {
4199                 uint16          ClientID;
4200                 uint16          ServerID;
4201                 uint16          SessionID;
4202                 uint16          RequestID;
4203                 uint32          TimeSinceRequest;
4204                 uint32          TimeToCompleteRequest;
4205         } AUX_PERF_MDB_SUCCESS;
4206
4207         typedef [flag(NDR_NOALIGN)] struct {
4208                 uint16          ProcessID;
4209                 uint16          ClientID;
4210                 uint16          ServerID;
4211                 uint16          SessionID;
4212                 uint16          RequestID;
4213                 uint16          Reserved;
4214                 uint32          TimeSinceRequest;
4215                 uint32          TimeToCompleteRequest;
4216         } AUX_PERF_MDB_SUCCESS_V2;
4217
4218         /**************************/
4219         /* AUX_HEADER case (0x8)  */
4220         typedef [flag(NDR_NOALIGN)] struct {
4221                 uint16          ClientID;
4222                 uint16          ServerID;
4223                 uint16          SessionID;
4224                 uint16          Reserved_1;
4225                 uint32          TimeSinceRequest;
4226                 uint32          TimeToCompleteRequest;
4227                 uint8           RequestOperation;
4228                 uint8           Reserved_2[3];
4229         } AUX_PERF_GC_SUCCESS;
4230
4231         typedef [flag(NDR_NOALIGN)] struct {
4232                 uint16          ProcessID;
4233                 uint16          ClientID;
4234                 uint16          ServerID;
4235                 uint16          SessionID;
4236                 uint32          TimeSinceRequest;
4237                 uint32          TimeToCompleteRequest;
4238                 uint8           RequestOperation;
4239                 uint8           Reserved[3];
4240         } AUX_PERF_GC_SUCCESS_V2;
4241
4242         /**************************/
4243         /* AUX_HEADER case (0x9)  */
4244         typedef [flag(NDR_NOALIGN)] struct {
4245                 uint16          ClientID;
4246                 uint16          ServerID;
4247                 uint16          SessionID;
4248                 uint16          RequestID;
4249                 uint32          TimeSinceRequest;
4250                 uint32          TimeToFailRequest;
4251                 MAPISTATUS      ResultCode;
4252                 uint8           RequestOperation;
4253                 uint8           Reserved[3];
4254         } AUX_PERF_FAILURE;
4255
4256         typedef [flag(NDR_NOALIGN)] struct {
4257                 uint16          ProcessID;
4258                 uint16          ClientID;
4259                 uint16          ServerID;
4260                 uint16          SessionID;
4261                 uint16          RequestID;
4262                 uint16          Reserved_1;
4263                 uint32          TimeSinceRequest;
4264                 uint32          TimeToFailRequest;
4265                 MAPISTATUS      ResultCode;
4266                 uint8           RequestOperation;
4267                 uint8           Reserved_2[3];
4268         } AUX_PERF_FAILURE_V2;
4269
4270         /**************************/
4271         /* AUX_HEADER case (0xA)  */
4272         typedef [bitmap32bit] bitmap {
4273                 ENABLE_PERF_SENDTOSERVER        = 0x00000001,
4274                 ENABLE_PERF_SENDTOMAILBOX       = 0x00000002,
4275                 ENABLE_COMPRESSION              = 0x00000004,
4276                 ENABLE_HTTP_TUNNELING           = 0x00000008,
4277                 ENABLE_PERF_SENDGCDATA          = 0x00000010
4278         } CLIENT_CONTROL_EnableFlags;
4279
4280         typedef [flag(NDR_NOALIGN)] struct {
4281                 CLIENT_CONTROL_EnableFlags      EnableFlags;
4282                 uint32                          ExpiryTime;
4283         } AUX_CLIENT_CONTROL;
4284
4285         /*************************/
4286         /* AUX_HEADER case (0xB) */
4287         typedef [nodiscriminant] union {
4288                 [case(0x0)];
4289                 [default] nstring       ProcessName;
4290         } ProcessNameString;
4291
4292         typedef [flag(NDR_NOALIGN)] struct {
4293                 uint16          ProcessID;
4294                 uint16          Reserved1;
4295                 GUID            ProcessGuid;
4296                 uint16          ProcessNameOffset;
4297                 uint16          Reserved2;
4298                 [switch_is(ProcessNameOffset)] ProcessNameString ProcessName;
4299         } AUX_PERF_PROCESSINFO;
4300
4301         /**************************/
4302         /* AUX_HEADER case (0x16) */
4303         typedef [flag(NDR_NOALIGN)] struct {
4304                 uint32          OSVersionInfoSize;
4305                 uint32          MajorVersion;
4306                 uint32          MinorVersion;
4307                 uint32          BuildNumber;
4308                 [subcontext(0), subcontext_size(132), flag(NDR_NOALIGN|NDR_REMAINING)] DATA_BLOB Reserved_1;
4309                 uint16          ServicePackMajor;
4310                 uint16          ServicePackMinor;
4311                 uint32          Reserved_2;
4312         } AUX_OSVERSIONINFO;
4313
4314         /**************************/
4315         /* AUX_HEADER case (0x17) */
4316         typedef [bitmap32bit] bitmap {
4317                 PUBLIC_FOLDERS_ENABLED  = 0x00000001
4318         } EXORGINFO_OrgFlags;
4319
4320         typedef [flag(NDR_NOALIGN)] struct {
4321                 EXORGINFO_OrgFlags      OrgFlags;
4322         } AUX_EXORGINFO;
4323
4324         typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
4325                 [case(AUX_TYPE_PERF_REQUESTID)]         AUX_PERF_REQUESTID              AUX_PERF_REQUESTID;
4326           //            [case(AUX_TYPE_PERF_CLIENTDINFO)]       AUX_PERF_CLIENTINFO             AUX_PERF_CLIENTINFO;
4327                 [case(AUX_TYPE_PERF_SERVERINFO)]        AUX_PERF_SERVERINFO             AUX_PERF_SERVERINFO;
4328                 [case(AUX_TYPE_PERF_SESSIONINFO)]       AUX_PERF_SESSIONINFO            AUX_PERF_SESSIONINFO;
4329                 [case(AUX_TYPE_PERF_DEFMDB_SUCCESS)]    AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4330                 [case(AUX_TYPE_PERF_DEFGC_SUCCESS)]     AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4331                 [case(AUX_TYPE_PERF_MDB_SUCCESS)]       AUX_PERF_MDB_SUCCESS            AUX_PERF_MDB_SUCCESS;
4332                 [case(AUX_TYPE_PERF_GC_SUCCESS)]        AUX_PERF_GC_SUCCESS             AUX_PERF_GC_SUCCESS;
4333                 [case(AUX_TYPE_PERF_FAILURE)]           AUX_PERF_FAILURE                AUX_PERF_FAILURE;
4334                 [case(AUX_TYPE_CLIENT_CONTROL)]         AUX_CLIENT_CONTROL              AUX_CLIENT_CONTROL;
4335                 [case(AUX_TYPE_PERF_PROCESSINFO)]       AUX_PERF_PROCESSINFO            AUX_PERF_PROCESSINFO;
4336                 [case(AUX_TYPE_PERF_BG_DEFMDB_SUCCESS)] AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4337                 [case(AUX_TYPE_PERF_BG_DEFGC_SUCCESS)]  AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4338                 [case(AUX_TYPE_PERF_BG_MDB_SUCCESS)]    AUX_PERF_MDB_SUCCESS            AUX_PERF_MDB_SUCCESS;
4339                 [case(AUX_TYPE_PERF_BG_GC_SUCCESS)]     AUX_PERF_GC_SUCCESS             AUX_PERF_GC_SUCCESS;
4340                 [case(AUX_TYPE_PERF_BG_FAILURE)]        AUX_PERF_FAILURE                AUX_PERF_FAILURE;
4341                 [case(AUX_TYPE_PERF_FG_DEFMDB_SUCCESS)] AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4342                 [case(AUX_TYPE_PERF_FG_DEFGC_SUCCESS)]  AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4343                 [case(AUX_TYPE_PERF_FG_MDB_SUCCESS)]    AUX_PERF_MDB_SUCCESS            AUX_PERF_MDB_SUCCESS;
4344                 [case(AUX_TYPE_PERF_FG_GC_SUCCESS)]     AUX_PERF_GC_SUCCESS             AUX_PERG_GC_SUCCESS;
4345                 [case(AUX_TYPE_PERF_FG_FAILURE)]        AUX_PERF_FAILURE                AUX_PERF_FAILURE;
4346                 [case(AUX_TYPE_OSVERSIONINFO)]          AUX_OSVERSIONINFO               AUX_OSVERSIONINFO;
4347                 [case(AUX_TYPE_EXORGINFO)]              AUX_EXORGINFO                   AUX_EXORGINFO;
4348                 [default][flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB    Payload;
4349         } AUX_HEADER_TYPE_UNION_1;
4350
4351         typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
4352                 [case(AUX_TYPE_PERF_REQUESTID)]         AUX_PERF_REQUESTID              AUX_PERF_REQUESTID;
4353           //    [case(AUX_TYPE_PERF_CLIENTDINFO)]       AUX_PERF_CLIENTINFO             AUX_PERF_CLIENTINFO;
4354                 [case(AUX_TYPE_PERF_SERVERINFO)]        AUX_PERF_SERVERINFO             AUX_PERF_SERVERINFO;
4355                 [case(AUX_TYPE_PERF_SESSIONINFO_2)]     AUX_PERF_SESSIONINFO_V2         AUX_PERF_SESSIONINFO_V2;        /* V2 specific */
4356                 [case(AUX_TYPE_PERF_DEFMDB_SUCCESS)]    AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4357                 [case(AUX_TYPE_PERF_DEFGC_SUCCESS)]     AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4358                 [case(AUX_TYPE_PERF_MDB_SUCCESS_2)]     AUX_PERF_MDB_SUCCESS_V2         AUX_PERF_MDB_SUCCESS_V2;        /* V2 specific */
4359                 [case(AUX_TYPE_PERF_GC_SUCCESS_2)]      AUX_PERF_GC_SUCCESS_V2          AUX_PERF_GC_SUCCESS_V2;         /* V2 specific */
4360                 [case(AUX_TYPE_PERF_FAILURE_2)]         AUX_PERF_FAILURE_V2             AUX_PERF_FAILURE_V2;            /* V2 specific*/
4361                 [case(AUX_TYPE_CLIENT_CONTROL)]         AUX_CLIENT_CONTROL              AUX_CLIENT_CONTROL;
4362                 [case(AUX_TYPE_PERF_PROCESSINFO)]       AUX_PERF_PROCESSINFO            AUX_PERF_PROCESSINFO;
4363                 [case(AUX_TYPE_PERF_BG_DEFMDB_SUCCESS)] AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4364                 [case(AUX_TYPE_PERF_BG_DEFGC_SUCCESS)]  AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4365                 [case(AUX_TYPE_PERF_BG_MDB_SUCCESS)]    AUX_PERF_MDB_SUCCESS            AUX_PERF_MDB_SUCCESS;
4366                 [case(AUX_TYPE_PERF_BG_GC_SUCCESS)]     AUX_PERF_GC_SUCCESS             AUX_PERF_GC_SUCCESS;
4367                 [case(AUX_TYPE_PERF_BG_FAILURE)]        AUX_PERF_FAILURE                AUX_PERF_FAILURE;
4368                 [case(AUX_TYPE_PERF_FG_DEFMDB_SUCCESS)] AUX_PERF_DEFMDB_SUCCESS         AUX_PERF_DEFMDB_SUCCESS;
4369                 [case(AUX_TYPE_PERF_FG_DEFGC_SUCCESS)]  AUX_PERF_DEFGC_SUCCESS          AUX_PERF_DEFGC_SUCCESS;
4370                 [case(AUX_TYPE_PERF_FG_MDB_SUCCESS)]    AUX_PERF_MDB_SUCCESS            AUX_PERF_MDB_SUCCESS;
4371                 [case(AUX_TYPE_PERF_FG_GC_SUCCESS)]     AUX_PERF_GC_SUCCESS             AUX_PERG_GC_SUCCESS;
4372                 [case(AUX_TYPE_PERF_FG_FAILURE)]        AUX_PERF_FAILURE                AUX_PERF_FAILURE;
4373                 [case(AUX_TYPE_OSVERSIONINFO)]          AUX_OSVERSIONINFO               AUX_OSVERSIONINFO;
4374                 [case(AUX_TYPE_EXORGINFO)]              AUX_EXORGINFO                   AUX_EXORGINFO;
4375                 [default][flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB    Payload;
4376         } AUX_HEADER_TYPE_UNION_2;
4377
4378         typedef [public,nopull,noprint,flag(NDR_NOALIGN)] struct {
4379                 uint16                                                  Size;
4380                 AUX_VERSION                                             Version;
4381                 uint8                                                   Type;
4382                 [switch_is(Type)] AUX_HEADER_TYPE_UNION_1               Payload_1;
4383                 [switch_is(Type)] AUX_HEADER_TYPE_UNION_2               Payload_2;
4384         } AUX_HEADER;
4385
4386         typedef [public,nopull,noprint] struct {
4387                 RPC_HEADER_EXT                                                          RPC_HEADER_EXT;
4388                 [subcontext(0), subcontext_size(RPC_HEADER_EXT.Size)] AUX_HEADER        *AUX_HEADER;
4389         } mapi2k7_AuxInfo;
4390
4391
4392         [public,nopull,nopush,noprint] MAPISTATUS EcDoConnectEx(
4393                 [out]                           policy_handle                           *handle,
4394                 [in,string,charset(DOS)]        uint8                                   szUserDN[],
4395                 [in]                            uint32                                  ulFlags,
4396                 [in]                            uint32                                  ulConMod,
4397                 [in]                            uint32                                  cbLimit,
4398                 [in]                            uint32                                  ulCpid,
4399                 [in]                            uint32                                  ulLcidString,
4400                 [in]                            uint32                                  ulLcidSort,
4401                 [in]                            uint32                                  ulIcxrLink,
4402                 [in]                            uint16                                  usFCanConvertCodePages,
4403                 [out]                           uint32                                  *pcmsPollsMax,
4404                 [out]                           uint32                                  *pcRetry,
4405                 [out]                           uint32                                  *pcmsRetryDelay,
4406                 [out]                           uint32                                  *picxr,
4407                 [out,ref,string,charset(DOS)]uint8                                      **szDNPrefix,
4408                 [out,ref,string,charset(DOS)]uint8                                      **szDisplayName,
4409                 [in]                            uint16                                  rgwClientVersion[3],
4410                 [out]                           uint16                                  rgwServerVersion[3],
4411                 [out]                           uint16                                  rgwBestVersion[3],
4412                 [in,out]                        uint32                                  *pulTimeStamp,
4413                 [in,subcontext(4),flag(NDR_NOALIGN|NDR_REMAINING)] mapi2k7_AuxInfo      *rgbAuxIn,
4414                 [in]                            uint32                                  cbAuxIn,
4415                 [out, length_is(*pcbAuxOut), size_is(*pcbAuxOut)] mapi2k7_AuxInfo       *rgbAuxOut,
4416                 [in,out][range(0,0x1008)]       uint32                                  *pcbAuxOut
4417                 );
4418
4419         /*****************/
4420         /* Function 0xb  */
4421         typedef [public,bitmap32bit] bitmap {
4422                 pulFlags_NoCompression  = 0x00000001,
4423                 pulFlags_NoXorMagic     = 0x00000002,
4424                 pulFlags_Chain          = 0x00000004
4425         } pulFlags;
4426
4427         typedef [public,nopull] struct {
4428                 RPC_HEADER_EXT                                                  header;
4429                 [subcontext(0),flag(NDR_REMAINING|NDR_NOALIGN)] mapi_request    *mapi_request;
4430         } mapi2k7_request;
4431
4432         typedef [public,nopull] struct {
4433                 RPC_HEADER_EXT                                                  header;
4434                 [subcontext(0),flag(NDR_NOALIGN|NDR_REMAINING)] mapi_response   *mapi_response;
4435         } mapi2k7_response;
4436
4437         [public,noprint] MAPISTATUS EcDoRpcExt2(
4438                 [in,out]                                        policy_handle   *handle,
4439                 [in,out]                                        uint32          *pulFlags,
4440                 [in, size_is(cbIn)]                             uint8           rgbIn[],
4441                 [in]                                            uint32          cbIn,
4442                 [out, length_is(*pcbOut), size_is(*pcbOut)]     uint8           rgbOut[],
4443                 [in,out][range(0x0,0x40000)]                    uint32          *pcbOut,
4444                 [in, size_is(cbAuxIn)]                          uint8           rgbAuxIn[],
4445                 [in]                                            uint32          cbAuxIn,
4446                 [out, length_is(*pcbAuxOut), size_is(*pcbAuxOut)] uint32        rgbAuxOut[],
4447                 [in,out][range(0x0,0x1008)]                     uint32          *pcbAuxOut,
4448                 [out]                                           uint32          *pulTransTime
4449                 );
4450
4451         /*****************/
4452         /* Function 0xc  */
4453         void EcUnknown0xC();
4454
4455         /*****************/
4456         /* Function 0xd  */
4457         void EcUnknown0xD();
4458
4459         /*****************/
4460         /* Function 0xe  */
4461         [public] MAPISTATUS EcDoAsyncConnectEx(
4462                 [in] policy_handle      *handle,
4463                 [out] policy_handle     *async_handle
4464                 );
4465
4466 }
4467
4468 [
4469   uuid("5261574a-4572-206e-b268-6b199213b4e4"),
4470   pointer_default(unique),
4471   endpoint("ncacn_ip_tcp:"),
4472   version(0.01)
4473 ] interface exchange_async_emsmdb
4474 {
4475         [public] MAPISTATUS EcDoAsyncWaitEx(
4476                 [in] policy_handle      *async_handle,
4477                 [in] uint32             ulFlagsIn,
4478                 [out] uint32            *pulFlagsOut
4479                 );
4480 }
4481
4482 [
4483   uuid("c840a7dc-42c0-1a10-b4b9-08002b2fe182"),
4484   pointer_default(unique),
4485   helpstring("Unknown")
4486 ] interface exchange_unknown
4487 {
4488         void unknown_dummy();
4489 }
4490