- Add GetStoreState (0x7b) IDL, implementation and mapitest unit
[jelmer/openchange.git] / exchange.idl
1 #include "idl_types.h"
2
3 import "misc.idl";
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 "mapitags_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         typedef struct {
247                 FlatUID_r       *lpguid;
248                 uint32          ulReserved;
249                 uint32          lID;
250         } PropertyName_r;
251
252         typedef struct {
253                 [range(0,100000)] uint32                cNames;
254                 [size_is(cNames)] PropertyName_r        aNames[];
255         } PropertyNameSet_r;
256
257         typedef struct {
258                 [range(0,100000)] uint32                        cValues;
259                 [string,size_is(cValues),charset(DOS)] uint8    **lppszA;
260         } StringArray_r;
261
262         typedef struct {
263                 [range(0,100000)] uint32                        Count;
264                 [string,size_is(Count),charset(DOS)] uint8      *Strings[];
265         } StringsArray_r;
266
267         typedef struct {
268                 [range(0,100000)] uint32                        cValues;
269                 [string,size_is(cValues),charset(UTF16)] uint16 **lppszW;
270         } WStringArray_r;
271
272         typedef struct {
273                 [range(0,100000)] uint32                        Count;
274                 [string,size_is(Count),charset(UTF16)] uint16   *Strings[];
275         } WStringsArray_r;
276
277         typedef struct {
278                 [range(0,100001)] uint32                                cValues;
279                 [size_is(cValues+1),length_is(cValues)] MAPITAGS        aulPropTag[];
280         } SPropTagArray;
281
282         typedef struct {
283                 [range(0,2097152)] uint32       cb;
284                 [size_is(cb)] uint8             *lpb;
285         } Binary_r;
286
287         typedef [public] struct {
288                 uint32 dwLowDateTime;
289                 uint32 dwHighDateTime;
290         } FILETIME;
291
292         typedef struct {
293                 [range(0,100000)] uint32        cValues;
294                 [size_is(cValues)] uint16       *lpi;
295         } ShortArray_r;
296
297         typedef struct {
298                 [range(0,100000)] uint32        cValues;
299                 [size_is(cValues)] uint32       *lpl; 
300         } LongArray_r;
301
302         typedef struct {
303                 [range(0,100000)] uint32        cValues;
304                 [size_is(cValues)] Binary_r     *lpbin;
305         } BinaryArray_r;
306
307         typedef [flag(NDR_NOALIGN)] struct {
308                 [range(0,100000)]uint32         cValues;
309                 [size_is(cValues)] FlatUID_r    **lpguid; 
310         } FlatUIDArray_r;
311
312         typedef struct {
313                 [range(0,100000)] uint32        cValues;
314                 [size_is(cValues)] FILETIME     *lpft;
315         } DateTimeArray_r;
316
317         typedef [switch_type(uint32)] union {
318                 [case(PT_I2)]                   uint16                  i;
319                 [case(PT_LONG)]                 uint32                  l;
320                 [case(PT_DOUBLE)]               dlong                   dbl;
321                 [case(PT_BOOLEAN)]              uint8                   b;
322                 [case(PT_I8)]                   dlong                   d;
323                 [case(PT_STRING8)][unique][string,charset(DOS)] uint8   *lpszA;
324                 [case(PT_BINARY)]               Binary_r                bin;
325                 [case(PT_UNICODE)][string,charset(UTF16)] uint16        *lpszW;
326                 [case(PT_CLSID)]                FlatUID_r               *lpguid;
327                 [case(PT_SYSTIME)]              FILETIME                ft;
328                 [case(PT_ERROR)]                MAPISTATUS              err;
329                 [case(PT_MV_I2)]                ShortArray_r            MVi;
330                 [case(PT_MV_LONG)]              LongArray_r             MVl;
331                 [case(PT_MV_STRING8)]           StringArray_r           MVszA;
332                 [case(PT_MV_BINARY)]            BinaryArray_r           MVbin;
333                 [case(PT_MV_CLSID)]             FlatUIDArray_r          MVguid;
334                 [case(PT_MV_UNICODE)]           WStringArray_r          MVszW;
335                 [case(PT_MV_SYSTIME)]           DateTimeArray_r         MVft;
336                 [case(PT_NULL)]                 uint32                  null;
337                 [case(PT_OBJECT)]               uint32                  object;
338         } SPropValue_CTR;
339
340         typedef [public]struct {
341                 MAPITAGS ulPropTag;
342                 uint32 dwAlignPad;
343                 [switch_is(ulPropTag & 0xFFFF)] SPropValue_CTR value; 
344         } SPropValue;
345         
346         typedef struct {
347                 uint32                          ulAdrEntryPad;
348                 [range(0,100000)] uint32        cValues;
349                 [size_is(cValues)]SPropValue    *lpProps;
350         } SRow;
351
352
353         typedef [public] struct {
354                 [range(0,100000)] uint32        cRows;
355                 [size_is(cRows)] SRow           aRow[];
356         } SRowSet;
357         
358         typedef struct {
359                 [range(0,100000)] uint32                cRes;
360                 [size_is(cRes)] Restriction_r           *lpRes;
361         } AndRestriction_r;
362
363         typedef struct {
364                 [range(0,100000)] uint32                cRes;
365                 [size_is(cRes)] Restriction_r           *lpRes;
366         } OrRestriction_r;
367
368         typedef struct {
369                 Restriction_r                           *lpRes;
370         } NotRestriction_r;
371
372         typedef struct {
373                 uint32                                  ulFuzzyLevel;
374                 MAPITAGS                                ulPropTag;
375                 SPropValue                              *lpProp;
376         } ContentRestriction_r;
377
378         typedef struct {
379                 uint32                                  relop;
380                 MAPITAGS                                ulPropTag;
381                 SPropValue                              *lpProp;
382         } PropertyRestriction_r;
383
384         typedef struct {
385                 uint32                                  relop;
386                 MAPITAGS                                ulPropTag1;
387                 MAPITAGS                                ulPropTag2;
388         } ComparePropsRestriction_r;
389
390         typedef struct {
391                 uint32                                  relMBR;
392                 MAPITAGS                                ulPropTag;
393                 uint32                                  ulMask;
394         } BitMaskRestriction_r;
395
396         typedef struct {
397                 uint32                                  relop;
398                 MAPITAGS                                ulPropTag;
399                 uint32                                  cb;
400         } SizeRestriction_r;
401
402         typedef struct {
403                 uint32                                  ulReserved1;
404                 MAPITAGS                                ulPropTag;
405                 uint32                                  ulReserved2;
406         } ExistRestriction_r;
407
408         typedef struct {
409                 uint32                                  ulSubObject;
410                 Restriction_r                           *lpRes;
411         } SubRestriction_r;
412
413         typedef [v1_enum] enum {
414                 RES_AND                 = 0x0,
415                 RES_OR                  = 0x1,
416                 RES_NOT                 = 0x2,
417                 RES_CONTENT             = 0x3,
418                 RES_PROPERTY            = 0x4,
419                 RES_COMPAREPROPS        = 0x5,
420                 RES_BITMASK             = 0x6,
421                 RES_SIZE                = 0x7,
422                 RES_EXIST               = 0x8,
423                 RES_SUBRESTRICTION      = 0x9,
424                 RES_COMMENT             = 0xA
425         } RestrictionType_r;
426
427         typedef [switch_type(uint32)] union {
428                 [case(RES_AND)]                 AndRestriction_r                resAnd;
429                 [case(RES_OR)]                  OrRestriction_r                 resOr;
430                 [case(RES_NOT)]                 NotRestriction_r                resNot;
431                 [case(RES_CONTENT)]             ContentRestriction_r            resContent;
432                 [case(RES_PROPERTY)]            PropertyRestriction_r           resProperty;
433                 [case(RES_COMPAREPROPS)]        ComparePropsRestriction_r       resCompareProps;
434                 [case(RES_BITMASK)]             BitMaskRestriction_r            resBitMask;
435                 [case(RES_SIZE)]                SizeRestriction_r               resSize;
436                 [case(RES_EXIST)]               ExistRestriction_r              resExist;
437                 [case(RES_SUBRESTRICTION)]      SubRestriction_r                resSub;
438         } RestrictionUnion_r;
439
440         typedef [public] struct _Restriction_r{
441                 RestrictionType_r                       rt;
442                 [switch_is(rt)] RestrictionUnion_r      res;
443         } Restriction_r;
444
445         /*****************/
446         /* Function 0x00 */
447         typedef [bitmap32bit] bitmap {
448                 fAnonymousLogin = 0x00000020
449         } NspiBind_dwFlags;
450
451         MAPISTATUS NspiBind(
452                 [in] NspiBind_dwFlags   dwFlags,
453                 [in] STAT               *pStat,
454                 [in,out,unique] GUID    *mapiuid,
455                 [out] policy_handle     *handle
456                 );
457
458         /*****************/
459         /* Function 0x01 */
460         MAPISTATUS NspiUnbind(
461                 [in, out] policy_handle *handle,
462                 [in] uint32             Reserved
463                 );
464
465         /*****************/
466         /* Function 0x02 */
467         MAPISTATUS NspiUpdateStat(
468                 [in] policy_handle      *handle,
469                 [in] uint32             Reserved,
470                 [in,out] STAT           *pStat,
471                 [in,out,unique] uint32  *plDelta
472                 );
473
474         /*****************/
475         /* Function 0x03 */
476         typedef [bitmap32bit] bitmap {
477                 fSkipObjects    = 0x00000001,
478                 fEphID          = 0x00000002
479         } NspiQueryRows_dwFlags;
480
481         MAPISTATUS NspiQueryRows(
482                 [in]                                    policy_handle                   *handle,
483                 [in]                                    NspiQueryRows_dwFlags           dwFlags,
484                 [in,out]                                STAT                            *pStat,
485                 [in,range(0,100000)]                    uint32                          dwETableCount,
486                 [in,unique,size_is(dwETableCount)]      uint32                          *lpETable,
487                 [in]                                    uint32                          Count,
488                 [in,unique]                             SPropTagArray                   *pPropTags,
489                 [out]                                   SRowSet                         **ppRows
490                 );
491
492         /*****************/
493         /* Function 0x04 */
494         MAPISTATUS NspiSeekEntries(
495                 [in]            policy_handle   *handle,
496                 [in]            uint32          Reserved,
497                 [in,out]        STAT            *pStat,
498                 [in]            SPropValue      *pTarget,
499                 [in,unique]     SPropTagArray   *lpETable,
500                 [in,unique]     SPropTagArray   *pPropTags,
501                 [out]           SRowSet         **pRows
502                 );
503
504         /*****************/
505         /* Function 0x05 */
506         MAPISTATUS NspiGetMatches(
507                 [in]            policy_handle   *handle,
508                 [in]            uint32          Reserved,
509                 [in,out]        STAT            *pStat,
510                 [in][unique]    SPropTagArray   *pReserved,
511                 [in]            uint32          Reserved2,
512                 [in][unique]    Restriction_r   *Filter,
513                 [in][unique]    PropertyName_r  *lpPropName,
514                 [in]            uint32          ulRequested,
515                 [out]           SPropTagArray   **ppOutMIds,
516                 [in][unique]    SPropTagArray   *pPropTags,
517                 [out]           SRowSet         **ppRows
518                 );
519
520         /*****************/
521         /* Function 0x06 */
522         MAPISTATUS NspiResortRestriction(
523                 [in] policy_handle      *handle,
524                 [in] uint32             Reserved,
525                 [in,out] STAT           *pStat,
526                 [in] SPropTagArray      *pInMIds,
527                 [in,out] SPropTagArray  **ppMIds
528                 );
529
530         /*****************/
531         /* Function 0x07 */
532         MAPISTATUS NspiDNToMId(
533                 [in] policy_handle      *handle,
534                 [in] uint32             Reserved,
535                 [in] StringsArray_r     *pNames,
536                 [out] SPropTagArray     **ppMIds
537                 );
538
539         /*****************/
540         /* Function 0x08 */
541         MAPISTATUS NspiGetPropList(
542                 [in] policy_handle      *handle,
543                 [in] uint32             dwFlags,
544                 [in] uint32             dwMId,
545                 [in] uint32             CodePage,
546                 [out] SPropTagArray     **ppPropTags
547                 );
548
549         /*****************/
550         /* Function 0x09 */
551         MAPISTATUS NspiGetProps(
552                 [in]    policy_handle                   *handle,
553                 [in]    uint32                          dwFlags,
554                 [in]    STAT                            *pStat,
555                 [in,unique] SPropTagArray               *pPropTags,
556                 [out]   SRow                            **ppRows
557                 );
558
559         /*****************/
560         /* Funcion 0xa   */
561         MAPISTATUS NspiCompareMIds(
562                 [in] policy_handle      *handle,
563                 [in] uint32             Reserved,
564                 [in] STAT               *pStat,
565                 [in] uint32             MId1,
566                 [in] uint32             MId2,
567                 [out] uint32            *plResult
568                 );
569
570         /*****************/
571         /* Function 0xb  */
572         MAPISTATUS NspiModProps(
573                 [in] policy_handle              *handle,
574                 [in] uint32                     Reserved,
575                 [in] STAT                       *pStat,
576                 [in,unique] SPropTagArray       *pPropTags,
577                 [in] SRow                       *pRow
578                 );
579
580         /*****************/
581         /* Function 0x0c */
582         typedef [bitmap32bit] bitmap {
583                 NspiAddressCreationTemplates    = 0x00000002,
584                 NspiUnicodeStrings              = 0x00000004
585         } NspiGetSpecialTable_dwFlags;
586
587         MAPISTATUS NspiGetSpecialTable(
588                 [in] policy_handle                      *handle,
589                 [in] NspiGetSpecialTable_dwFlags        dwFlags,
590                 [in] STAT                               *pStat,
591                 [in,out] uint32                         *lpVersion,
592                 [out] SRowSet                           **ppRows
593                 );
594
595         /*******************/
596         /* Function 0x0d   */
597         typedef [bitmap32bit] bitmap {
598                 TI_TEMPLATE             = 0x00000001,
599                 TI_SCRIPT               = 0x00000004,
600                 TI_EMT                  = 0x00000010,
601                 TI_HELPFILE_NAME        = 0x00000020,
602                 TI_HELPFILE_CONTENTS    = 0x00000040
603         } TI_dwFlags;
604
605         MAPISTATUS NspiGetTemplateInfo(
606                 [in] policy_handle                      *handle,
607                 [in] TI_dwFlags                         dwFlags,
608                 [in] uint32                             ulType,
609                 [in,unique,string,charset(DOS)] uint8   *pDN,
610                 [in] uint32                             dwCodePage,
611                 [in] uint32                             dwLocaleID,
612                 [out] SRow                              **ppData
613                 );
614
615         /*******************/
616         /* Function 0x0e   */
617         MAPISTATUS NspiModLinkAtt(
618                 [in] policy_handle                      *handle,
619                 [in] uint32                             dwFlags,
620                 [in] uint32                             ulPropTag,
621                 [in] uint32                             MId,
622                 [in] BinaryArray_r                      *lpEntryIds
623                 );
624
625         /*************************************/
626         /* Function 0x0f: Not used on wire   */
627         MAPISTATUS NspiDeleteEntries(
628                 [in] policy_handle                      *Reserved1,
629                 [in] uint32                             Reserved2,
630                 [in] uint32                             Reserved3,
631                 [in] BinaryArray_r                      *Reserved4
632                 );
633
634         /*******************/
635         /* Function 0x10   */
636         typedef [bitmap32bit] bitmap {
637                 NspiUnicodeProptypes    = 0x80000000
638         } NspiQueryColumns_dwFlags;
639
640         MAPISTATUS NspiQueryColumns(
641                 [in] policy_handle                      *handle,
642                 [in] uint32                             Reserved,
643                 [in] NspiQueryColumns_dwFlags           dwFlags,
644                 [out] SPropTagArray                     **ppColumns
645                 );
646
647         /*******************/
648         /* Function 0x11   */
649         MAPISTATUS NspiGetNamesFromIDs(
650                 [in] policy_handle                      *handle,
651                 [in] uint32                             Reserved,
652                 [in,unique] FlatUID_r                   *lpGuid,
653                 [in,unique] SPropTagArray               *pPropTags,
654                 [out] SPropTagArray                     **ppReturnedPropTags,
655                 [out] PropertyNameSet_r                 **ppNames
656                 );
657
658         /*******************/
659         /* Function 0x12   */
660         MAPISTATUS NspiGetIDsFromNames(
661                 [in] policy_handle                      *handle,
662                 [in] uint32                             Reserved,
663                 [in] uint32                             dwFlags,
664                 [in,range(0,100000)] uint32             cPropNames,
665                 [in,size_is(cPropNames)] PropertyName_r **ppNames,
666                 [out] SPropTagArray                     **ppPropTags
667                 );
668
669         /*****************/
670         /* Function 0x13 */
671         MAPISTATUS NspiResolveNames(
672                 [in] policy_handle              *handle,
673                 [in] uint32                     Reserved,
674                 [in] STAT                       *pStat,
675                 [in,unique] SPropTagArray       *pPropTags,
676                 [in] StringsArray_r             *paStr,
677                 [out] SPropTagArray             **ppMIds,
678                 [out] SRowSet                   **ppRows
679         );
680
681         /*****************/
682         /* Function 0x14 */
683         MAPISTATUS NspiResolveNamesW(
684                 [in] policy_handle              *handle,
685                 [in] uint32                     Reserved,
686                 [in] STAT                       *pStat,
687                 [in,unique] SPropTagArray       *pPropTags,
688                 [in] WStringsArray_r            *paWStr,
689                 [out] SPropTagArray             **ppMIds,
690                 [out] SRowSet                   **ppRows
691                 );
692 }
693
694 [
695   uuid("a4f1db00-ca47-1067-b31f-00dd010662da"),
696   pointer_default(unique),
697   endpoint("ncacn_np:[\\pipe\\lsass]","ncacn_np:[\\pipe\\protected_storage]","ncacn_ip_tcp:"),
698   //version(0.81),
699   version(5308416),
700   helpstring("Exchange 5.5 EMSMDB")
701 ] interface exchange_emsmdb
702 {
703         /*****************/
704         /* Function 0x00 */
705
706         MAPISTATUS EcDoConnect(
707                 [out]                           policy_handle   *handle,
708                 [in,string,charset(DOS)]        uint8           szUserDN[],
709                 [in]                            uint32          ulFlags,
710                 [in]                            uint32          ulConMod,
711                 [in]                            uint32          cbLimit,
712                 [in]                            uint32          ulCpid,
713                 [in]                            uint32          ulLcidString,
714                 [in]                            uint32          ulLcidSort,
715                 [in]                            uint32          ulIcxrLink,
716                 [in]                            uint16          usFCanConvertCodePages,
717                 [out]                           uint32          *pcmsPollsMax,
718                 [out]                           uint32          *pcRetry,
719                 [out]                           uint32          *pcmsRetryDelay,
720                 [out]                           uint32          *picxr,
721                 [out,unique,string,charset(DOS)]uint8           *szDNPrefix,
722                 [out,unique,string,charset(DOS)]uint8           *szDisplayName,
723                 [out]                           uint16          rgwServerVersion[3],
724                 [in,out]                        uint16          rgwClientVersion[3],
725                 [in,out]                        uint32          *pullTimeStamp
726                 );
727
728         /*****************/
729         /* Function 0x01 */
730         MAPISTATUS EcDoDisconnect(
731                 [in,out]   policy_handle   *handle
732                 );
733
734         /*****************/
735         /* Function 0x02 */
736
737         /*
738           EcDoRpc opnums
739         */
740
741         typedef [public, enum8bit, flag(NDR_PAHEX)] enum 
742                 {
743                         MAPI_STORE      = 0x1,
744                         MAPI_ADDRBOOK   = 0x2,
745                         MAPI_FOLDER     = 0x3,
746                         MAPI_ABCONT     = 0x4,
747                         MAPI_MESSAGE    = 0x5,
748                         MAPI_MAILUSER   = 0x6, /* Individual Recipient */
749                         MAPI_ATTACH     = 0x7,
750                         MAPI_DISTLIST   = 0x8,
751                         MAPI_PROFSECT   = 0x9,
752                         MAPI_STATUS     = 0xA,
753                         MAPI_SESSION    = 0xB,
754                         MAPI_FORMINFO   = 0xC
755                 } MAPI_OBJTYPE;
756
757         typedef [public, v1_enum, flag(NDR_PAHEX)] enum 
758                 {
759                         RightsNone              = 0x00000000,
760                         RightsReadItems         = 0x00000001,
761                         RightsCreateItems       = 0x00000002,
762                         RightsEditOwn           = 0x00000008,
763                         RightsDeleteOwn         = 0x00000010,
764                         RightsEditAll           = 0x00000020,
765                         RightsDeleteAll         = 0x00000040,
766                         RightsCreateSubfolders  = 0x00000080,
767                         RightsFolderOwner       = 0x00000100,
768                         RightsFolderContact     = 0x00000200,
769                         RoleNone                = 0x00000400,
770                         RoleReviewer            = 0x00000401,
771                         RoleContributor         = 0x00000402,
772                         RoleNoneditingAuthor    = 0x00000413,
773                         RoleAuthor              = 0x0000041B,
774                         RoleEditor              = 0x0000047B,
775                         RolePublishAuthor       = 0x0000049B,
776                         RolePublishEditor       = 0x000004FB,
777                         RightsAll               = 0x000005FB,
778                         RoleOwner               = 0x000007FB
779                 } ACLRIGHTS;
780
781         typedef [public, enum8bit, flag(NDR_PAHEX)] enum
782                 {
783                         op_MAPI_Release                         = 0x1,
784                         op_MAPI_OpenFolder                      = 0x2,
785                         op_MAPI_OpenMessage                     = 0x3,
786                         op_MAPI_GetHierarchyTable               = 0x4,
787                         op_MAPI_GetContentsTable                = 0x5,
788                         op_MAPI_CreateMessage                   = 0x6,
789                         op_MAPI_GetProps                        = 0x7,
790                         op_MAPI_GetPropsAll                     = 0x8,
791                         op_MAPI_GetPropList                     = 0x9,
792                         op_MAPI_SetProps                        = 0xa,
793                         op_MAPI_DeleteProps                     = 0xb,
794                         op_MAPI_SaveChangesMessage              = 0xc,
795                         op_MAPI_RemoveAllRecipients             = 0xd,
796                         op_MAPI_ModifyRecipients                = 0xe,
797                         op_MAPI_ReadRecipients                  = 0xf,
798                         op_MAPI_ReloadCachedInformation         = 0x10,
799                         op_MAPI_SetMessageReadFlag              = 0x11,
800                         op_MAPI_SetColumns                      = 0x12,
801                         op_MAPI_SortTable                       = 0x13,
802                         op_MAPI_Restrict                        = 0x14,
803                         op_MAPI_QueryRows                       = 0x15,
804                         op_MAPI_GetStatus                       = 0x16,
805                         op_MAPI_QueryPosition                   = 0x17,
806                         op_MAPI_SeekRow                         = 0x18,
807                         op_MAPI_SeekRowBookmark                 = 0x19,
808                         op_MAPI_SeekRowApprox                   = 0x1a,
809                         op_MAPI_CreateBookmark                  = 0x1b,
810                         op_MAPI_CreateFolder                    = 0x1c,
811                         op_MAPI_DeleteFolder                    = 0x1d,
812                         op_MAPI_DeleteMessages                  = 0x1e,
813                         op_MAPI_GetMessageStatus                = 0x1f,
814                         op_MAPI_SetMessageStatus                = 0x20,
815                         op_MAPI_GetAttachmentTable              = 0x21,
816                         op_MAPI_OpenAttach                      = 0x22,
817                         op_MAPI_CreateAttach                    = 0x23,
818                         op_MAPI_DeleteAttach                    = 0x24,
819                         op_MAPI_SaveChangesAttachment           = 0x25,
820                         op_MAPI_SetReceiveFolder                = 0x26,
821                         op_MAPI_GetReceiveFolder                = 0x27,
822                         op_MAPI_RegisterNotification            = 0x29,
823                         op_MAPI_Notify                          = 0x2a,
824                         op_MAPI_OpenStream                      = 0x2b,
825                         op_MAPI_ReadStream                      = 0x2c,
826                         op_MAPI_WriteStream                     = 0x2d,
827                         op_MAPI_SeekStream                      = 0x2e,
828                         op_MAPI_SetStreamSize                   = 0x2f,
829                         op_MAPI_SetSearchCriteria               = 0x30,
830                         op_MAPI_GetSearchCriteria               = 0x31,
831                         op_MAPI_SubmitMessage                   = 0x32,
832                         op_MAPI_MoveCopyMessages                = 0x33,
833                         op_MAPI_AbortSubmit                     = 0x34,
834                         op_MAPI_MoveFolder                      = 0x35,
835                         op_MAPI_CopyFolder                      = 0x36,
836                         op_MAPI_QueryColumnsAll                 = 0x37,
837                         op_MAPI_Abort                           = 0x38,
838                         op_MAPI_CopyTo                          = 0x39,
839                         op_MAPI_CopyToStream                    = 0x3a,
840                         op_MAPI_GetTable                        = 0x3e,
841                         op_MAPI_GetRulesTable                   = 0x3f,
842                         op_MAPI_ModifyTable                     = 0x40,
843                         op_MAPI_ModifyRules                     = 0x41,
844                         op_MAPI_GetOwningServers                = 0x42,
845                         op_MAPI_LongTermIdFromId                = 0x43,
846                         op_MAPI_IdFromLongTermId                = 0x44,
847                         op_MAPI_PublicFolderIsGhosted           = 0x45,
848                         op_MAPI_OpenEmbeddedMessage             = 0x46,
849                         op_MAPI_SetSpooler                      = 0x47,
850                         op_MAPI_SpoolerLockMessage              = 0x48,
851                         op_MAPI_AddressTypes                    = 0x49,
852                         op_MAPI_TransportSend                   = 0x4a,
853                         op_MAPI_FastTransferSourceGetBuffer     = 0x4e,
854                         op_MAPI_FindRow                         = 0x4f,
855                         op_MAPI_Progress                        = 0x50,
856                         op_MAPI_GetNamesFromIDs                 = 0x55,
857                         op_MAPI_GetIDsFromNames                 = 0x56,
858                         op_MAPI_EmptyFolder                     = 0x58,
859                         op_MAPI_ExpandRow                       = 0x59,
860                         op_MAPI_CollapseRow                     = 0x5a,
861                         op_MAPI_CommitStream                    = 0x5d,
862                         op_MAPI_GetStreamSize                   = 0x5e,
863                         op_MAPI_QueryNamedProperties            = 0x5f,
864                         op_MAPI_GetPerUserLongTermIds           = 0x60,
865                         op_MAPI_GetPerUserGuid                  = 0x61,
866                         op_MAPI_ReadPerUserInformation          = 0x63,
867                         op_MAPI_SetReadFlags                    = 0x66,
868                         op_MAPI_CopyProperties                  = 0x67,
869                         op_MAPI_GetReceiveFolderTable           = 0x68,
870                         op_MAPI_GetCollapseState                = 0x6b,
871                         op_MAPI_SetCollapseState                = 0x6c,
872                         op_MAPI_GetTransportFolder              = 0x6d,
873                         op_MAPI_Pending                         = 0x6e,
874                         op_MAPI_RegisterOptions                 = 0x6f,
875                         op_MAPI_SyncConfigure                   = 0x70,
876                         op_MAPI_SyncImportMessageChange         = 0x72,
877                         op_MAPI_SyncImportHierarchyChange       = 0x73,
878                         op_MAPI_SyncImportDeletes               = 0x74,
879                         op_MAPI_SyncUploadStateStreamBegin      = 0x75,
880                         op_MAPI_SyncUploadStateStreamContinue   = 0x76,
881                         op_MAPI_SyncUploadStateStreamEnd        = 0x77,
882                         op_MAPI_SyncImportMessageMove           = 0x78,
883                         op_MAPI_SetPropertiesNoReplicate        = 0x79,
884                         op_MAPI_DeletePropertiesNoReplicate     = 0x7a,
885                         op_MAPI_GetStoreState                   = 0x7b,
886                         op_MAPI_SyncOpenCollector               = 0x7e,
887                         op_MAPI_GetLocalReplicaIds              = 0x7f,
888                         op_MAPI_SyncImportReadStateChanges      = 0x80,
889                         op_MAPI_ResetTable                      = 0x81,
890                         op_MAPI_SyncGetTransferState            = 0x82,
891                         op_MAPI_OpenPublicFolderByName          = 0x87,
892                         op_MAPI_SetSyncNotificationGuid         = 0x88,
893                         op_MAPI_FreeBookmark                    = 0x89,
894                         op_MAPI_Logon                           = 0xfe,
895                         /****** custom MAPI opnum for mapiproxy ******/
896                         op_MAPI_proxypack                       = 0xa5
897                 } MAPI_OPNUM;
898
899
900         typedef [public,noprint,flag(NDR_NOALIGN)] struct {
901                 uint16                          cb;
902                 [flag(NDR_BUFFERS)]uint8        lpb[cb];
903         } SBinary_short;
904
905         typedef struct {
906                 uint32 cValues;
907                 uint32 lpl[cValues]; 
908         } mapi_MV_LONG_STRUCT;
909
910         typedef [public] struct {
911                 astring lppszA;
912         } mapi_LPSTR;
913
914         typedef [public] struct {
915                 uint32 cValues;
916                 mapi_LPSTR strings[cValues]; 
917         } mapi_SLPSTRArray;
918
919         typedef struct {
920                 [flag(STR_NULLTERM)] string lppszW;
921         } mapi_LPWSTR;
922
923         typedef struct {
924                 uint32 cValues;
925                 mapi_LPWSTR strings[cValues];
926         } mapi_SPLSTRArrayW;
927         
928         typedef struct {
929                 uint32          cValues;
930                 SBinary_short   bin[cValues];
931         } mapi_SBinaryArray;
932
933         typedef struct {
934                 uint32          cValues;
935                 GUID            lpguid[cValues];
936         } mapi_SGuidArray;
937
938         /******* part of the no-pointer deep recursion hack *******/
939         typedef [nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
940                 uint8 wrap[0x8000];
941         } mapi_SRestriction_wrap;
942
943         typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
944                 uint8   wrap[0x8000];
945         } mapi_SPropValue_wrap;
946
947         typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
948                 uint8   wrap[0x8000];
949         } mapi_SPropValue_array_wrap;
950         /**********************************************************/    
951
952         typedef [enum8bit] enum {
953                 ActionType_OP_MOVE              = 0x1,
954                 ActionType_OP_COPY              = 0x2,
955                 ActionType_OP_REPLY             = 0x3,
956                 ActionType_OP_OOF_REPLY         = 0x4,
957                 ActionType_OP_DEFER_ACTION      = 0x5,
958                 ActionType_OP_BOUNCE            = 0x6,
959                 ActionType_OP_FORWARD           = 0x7,
960                 ActionType_OP_DELEGATE          = 0x8,
961                 ActionType_OP_TAG               = 0x9,
962                 ActionType_OP_DELETE            = 0xA,
963                 ActionType_OP_MARK_AS_READ      = 0xB
964         } ActionType;
965
966         typedef [flag(NDR_NOALIGN)] struct {
967                 boolean8                FolderInThisStore;
968                 SBinary_short           StoreEID;
969                 SBinary_short           FolderEID;
970         } MoveCopy_Action;
971
972         typedef [flag(NDR_NOALIGN)] struct {
973                 hyper                   ReplyTemplateFID;
974                 hyper                   ReplyTemplateMID;
975                 GUID                    ReplyTemplateGUID;                      
976         } ReplyOOF_Action;
977
978         typedef [flag(NDR_NOALIGN)] struct {
979                 uint8                           Reserved;
980                 mapi_SPropValue_array_wrap      PropertyValue;
981         } RecipientBlock;
982
983         typedef [flag(NDR_NOALIGN)] enum {
984                 BOUNCE_MESSAGE_TOO_LARGE        = 0x0000000d,
985                 BOUNCE_MESSAGE_NOT_DISPLAYED    = 0x0000001f,
986                 BOUNCE_MESSAGE_DENIED           = 0x00000026
987         } BounceCode;
988
989         typedef [flag(NDR_NOALIGN)] struct {
990                 uint16                  RecipientCount;
991                 RecipientBlock          RecipientBlock[RecipientCount];
992         } ForwardDelegate_Action;
993
994         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
995                 [case(ActionType_OP_MOVE)]              MoveCopy_Action                 MoveAction;
996                 [case(ActionType_OP_COPY)]              MoveCopy_Action                 CopyAction;
997                 [case(ActionType_OP_REPLY)]             ReplyOOF_Action                 ReplyAction;
998                 [case(ActionType_OP_OOF_REPLY)]         ReplyOOF_Action                 ReplyOOFAction;
999                 [case(ActionType_OP_DEFER_ACTION)][flag(NDR_REMAINING)] DATA_BLOB       DeferAction;
1000                 [case(ActionType_OP_BOUNCE)]            BounceCode                      BounceCode;
1001                 [case(ActionType_OP_TAG)]               mapi_SPropValue_wrap            PropValue;
1002                 [case(ActionType_OP_FORWARD)]           ForwardDelegate_Action          ForwardAction;
1003                 [case(ActionType_OP_DELEGATE)]          ForwardDelegate_Action          DelegateAction;
1004                 [case(ActionType_OP_DELETE)];
1005                 [case(ActionType_OP_MARK_AS_READ)];
1006         } ActionData;
1007
1008         typedef [flag(NDR_NOALIGN)] struct {
1009                 ActionType                              ActionType;
1010                 uint32                                  ActionFlavor;
1011                 uint32                                  ActionFlags;
1012                 [switch_is(ActionType)] ActionData      ActionDataBuffer;
1013         } ActionBlockData;
1014
1015         typedef [flag(NDR_NOALIGN)] struct {
1016                 uint16                                  ActionLength;
1017                 [subcontext(0),subcontext_size(ActionLength),flag(NDR_REMAINING)] ActionBlockData ActionBlockData;
1018         } ActionBlock;
1019
1020         typedef [flag(NDR_NOALIGN)] struct {
1021                 uint16          count;
1022                 ActionBlock     ActionBlock[count];
1023         } RuleAction;
1024
1025         typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
1026                 [case(PT_I2)]           uint16                  i;
1027                 [case(PT_LONG)]         uint32                  l;
1028                 [case(PT_DOUBLE)]       dlong                   dbl;
1029                 [case(PT_ERROR)]        uint32                  err;
1030                 [case(PT_BOOLEAN)]      uint8                   b;
1031                 [case(PT_I8)]           dlong                   d;
1032                 [case(PT_STRING8)]      astring                 lpszA;
1033                 [case(PT_UNICODE)][flag(STR_NULLTERM)] string   lpszW;
1034                 [case(PT_SYSTIME)]      FILETIME                ft;
1035                 [case(PT_CLSID)]        GUID                    lpguid;
1036                 [case(PT_SRESTRICT)]    mapi_SRestriction_wrap  Restrictions;
1037                 [case(PT_ACTIONS)]      RuleAction              RuleAction;
1038                 [case(PT_BINARY)]       SBinary_short           bin;
1039                 [case(PT_SVREID)]       SBinary_short           bin;
1040                 [case(PT_MV_LONG)]      mapi_MV_LONG_STRUCT     MVl;    
1041                 [case(PT_MV_STRING8)]   mapi_SLPSTRArray        MVszA;
1042                 [case(PT_MV_UNICODE)]   mapi_SPLSTRArrayW       MVszW;
1043                 [case(PT_MV_CLSID)]     mapi_SGuidArray         MVguid;
1044                 [case(PT_MV_BINARY)]    mapi_SBinaryArray       MVbin;
1045         } mapi_SPropValue_CTR;
1046
1047         typedef [public,flag(NDR_NOALIGN)] struct {
1048                 MAPITAGS ulPropTag;
1049                 [switch_is(ulPropTag & 0xFFFF)] mapi_SPropValue_CTR value; 
1050         } mapi_SPropValue;
1051
1052         typedef [public,flag(NDR_NOALIGN)] struct {
1053                 uint16                                  cValues;
1054                 [flag(NDR_REMAINING)]mapi_SPropValue    lpProps[cValues];
1055         } mapi_SPropValue_array;
1056
1057         typedef [flag(NDR_NOALIGN)] struct {
1058                 uint16                                  cValues;
1059                 MAPITAGS                                aulPropTag[cValues];
1060         } mapi_SPropTagArray;
1061
1062         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1063                 ROW_ADD         =       0x1,
1064                 ROW_MODIFY      =       0x2,
1065                 ROW_REMOVE      =       0x4
1066         } ulRowFlags;
1067
1068         typedef [flag(NDR_NOALIGN)] struct {
1069                 ulRowFlags                              ulRowFlags;
1070                 mapi_SPropValue_array                   lpProps;
1071         } mapi_SRow;
1072
1073         typedef [flag(NDR_NOALIGN)] struct {
1074                 uint8                                   padding;
1075                 uint16                                  cEntries;
1076                 mapi_SRow                               aEntries[cEntries];
1077         } mapi_SRowList;
1078
1079         /**************************/
1080         /* EcDoRpc Function 0x1   */
1081         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1082         } Release_req;
1083
1084         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1085         } Release_repl;
1086
1087         /**************************/
1088         /* EcDoRpc Function 0x2   */
1089         typedef [enum8bit] enum {
1090                 OpenModeFlags_Folder            = 0x0,
1091                 OpenModeFlags_SoftDeleted       = 0x4
1092         } OpenFolder_OpenModeFlags;
1093
1094         typedef [flag(NDR_NOALIGN)] struct {
1095                 uint8                           handle_idx;
1096                 hyper                           folder_id;
1097                 OpenFolder_OpenModeFlags        OpenModeFlags;
1098         } OpenFolder_req;
1099
1100         typedef [flag(NDR_NOALIGN)] struct {
1101                 uint16          ServerCount;
1102                 uint16          CheapServerCount;
1103                 astring         Servers[ServerCount];
1104         } OpenFolder_Replicas;
1105
1106         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1107                 [case(0x0)];
1108                 [case(0x1)] OpenFolder_Replicas Replicas;
1109         } IsGhosted;
1110
1111         typedef [flag(NDR_NOALIGN)] struct {
1112                 boolean8                                HasRules;
1113                 boolean8                                IsGhosted;
1114                 [switch_is(IsGhosted)] IsGhosted        Ghost;
1115         } OpenFolder_repl;
1116         
1117         /**************************/
1118         /* EcDoRpc Function 0x3   */
1119         typedef [enum8bit] enum {
1120                 StringType_NONE                 = 0x0,
1121                 StringType_EMPTY                = 0x1,
1122                 StringType_STRING8              = 0x2,
1123                 StringType_UNICODE_REDUCED      = 0x3,
1124                 StringType_UNICODE              = 0x4
1125         } StringType;
1126
1127         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1128                 [case(0x0)];
1129                 [case(0x1)];
1130                 [case(0x2)] astring                     lpszA;
1131                 [case(0x3)] astring                     lpszW_reduced;
1132                 [case(0x4)] [flag(STR_NULLTERM)] string lpszW;
1133         } String;
1134
1135         typedef [flag(NDR_NOALIGN)] struct {
1136                 StringType                      StringType;
1137                 [switch_is(StringType)] String  String;
1138         } TypedString;
1139
1140         typedef [bitmap8bit] bitmap {
1141                 /* 0x0 means Read Only */
1142                 ReadWrite       = 0x1,
1143                 Create          = 0x3
1144         } OpenMessage_OpenModeFlags;
1145
1146         typedef [flag(NDR_NOALIGN)] struct {
1147                 uint8                           handle_idx;
1148                 uint16                          CodePageId;
1149                 hyper                           FolderId;
1150                 OpenMessage_OpenModeFlags       OpenModeFlags;
1151                 hyper                           MessageId;
1152         } OpenMessage_req;
1153
1154         typedef [v1_enum, flag(NDR_PAHEX)] enum {
1155                 CP_USASCII      = 0x04E4,
1156                 CP_UNICODE      = 0x04B0,
1157                 CP_JAUTODETECT  = 0xC6F4,
1158                 CP_KAUTODETECT  = 0xC705,
1159                 CP_ISO2022JPESC = 0xC42D,
1160                 CP_ISO2022JPSIO = 0xC42E
1161         } CODEPAGEID;
1162
1163         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1164                 MAPI_ORIG               = 0x0,
1165                 MAPI_TO                 = 0x1,
1166                 MAPI_CC                 = 0x2,
1167                 MAPI_BCC                = 0x3
1168         } ulRecipClass;
1169
1170         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1171                 SINGLE_RECIPIENT        = 0x0,
1172                 DISTRIBUTION_LIST       = 0x1
1173         } addr_type;
1174
1175         typedef  [flag(NDR_NOALIGN)]struct {
1176                 uint8           organization_length;
1177                 addr_type       addr_type;
1178                 astring         username;
1179         } RecipExchange;
1180
1181         typedef [flag(NDR_NOALIGN)] struct {
1182         } RecipSMTP;
1183
1184         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1185                 [case(0x0)] RecipExchange       EXCHANGE;
1186                 [case(0xA)] RecipSMTP           SMTP;
1187                 [default];
1188         } recipient_type;
1189
1190         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1191                 [case(0x0)];
1192                 [case(0x400)] astring                           lpszA;
1193                 [case(0x600)][flag(STR_NULLTERM)] string        lpszW;
1194                 [default];
1195         } recipient_SimpleDisplayName;
1196
1197         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1198                 [case(0x0)];
1199                 [case(0x20)] astring                            lpszA;
1200                 [case(0x220)][flag(STR_NULLTERM)] string        lpszW;
1201                 [default];
1202         } recipient_TransmittableDisplayName;
1203
1204         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1205                 [case(0x0)];
1206                 [case(0x10)] astring                            lpszA;
1207                 [case(0x210)][flag(STR_NULLTERM)] string        lpszW;
1208                 [default];
1209         } recipient_DisplayName;
1210
1211         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1212                 [case(0x0)];
1213                 [case(0x8)] astring                             lpszA;
1214                 [case(0x208)][flag(STR_NULLTERM)] string        lpszW;
1215                 [default];
1216         } recipient_EmailAddress;
1217
1218         typedef [flag(NDR_NOALIGN)] struct {
1219                 uint16                                                                  RecipientFlags;
1220                 [switch_is(RecipientFlags & 0xA)]   recipient_type                      type;
1221                 [switch_is(RecipientFlags & 0x600)] recipient_SimpleDisplayName         SimpleDisplayName;
1222                 [switch_is(RecipientFlags & 0x220)] recipient_TransmittableDisplayName  TransmittableDisplayName;
1223                 [switch_is(RecipientFlags & 0x210)] recipient_DisplayName               DisplayName;
1224                 [switch_is(RecipientFlags & 0x208)] recipient_EmailAddress              EmailAddress;
1225                 uint16                                                                  prop_count;
1226                 uint8                                                                   layout;
1227                 [flag(NDR_REMAINING)] DATA_BLOB                                         prop_values;
1228         } RecipientRow;
1229
1230         typedef [flag(NDR_NOALIGN)] struct {
1231                 ulRecipClass    RecipClass;
1232                 CODEPAGEID      codepage;
1233                 [subcontext(2)] RecipientRow    RecipientRow;
1234         } OpenMessage_recipients;
1235
1236         typedef [flag(NDR_NOALIGN)] struct {
1237                 boolean8                HasNamedProperties;
1238                 TypedString             SubjectPrefix;
1239                 TypedString             NormalizedSubject;
1240                 uint16                  RecipientCount;
1241                 mapi_SPropTagArray      RecipientColumns;
1242                 uint8                   RowCount;
1243                 OpenMessage_recipients  recipients[RowCount];
1244         } OpenMessage_repl;
1245
1246         /**************************/
1247         /* EcDoRpc Function 0x4   */
1248         typedef [bitmap8bit] bitmap {
1249                 TableFlags_Depth                        = 0x4,
1250                 TableFlags_DeferredErrors               = 0x8,
1251                 TableFlags_NoNotifications              = 0x10,
1252                 TableFlags_SoftDeletes                  = 0x20,
1253                 TableFlags_UseUnicode                   = 0x40,
1254                 TableFlags_SuppressNotifications        = 0x80
1255         } TableFlags;
1256
1257         typedef [flag(NDR_NOALIGN)] struct {
1258                 uint8           handle_idx;
1259                 TableFlags      TableFlags;
1260         } GetHierarchyTable_req;
1261
1262         typedef [flag(NDR_NOALIGN)] struct {
1263                 uint32          RowCount;
1264         } GetHierarchyTable_repl;
1265
1266         /**************************/
1267         /* EcDoRpc Function 0x5   */
1268         typedef [flag(NDR_NOALIGN)] struct {
1269                 uint8           handle_idx;
1270                 TableFlags      TableFlags;
1271         } GetContentsTable_req;
1272
1273         typedef [flag(NDR_NOALIGN)] struct {
1274                 uint32          RowCount;
1275         } GetContentsTable_repl;
1276
1277         /**************************/
1278         /* EcDoRpc Function 0x6   */
1279         typedef [flag(NDR_NOALIGN)] struct {
1280                 uint8           handle_idx;
1281                 uint16          CodePageId;
1282                 hyper           FolderId;
1283                 boolean8        AssociatedFlag;
1284         } CreateMessage_req;
1285
1286         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1287                 [case(0x0)];
1288                 [case(0x1)] hyper       MessageId;
1289         } CreateMessage_MessageId;
1290
1291         typedef [flag(NDR_NOALIGN)] struct {
1292                 boolean8                                                HasMessageId;
1293                 [switch_is(HasMessageId)] CreateMessage_MessageId       MessageId;
1294         } CreateMessage_repl;
1295
1296         /*************************/
1297         /* EcDoRpc Function 0x7  */
1298         typedef [flag(NDR_NOALIGN)] struct {
1299                 uint16          PropertySizeLimit;
1300                 uint16          WantUnicode;
1301                 uint16          prop_count;
1302                 MAPITAGS        properties[prop_count];
1303         } GetProps_req;
1304
1305         typedef [flag(NDR_NOALIGN)] struct {
1306                 uint8           layout;
1307                 [flag(NDR_REMAINING)] DATA_BLOB prop_data;
1308         } GetProps_repl;
1309
1310         /*************************/
1311         /* EcDoRpc Function 0x8  */
1312         typedef [flag(NDR_NOALIGN)] struct {
1313                 uint16          PropertySizeLimit;
1314                 uint16          WantUnicode;
1315         } GetPropsAll_req;
1316
1317         typedef [flag(NDR_NOALIGN)] struct {
1318                 mapi_SPropValue_array   properties;
1319         } GetPropsAll_repl;
1320
1321         /*************************/
1322         /* EcDoRpc Function 0x9  */
1323         typedef [flag(NDR_NOALIGN)] struct {
1324         } GetPropList_req;
1325
1326         typedef [flag(NDR_NOALIGN)] struct {
1327                 uint16          count;
1328                 MAPITAGS        tags[count];
1329         } GetPropList_repl;
1330
1331         /*************************/
1332         /* EcDoRpc Function 0xa  */
1333         typedef [flag(NDR_NOALIGN)] struct {
1334                 uint32          index;          /* index into array of property tags */
1335                 MAPITAGS        property_tag;   /* property for which there was an error */
1336                 MAPISTATUS      error_code;     /* the error that occurred for this property */
1337         } PropertyProblem;
1338
1339         typedef [flag(NDR_NOALIGN)] struct {
1340                 [subcontext(2)] mapi_SPropValue_array values;
1341         } SetProps_req;
1342
1343         typedef [flag(NDR_NOALIGN)] struct {
1344                 uint16          PropertyProblemCount;
1345                 PropertyProblem PropertyProblem[PropertyProblemCount];          
1346         } SetProps_repl;
1347
1348         /*************************/
1349         /* EcDoRpc Function 0xb  */
1350         typedef [flag(NDR_NOALIGN)] struct {
1351                 uint16          count;
1352                 MAPITAGS        tags[count];
1353         } DeleteProps_req;
1354
1355         typedef [flag(NDR_NOALIGN)] struct {
1356                 uint16          PropertyProblemCount;
1357                 PropertyProblem PropertyProblem[PropertyProblemCount];
1358         } DeleteProps_repl;
1359
1360         /*************************/
1361         /* EcDoRpc Function 0xc  */
1362         typedef [enum8bit] enum {
1363                 KeepOpenReadOnly        = 0x9,
1364                 KeepOpenReadWrite       = 0xA,
1365                 ForceSave               = 0xC
1366         } SaveFlags;
1367
1368         typedef [flag(NDR_NOALIGN)] struct {
1369                 uint8           handle_idx;
1370                 uint8           SaveFlags;
1371         } SaveChangesMessage_req;
1372
1373         typedef [flag(NDR_NOALIGN)] struct {
1374                 uint8           handle_idx;
1375                 hyper           MessageId;
1376         } SaveChangesMessage_repl;
1377
1378         /*************************/
1379         /* EcDoRpc Function 0xd  */
1380         typedef [flag(NDR_NOALIGN)] struct {
1381                 uint32          ulReserved;
1382         } RemoveAllRecipients_req;
1383
1384         typedef [flag(NDR_NOALIGN)] struct {
1385
1386         } RemoveAllRecipients_repl;
1387
1388         /*************************/
1389         /* EcDoRpc Function 0xe  */
1390
1391         /* 
1392          * MODRECIP_NULL and INVALID are not part of the msdn flags
1393          * but are added for printing support 
1394          */
1395         typedef [enum8bit,flag(NDR_PAHEX)] enum {
1396                 MODRECIP_NULL           = 0x0,
1397                 MODRECIP_INVALID        = 0x1,
1398                 MODRECIP_ADD            = 0x2,
1399                 MODRECIP_MODIFY         = 0x4,
1400                 MODRECIP_REMOVE         = 0x8
1401         } modrecip;
1402
1403         typedef [flag(NDR_NOALIGN)]struct {
1404                 uint32          idx;
1405                 ulRecipClass    RecipClass;             
1406                 [subcontext(2),flag(NDR_REMAINING)] RecipientRow RecipientRow;
1407         } ModifyRecipientRow;
1408
1409         typedef [flag(NDR_NOALIGN)] struct {
1410                 uint16                          prop_count;
1411                 MAPITAGS                        properties[prop_count];
1412                 uint16                          cValues;
1413                 ModifyRecipientRow              RecipientRow[cValues];
1414         } ModifyRecipients_req;
1415
1416         typedef [flag(NDR_NOALIGN)] struct {
1417
1418         } ModifyRecipients_repl;
1419
1420         /*************************/
1421         /* EcDoRpc Function 0xf  */
1422         typedef [flag(NDR_NOALIGN)] struct {
1423                 uint32          RowId;
1424                 uint16          ulReserved;
1425         } ReadRecipients_req;
1426
1427         typedef [flag(NDR_NOALIGN)] struct {
1428                 uint32                          RowId;
1429                 ulRecipClass                    RecipientType;
1430                 uint16                          CodePageId;
1431                 uint16                          ulReserved;
1432                 [subcontext(2)] RecipientRow    RecipientRow;
1433         } ReadRecipientRow;
1434
1435         typedef [flag(NDR_NOALIGN)] struct {
1436                 uint8                   RowCount;
1437                 ReadRecipientRow        RecipientRows[RowCount];
1438         } ReadRecipients_repl;
1439
1440         /*************************/
1441         /* EcDoRpc Function 0x10 */
1442         typedef [flag(NDR_NOALIGN)] struct {
1443                 ulRecipClass            RecipientType;
1444                 uint16                  CodePageId;
1445                 uint16                  Reserved;
1446                 uint16                  RecipientRowSize;
1447                 [subcontext(0),subcontext_size(RecipientRowSize),flag(NDR_REMAINING)]RecipientRow       RecipientRow;
1448         } OpenRecipientRow;
1449
1450         typedef [flag(NDR_NOALIGN)] struct {
1451                 uint16          Reserved;
1452         } ReloadCachedInformation_req;
1453
1454         typedef [flag(NDR_NOALIGN)] struct {
1455                 boolean8                HasNamedProperties;
1456                 TypedString             SubjectPrefix;
1457                 TypedString             NormalizedSubject;
1458                 uint16                  RecipientCount;
1459                 uint16                  ColumnCount;
1460                 MAPITAGS                RecipientColumns[ColumnCount];
1461                 uint8                   RowCount;
1462                 OpenRecipientRow        RecipientRows[RowCount];
1463         } ReloadCachedInformation_repl;
1464
1465         /*************************/
1466         /* EcDoRpc Function 0x11 */
1467
1468         typedef [bitmap8bit] bitmap {
1469                 SUPPRESS_RECEIPT        = 0x01,
1470                 CLEAR_READ_FLAG         = 0x04,
1471                 MAPI_DEFERRED_ERRORS    = 0x08,
1472                 GENERATE_RECEIPT_ONLY   = 0x10,
1473                 CLEAR_RN_PENDING        = 0x20,
1474                 CLEAR_NRN_PENDING       = 0x40
1475         } MSGFLAG_READ;
1476
1477         /* TODO: there is a variation that can provide "client data" here */
1478         typedef [flag(NDR_NOALIGN)] struct {
1479                 uint8                           handle_idx;
1480                 MSGFLAG_READ                    flags;
1481                 [flag(NDR_REMAINING)] DATA_BLOB clientdata;
1482         } SetMessageReadFlag_req;
1483
1484         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1485                 [case(0x0)];
1486                 [case(0x1)] uint8       LogonId;
1487         } SetMessageReadFlag_LogonId;
1488
1489         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1490                 [case(0x0)];
1491                 [case(0x1)] uint8       ClientData[24];
1492         } SetMessageReadFlag_ClientData;
1493
1494         typedef [flag(NDR_NOALIGN)] struct {
1495                 boolean8                                                        ReadStatusChanged;
1496                 [switch_is(ReadStatusChanged)] SetMessageReadFlag_LogonId       LogonId;
1497                 [switch_is(ReadStatusChanged)] SetMessageReadFlag_ClientData    ClientData;
1498         } SetMessageReadFlag_repl;
1499
1500         /*************************/
1501         /* EcDoRpc Function 0x12 */
1502         typedef [enum8bit] enum {
1503                 SetColumns_TBL_SYNC     = 0x0,
1504                 SetColumns_TBL_ASYNC    = 0x1
1505         } SetColumnsFlags;
1506         
1507         typedef [enum8bit] enum {
1508                 TBLSTAT_COMPLETE        = 0x0,
1509                 TBLSTAT_SORTING         = 0x9,
1510                 TBLSTAT_SORT_ERROR      = 0xA,
1511                 TBLSTAT_SETTING_COLS    = 0xB,
1512                 TBLSTAT_SETCOL_ERROR    = 0xD,
1513                 TBLSTAT_RESTRICTING     = 0xE,
1514                 TBLSTAT_RESTRICT_ERROR  = 0xF
1515         } TableStatus;
1516
1517         typedef [flag(NDR_NOALIGN)] struct {
1518                 SetColumnsFlags SetColumnsFlags;
1519                 uint16          prop_count;
1520                 MAPITAGS        properties[prop_count];
1521         } SetColumns_req;
1522
1523         typedef [flag(NDR_NOALIGN)] struct {
1524                 TableStatus     TableStatus;
1525         } SetColumns_repl;
1526
1527         /**************************/
1528         /* EcDoRpc Function 0x13  */
1529         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1530                 TBL_ASYNC = 0x1,
1531                 TBL_BATCH = 0x2
1532         } TBL_FLAGS;
1533         
1534         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1535                 TABLE_SORT_ASCEND = 0x0,
1536                 TABLE_SORT_COMBINE = 0x1,
1537                 TABLE_SORT_DESCEND = 0x2
1538         } TABLE_SORT;
1539
1540         typedef [public, flag(NDR_NOALIGN)] struct _SSortOrder{
1541                 MAPITAGS ulPropTag;
1542                 TABLE_SORT ulOrder;
1543         } SSortOrder;
1544
1545         typedef [public, flag(NDR_NOALIGN)] struct _SSortOrderSet {
1546                 uint16          cSorts;
1547                 uint16          cCategories;
1548                 uint16          cExpanded;
1549                 SSortOrder      aSort[cSorts];
1550         } SSortOrderSet;
1551
1552         typedef [flag(NDR_NOALIGN)] struct {
1553                 uint8           SortTableFlags;
1554                 SSortOrderSet   lpSortCriteria;
1555         } SortTable_req;
1556
1557         typedef [flag(NDR_NOALIGN)] struct {
1558                 TableStatus     TableStatus;
1559         } SortTable_repl;
1560
1561         /**************************/
1562         /* EcDoRpc Function 0x14  */
1563         typedef [flag(NDR_NOALIGN)] struct {
1564                 uint16                  cRes;
1565                 mapi_SRestriction_and   res[cRes];
1566         } mapi_SAndRestriction;
1567
1568         typedef [flag(NDR_NOALIGN)] struct {
1569                 uint16  cRes;
1570                 mapi_SRestriction_or    res[cRes];
1571         } mapi_SOrRestriction;
1572
1573         typedef [flag(NDR_NOALIGN)] struct {
1574                 mapi_SRestriction_wrap  res;
1575         } mapi_SNotRestriction;
1576
1577         typedef [noprint, bitmap32bit] bitmap {
1578                 FL_FULLSTRING           = 0x00000,
1579                 FL_SUBSTRING            = 0x00001,
1580                 FL_PREFIX               = 0x00002,
1581                 FL_IGNORECASE           = 0x10000,
1582                 FL_IGNORENONSPACE       = 0x20000,
1583                 FL_LOOSE                = 0x40000
1584         } fuzzyLevel;
1585
1586         typedef [flag(NDR_NOALIGN)] struct {
1587                 fuzzyLevel      fuzzy;
1588                 MAPITAGS        ulPropTag;
1589                 mapi_SPropValue lpProp;
1590         } mapi_SContentRestriction;
1591
1592         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1593                 BMR_EQZ = 0x0,
1594                 BMR_NEZ = 0x1
1595         } relMBR;
1596
1597         typedef [flag(NDR_NOALIGN)] struct {
1598                 relMBR          relMBR;
1599                 MAPITAGS        ulPropTag;
1600                 uint32          ulMask;
1601         } mapi_SBitmaskRestriction;
1602
1603         typedef [enum8bit, flag(NDR_PAHEX)] enum {
1604                 RELOP_LT = 0x0,         /* <  */
1605                 RELOP_LE = 0x1,         /* <= */
1606                 RELOP_GT = 0x2,         /* >  */
1607                 RELOP_GE = 0x3,         /* >= */
1608                 RELOP_EQ = 0x4,         /* == */
1609                 RELOP_NE = 0x5,         /* != */
1610                 RELOP_RE = 0x6          /* LIKE (Regular expression) */
1611         } CompareRelop;
1612
1613         typedef [flag(NDR_NOALIGN)] struct {
1614                 CompareRelop    relop;
1615                 MAPITAGS        ulPropTag;
1616                 uint32          size;
1617         } mapi_SSizeRestriction;
1618
1619         typedef [flag(NDR_NOALIGN)] struct {
1620                 uint8           relop;
1621                 MAPITAGS        ulPropTag;
1622                 mapi_SPropValue lpProp;
1623         } mapi_SPropertyRestriction;
1624
1625         typedef [flag(NDR_NOALIGN)] struct {
1626                 CompareRelop    relop;
1627                 MAPITAGS        ulPropTag1;
1628                 MAPITAGS        ulPropTag2;
1629         } mapi_SCompareProps;
1630
1631         typedef [flag(NDR_NOALIGN)] struct {
1632                 MAPITAGS        ulPropTag;
1633         } mapi_SExistRestriction;
1634
1635         typedef [flag(NDR_NOALIGN)] struct {
1636                 MAPITAGS                ulSubObject;
1637                 mapi_SRestriction_sub   res[ulSubObject - ulSubObject + 1]; /* nasty hack - generates fake pointer */
1638         } mapi_SSubRestriction;
1639
1640         typedef [nopush,nopull,noprint,nodiscriminant] union {
1641                 [case(0x0)];
1642                 [case(0x1)] mapi_SRestriction_comment *res;
1643         } RestrictionVariable;
1644
1645         typedef [flag(NDR_NOALIGN)] struct {
1646                 uint8                           TaggedValuesCount;
1647                 mapi_SPropValue                 TaggedValues[TaggedValuesCount];
1648                 boolean8                        RestrictionPresent;
1649                 [switch_is(RestrictionPresent)] RestrictionVariable Restriction;
1650         } mapi_SCommentRestriction;
1651
1652         typedef [public,nodiscriminant] union {
1653                 [case(RES_AND)]                 mapi_SAndRestriction            resAnd;
1654                 [case(RES_OR)]                  mapi_SOrRestriction             resOr;
1655                 [case(RES_NOT)]                 mapi_SNotRestriction            resNot;
1656                 [case(RES_CONTENT)]             mapi_SContentRestriction        resContent;
1657                 [case(RES_PROPERTY)]            mapi_SPropertyRestriction       resProperty;
1658                 [case(RES_COMPAREPROPS)]        mapi_SCompareProps              resCompareProps;
1659                 [case(RES_BITMASK)]             mapi_SBitmaskRestriction        resBitmask;
1660                 [case(RES_SIZE)]                mapi_SSizeRestriction           resSize;
1661                 [case(RES_EXIST)]               mapi_SExistRestriction          resExist;
1662                 [case(RES_SUBRESTRICTION)]      mapi_SSubRestriction            resSub;
1663                 [case(RES_COMMENT)]             mapi_SCommentRestriction        resComment;
1664                 [default];
1665         } mapi_SRestriction_CTR;
1666
1667         typedef [public,flag(NDR_NOALIGN)] struct {
1668                 uint8 rt;
1669                 [switch_is(rt)] mapi_SRestriction_CTR res;
1670         } mapi_SRestriction;
1671
1672         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1673                 uint8 rt;
1674                 [switch_is(rt)] mapi_SRestriction_CTR res;
1675         } mapi_SRestriction_and;
1676
1677         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1678                 uint8 rt;
1679                 [switch_is(rt)] mapi_SRestriction_CTR res;
1680         } mapi_SRestriction_or;
1681
1682         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1683                 uint8 rt;
1684                 [switch_is(rt)] mapi_SRestriction_CTR res;
1685         } mapi_SRestriction_sub;
1686
1687         typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
1688                 uint8 rt;
1689                 [switch_is(rt)] mapi_SRestriction_CTR res;
1690         } mapi_SRestriction_comment;
1691
1692         typedef [flag(NDR_NOALIGN)] struct {
1693                 uint8 handle_idx;
1694                 [subcontext(2)] mapi_SRestriction  restrictions;
1695         } Restrict_req;
1696
1697         typedef [flag(NDR_NOALIGN)] struct {
1698                 TableStatus     TableStatus;
1699         } Restrict_repl;
1700
1701         /**************************/
1702         /* EcDoRpc Function 0x15  */
1703         typedef [enum8bit] enum {
1704                 TBL_ADVANCE             = 0x0,
1705                 TBL_NOADVANCE           = 0x1,
1706                 TBL_ENABLEPACKEDBUFFERS = 0x2
1707         } QueryRowsFlags;
1708
1709         typedef [flag(NDR_NOALIGN)] struct {
1710                 QueryRowsFlags  QueryRowsFlags;
1711                 uint8           ForwardRead;
1712                 uint16          RowCount;
1713         } QueryRows_req;
1714
1715         typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
1716                 uint8           Origin;
1717                 uint16          RowCount;
1718                 [flag(NDR_REMAINING)]DATA_BLOB  RowData;
1719         } QueryRows_repl;
1720
1721         /**************************/
1722         /* EcDoRpc Function 0x16  */
1723         typedef [flag(NDR_NOALIGN)] struct {
1724         } GetStatus_req;
1725
1726         typedef [flag(NDR_NOALIGN)] struct {
1727                 TableStatus     TableStatus;
1728         } GetStatus_repl;
1729
1730         /**************************/
1731         /* EcDoRpc Function 0x17  */
1732         typedef [flag(NDR_NOALIGN)] struct {
1733         } QueryPosition_req;
1734
1735         typedef [flag(NDR_NOALIGN)] struct {
1736                 uint32  Numerator;
1737                 uint32  Denominator;
1738         } QueryPosition_repl;
1739
1740         /**************************/
1741         /* EcDoRpc Function 0x18  */
1742         typedef [enum8bit] enum {
1743                 BOOKMARK_BEGINNING      = 0x0,
1744                 BOOKMARK_CURRENT        = 0x1,
1745                 BOOKMARK_END            = 0x2,
1746                 BOOKMARK_USER           = 0x3
1747         } BOOKMARK;
1748
1749         typedef [flag(NDR_NOALIGN)] struct {
1750                 BOOKMARK        origin;
1751                 int32           offset;
1752                 boolean8        WantRowMovedCount;
1753         } SeekRow_req;
1754
1755         typedef [flag(NDR_NOALIGN)] struct {
1756                 boolean8        HasSoughtLess;
1757                 uint32          RowsSought;
1758         } SeekRow_repl;
1759
1760         /**************************/
1761         /* EcDoRpc Function 0x19  */
1762         typedef [flag(NDR_NOALIGN)] struct {
1763                 SBinary_short   Bookmark;
1764                 uint32          RowCount;
1765                 boolean8        WantRowMovedCount;
1766         } SeekRowBookmark_req;
1767
1768         typedef [flag(NDR_NOALIGN)] struct {
1769                 boolean8        RowNoLongerVisible;
1770                 boolean8        HasSoughtLess;
1771                 uint32          RowsSought;
1772         } SeekRowBookmark_repl;
1773
1774         /**************************/
1775         /* EcDoRpc Function 0x1a  */
1776         typedef [flag(NDR_NOALIGN)] struct {
1777                 uint32          ulNumerator;
1778                 uint32          ulDenominator;
1779         } SeekRowApprox_req;
1780
1781         typedef [flag(NDR_NOALIGN)] struct {
1782         } SeekRowApprox_repl;
1783         
1784         /**************************/
1785         /* EcDoRpc Function 0x1b  */
1786         typedef [flag(NDR_NOALIGN)] struct {
1787         } CreateBookmark_req;
1788
1789         typedef [flag(NDR_NOALIGN)] struct {
1790                 SBinary_short   bookmark;
1791         } CreateBookmark_repl;
1792
1793         /**************************/
1794         /* EcDoRpc Function 0x1c  */
1795         typedef [enum8bit] enum {
1796                 FOLDER_GENERIC  = 0x1,
1797                 FOLDER_SEARCH   = 0x2
1798         } FOLDER_TYPE;
1799
1800         typedef [enum8bit] enum {
1801                 MAPI_FOLDER_ANSI        = 0x0,
1802                 MAPI_FOLDER_UNICODE     = 0x1
1803         } FOLDER_STRING;
1804
1805         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1806                 [case(MAPI_FOLDER_ANSI)] astring                        lpszA;
1807                 [case(MAPI_FOLDER_UNICODE)][flag(STR_NULLTERM)] string  lpszW;
1808         } LPTSTR;
1809
1810         typedef [enum16bit] enum {
1811                 NONE            = 0x0000,
1812                 OPEN_IF_EXISTS  = 0x0001
1813         } FOLDER_FLAGS;
1814
1815         typedef [flag(NDR_NOALIGN)] struct {
1816                 uint8                           handle_idx;
1817                 FOLDER_TYPE                     ulFolderType;
1818                 FOLDER_STRING                   ulType;
1819                 FOLDER_FLAGS                    ulFlags;
1820                 [switch_is(ulType)] LPTSTR      FolderName;
1821                 [switch_is(ulType)] LPTSTR      FolderComment;
1822         } CreateFolder_req;
1823
1824         typedef [flag(NDR_NOALIGN)] struct {
1825                 boolean8                                HasRules;
1826                 boolean8                                IsGhosted;
1827                 [switch_is(IsGhosted)] IsGhosted        Ghost;
1828         } CreateFolder_GhostInfo;
1829
1830         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
1831                 [case(0x0)];
1832                 [case(0x1)] CreateFolder_GhostInfo      GhostInfo;
1833         } CreateFolder_GhostUnion;
1834
1835         typedef [flag(NDR_NOALIGN)] struct {
1836                 hyper                                                   folder_id;
1837                 boolean8                                                IsExistingFolder;
1838                 [switch_is(IsExistingFolder)]   CreateFolder_GhostUnion GhostUnion;
1839         } CreateFolder_repl;
1840
1841         /**************************/
1842         /* EcDoRpc Function 0x1d  */
1843         typedef [bitmap8bit] bitmap {
1844                 DEL_MESSAGES            = 0x1,
1845                 DEL_FOLDERS             = 0x4,
1846                 DELETE_HARD_DELETE      = 0x10
1847         } DeleteFolderFlags;
1848
1849         typedef [flag(NDR_NOALIGN)] struct {
1850                 DeleteFolderFlags       DeleteFolderFlags;
1851                 hyper                   FolderId;
1852         } DeleteFolder_req;
1853
1854         typedef [flag(NDR_NOALIGN)] struct {
1855                 boolean8                PartialCompletion;
1856         } DeleteFolder_repl;
1857
1858         /**************************/
1859         /* EcDoRpc Function 0x1e  */
1860         typedef [flag(NDR_NOALIGN)] struct {
1861                 boolean8        WantAsynchronous;
1862                 boolean8        NotifyNonRead;
1863                 uint16          cn_ids;
1864                 hyper           message_ids[cn_ids];
1865         } DeleteMessages_req;
1866
1867         typedef [flag(NDR_NOALIGN)] struct {
1868                 boolean8        PartialCompletion;
1869         } DeleteMessages_repl;
1870
1871         /**************************/
1872         /* EcDoRpc Function 0x1f  */
1873         typedef [flag(NDR_NOALIGN)] struct {
1874                 hyper           msgid;
1875         } GetMessageStatus_req;
1876
1877         /**************************/
1878         /* EcDoRpc Function 0x20  */
1879         typedef [bitmap32bit] bitmap {
1880                 MSGSTATUS_HIGHLIGHTED           = 0x1,
1881                 MSGSTATUS_TAGGED                = 0x2,
1882                 MSGSTATUS_HIDDEN                = 0x4,
1883                 MSGSTATUS_DELMARKED             = 0x8,
1884                 MSGSTATUS_REMOTE_DOWNLOAD       = 0x1000,
1885                 MSGSTATUS_REMOTE_DELETE         = 0x2000
1886         } ulMessageStatus;
1887
1888
1889         typedef [flag(NDR_NOALIGN)] struct {
1890                 hyper           msgid;
1891                 uint32          ulNewStatus;
1892                 ulMessageStatus ulNewStatusMask;
1893         } SetMessageStatus_req;
1894
1895         typedef [flag(NDR_NOALIGN)] struct {
1896                 ulMessageStatus ulOldStatus;
1897         } SetMessageStatus_repl;
1898
1899         /**************************/
1900         /* EcDoRpc Function 0x21  */
1901         typedef [flag(NDR_NOALIGN)] struct {
1902                 uint8           handle_idx;
1903                 TableFlags      TableFlags;
1904         } GetAttachmentTable_req;
1905
1906         typedef [flag(NDR_NOALIGN)] struct {            
1907         } GetAttachmentTable_repl;
1908
1909         /*************************/
1910         /* EcDoRpc Function 0x22 */
1911         typedef [enum8bit] enum {
1912                 OpenAttachmentFlags_ReadOnly    = 0x0,
1913                 OpenAttachmentFlags_ReadWrite   = 0x1,
1914                 OpenAttachmentFlags_BestAccess  = 0x3
1915         } OpenAttachmentFlags;
1916
1917         typedef [flag(NDR_NOALIGN)] struct {
1918                 uint8                   handle_idx;
1919                 OpenAttachmentFlags     OpenAttachmentFlags;
1920                 uint32                  AttachmentID;
1921         } OpenAttach_req;
1922
1923         typedef [flag(NDR_NOALIGN)] struct {
1924         } OpenAttach_repl;
1925
1926         /*************************/
1927         /* EcDoRpc Function 0x23 */
1928         typedef [flag(NDR_NOALIGN)] struct {
1929                 uint8   handle_idx;
1930         } CreateAttach_req;
1931
1932         typedef [flag(NDR_NOALIGN)] struct {
1933                 uint32  AttachmentID;
1934         } CreateAttach_repl;
1935
1936         /*************************/
1937         /* EcDoRpc Function 0x24 */
1938         typedef [flag(NDR_NOALIGN)] struct {
1939                 uint32          AttachmentID;
1940         } DeleteAttach_req;
1941
1942
1943         typedef [flag(NDR_NOALIGN)] struct {
1944         } DeleteAttach_repl;
1945
1946         /*************************/
1947         /* EcDoRpc Function 0x25 */
1948         typedef [flag(NDR_NOALIGN)] struct {
1949                 uint8           handle_idx;
1950                 SaveFlags       SaveFlags;
1951         } SaveChangesAttachment_req;
1952
1953         typedef [flag(NDR_NOALIGN)] struct {
1954         } SaveChangesAttachment_repl;
1955
1956         /*************************/
1957         /* EcDoRpc Function 0x26 */
1958         typedef [flag(NDR_NOALIGN)] struct {
1959                 hyper           fid;
1960                 astring         lpszMessageClass;
1961         } SetReceiveFolder_req;
1962
1963         typedef [flag(NDR_NOALIGN)] struct {
1964         } SetReceiveFolder_repl;
1965
1966         /*************************/
1967         /* EcDoRpc Function 0x27 */
1968         typedef [flag(NDR_NOALIGN)] struct {
1969                 astring         MessageClass;
1970         } GetReceiveFolder_req;
1971
1972         typedef [flag(NDR_NOALIGN)] struct {
1973                 hyper           folder_id;
1974                 astring         MessageClass;
1975         } GetReceiveFolder_repl;
1976
1977         /*************************/
1978         /* EcDoRpc Function 0x29 */
1979         typedef [bitmap16bit] bitmap {
1980                 fnevCriticalError               = 0x0001,
1981                 fnevNewMail                     = 0x0002,
1982                 fnevObjectCreated               = 0x0004,
1983                 fnevObjectDeleted               = 0x0008,
1984                 fnevObjectModified              = 0x0010,
1985                 fnevObjectMoved                 = 0x0020,
1986                 fnevObjectCopied                = 0x0040,
1987                 fnevSearchComplete              = 0x0080,
1988                 fnevTableModified               = 0x0100,
1989                 fnevStatusObjectModified        = 0x0200,
1990                 fnevReserved                    = 0x0400,
1991                 fnevTbit                        = 0x1000,
1992                 fnevUbit                        = 0x2000,
1993                 fnevSbit                        = 0x4000,
1994                 fnevMbit                        = 0x8000
1995         } NotificationFlags;
1996
1997         typedef [nodiscriminant,flag(NDR_NOALIGN)] union {
1998                 [case(0x0)] hyper       ID;
1999                 [case(0x1)];
2000         } hyperbool;
2001
2002         typedef [flag(NDR_NOALIGN)] struct {
2003                 uint8                                   handle_idx;
2004                 NotificationFlags                       NotificationFlags;
2005                 boolean8                                WantWholeStore;
2006                 [switch_is(WantWholeStore)] hyperbool   FolderId;
2007                 [switch_is(WantWholeStore)] hyperbool   MessageId;
2008         } RegisterNotification_req;
2009
2010         typedef [flag(NDR_NOALIGN)] struct {
2011         } RegisterNotification_repl;
2012
2013         /*************************/
2014         /* EcDoRpc Function 0x2a */
2015         typedef [bitmap32bit] bitmap {
2016                 MSGFLAG_READ            = 0x1,
2017                 MSGFLAG_UNMODIFIED      = 0x2,
2018                 MSGFLAG_SUBMIT          = 0x4,
2019                 MSGFLAG_UNSENT          = 0x8,
2020                 MSGFLAG_HASATTACH       = 0x10,
2021                 MSGFLAG_FROMME          = 0x20,
2022                 MSGFLAG_ASSOCIATED      = 0x40,
2023                 MSGFLAG_RESEND          = 0x80,
2024                 MSGFLAG_RN_PENDING      = 0x100,
2025                 MSGFLAG_NRN_PENDING     = 0x200
2026         } MsgFlags;
2027
2028         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2029                 [case(0x0)] astring                     lpszA;
2030                 [case(0x1)][flag(STR_NULLTERM)] string  lpszW;
2031         } MessageClass;
2032
2033         typedef [flag(NDR_NOALIGN)] struct {
2034                 GUID            DatabaseGUID;
2035                 uint8           GlobalCounter[6];
2036         } GID;
2037
2038         typedef [enum16bit] enum {
2039                 TABLE_CHANGED           =       0x1,
2040                 TABLE_ROW_ADDED         =       0x3,
2041                 TABLE_ROW_DELETED       =       0x4,
2042                 TABLE_ROW_MODIFIED      =       0x5,
2043                 TABLE_RESTRICT_DONE     =       0x7
2044         } RichTableNotificationType;
2045
2046         /* NewMailNotification: case 0x2 and 0x8002 */
2047         typedef [flag(NDR_NOALIGN)] struct {
2048                 hyper                                   FID;
2049                 hyper                                   MID;
2050                 MsgFlags                                MessageFlags;
2051                 boolean8                                UnicodeFlag;
2052                 [switch_is(UnicodeFlag)] MessageClass   MessageClass;
2053         } NewMailNotification;
2054
2055         /* FolderCreatedNotification: case 0x4 */
2056         typedef [flag(NDR_NOALIGN)] struct {
2057                 hyper                                   FID;
2058                 hyper                                   ParentFID;
2059                 uint16                                  TagCount;
2060                 MAPITAGS                                Tags[TagCount];
2061         } FolderCreatedNotification;
2062
2063         /* FolderDeletedNotification: case 0x8 */
2064         typedef [flag(NDR_NOALIGN)] struct {
2065                 hyper                                   FID;
2066                 hyper                                   ParentFID;
2067         } FolderDeletedNotification;
2068
2069         /* FolderModifiedNotification: case 0x10 */
2070         typedef [flag(NDR_NOALIGN)] struct {
2071                 hyper                   FID;
2072                 uint16                  TagCount;
2073                 MAPITAGS                Tags[TagCount];
2074         } FolderModifiedNotification_10;
2075
2076         /* FolderMoveCopyNotification: case 0x20 and 0x40 */
2077         typedef [flag(NDR_NOALIGN)] struct {
2078                 hyper                   FID;
2079                 hyper                   ParentFID;
2080                 hyper                   OldFID;
2081                 hyper                   OldParentFID;
2082         } FolderMoveCopyNotification;
2083
2084         /* SearchCompleteNotification: case 0x80 */
2085         typedef [flag(NDR_NOALIGN)] struct {
2086                 hyper                   FID;
2087         } SearchCompleteNotification;
2088
2089         /* HierarchyTable: case 0x100 */
2090         typedef [flag(NDR_NOALIGN)] struct {
2091                 hyper                           FID;
2092                 hyper                           InsertAfterFID;
2093                 [subcontext(2)] DATA_BLOB       Columns;
2094         } HierarchyRowAddedNotification;
2095
2096         typedef [flag(NDR_NOALIGN)] struct {
2097                 hyper                           FID;
2098         } HierarchyRowDeletedNotification;
2099         
2100         typedef [flag(NDR_NOALIGN)] struct {
2101                 hyper                           FID;
2102                 hyper                           InsertAfterFID;
2103                 [subcontext(2)] DATA_BLOB       Columns;
2104         } HierarchyRowModifiedNotification;
2105
2106         typedef [nodiscriminant] union {
2107                 [case(TABLE_ROW_ADDED)] HierarchyRowAddedNotification           HierarchyRowAddedNotification;
2108                 [case(TABLE_ROW_DELETED)] HierarchyRowDeletedNotification       HierarchyRowDeletedNotification;
2109                 [case(TABLE_ROW_MODIFIED)] HierarchyRowModifiedNotification     HierarchyRowModifiedNotification;
2110                 [default];
2111         } HierarchyTableChangeUnion;
2112
2113         typedef [flag(NDR_NOALIGN)] struct {
2114                 RichTableNotificationType                               TableEvent;
2115                 [switch_is(TableEvent)] HierarchyTableChangeUnion       HierarchyTableChangeUnion;
2116         } HierarchyTableChange;
2117
2118         /* IcsNotification: case 0x200 */
2119         typedef [flag(NDR_NOALIGN)] struct {
2120                 boolean8                HierChanged;
2121                 uint32                  GIDCount;
2122                 GID                     GID[GIDCount];
2123         } IcsNotification;
2124
2125         /* FolderModifiedNotification: case 0x1010 */
2126         typedef [flag(NDR_NOALIGN)] struct {
2127                 hyper                   FID;
2128                 uint16                  TagCount;
2129                 MAPITAGS                Tags[TagCount];
2130                 uint32                  TotalMessageCount;
2131         } FolderModifiedNotification_1010;
2132
2133         /* FolderModifiedNotification: case 0x2010 */
2134         typedef [flag(NDR_NOALIGN)] struct {
2135                 hyper                   FID;
2136                 uint16                  TagCount;
2137                 MAPITAGS                Tags[TagCount];
2138                 uint32                  UnreadMessageCount;
2139         } FolderModifiedNotification_2010;
2140
2141         /* FolderModifiedNotification: case 0x3010 */
2142         typedef [flag(NDR_NOALIGN)] struct {
2143                 hyper                   FID;
2144                 uint16                  TagCount;
2145                 MAPITAGS                Tags[TagCount];
2146                 uint32                  TotalMessageCount;
2147                 uint32                  UnreadMessageCount;
2148         } FolderModifiedNotification_3010;
2149
2150         /* MessageCreatedNotification: case 0x8004 */
2151         typedef [flag(NDR_NOALIGN)] struct {
2152                 hyper                                   FID;
2153                 hyper                                   MID;
2154                 uint16                                  TagCount;
2155                 MAPITAGS                                Tags[TagCount];
2156         } MessageCreatedNotification;
2157
2158         /* MessageDeletedNotification: case 0x8008 */
2159         typedef [flag(NDR_NOALIGN)] struct {
2160                 hyper                                   FID;
2161                 hyper                                   MID;
2162         } MessageDeletedNotification;
2163
2164         /* MessageModifiedNotification: case 0x8010 */
2165         typedef [flag(NDR_NOALIGN)] struct {
2166                 hyper                                   FID;
2167                 hyper                                   MID;
2168                 uint16                                  TagCount;
2169                 MAPITAGS                                Tags[TagCount];
2170         } MessageModifiedNotification;
2171
2172         /* MessageMoveCopyNotification: case 0x8020 and 0x8040 */
2173         typedef [flag(NDR_NOALIGN)] struct {
2174                 hyper                   FID;
2175                 hyper                   MID;
2176                 hyper                   OldFID;
2177                 hyper                   OldMID;
2178         } MessageMoveCopyNotification;  
2179
2180         /* ContentsTableChange: case 0x8100 and 0xc100 */
2181         typedef [flag(NDR_NOALIGN)] struct {
2182                 hyper                           FID;
2183                 hyper                           MID;
2184                 uint32                          Instance;
2185                 hyper                           InsertAfterFID;
2186                 hyper                           InsertAfterMID;
2187                 uint32                          InsertAfterInstance;
2188                 [subcontext(2)] DATA_BLOB       Columns;
2189         } ContentsRowAddedNotification;
2190
2191         typedef [flag(NDR_NOALIGN)] struct {
2192                 hyper                           FID;
2193                 hyper                           MID;
2194                 uint32                          Instance;
2195         } ContentsRowDeletedNotification;
2196
2197         typedef [flag(NDR_NOALIGN)] struct {
2198                 hyper                           FID;
2199                 hyper                           MID;
2200                 uint32                          Instance;
2201                 hyper                           InsertAfterFID;
2202                 hyper                           InsertAfterMID;
2203                 uint32                          InsertAfterInstance;
2204                 [subcontext(2)] DATA_BLOB       Columns;
2205         } ContentsRowModifiedNotification;
2206
2207         typedef [nodiscriminant] union {
2208                 [case(TABLE_ROW_ADDED)] ContentsRowAddedNotification            ContentsRowAddedNotification;
2209                 [case(TABLE_ROW_DELETED)] ContentsRowDeletedNotification        ContentsRowDeletedNotification;
2210                 [case(TABLE_ROW_MODIFIED)] ContentsRowModifiedNotification      ContentsRowModifiedNotification;
2211                 [default];
2212         } ContentsTableChangeUnion;
2213
2214         typedef [flag(NDR_NOALIGN)] struct {
2215                 RichTableNotificationType                               TableEvent;
2216                 [switch_is(TableEvent)] ContentsTableChangeUnion        ContentsTableChangeUnion;
2217         } ContentsTableChange;
2218
2219         /* SearchMessageRemovedNotification: case 0xc008 */
2220         typedef [flag(NDR_NOALIGN)] struct {
2221                 hyper                                   FID;
2222                 hyper                                   MID;
2223                 hyper                                   SearchFID;
2224         } SearchMessageRemovedNotification;
2225
2226         /* SearchMessageModifiedNotification: 0xc010 */
2227         typedef [flag(NDR_NOALIGN)] struct {
2228                 hyper                                   FID;
2229                 hyper                                   MID;
2230                 hyper                                   SearchFID;
2231                 uint16                                  TagCount;
2232                 MAPITAGS                                Tags[TagCount];
2233         } SearchMessageModifiedNotification;
2234
2235         typedef [nodiscriminant] union {
2236                 [case(0x0002)] NewMailNotification                      NewMailNotification;
2237                 [case(0x0004)] FolderCreatedNotification                FolderCreatedNotification;
2238                 [case(0x0008)] FolderDeletedNotification                FolderDeletedNotification;
2239                 [case(0x0010)] FolderModifiedNotification_10            FolderModifiedNotification_10;
2240                 [case(0x0020)] FolderMoveCopyNotification               FolderMoveNotification;
2241                 [case(0x0040)] FolderMoveCopyNotification               FolderCopyNotification;
2242                 [case(0x0080)] SearchCompleteNotification               SearchCompleteNotification;
2243                 [case(0x0100)] HierarchyTableChange                     HierarchyTableChange;
2244                 [case(0x0200)] IcsNotification                          IcsNotification;
2245                 [case(0x1010)] FolderModifiedNotification_1010          FolderModifiedNotification_1010;
2246                 [case(0x2010)] FolderModifiedNotification_2010          FolderModifiedNotification_2010;
2247                 [case(0x3010)] FolderModifiedNotification_3010          FolderModifiedNotification_3010;
2248                 [case(0x8002)] NewMailNotification                      NewMessageNotification;
2249                 [case(0x8004)] MessageCreatedNotification               MessageCreatedNotification;
2250                 [case(0x8008)] MessageDeletedNotification               MessageDeletedNotification;
2251                 [case(0x8010)] MessageModifiedNotification              MessageModifiedNotification;
2252                 [case(0x8020)] MessageMoveCopyNotification              MessageMoveNotification;
2253                 [case(0x8040)] MessageMoveCopyNotification              MessageCopyNotification;
2254                 [case(0x8100)] ContentsTableChange                      ContentsTableChange;
2255                 [case(0xc008)] SearchMessageRemovedNotification         SearchMessageRemovedNotification;
2256                 [case(0xc010)] SearchMessageModifiedNotification        SearchMessageModifiedNotification;
2257                 [case(0xc100)] ContentsTableChange                      SearchTableChange;
2258         } NotificationData;
2259
2260         typedef [flag(NDR_NOALIGN)] struct {
2261                 uint32                                          NotificationHandle;
2262                 uint8                                           LogonId;
2263                 NotificationFlags                               NotificationType;
2264                 [switch_is(NotificationType)] NotificationData  NotificationData;
2265         } Notify_repl;
2266
2267         /*************************/
2268         /* EcDoRpc Function 0x2b */
2269         typedef [enum8bit] enum {
2270                 OpenStream_ReadOnly     = 0x0,
2271                 OpenStream_ReadWrite    = 0x1,
2272                 OpenStream_Create       = 0x2,
2273                 OpenStream_BestAccess   = 0x3
2274         } OpenStream_OpenModeFlags;
2275
2276         typedef [flag(NDR_NOALIGN)] struct {
2277                 uint8                           handle_idx;
2278                 MAPITAGS                        PropertyTag;
2279                 OpenStream_OpenModeFlags        OpenModeFlags;
2280         } OpenStream_req;
2281
2282         typedef [flag(NDR_NOALIGN)] struct {
2283                 uint32          StreamSize;
2284         } OpenStream_repl;
2285
2286         /*************************/
2287         /* EcDoRpc Function 0x2c */
2288         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2289                 [case(0xBABE)] uint32   value;
2290                 [default];
2291         } MaximumByteCount;
2292
2293         typedef [flag(NDR_NOALIGN)] struct {
2294                 uint16                                          ByteCount;
2295                 [switch_is(ByteCount)]  MaximumByteCount        MaximumByteCount;
2296         } ReadStream_req;
2297
2298         typedef [flag(NDR_ALIGN2)] struct {
2299                 [subcontext(2), flag(NDR_REMAINING)] DATA_BLOB data;
2300         } ReadStream_repl;
2301
2302         /*************************/
2303         /* EcDoRpc Function 0x2d */
2304         typedef [flag(NDR_NOALIGN)] struct {
2305                 [subcontext(2), flag(NDR_REMAINING)] DATA_BLOB  data;
2306         } WriteStream_req;
2307
2308
2309         typedef [flag(NDR_NOALIGN)] struct {
2310                 uint16          WrittenSize;
2311         } WriteStream_repl;
2312
2313         /*************************/
2314         /* EcDoRpc Function 0x2e */
2315         typedef [flag(NDR_NOALIGN)] struct {
2316                 uint8           Origin;
2317                 hyper           Offset;
2318         } SeekStream_req;
2319
2320         typedef [flag(NDR_NOALIGN)] struct {
2321                 hyper           NewPosition;
2322         } SeekStream_repl;
2323
2324         /*************************/
2325         /* EcDoRpc Function 0x2f */
2326         typedef [flag(NDR_NOALIGN)] struct {
2327                 hyper           SizeStream;
2328         } SetStreamSize_req;
2329
2330         typedef [flag(NDR_NOALIGN)] struct {
2331         } SetStreamSize_repl;
2332
2333         /*************************/
2334         /* EcDoRpc Function 0x30 */
2335         typedef [bitmap32bit, flag(NDR_PAHEX)] bitmap {
2336                 STOP_SEARCH                     = 0x00000001,
2337                 RESTART_SEARCH                  = 0x00000002,
2338                 RECURSIVE_SEARCH                = 0x00000004,
2339                 SHALLOW_SEARCH                  = 0x00000008,
2340                 FOREGROUND_SEARCH               = 0x00000010,
2341                 BACKGROUND_SEARCH               = 0x00000020,
2342                 CONTENT_INDEXED_SEARCH          = 0x00010000,
2343                 NON_CONTENT_INDEXED_SEARCH      = 0x00020000,
2344                 STATIC_SEARCH                   = 0x00040000
2345         } SearchFlags;
2346
2347         typedef [flag(NDR_NOALIGN)] struct {
2348                 [subcontext(2)] mapi_SRestriction       res;
2349                 uint16                                  FolderIdCount;
2350                 hyper                                   FolderIds[FolderIdCount];
2351                 SearchFlags                             SearchFlags;
2352         } SetSearchCriteria_req;
2353
2354         typedef [flag(NDR_NOALIGN)] struct {
2355         } SetSearchCriteria_repl;
2356
2357         /*************************/
2358         /* EcDoRpc Function 0x31 */
2359         typedef [flag(NDR_NOALIGN)] struct {
2360                 boolean8        UseUnicode;
2361                 boolean8        IncludeRestriction;
2362                 boolean8        IncludeFolders;
2363         } GetSearchCriteria_req;
2364
2365         typedef [flag(NDR_NOALIGN)] struct {
2366                 [subcontext(2)] mapi_SRestriction       res;
2367                 uint8                                   unknown;
2368                 uint16                                  FolderIdCount;
2369                 hyper                                   FolderIds[FolderIdCount];
2370                 SearchFlags                             SearchFlags;
2371         } GetSearchCriteria_repl;
2372
2373         /*************************/
2374         /* EcDoRpc Function 0x32 */
2375         typedef [enum8bit] enum {
2376                 None            = 0x0,  /* None */
2377                 PreProcess      = 0x1,  /* Needs to be preprocessed by the server */
2378                 NeedsSpooler    = 0x2   /* Is to be processed by a client spooler */
2379         } SubmitFlags;
2380
2381         typedef [flag(NDR_NOALIGN)] struct {
2382                 SubmitFlags     SubmitFlags;
2383         } SubmitMessage_req;
2384
2385         typedef [flag(NDR_NOALIGN)] struct {
2386         } SubmitMessage_repl;
2387
2388         /*************************/
2389         /* EcDoRpc Function 0x33 */
2390         typedef [flag(NDR_NOALIGN)] struct {
2391                 uint8           handle_idx;
2392                 uint16          count;
2393                 hyper           message_id[count];
2394                 boolean8        WantAsynchronous;
2395                 boolean8        WantCopy;
2396         } MoveCopyMessages_req;
2397
2398         typedef [flag(NDR_NOALIGN)] struct {
2399                 boolean8        PartialCompletion;
2400         } MoveCopyMessages_repl;
2401
2402         /*************************/
2403         /* EcDoRpc Function 0x34 */
2404         typedef [flag(NDR_NOALIGN)] struct {
2405                 hyper           FolderId;
2406                 hyper           MessageId;
2407         } AbortSubmit_req;
2408
2409         typedef [flag(NDR_NOALIGN)] struct {
2410         } AbortSubmit_repl;
2411
2412         /*************************/
2413         /* EcDoRpc Function 0x35 */
2414         typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
2415                 [case(0x0)] astring                     lpszA;
2416                 [case(0x1)][flag(STR_NULLTERM)] string  lpszW;
2417         } Folder_name;
2418
2419         typedef [flag(NDR_NOALIGN)] struct {
2420                 uint8                                   handle_idx;
2421                 boolean8                                WantAsynchronous;
2422                 boolean8                                UseUnicode;
2423                 hyper                                   FolderId;
2424                 [switch_is(UseUnicode)] Folder_name     NewFolderName;
2425         } MoveFolder_req;
2426
2427         typedef [flag(NDR_NOALIGN)] struct {
2428                 boolean8                                PartialCompletion;
2429         } MoveFolder_repl;
2430
2431         /*************************/
2432         /* EcDoRpc Function 0x36 */
2433         typedef [flag(NDR_NOALIGN)] struct {
2434                 uint8                                   handle_idx;
2435                 boolean8                                WantAsynchronous;
2436                 boolean8                                WantRecursive;
2437                 boolean8                                UseUnicode;
2438                 hyper                                   FolderId;
2439                 [switch_is(UseUnicode)] Folder_name     NewFolderName;
2440         } CopyFolder_req;
2441
2442         typedef [flag(NDR_NOALIGN)] struct {
2443                 boolean8                                PartialCompletion;
2444         } CopyFolder_repl;
2445
2446         /*************************/
2447         /* EcDoRpc Function 0x37 */
2448         typedef [flag(NDR_NOALIGN)] struct {
2449         } QueryColumnsAll_req;
2450
2451         typedef [flag(NDR_NOALIGN)] struct {
2452                 uint16          PropertyTagCount;
2453                 MAPITAGS        PropertyTags[PropertyTagCount];
2454         } QueryColumnsAll_repl;
2455
2456         /*************************/
2457         /* EcDoRpc Function 0x38 */
2458         typedef [flag(NDR_NOALIGN)] struct {
2459         } Abort_req;
2460
2461         typedef [flag(NDR_NOALIGN)] struct {
2462                 TableStatus     TableStatus;
2463         } Abort_repl;
2464
2465         /*************************/
2466         /* EcDoRpc Function 0x39 */
2467         typedef [bitmap8bit] bitmap {
2468                 CopyFlagsMove           = 0x1,  /* Move properties */
2469                 CopyFlagsNoOverwrite    = 0x2   /* Do not overwrite existing properties */
2470         } CopyFlags;
2471
2472         typedef [flag(NDR_NOALIGN)] struct {
2473                 uint8                   handle_idx;
2474                 boolean8                WantAsynchronous;
2475                 boolean8                WantSubObjects;
2476                 CopyFlags               CopyFlags;
2477                 mapi_SPropTagArray      ExcludedTags;
2478         } CopyTo_req;
2479
2480         typedef [flag(NDR_NOALIGN)] struct {
2481                 uint16          PropertyProblemCount;
2482                 PropertyProblem PropertyProblem[PropertyProblemCount];
2483         } CopyTo_repl;
2484
2485         /*************************/
2486         /* EcDoRpc Function 0x3a */
2487         typedef [flag(NDR_NOALIGN)] struct {
2488                 uint8           handle_idx;
2489                 hyper           ByteCount;
2490         } CopyToStream_req;
2491
2492         typedef [flag(NDR_NOALIGN)] struct {
2493                 hyper           ReadByteCount;
2494                 hyper           WrittenByteCount;
2495         } CopyToStream_repl;
2496
2497         /*************************/
2498         /* EcDoRpc Function 0x3e */
2499         typedef [flag(NDR_NOALIGN)] struct {
2500                 uint8           handle_idx;
2501                 uint8           padding;
2502         } GetTable_req;
2503
2504         typedef [flag(NDR_NOALIGN)] struct {
2505         } GetTable_repl;
2506
2507         /*************************/
2508         /* EcDoRpc Function 0x3f */
2509         typedef [bitmap8bit] bitmap {
2510                 RulesTableFlags_Unicode = 0x40
2511         } RulesTableFlags;
2512
2513         typedef [flag(NDR_NOALIGN)] struct {
2514                 uint8           handle_idx;
2515                 RulesTableFlags TableFlags;
2516         } GetRulesTable_req;
2517
2518         typedef [flag(NDR_NOALIGN)] struct {
2519         } GetRulesTable_repl;
2520
2521         /*************************/
2522         /* EcDoRpc Function 0x40 */
2523         typedef [flag(NDR_NOALIGN)] struct {
2524                 mapi_SRowList           rowList;
2525         } ModifyTable_req;
2526
2527         typedef [flag(NDR_NOALIGN)] struct {
2528                 [flag(NDR_REMAINING)] DATA_BLOB remaining;
2529         } ModifyTable_repl;
2530
2531         /*************************/
2532         /* EcDoRpc Function 0x41 */
2533         typedef [flag(NDR_NOALIGN)] struct {
2534                 ulRowFlags              RulesDataFlags;
2535                 mapi_SPropValue_array   PropertyValues;
2536         } RulesData;
2537
2538         typedef [flag(NDR_NOALIGN)] struct {
2539                 uint8           ModifyRulesFlags;
2540                 uint16          RulesCount;
2541                 RulesData       RulesData[RulesCount];
2542         } ModifyRules_req;
2543
2544         typedef [flag(NDR_NOALIGN)] struct {
2545         } ModifyRules_repl;
2546
2547         /*************************/
2548         /* EcDoRpc Function 0x42 */
2549         typedef [flag(NDR_NOALIGN)] struct {
2550                 hyper           FolderId;
2551         } GetOwningServers_req;
2552
2553         typedef [flag(NDR_NOALIGN)] struct {
2554                 uint16          OwningServersCount;
2555                 uint16          CheapServersCount;
2556                 astring         OwningServers[OwningServersCount];
2557         } GetOwningServers_repl;
2558
2559         /*************************/
2560         /* EcDoRpc Function 0x43 */
2561         typedef [flag(NDR_NOALIGN)] struct {
2562                 hyper   Id;
2563         } LongTermIdFromId_req;
2564
2565         typedef [flag(NDR_NOALIGN)] struct {
2566                 GUID    DatabaseGuid;
2567                 uint8   GlobalCounter[6];
2568                 uint16  padding;
2569         } LongTermId;
2570
2571         typedef [flag(NDR_NOALIGN)] struct {
2572                 LongTermId      LongTermId;
2573         } LongTermIdFromId_repl;
2574
2575         /*************************/
2576         /* EcDoRpc Function 0x44 */
2577         typedef [flag(NDR_NOALIGN)] struct {
2578                 LongTermId      LongTermId;
2579         } IdFromLongTermId_req;
2580
2581         typedef [flag(NDR_NOALIGN)] struct {
2582                 hyper           Id;
2583         } IdFromLongTermId_repl;
2584
2585         /*************************/
2586         /* EcDoRpc Function 0x45 */
2587         typedef [flag(NDR_NOALIGN)] struct {
2588                 hyper           FolderId;
2589         } PublicFolderIsGhosted_req;
2590
2591         typedef [flag(NDR_NOALIGN)] struct {
2592                 boolean8                                IsGhosted;
2593                 [switch_is(IsGhosted)] IsGhosted        Ghost;
2594         } PublicFolderIsGhosted_repl;
2595
2596         /*************************/
2597         /* EcDoRpc Function 0x46 */
2598         typedef [flag(NDR_NOALIGN)] struct {
2599                 uint8                           handle_idx;
2600                 uint16                          CodePageId;
2601                 OpenMessage_OpenModeFlags       OpenModeFlags;
2602         } OpenEmbeddedMessage_req;
2603
2604         typedef [flag(NDR_NOALIGN)] struct {
2605                 uint8                   Reserved;
2606                 hyper                   MessageId;
2607                 boolean8                HasNamedProperties;
2608                 TypedString             SubjectPrefix;
2609                 TypedString             NormalizedSubject;
2610                 uint16                  RecipientCount;
2611                 uint16                  ColumnCount;
2612                 MAPITAGS                RecipientColumns[ColumnCount];
2613                 uint8                   RowCount;
2614                 OpenRecipientRow        RecipientRows[RowCount];
2615         } OpenEmbeddedMessage_repl;
2616
2617         /*************************/
2618         /* EcDoRpc Function 0x47 */
2619         typedef [flag(NDR_NOALIGN)] struct {
2620         } SetSpooler_req;
2621
2622         typedef [flag(NDR_NOALIGN)] struct {
2623         } SetSpooler_repl;
2624
2625         /*************************/
2626         /* EcDoRpc Function 0x48 */
2627         typedef [enum8bit] enum {
2628                 LockState_1stLock       = 0x0,
2629                 LockState_1stUnlock     = 0x1,
2630                 LockState_1stFinished   = 0x2
2631         } LockState;
2632
2633         typedef [flag(NDR_NOALIGN)] struct {
2634                 hyper           MessageId;
2635                 LockState       LockState;
2636         } SpoolerLockMessage_req;
2637
2638         typedef [flag(NDR_NOALIGN)] struct {
2639         } SpoolerLockMessage_repl;
2640
2641         /*************************/
2642         /* EcDoRpc Function 0x49 */
2643         typedef [flag(NDR_NOALIGN)] struct {
2644         } AddressTypes_req;
2645
2646         typedef [flag(NDR_NOALIGN)] struct {
2647                 uint16          cValues;
2648                 uint16          size;
2649                 mapi_LPSTR      transport[cValues];
2650         } AddressTypes_repl;
2651
2652         /**************************/
2653         /* EcDoRpc Function 0x4a  */
2654         typedef [flag(NDR_NOALIGN)] struct {
2655         } TransportSend_req;
2656
2657         typedef [nodiscriminant] union {
2658                 [case(0x0)] mapi_SPropValue_array       lpProps;
2659                 [case(0x1)];
2660         } TransportSend_lpProps;
2661
2662         typedef [flag(NDR_NOALIGN)] struct {
2663                 boolean8                                                NoPropertiesReturned;
2664                 [switch_is(NoPropertiesReturned)] TransportSend_lpProps properties;
2665         } TransportSend_repl;
2666
2667         /**************************/
2668         /* EcDoRpc Function 0x4e  */
2669         typedef [flag(NDR_NOALIGN)] struct {
2670                 uint16          BufferSize;
2671         } FastTransferSourceGetBuffer_req;
2672
2673         typedef [enum16bit] enum {
2674                 TransferStatus_Error    = 0x0,
2675                 TransferStatus_Partial  = 0x1,
2676                 TransferStatus_NoRoom   = 0x2,
2677                 TransferStatus_Done     = 0x3
2678         } TransferStatus;
2679
2680         typedef [flag(NDR_NOALIGN)] struct {
2681                 TransferStatus  TransferStatus;
2682                 uint16          InProgressCount;
2683                 uint16          TotalStepCount;
2684                 uint8           Reserved;
2685                 uint16          TransferBufferSize;
2686                 [subcontext(0),subcontext_size(TransferBufferSize),flag(NDR_REMAINING)] DATA_BLOB TransferBuffer;
2687         } FastTransferSourceGetBuffer_repl;
2688
2689         /**************************/
2690         /* EcDoRpc Function 0x4f  */
2691         typedef [enum8bit] enum {
2692                 DIR_FORWARD  = 0x0,
2693                 DIR_BACKWARD = 0x1
2694         } FindRow_ulFlags;
2695
2696         typedef [flag(NDR_NOALIGN)] struct {
2697                 FindRow_ulFlags ulFlags;
2698                 [subcontext(2)] mapi_SRestriction res;
2699                 BOOKMARK        origin;
2700                 SBinary_short   bookmark;
2701         } FindRow_req;
2702
2703         typedef [flag(NDR_NOALIGN)] struct {
2704                 uint8           RowNoLongerVisible;
2705                 uint8           HasRowData;
2706                 [flag(NDR_NOALIGN)] DATA_BLOB row;
2707         } FindRow_repl;
2708
2709         /**************************/
2710         /* EcDoRpc Function 0x50  */
2711         typedef [flag(NDR_NOALIGN)] struct {
2712                 boolean8        WantCancel;
2713         } Progress_req;
2714
2715         typedef [flag(NDR_NOALIGN)] struct {
2716                 uint32          CompletedTaskCount;
2717                 uint32          TotalTaskCount;
2718         } Progress_repl;
2719
2720         /*************************/
2721         /* EcDoRpc Function 0x55 */
2722         typedef [enum8bit] enum {
2723                 MNID_ID = 0,
2724                 MNID_STRING = 1
2725         } ulKind;
2726
2727         typedef [flag(NDR_NOALIGN)] struct {
2728                 uint8                           NameSize;
2729                 [flag(STR_NULLTERM)] string     Name;
2730         } mapi_name;
2731
2732         typedef [nodiscriminant] union {
2733                 [case(MNID_ID)] uint32          lid;
2734                 [case(MNID_STRING)] mapi_name   lpwstr;
2735         } Kind;
2736         
2737         typedef [flag(NDR_NOALIGN)] struct {
2738                 ulKind                          ulKind;
2739                 GUID                            lpguid;
2740                 [switch_is(ulKind)] Kind        kind;
2741         } MAPINAMEID;
2742
2743         typedef [flag(NDR_NOALIGN)] struct {
2744                 MAPITAGS        ulPropTag;
2745         } GetNamesFromIDs_req;
2746
2747         typedef [flag(NDR_NOALIGN)] struct {
2748                 uint16          count;
2749                 MAPINAMEID      nameid[count];
2750         } GetNamesFromIDs_repl;
2751
2752         /*************************/
2753         /* EcDoRpc Function 0x56 */
2754         typedef [flag(NDR_NOALIGN)] struct {
2755                 uint8           ulFlags;
2756                 uint16          count;
2757                 MAPINAMEID      nameid[count];
2758         } GetIDsFromNames_req;
2759
2760         typedef [flag(NDR_NOALIGN)] struct {
2761                 uint16          count;
2762                 uint16          propID[count];
2763         } GetIDsFromNames_repl;
2764
2765         /*************************/
2766         /* EcDoRpc Function 0x58 */
2767         typedef [flag(NDR_NOALIGN)] struct {
2768                 boolean8        WantAsynchronous;
2769                 boolean8        WantDeleteAssociated;
2770         } EmptyFolder_req;
2771
2772         typedef [flag(NDR_NOALIGN)] struct {
2773                 boolean8        PartialCompletion;
2774         } EmptyFolder_repl;
2775
2776         /*************************/
2777         /* EcDoRpc Function 0x59 */
2778         typedef [flag(NDR_NOALIGN)] struct {
2779                 uint16          MaxRowCount;
2780                 hyper           CategoryId;
2781         } ExpandRow_req;
2782
2783         typedef [flag(NDR_NOALIGN)] struct {
2784                 uint32          ExpandedRowCount;
2785                 uint16          RowCount;
2786                 [flag(NDR_REMAINING)]DATA_BLOB  RowData;
2787         } ExpandRow_repl;
2788
2789         /*************************/
2790         /* EcDoRpc Function 0x5a */
2791         typedef [flag(NDR_NOALIGN)] struct {
2792                 hyper           CategoryId;
2793         } CollapseRow_req;
2794
2795         typedef [flag(NDR_NOALIGN)] struct {
2796                 uint32          CollapsedRowCount;
2797         } CollapseRow_repl;
2798
2799         /*************************/
2800         /* EcDoRpc Function 0x5d */
2801         typedef [flag(NDR_NOALIGN)] struct {
2802         } CommitStream_req;
2803
2804         typedef [flag(NDR_NOALIGN)] struct {
2805         } CommitStream_repl;
2806
2807         /*************************/
2808         /* EcDoRpc Function 0x5e */
2809         typedef [flag(NDR_NOALIGN)] struct {
2810         } GetStreamSize_req;
2811
2812         typedef [flag(NDR_NOALIGN)] struct {
2813                 uint32          StreamSize;
2814         } GetStreamSize_repl;
2815
2816         /*************************/
2817         /* EcDoRpc Function 0x5f */
2818         typedef [bitmap8bit] bitmap {
2819                 NoStrings       = 0x01,
2820                 NoIds           = 0x02
2821         } QueryFlags;
2822
2823         typedef [nodiscriminant] union {
2824                 [case(0x0)];
2825                 [case(0x1)] GUID guid;
2826         } QueryNamedProperties_guid;
2827
2828         typedef [flag(NDR_NOALIGN)] struct {
2829                 QueryFlags              QueryFlags;
2830                 boolean8                HasGuid;
2831                 [switch_is(HasGuid)]    QueryNamedProperties_guid PropertyGuid;
2832         } QueryNamedProperties_req;
2833
2834         typedef [flag(NDR_NOALIGN)] struct {
2835                 uint16          IdCount;
2836                 uint16          PropertyIds[IdCount];
2837                 MAPINAMEID      PropertyNames[IdCount];
2838         } QueryNamedProperties_repl;
2839   
2840         /*************************/
2841         /* EcDoRpc Function 0x60 */
2842         typedef [flag(NDR_NOALIGN)] struct {
2843                 GUID    DatabaseGuid;
2844         } GetPerUserLongTermIds_req;
2845
2846         typedef [flag(NDR_NOALIGN)] struct {
2847                 uint16          LongTermIdCount;
2848                 LongTermId      LongTermIds[LongTermIdCount];
2849         } GetPerUserLongTermIds_repl;
2850
2851         /*************************/
2852         /* EcDoRpc Function 0x61 */
2853         typedef [flag(NDR_NOALIGN)] struct {
2854                 LongTermId      LongTermId;
2855         } GetPerUserGuid_req;
2856
2857         typedef [flag(NDR_NOALIGN)] struct {
2858                 GUID            DatabaseGuid;
2859         } GetPerUserGuid_repl;
2860
2861         /*************************/
2862         /* EcDoRpc Function 0x63 */
2863         typedef [flag(NDR_NOALIGN)] struct {
2864                 uint8           FolderId[24];
2865                 boolean8        WhatIfChanged;
2866                 uint32          DataOffset;
2867                 uint16          MaxDataSize;
2868         } ReadPerUserInformation_req;
2869
2870         typedef [flag(NDR_NOALIGN)] struct {
2871                 boolean8        HasFinished;
2872                 uint16          DataSize;
2873                 [subcontext(0), subcontext_size(DataSize), flag(NDR_REMAINING)] DATA_BLOB Data;
2874         } ReadPerUserInformation_repl;
2875
2876         /*************************/
2877         /* EcDoRpc Function 0x66 */
2878         typedef [flag(NDR_NOALIGN)] struct {
2879                 boolean8        WantAsynchronous;
2880                 MSGFLAG_READ    ReadFlags;
2881                 uint16          MessageIdCount;
2882                 hyper           MessageIds[MessageIdCount];
2883         } SetReadFlags_req;
2884
2885         typedef [flag(NDR_NOALIGN)] struct {
2886                 boolean8        PartialCompletion;
2887         } SetReadFlags_repl;
2888
2889         /*************************/
2890         /* EcDoRpc Function 0x67 */
2891         typedef [flag(NDR_NOALIGN)] struct {
2892                 uint8                   handle_idx;
2893                 boolean8                WantAsynchronous;
2894                 CopyFlags               CopyFlags;
2895                 mapi_SPropTagArray      PropertyTags;
2896         } CopyProperties_req;
2897
2898         typedef [flag(NDR_NOALIGN)] struct {
2899                 uint16          PropertyProblemCount;
2900                 PropertyProblem PropertyProblem[PropertyProblemCount];
2901         } CopyProperties_repl;
2902
2903         /*************************/
2904         /* EcDoRpc Function 0x68 */
2905         typedef [flag(NDR_NOALIGN)] struct {
2906                 uint8           unknown;
2907                 hyper           fid;
2908                 astring         lpszMessageClass;
2909                 FILETIME        modiftime;
2910         } ReceiveFolder;
2911
2912         typedef [flag(NDR_NOALIGN)] struct {
2913         } GetReceiveFolderTable_req;
2914
2915         typedef [flag(NDR_NOALIGN)] struct {
2916                 uint32          cValues;
2917                 ReceiveFolder   entries[cValues];
2918         } GetReceiveFolderTable_repl;
2919
2920         /*************************/
2921         /* EcDoRpc Function 0x6b */
2922         typedef [flag(NDR_NOALIGN)] struct {
2923                 hyper           RowId;
2924                 uint32          RowInstanceNumber;
2925         } GetCollapseState_req;
2926
2927         typedef [flag(NDR_NOALIGN)] struct {
2928                 SBinary_short   CollapseState;
2929         } GetCollapseState_repl;
2930
2931         /*************************/
2932         /* EcDoRpc Function 0x6c */
2933         typedef [flag(NDR_NOALIGN)] struct {
2934                 SBinary_short   CollapseState;
2935         } SetCollapseState_req;
2936
2937         typedef [flag(NDR_NOALIGN)] struct {
2938                 SBinary_short   bookmark;
2939         } SetCollapseState_repl;
2940
2941         /*************************/
2942         /* EcDoRpc Function 0x6d */
2943         typedef [flag(NDR_NOALIGN)] struct {
2944         } GetTransportFolder_req;
2945
2946         typedef [flag(NDR_NOALIGN)] struct {
2947                 hyper           FolderId;
2948         } GetTransportFolder_repl;
2949
2950         /*************************/
2951         /* EcDoRpc Function 0x6e */
2952         typedef [flag(NDR_NOALIGN)] struct {
2953                 uint16  SessionIndex;
2954         } Pending_repl;
2955
2956         /*************************/
2957         /* EcDoRpc Function 0x6f */
2958         typedef [enum8bit,flag(NDR_NOALIGN)] enum {
2959                 OPTION_TYPE_RECIPIENT   = 0x1,
2960                 OPTION_TYPE_MESSAGE     = 0x2
2961         } OPTIONDATA_ulFlags;
2962
2963         typedef [flag(NDR_NOALIGN)] struct {
2964                 astring                 transport;
2965                 OPTIONDATA_ulFlags      type;
2966         } RegisterOptions_req;
2967
2968         typedef [flag(NDR_NOALIGN)] struct {
2969                 OPTIONDATA_ulFlags      ulFlags;
2970                 DATA_BLOB               data;
2971         } RegisterOptions_repl;
2972
2973         /*************************/
2974         /* EcDoRpc Function 0x70 */
2975         typedef [enum8bit] enum {
2976                 Contents        = 0x1,
2977                 Hierarchy       = 0x2
2978         } SynchronizationType;
2979
2980         typedef [bitmap8bit] bitmap {
2981                 SendOptions_Unicode             = 0x1,
2982                 SendOptions_ForUpload           = 0x3,
2983                 SendOptions_RecoverMode         = 0x4,
2984                 SendOptions_ForceUnicode        = 0x8,
2985                 SendOptions_Partial             = 0x10
2986         } SendOptions;
2987
2988         typedef [bitmap16bit] bitmap {
2989                 SynchronizationFlag_Unicode                     = 0x1,
2990                 SynchronizationFlag_NoDeletions                 = 0x2,
2991                 SynchronizationFlag_NoSoftDeletions             = 0x4,
2992                 SynchronizationFlag_ReadState                   = 0x8,
2993                 SynchronizationFlag_FAI                         = 0x10,
2994                 SynchronizationFlag_Normal                      = 0x20,
2995                 SynchronizationFlag_OnlySpecifiedProperties     = 0x80,
2996                 SynchronizationFlag_NoForeignIdentifiers        = 0x100,
2997                 SynchronizationFlag_Reserved                    = 0x1000,
2998                 SynchronizationFlag_BestBody                    = 0x2000,
2999                 SynchronizationFlag_IgnoreSpecifiedOnFAI        = 0x4000,
3000                 SynchronizationFlag_Progress                    = 0x8000
3001         } SynchronizationFlag;
3002
3003         typedef [bitmap32bit] bitmap {
3004                 Eid                     = 0x00000001,
3005                 MessageSize             = 0x00000002,
3006                 Cn                      = 0x00000004,
3007                 OrderByDeliveryTime     = 0x00000008
3008         } SynchronizationExtraFlags;
3009
3010         typedef [flag(NDR_NOALIGN)] struct {
3011                 uint8                                   handle_idx;
3012                 SynchronizationType                     SynchronizationType;
3013                 SendOptions                             SendOptions;
3014                 SynchronizationFlag                     SynchronizationFlag;
3015                 uint16                                  RestrictionSize;
3016                 [subcontext(0),subcontext_size(RestrictionSize),flag(NDR_REMAINING)] DATA_BLOB  RestrictionData;
3017                 SynchronizationExtraFlags               SynchronizationExtraFlags;
3018                 mapi_SPropTagArray                      PropertyTags;
3019         } SyncConfigure_req;
3020
3021         typedef [flag(NDR_NOALIGN)] struct {
3022         } SyncConfigure_repl;
3023
3024         /*************************/
3025         /* EcDoRpc Function 0x72 */
3026         typedef [bitmap8bit] bitmap {
3027                 ImportFlag_Associated           = 0x10,
3028                 ImportFlag_FailOnConflict       = 0x40
3029         } ImportFlag;
3030
3031         typedef [flag(NDR_NOALIGN)] struct {
3032                 uint8                   handle_idx;
3033                 ImportFlag              ImportFlag;
3034                 mapi_SPropValue_array   PropertyValues;
3035         } SyncImportMessageChange_req;
3036
3037         typedef [flag(NDR_NOALIGN)] struct {
3038                 hyper           MessageId;
3039         } SyncImportMessageChange_repl;
3040
3041         /*************************/
3042         /* EcDoRpc Function 0x73 */
3043         typedef [flag(NDR_NOALIGN)] struct {
3044                 mapi_SPropValue_array   HierarchyValues;
3045                 mapi_SPropValue_array   PropertyValues;
3046         } SyncImportHierarchyChange_req;
3047
3048         typedef [flag(NDR_NOALIGN)] struct {
3049                 hyper                   FolderId;
3050         } SyncImportHierarchyChange_repl;
3051
3052         /*************************/
3053         /* EcDoRpc Function 0x74 */
3054         typedef [flag(NDR_NOALIGN)] struct {
3055                 boolean8                IsHierarchy;
3056                 mapi_SPropValue_array   PropertyValues;
3057         } SyncImportDeletes_req;
3058
3059         typedef [flag(NDR_NOALIGN)] struct {
3060         } SyncImportDeletes_repl;
3061
3062         /*************************/
3063         /* EcDoRpc Function 0x75 */
3064         typedef [v1_enum,flag(NDR_PAHEX)] enum {
3065                 PidTagIdsetGiven        = 0x40170003,
3066                 PidTagCnsetSeen         = 0x67960102,
3067                 PidTagCnsetSeenFAI      = 0x67da0102,
3068                 PidTagCnsetRead         = 0x67d20102
3069         } StateProperty;
3070
3071         typedef [flag(NDR_NOALIGN)] struct {
3072                 StateProperty           StateProperty;
3073                 uint32                  TransferBufferSize;
3074         } SyncUploadStateStreamBegin_req;
3075
3076         typedef [flag(NDR_NOALIGN)] struct {
3077         } SyncUploadStateStreamBegin_repl;
3078
3079         /*************************/
3080         /* EcDoRpc Function 0x76 */
3081         typedef [flag(NDR_NOALIGN)] struct {
3082                 uint32                  StreamDataSize;
3083                 uint8                   StreamData[StreamDataSize];
3084         } SyncUploadStateStreamContinue_req;
3085
3086         typedef [flag(NDR_NOALIGN)] struct {
3087         } SyncUploadStateStreamContinue_repl;
3088
3089         /*************************/
3090         /* EcDoRpc Function 0x77 */
3091         typedef [flag(NDR_NOALIGN)] struct {
3092         } SyncUploadStateStreamEnd_req;
3093
3094         typedef [flag(NDR_NOALIGN)] struct {
3095         } SyncUploadStateStreamEnd_repl;
3096
3097         /*************************/
3098         /* EcDoRpc Function 0x78 */
3099         typedef [flag(NDR_NOALIGN)] struct {
3100                 uint32          SourceFolderIdSize;
3101                 uint8           SourceFolderId[SourceFolderIdSize];
3102                 uint32          SourceMessageIdSize;
3103                 uint8           SourceMessageId[SourceMessageIdSize];
3104                 uint32          PredecessorChangeListSize;
3105                 uint8           PredecessorChangeList[PredecessorChangeListSize];
3106                 uint32          DestinationMessageIdSize;
3107                 uint8           DestinationMessageId[DestinationMessageIdSize];
3108                 uint32          ChangeNumberSize;
3109                 uint8           ChangeNumber[ChangeNumberSize];
3110         } SyncImportMessageMove_req;
3111
3112         typedef [flag(NDR_NOALIGN)] struct {
3113                 hyper           MessageId;
3114         } SyncImportMessageMove_repl;
3115
3116         /*************************/
3117         /* EcDoRpc Function 0x79 */
3118         typedef [flag(NDR_NOALIGN)] struct {
3119                 [subcontext(2)] mapi_SPropValue_array   values;
3120         } SetPropertiesNoReplicate_req;
3121
3122         typedef [flag(NDR_NOALIGN)] struct {
3123                 uint16          PropertyProblemCount;
3124                 PropertyProblem PropertyProblem[PropertyProblemCount];
3125         } SetPropertiesNoReplicate_repl;
3126
3127         /*************************/
3128         /* EcDoRpc Function 0x7a */
3129         typedef [flag(NDR_NOALIGN)] struct {
3130                 mapi_SPropTagArray      PropertyTags;
3131         } DeletePropertiesNoReplicate_req;
3132
3133         typedef [flag(NDR_NOALIGN)] struct {
3134                 uint16          PropertyProblemCount;
3135                 PropertyProblem PropertyProblem[PropertyProblemCount];
3136         } DeletePropertiesNoReplicate_repl;
3137
3138         /*************************/
3139         /* EcDoRpc Function 0x7b */
3140         typedef [public,bitmap32bit] bitmap {
3141                 STORE_HAS_SEARCHES              = 0x010000000
3142         } StoreState;
3143
3144         typedef [flag(NDR_NOALIGN)] struct {
3145         } GetStoreState_req;
3146
3147         typedef [flag(NDR_NOALIGN)] struct {
3148                 StoreState      StoreState;
3149         } GetStoreState_repl;
3150
3151         /*************************/
3152         /* EcDoRpc Function 0x7e */
3153         typedef [flag(NDR_NOALIGN)] struct {
3154                 uint8           handle_idx;
3155                 boolean8        IsContentsCollector;
3156         } SyncOpenCollector_req;
3157
3158         typedef [flag(NDR_NOALIGN)] struct {
3159         } SyncOpenCollector_repl;
3160
3161         /*************************/
3162         /* EcDoRpc Function 0x7f */
3163         typedef [flag(NDR_NOALIGN)] struct {
3164                 uint32          IdCount;
3165         } GetLocalReplicaIds_req;
3166
3167         typedef [flag(NDR_NOALIGN)] struct {
3168                 GUID            ReplGuid;
3169                 uint8           GlobalCount[6];
3170         } GetLocalReplicaIds_repl;
3171
3172         /*************************/
3173         /* EcDoRpc Function 0x80 */
3174 //      typedef [flag(NDR_NOALIGN)] struct {
3175 //              uint16          MessageSize;
3176 //              uint8           MessageId[MessageSize];
3177 //              boolean8        MarkAsRead;
3178 //      } MessageReadStates;
3179
3180         typedef [flag(NDR_NOALIGN)] struct {
3181                 uint16          MessageReadStateSize;
3182                 [subcontext(0),subcontext_size(MessageReadStateSize),flag(NDR_REMAINING)] DATA_BLOB MessageStates;
3183         } SyncImportReadStateChanges_req;
3184
3185         typedef [flag(NDR_NOALIGN)] struct {
3186         } SyncImportReadStateChanges_repl;
3187
3188         /*************************/
3189         /* EcDoRpc Function 0x81 */
3190         typedef [flag(NDR_NOALIGN)] struct {
3191         } ResetTable_req;
3192
3193         typedef [flag(NDR_NOALIGN)] struct {
3194         } ResetTable_repl;
3195
3196         /*************************/
3197         /* EcDoRpc Function 0x82 */
3198         typedef [flag(NDR_NOALIGN)] struct {
3199                 uint8           handle_idx;
3200         } SyncGetTransferState_req;
3201
3202         typedef [flag(NDR_NOALIGN)] struct {
3203         } SyncGetTransferState_repl;
3204
3205         /*************************/
3206         /* EcDoRpc Function 0x87 */
3207         typedef [flag(NDR_NOALIGN)] struct {
3208                 uint8           handle_idx;
3209                 asclstr         name;
3210         } OpenPublicFolderByName_req; 
3211
3212         typedef [flag(NDR_NOALIGN)] struct {
3213                 boolean8                                HasRules;
3214                 boolean8                                IsGhosted;
3215                 [switch_is(IsGhosted)] IsGhosted        Ghost;
3216         } OpenPublicFolderByName_repl;
3217
3218         /*************************/
3219         /* EcDoRpc Function 0x88 */
3220         typedef [flag(NDR_NOALIGN)] struct {
3221                 GUID    NotificationGuid;
3222         } SetSyncNotificationGuid_req;
3223
3224         typedef [flag(NDR_NOALIGN)] struct {
3225         } SetSyncNotificationGuid_repl;
3226
3227         /*************************/
3228         /* EcDoRpc Function 0x89 */
3229         typedef [flag(NDR_NOALIGN)] struct {
3230                 SBinary_short   bookmark;
3231         } FreeBookmark_req;
3232
3233         typedef [flag(NDR_NOALIGN)] struct {
3234         } FreeBookmark_repl;
3235
3236         /*************************/
3237         /* EcDoRpc Function 0xFE */
3238         typedef [public,bitmap8bit] bitmap {
3239                 LogonPrivate    = 0x1,
3240                 UnderCover      = 0x2,
3241                 Ghosted         = 0x4,
3242                 SpIProcess      = 0x8
3243         } LogonFlags;
3244
3245         typedef [public,bitmap32bit] bitmap {
3246                 PUBLIC                          = 0x2,
3247                 HOME_LOGON                      = 0x4,
3248                 TAKE_OWNERSHIP                  = 0x8,
3249                 ALTERNATE_SERVER                = 0x100,
3250                 IGNORE_HOME_MDB                 = 0x200,
3251                 NO_MAIL                         = 0x400,
3252                 USE_PER_MDB_REPLID_MAPPING      = 0x010000000
3253         } OpenFlags;
3254
3255         typedef [nopush,flag(NDR_NOALIGN)] struct {
3256                 LogonFlags      LogonFlags;
3257                 OpenFlags       OpenFlags;
3258                 StoreState      StoreState;
3259                 ascstr3         LegacyDN;
3260         } Logon_req;
3261
3262         typedef [flag(NDR_NOALIGN)] struct {
3263                 hyper           folder_id[13];
3264                 uint16          unknown;
3265                 FlatUID_r       entryid;
3266                 FlatUID_r       msgstore;
3267         } store_pf;
3268
3269         typedef [flag(NDR_NOALIGN)] struct {
3270                 hyper           folder_id[13];
3271                 uint8           unknown3;
3272                 FlatUID_r       entryid;
3273                 uint16          default_store;
3274                 FlatUID_r       msgstore;
3275                 FILETIME        ts_access;
3276                 astring         creation_date;
3277                 uint8           terminator;
3278                 uint16          unknown4;
3279         } store_mailbox;
3280
3281         typedef [nodiscriminant] union {
3282                 [case(0x0)] store_pf store_pf;
3283                 [case(0x1)] store_mailbox store_mailbox;
3284         } store_type;
3285
3286         typedef [enum8bit,flag(NDR_NOALIGN)] enum {
3287                 PROVIDER_TYPE_PF = 0x0,
3288                 PROVIDER_TYPE_MAILBOX = 0x1
3289         } PROVIDER_TYPE;
3290
3291
3292
3293         typedef [flag(NDR_NOALIGN)] struct {
3294                 PROVIDER_TYPE   PR_OBJECT_TYPE;
3295                 [switch_is(PR_OBJECT_TYPE)] store_type type;
3296         } Logon_repl;
3297
3298         /*************************/
3299         /* EcDoRpc Function 0xA5 */
3300         typedef [flag(NDR_NOALIGN)] struct {
3301                 SBinary_short   bin;
3302         } proxypack_req;
3303
3304         typedef [flag(NDR_NOALIGN)] struct {
3305                 SBinary_short   bin;
3306         } proxypack_repl;
3307
3308         typedef [public, nodiscriminant] union {
3309                 [case(op_MAPI_Release)] Release_req mapi_Release;
3310                 [case(op_MAPI_OpenFolder)] OpenFolder_req mapi_OpenFolder;
3311                 [case(op_MAPI_OpenMessage)] OpenMessage_req mapi_OpenMessage;
3312                 [case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_req mapi_GetHierarchyTable;
3313                 [case(op_MAPI_GetContentsTable)] GetContentsTable_req mapi_GetContentsTable;
3314                 [case(op_MAPI_CreateMessage)] CreateMessage_req mapi_CreateMessage;
3315                 [case(op_MAPI_GetProps)] GetProps_req mapi_GetProps;
3316                 [case(op_MAPI_GetPropsAll)] GetPropsAll_req mapi_GetPropsAll;
3317                 [case(op_MAPI_GetPropList)] GetPropList_req mapi_GetPropList;
3318                 [case(op_MAPI_SetProps)] SetProps_req mapi_SetProps;
3319                 [case(op_MAPI_DeleteProps)] DeleteProps_req mapi_DeleteProps;
3320                 [case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_req mapi_SaveChangesMessage;
3321                 [case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_req mapi_SetMessageReadFlag;
3322                 [case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_req mapi_ReloadCachedInformation;
3323                 [case(op_MAPI_SetColumns)] SetColumns_req mapi_SetColumns;
3324                 [case(op_MAPI_SortTable)] SortTable_req mapi_SortTable;
3325                 [case(op_MAPI_Restrict)] Restrict_req mapi_Restrict;
3326                 [case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_req mapi_RemoveAllRecipients;
3327                 [case(op_MAPI_ModifyRecipients)] ModifyRecipients_req mapi_ModifyRecipients;
3328                 [case(op_MAPI_ReadRecipients)] ReadRecipients_req mapi_ReadRecipients;
3329                 [case(op_MAPI_QueryRows)] QueryRows_req mapi_QueryRows;
3330                 [case(op_MAPI_GetStatus)] GetStatus_req mapi_GetStatus;
3331                 [case(op_MAPI_QueryPosition)] QueryPosition_req mapi_QueryPosition;
3332                 [case(op_MAPI_SeekRow)] SeekRow_req mapi_SeekRow;
3333                 [case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_req mapi_SeekRowBookmark;
3334                 [case(op_MAPI_SeekRowApprox)] SeekRowApprox_req mapi_SeekRowApprox;
3335                 [case(op_MAPI_CreateBookmark)] CreateBookmark_req mapi_CreateBookmark;
3336                 [case(op_MAPI_CreateFolder)] CreateFolder_req mapi_CreateFolder;
3337                 [case(op_MAPI_DeleteFolder)] DeleteFolder_req mapi_DeleteFolder;
3338                 [case(op_MAPI_DeleteMessages)] DeleteMessages_req mapi_DeleteMessages;
3339                 [case(op_MAPI_GetMessageStatus)] GetMessageStatus_req mapi_GetMessageStatus;
3340                 [case(op_MAPI_SetMessageStatus)] SetMessageStatus_req mapi_SetMessageStatus;
3341                 [case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_req mapi_GetAttachmentTable;
3342                 [case(op_MAPI_OpenAttach)] OpenAttach_req mapi_OpenAttach;
3343                 [case(op_MAPI_CreateAttach)] CreateAttach_req mapi_CreateAttach;
3344                 [case(op_MAPI_DeleteAttach)] DeleteAttach_req mapi_DeleteAttach;
3345                 [case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_req mapi_SaveChangesAttachment;
3346                 [case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_req mapi_SetReceiveFolder;
3347                 [case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_req mapi_GetReceiveFolder;
3348                 [case(op_MAPI_RegisterNotification)] RegisterNotification_req mapi_RegisterNotification;
3349                 [case(op_MAPI_OpenStream)] OpenStream_req mapi_OpenStream;
3350                 [case(op_MAPI_ReadStream)] ReadStream_req mapi_ReadStream;
3351                 [case(op_MAPI_WriteStream)] WriteStream_req mapi_WriteStream;
3352                 [case(op_MAPI_SeekStream)] SeekStream_req mapi_SeekStream;
3353                 [case(op_MAPI_SetStreamSize)] SetStreamSize_req mapi_SetStreamSize;
3354                 [case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_req mapi_SetSearchCriteria;
3355                 [case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_req mapi_GetSearchCriteria;
3356                 [case(op_MAPI_SubmitMessage)] SubmitMessage_req mapi_SubmitMessage;
3357                 [case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_req mapi_MoveCopyMessages;
3358                 [case(op_MAPI_AbortSubmit)] AbortSubmit_req mapi_AbortSubmit;
3359                 [case(op_MAPI_MoveFolder)] MoveFolder_req mapi_MoveFolder;
3360                 [case(op_MAPI_CopyFolder)] CopyFolder_req mapi_CopyFolder;
3361                 [case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_req mapi_QueryColumnsAll;
3362                 [case(op_MAPI_Abort)] Abort_req mapi_Abort;
3363                 [case(op_MAPI_CopyTo)] CopyTo_req mapi_CopyTo;
3364                 [case(op_MAPI_CopyToStream)] CopyToStream_req mapi_CopyToStream;
3365                 [case(op_MAPI_GetTable)] GetTable_req mapi_GetTable;
3366                 [case(op_MAPI_GetRulesTable)] GetRulesTable_req mapi_GetRulesTable;
3367                 [case(op_MAPI_ModifyTable)] ModifyTable_req mapi_ModifyTable;
3368                 [case(op_MAPI_ModifyRules)] ModifyRules_req mapi_ModifyRules;
3369                 [case(op_MAPI_GetOwningServers)] GetOwningServers_req mapi_GetOwningServers;
3370                 [case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_req mapi_LongTermIdFromId;
3371                 [case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_req mapi_IdFromLongTermId;
3372                 [case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_req mapi_PublicFolderIsGhosted;
3373                 [case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_req mapi_OpenEmbeddedMessage;
3374                 [case(op_MAPI_SetSpooler)] SetSpooler_req mapi_SetSpooler;
3375                 [case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_req mapi_SpoolerLockMessage;
3376                 [case(op_MAPI_AddressTypes)] AddressTypes_req mapi_AddressTypes;
3377                 [case(op_MAPI_TransportSend)] TransportSend_req mapi_TransportSend;
3378                 [case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_req mapi_FastTransferSourceGetBuffer;
3379                 [case(op_MAPI_FindRow)] FindRow_req mapi_FindRow;
3380                 [case(op_MAPI_Progress)] Progress_req mapi_Progress;
3381                 [case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_req mapi_GetNamesFromIDs;
3382                 [case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_req mapi_GetIDsFromNames;
3383                 [case(op_MAPI_EmptyFolder)] EmptyFolder_req mapi_EmptyFolder;
3384                 [case(op_MAPI_ExpandRow)] ExpandRow_req mapi_ExpandRow;
3385                 [case(op_MAPI_CollapseRow)] CollapseRow_req mapi_CollapseRow;
3386                 [case(op_MAPI_CommitStream)] CommitStream_req mapi_CommitStream;
3387                 [case(op_MAPI_GetStreamSize)] GetStreamSize_req mapi_GetStreamSize;
3388                 [case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_req mapi_QueryNamedProperties;
3389                 [case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_req mapi_GetPerUserLongTermIds;
3390                 [case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_req mapi_GetPerUserGuid;
3391                 [case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_req mapi_ReadPerUserInformation;
3392                 [case(op_MAPI_SetReadFlags)] SetReadFlags_req mapi_SetReadFlags;
3393                 [case(op_MAPI_CopyProperties)] CopyProperties_req mapi_CopyProperties;
3394                 [case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_req mapi_GetReceiveFolderTable;
3395                 [case(op_MAPI_GetCollapseState)] GetCollapseState_req mapi_GetCollapseState;
3396                 [case(op_MAPI_SetCollapseState)] SetCollapseState_req mapi_SetCollapseState;
3397                 [case(op_MAPI_GetTransportFolder)] GetTransportFolder_req mapi_GetTransportFolder;
3398                 [case(op_MAPI_RegisterOptions)] RegisterOptions_req mapi_RegisterOptions;
3399                 [case(op_MAPI_SyncConfigure)] SyncConfigure_req mapi_SyncConfigure;
3400                 [case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_req mapi_SyncImportMessageChange;
3401                 [case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_req mapi_SyncImportHierarchyChange;
3402                 [case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_req mapi_SyncImportDeletes;
3403                 [case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_req mapi_SyncUploadStateStreamBegin;
3404                 [case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_req mapi_SyncUploadStateStreamContinue;
3405                 [case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_req mapi_SyncUploadStateStreamEnd;
3406                 [case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_req mapi_SyncImportMessageMove;
3407                 [case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_req mapi_SetPropertiesNoReplicate;
3408                 [case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_req mapi_DeletePropertiesNoReplicate;
3409                 [case(op_MAPI_GetStoreState)] GetStoreState_req mapi_GetStoreState;
3410                 [case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_req mapi_SyncOpenCollector;
3411                 [case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_req mapi_GetLocalReplicaIds;
3412                 [case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_req mapi_SyncImportReadStateChanges;
3413                 [case(op_MAPI_ResetTable)] ResetTable_req mapi_ResetTable;
3414                 [case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_req mapi_SyncGetTransferState;
3415                 [case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_req mapi_OpenPublicFolderByName;
3416                 [case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_req mapi_SetSyncNotificationGuid;
3417                 [case(op_MAPI_FreeBookmark)] FreeBookmark_req mapi_FreeBookmark;
3418                 [case(op_MAPI_Logon)] Logon_req mapi_Logon;
3419                 [case(op_MAPI_proxypack)] proxypack_req mapi_proxypack;
3420         } EcDoRpc_MAPI_REQ_UNION;
3421
3422         typedef [public, nodiscriminant] union {
3423                 [case(op_MAPI_Release)] Release_repl mapi_Release;
3424                 [case(op_MAPI_OpenFolder)] OpenFolder_repl mapi_OpenFolder;
3425                 [case(op_MAPI_OpenMessage)] OpenMessage_repl mapi_OpenMessage;
3426                 [case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_repl mapi_GetHierarchyTable;
3427                 [case(op_MAPI_GetContentsTable)] GetContentsTable_repl mapi_GetContentsTable;
3428                 [case(op_MAPI_CreateMessage)] CreateMessage_repl mapi_CreateMessage;
3429                 [case(op_MAPI_GetProps)] GetProps_repl mapi_GetProps;
3430                 [case(op_MAPI_GetPropsAll)] GetPropsAll_repl mapi_GetPropsAll;
3431                 [case(op_MAPI_GetPropList)] GetPropList_repl mapi_GetPropList;
3432                 [case(op_MAPI_SetProps)] SetProps_repl mapi_SetProps;
3433                 [case(op_MAPI_DeleteProps)] DeleteProps_repl mapi_DeleteProps;
3434                 [case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_repl mapi_SaveChangesMessage;
3435                 [case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_repl mapi_RemoveAllRecipients;
3436                 [case(op_MAPI_ModifyRecipients)] ModifyRecipients_repl mapi_ModifyRecipients;
3437                 [case(op_MAPI_ReadRecipients)] ReadRecipients_repl mapi_ReadRecipients;
3438                 [case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_repl mapi_SetMessageReadFlag;
3439                 [case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_repl mapi_ReloadCachedInformation;
3440                 [case(op_MAPI_SetColumns)] SetColumns_repl mapi_SetColumns;
3441                 [case(op_MAPI_SortTable)] SortTable_repl mapi_SortTable;
3442                 [case(op_MAPI_Restrict)] Restrict_repl mapi_Restrict;
3443                 [case(op_MAPI_QueryRows)] QueryRows_repl mapi_QueryRows;
3444                 [case(op_MAPI_GetStatus)] GetStatus_repl mapi_GetStatus;
3445                 [case(op_MAPI_QueryPosition)] QueryPosition_repl mapi_QueryPosition;
3446                 [case(op_MAPI_SeekRow)] SeekRow_repl mapi_SeekRow;
3447                 [case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_repl mapi_SeekRowBookmark;
3448                 [case(op_MAPI_SeekRowApprox)] SeekRowApprox_repl mapi_SeekRowApprox;
3449                 [case(op_MAPI_CreateBookmark)] CreateBookmark_repl mapi_CreateBookmark;
3450                 [case(op_MAPI_CreateFolder)] CreateFolder_repl mapi_CreateFolder;
3451                 [case(op_MAPI_DeleteFolder)] DeleteFolder_repl mapi_DeleteFolder;
3452                 [case(op_MAPI_DeleteMessages)] DeleteMessages_repl mapi_DeleteMessages;
3453                 [case(op_MAPI_SetMessageStatus)] SetMessageStatus_repl mapi_SetMessageStatus;
3454                 [case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_repl mapi_GetAttachmentTable;
3455                 [case(op_MAPI_OpenAttach)] OpenAttach_repl mapi_OpenAttach;
3456                 [case(op_MAPI_CreateAttach)] CreateAttach_repl mapi_CreateAttach;
3457                 [case(op_MAPI_DeleteAttach)] DeleteAttach_repl mapi_DeleteAttach;
3458                 [case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_repl mapi_SaveChangesAttachment;
3459                 [case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_repl mapi_SetReceiveFolder;
3460                 [case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_repl mapi_GetReceiveFolder;
3461                 [case(op_MAPI_RegisterNotification)] RegisterNotification_repl mapi_RegisterNotification;
3462                 [case(op_MAPI_Notify)] Notify_repl mapi_Notify;
3463                 [case(op_MAPI_OpenStream)] OpenStream_repl mapi_OpenStream;
3464                 [case(op_MAPI_ReadStream)] ReadStream_repl mapi_ReadStream;
3465                 [case(op_MAPI_WriteStream)] WriteStream_repl mapi_WriteStream;
3466                 [case(op_MAPI_SeekStream)] SeekStream_repl mapi_SeekStream;
3467                 [case(op_MAPI_SetStreamSize)] SetStreamSize_repl mapi_SetStreamSize;
3468                 [case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_repl mapi_SetSearchCriteria;
3469                 [case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_repl mapi_GetSearchCriteria;
3470                 [case(op_MAPI_SubmitMessage)] SubmitMessage_repl mapi_SubmitMessage;
3471                 [case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_repl mapi_MoveCopyMessages;
3472                 [case(op_MAPI_AbortSubmit)] AbortSubmit_repl mapi_AbortSubmit;
3473                 [case(op_MAPI_MoveFolder)] MoveFolder_repl mapi_MoveFolder;
3474                 [case(op_MAPI_CopyFolder)] CopyFolder_repl mapi_CopyFolder;
3475                 [case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_repl mapi_QueryColumnsAll;
3476                 [case(op_MAPI_Abort)] Abort_repl mapi_Abort;
3477                 [case(op_MAPI_CopyTo)] CopyTo_repl mapi_CopyTo;
3478                 [case(op_MAPI_CopyToStream)] CopyToStream_repl mapi_CopyToStream;
3479                 [case(op_MAPI_GetTable)] GetTable_repl mapi_GetTable;
3480                 [case(op_MAPI_GetRulesTable)] GetRulesTable_repl mapi_GetRulesTable;
3481                 [case(op_MAPI_ModifyTable)] ModifyTable_repl mapi_ModifyTable;
3482                 [case(op_MAPI_ModifyRules)] ModifyRules_repl mapi_ModifyRules;
3483                 [case(op_MAPI_GetOwningServers)] GetOwningServers_repl mapi_GetOwningServers;
3484                 [case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_repl mapi_LongTermIdFromId;
3485                 [case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_repl mapi_IdFromLongTermId;
3486                 [case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_repl mapi_PublicFolderIsGhosted;
3487                 [case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_repl mapi_OpenEmbeddedMessage;
3488                 [case(op_MAPI_SetSpooler)] SetSpooler_repl mapi_SetSpooler;
3489                 [case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_repl mapi_SpoolerLockMessage;
3490                 [case(op_MAPI_AddressTypes)] AddressTypes_repl mapi_AddressTypes;
3491                 [case(op_MAPI_TransportSend)] TransportSend_repl mapi_TransportSend;
3492                 [case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_repl mapi_FastTransferSourceGetBuffer;
3493                 [case(op_MAPI_FindRow)] FindRow_repl mapi_FindRow;
3494                 [case(op_MAPI_Progress)] Progress_repl mapi_Progress;
3495                 [case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_repl mapi_GetNamesFromIDs;
3496                 [case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_repl mapi_GetIDsFromNames;
3497                 [case(op_MAPI_EmptyFolder)] EmptyFolder_repl mapi_EmptyFolder;
3498                 [case(op_MAPI_ExpandRow)] ExpandRow_repl mapi_ExpandRow;
3499                 [case(op_MAPI_CollapseRow)] CollapseRow_repl mapi_CollapseRow;
3500                 [case(op_MAPI_CommitStream)] CommitStream_repl mapi_CommitStream;
3501                 [case(op_MAPI_GetStreamSize)] GetStreamSize_repl mapi_GetStreamSize;
3502                 [case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_repl mapi_QueryNamedProperties;
3503                 [case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_repl mapi_GetPerUserLongTermIds;
3504                 [case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_repl mapi_GetPerUserGuid;
3505                 [case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_repl mapi_ReadPerUserInformation;
3506                 [case(op_MAPI_SetReadFlags)] SetReadFlags_repl mapi_SetReadFlags;
3507                 [case(op_MAPI_CopyProperties)] CopyProperties_repl mapi_CopyProperties;
3508                 [case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_repl mapi_GetReceiveFolderTable;
3509                 [case(op_MAPI_Pending)] Pending_repl mapi_Pending;
3510                 [case(op_MAPI_GetCollapseState)] GetCollapseState_repl mapi_GetCollapseState;
3511                 [case(op_MAPI_SetCollapseState)] SetCollapseState_repl mapi_SetCollapseState;
3512                 [case(op_MAPI_GetTransportFolder)] GetTransportFolder_repl mapi_GetTransportFolder;
3513                 [case(op_MAPI_RegisterOptions)] RegisterOptions_repl mapi_RegisterOptions;
3514                 [case(op_MAPI_SyncConfigure)] SyncConfigure_repl mapi_SyncConfigure;
3515                 [case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_repl mapi_SyncImportMessageChange;
3516                 [case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_repl mapi_SyncImportHierarchyChange;
3517                 [case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_repl mapi_SyncImportDeletes;
3518                 [case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_repl mapi_SyncUploadStateStreamBegin;
3519                 [case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_repl mapi_SyncUploadStateStreamContinue;
3520                 [case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_repl mapi_SyncUploadStateStreamEnd;
3521                 [case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_repl mapi_SyncImportMessageMove;
3522                 [case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_repl mapi_SetPropertiesNoReplicate;
3523                 [case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_repl mapi_DeletePropertiesNoReplicate;
3524                 [case(op_MAPI_GetStoreState)] GetStoreState_repl mapi_GetStoreState;
3525                 [case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_repl mapi_SyncOpenCollector;
3526                 [case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_repl mapi_GetLocalReplicaIds;
3527                 [case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_repl mapi_SyncImportReadStateChanges;
3528                 [case(op_MAPI_ResetTable)] ResetTable_repl mapi_ResetTable;
3529                 [case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_repl mapi_SyncGetTransferState;
3530                 [case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_repl mapi_OpenPublicFolderByName;
3531                 [case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_repl mapi_SetSyncNotificationGuid;
3532                 [case(op_MAPI_FreeBookmark)] FreeBookmark_repl mapi_FreeBookmark;
3533                 [case(op_MAPI_Logon)] Logon_repl mapi_Logon;
3534                 [case(op_MAPI_proxypack)] proxypack_repl mapi_proxypack;
3535
3536         } EcDoRpc_MAPI_REPL_UNION;
3537
3538         typedef [public,flag(NDR_NOALIGN)] struct {
3539                 uint8           opnum;
3540                 uint8           logon_id;
3541                 uint8           handle_idx;
3542                 [switch_is(opnum)] EcDoRpc_MAPI_REQ_UNION u;
3543         } EcDoRpc_MAPI_REQ;
3544
3545         typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
3546                 uint8           opnum;
3547                 uint8           handle_idx;
3548                 MAPISTATUS      error_code;
3549                 [switch_is(opnum)] EcDoRpc_MAPI_REPL_UNION u;
3550         } EcDoRpc_MAPI_REPL;
3551
3552
3553         /*
3554           Abstract way to represent MAPI content
3555         */
3556
3557         typedef [public,nopull,nopush,noprint] struct {
3558                 uint32                  mapi_len;       /* whole mapi_data length */
3559                 uint16                  length;         /* content length */
3560                 EcDoRpc_MAPI_REQ        *mapi_req;
3561                 uint32                  *handles;       /* handles id array */
3562         } mapi_request;
3563
3564         typedef [public,nopull,nopush,noprint] struct {
3565                 uint32                  mapi_len;
3566                 uint16                  length;
3567                 EcDoRpc_MAPI_REPL       *mapi_repl;
3568                 uint32                  *handles;
3569         } mapi_response;
3570         
3571
3572         [public] MAPISTATUS EcDoRpc(
3573                 [in,out]                                                policy_handle   *handle,
3574                 [in,out]                                                uint32          size,
3575                 [in,out]                                                uint32          offset,
3576                 [in] [subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]    mapi_request    *mapi_request,
3577                 [out][subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]    mapi_response   *mapi_response,
3578                 [in,out]                                                uint16          *length,
3579                 [in]                                                    uint16          max_data
3580                 );
3581
3582         /*****************/
3583         /* Function 0x03 */
3584         void EcGetMoreRpc();
3585
3586         /*****************/
3587         /* Function 0x04 */
3588
3589         /*
3590           we could directly use a NOTIFKEY structure rather than
3591           a uint8 array, but this makes the IDL more robust
3592         
3593           sockaddr array is made of: 
3594            - family (unsigned short in) sa_family_t
3595            - address data sa_data[14];
3596          */
3597
3598         typedef struct {
3599                 uint16          cb;
3600                 uint8           ab[cb];
3601         } NOTIFKEY;
3602
3603         MAPISTATUS EcRRegisterPushNotification(
3604                [in,out] policy_handle                   *handle,
3605                [in] NotificationFlags                   ulEventMask,
3606                [in,size_is(cbContext)] uint8            rgbContext[*],
3607                [in] uint16                              cbContext,
3608                [in] uint32                              grbitAdviseBits,
3609                [in,size_is(cbCallbackAddress)] uint8    rgCallbackAddress[*],
3610                [in] uint16                              cbCallbackAddress,
3611                [out,ref] uint32                         *hNotification
3612                 );
3613
3614         /*****************/
3615         /* Function 0x05 */
3616         MAPISTATUS EcRUnregisterPushNotification(
3617                 [in,out]        policy_handle           *handle,
3618                 [in]            uint32                  unknown[2]
3619                 );
3620
3621         /*****************/
3622         /* Function 0x06 */
3623         void EcDummyRpc();
3624
3625         /*****************/
3626         /* Function 0x07 */
3627         void EcRGetDCName();
3628
3629         /*****************/
3630         /* Function 0x08 */
3631         void EcRNetGetDCName();
3632
3633         /*****************/
3634         /* Function 0x09 */
3635         void EcDoRpcExt();
3636
3637         /*****************/
3638         /* Function 0xa  */
3639         MAPISTATUS EcDoConnectEx(
3640                 [out]                           policy_handle   *handle,
3641                 [in,string,charset(DOS)]        uint8           szUserDN[],
3642                 [in]                            uint32          ulFlags,
3643                 [in]                            uint32          ulConMod,
3644                 [in]                            uint32          cbLimit,
3645                 [in]                            uint32          ulCpid,
3646                 [in]                            uint32          ulLcidString,
3647                 [in]                            uint32          ulLcidSort,
3648                 [in]                            uint32          ulIcxrLink,
3649                 [in]                            uint16          usFCanConvertCodePages,
3650                 [out]                           uint32          *pcmsPollsMax,
3651                 [out]                           uint32          *pcRetry,
3652                 [out]                           uint32          *pcmsRetryDelay,
3653                 [out]                           uint32          *picxr,
3654                 [out,unique,string,charset(DOS)]uint8           *szDNPrefix,
3655                 [out,unique,string,charset(DOS)]uint8           *szDisplayName,
3656                 [in]                            uint16          rgwClientVersion[3],
3657                 [out]                           uint16          rgwServerVersion[3],
3658                 [out]                           uint16          rgwBestVersion[3],
3659                 [in,out]                        uint32          *pulTimeStamp,
3660                 [in][subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB rgbAuxIn,
3661                 [in,out][range(0x0,0x1008)]     uint32          *pcbAuxOut,
3662                 [in][flag(NDR_REMAINING)] DATA_BLOB data
3663                 );
3664 }
3665
3666 [
3667   uuid("c840a7dc-42c0-1a10-b4b9-08002b2fe182"),
3668   pointer_default(unique),
3669   helpstring("Unknown")
3670 ] interface exchange_unknown
3671 {
3672         void unknown_dummy();
3673 }
3674