#include "idl_types.h"

cpp_quote("#include <util/debug.h>")
cpp_quote("#include <gen_ndr/ndr_misc.h>")

/*
   http://support.microsoft.com/default.aspx?scid=KB;en-us;q159298
   Any UUID starting with:
   A4 - store
   F5 - directory
 */

[
  uuid("99e64010-b032-11d0-97a4-00c04fd6551d"),
  pointer_default(unique),
  version(3.0)
] interface exchange_store_admin3
{
	void ec_store_admin3_dummy();
}


[
  uuid("89742ace-a9ed-11cf-9c0c-08002be7ae86"),
  pointer_default(unique),
  version(2.0)
] interface exchange_store_admin2
{
	void ec_store_admin2_dummy();
}

[
  uuid("a4f1db00-ca47-1067-b31e-00dd010662da"),
  pointer_default(unique),
  version(1.0)
] interface exchange_store_admin1
{
	void ec_store_admin1_dummy();
}


[
  uuid("1544f5e0-613c-11d1-93df-00c04fd7bd09"),
  endpoint("ncacn_ip_tcp:"),
  authservice("exchangeRFR"),
  pointer_default(unique),
  version(1.0),
  helpstring("Exchange 2003 Directory Request For Response")
] interface exchange_ds_rfr
{

#include "properties_enum.h"
#include "mapicodes_enum.h"

	/*****************/
	/* Function 0x00 */
	MAPISTATUS RfrGetNewDSA(
		[in]                                    uint32  ulFlags,
		[in,string,charset(DOS)]                uint8   *pUserDN,
		[in,out,unique,string,charset(DOS)]     uint8   **ppszUnused,
		[in,out,unique,string,charset(DOS)]     uint8   **ppszServer
		);
	
	/*****************/
	/* Function 0x01 */
	MAPISTATUS RfrGetFQDNFromLegacyDN(
		[in]							uint32	ulFlags,
		[in,range(10,1024)]					uint32	cbMailboxServerDN,
		[in,string,charset(DOS),size_is(cbMailboxServerDN)]	uint8	*szMailboxServerDN,
		[out,ref,string,charset(DOS)]				uint8	**ppszServerFQDN
		);
}

[
  uuid("f930c514-1215-11d3-99a5-00a0c9b61b04"),
  helpstring("System Attendant Cluster Interface"),
  pointer_default(unique),
  version(1.0)
] interface exchange_sysatt_cluster
{
	void sysatt_cluster_dummy();
}

/*
[83d72bf0-0d89-11ce-b13f-00aa003bac6c] MS Exchange
System Attendant Private Interface
*/

[
  uuid("469d6ec0-0d87-11ce-b13f-00aa003bac6c"),
  pointer_default(unique),
  helpstring("Exchange 5.5 System Attendant Request for Response")
] interface exchange_system_attendant
{
	void sysatt_dummy();
}

[
  uuid("9e8ee830-4559-11ce-979b-00aa005ffebe"),
  pointer_default(unique),
  version(2.0),
  helpstring("Exchange 5.5 MTA")
] interface exchange_mta
{
	/*****************/
	/* Function 0x00 */
	void MtaBind();

	/*****************/
	/* Function 0x01 */
	void MtaBindAck();
}

[
  uuid("f5cc59b4-4264-101a-8c59-08002b2f8426"),
  pointer_default(unique),
  version(21.0),
  helpstring("Exchange 5.5 DRS")
] interface exchange_drs
{
	/*****************/
	/* Function 0x00 */
	void ds_abandon();

	/*****************/
	/* Function 0x01 */
	void ds_add_entry();

	void ds_bind();
	void ds_compare();
	void ds_list();
	void ds_modify_entry();
	void ds_modify_rdn();
	void ds_read();
	void ds_receive_result();
	void ds_remove_entry();
	void ds_search();
	void ds_unbind();
	void ds_wait();
	void dra_replica_add();
	void dra_replica_delete();
	void dra_replica_synchronize();
	void dra_reference_update();
	void dra_authorize_replica();
	void dra_unauthorize_replica();
	void dra_adopt();
	void dra_set_status();
	void dra_modify_entry();
	void dra_delete_subref();
}

[
  uuid("f5cc5a7c-4264-101a-8c59-08002b2f8426"),
  version(21.0),
  pointer_default(unique),
  helpstring("Exchange 5.5 XDS")
] interface exchange_xds
{
	void xds_dummy();
}

[
  uuid("38a94e72-a9bc-11d2-8faf-00c04fa378ff"),
  pointer_default(unique),
  version(1.0)
] interface exchange_mta_qadmin
{
	void exchange_mta_qadmin();
}


[
  uuid("0e4a0156-dd5d-11d2-8c2f-00c04fb6bcde"),
  pointer_default(unique),
  version(1.0)
] interface exchange_store_information
{
	void exchange_store_information_dummy();
}

[
  uuid("f5cc5a18-4264-101a-8c59-08002b2f8426"),
  endpoint("ncacn_ip_tcp:"),
  authservice("exchangeAB"),
  pointer_default(unique),
  version(56.0),
  helpstring("Exchange 5.5 Name Service Provider")
] interface exchange_nsp
{

#define	PT_UNSPECIFIED	0x0000
#define	PT_NULL		0x0001
#define	PT_I2		0x0002
#define	PT_LONG		0x0003
#define	PT_R4		0x0004
#define	PT_DOUBLE	0x0005
#define	PT_CURRENCY	0x0006
#define	PT_APPTIME	0x0007
#define	PT_ERROR	0x000a /* means the given attr contains no value */
#define	PT_BOOLEAN	0x000b
#define	PT_OBJECT	0x000d
#define	PT_I8		0x0014
#define	PT_STRING8	0x001e
#define	PT_UNICODE	0x001f
#define	PT_SYSTIME	0x0040
#define	PT_CLSID       	0x0048
#define	PT_SVREID	0x00fb
#define	PT_SRESTRICT	0x00fd
#define	PT_ACTIONS	0x00fe
#define	PT_BINARY	0x0102
/* Multi-valued properties */
#define	PT_MV_I2       	0x1002
#define	PT_MV_LONG     	0x1003
#define	PT_MV_R4       	0x1004
#define	PT_MV_DOUBLE   	0x1005
#define	PT_MV_CURRENCY 	0x1006
#define	PT_MV_APPTIME  	0x1007
#define	PT_MV_I8       	0x1014
#define	PT_MV_STRING8	0x101e
#define	PT_MV_TSTRING	0x101e
#define	PT_MV_UNICODE	0x101f
#define	PT_MV_SYSTIME	0x1040
#define	PT_MV_CLSID	0x1048
#define	PT_MV_BINARY	0x1102

	typedef [v1_enum] enum {
		SortTypeDisplayName		= 0x00000000,
		SortTypePhoneticDisplayName	= 0x00000003,
		SortTypeDisplayName_RO		= 0x000003E8,
		SortTypeDisplayName_W		= 0x000003E9
	} TableSortOrders;

	typedef [v1_enum] enum {
		MID_BEGINNING_OF_TABLE	= 0x0,
		MID_END_OF_TABLE	= 0x2,
		MID_CURRENT		= 0x1
	} NSPI_MID;

	typedef struct {
		TableSortOrders	SortType;
		uint32		ContainerID;
		NSPI_MID	CurrentRec;
		int32		Delta;
		uint32		NumPos;
		uint32		TotalRecs;
		uint32		CodePage;
		uint32		TemplateLocale;
		uint32		SortLocale;
	} STAT;

	typedef struct {
		uint8 ab[16];
	} FlatUID_r;

	/* like a SPropTagArray, but without the "value is a an enum MAPITAGS" semantics */
	typedef struct {
		[range(0,100000)] uint32                        cValues;
		[size_is(cValues+1), length_is(cValues)] uint32 aulPropTag[];
	} PropertyTagArray_r;
    
	typedef struct {
		FlatUID_r	*lpguid;
		uint32		ulReserved;
		uint32		lID;
	} PropertyName_r;

	typedef struct {
		[range(0,100000)] uint32		cNames;
		[size_is(cNames)] PropertyName_r	aNames[];
	} PropertyNameSet_r;

	typedef struct {
		[range(0,100000)] uint32			cValues;
		[string,size_is(cValues),charset(DOS)] uint8	**lppszA;
	} StringArray_r;

	typedef struct {
		[range(0,100000)] uint32		       	Count;
		[string,size_is(Count),charset(DOS)] uint8     	*Strings[];
	} StringsArray_r;

	typedef struct {
		[range(0,100000)] uint32			cValues;
		[string,size_is(cValues),charset(UTF16)] uint16	**lppszW;
	} StringArrayW_r;

	typedef struct {
		[range(0,100000)] uint32		       	Count;
		[string,size_is(Count),charset(UTF16)] uint16  	*Strings[];
	} StringsArrayW_r;

	typedef struct {
		[range(0,100001)] uint32       				cValues;
		[size_is(cValues+1),length_is(cValues)] MAPITAGS	aulPropTag[];
	} SPropTagArray;

	typedef [public,noprint] struct {
		[range(0,2097152)] uint32      	cb;
		[size_is(cb)] uint8		*lpb;
	} Binary_r;

	typedef [public] struct {
		uint32 dwLowDateTime;
		uint32 dwHighDateTime;
	} FILETIME;

	typedef struct {
		[range(0,100000)] uint32	cValues;
		[size_is(cValues)] uint16	*lpi;
	} ShortArray_r;

	typedef struct {
		[range(0,100000)] uint32	cValues;
		[size_is(cValues)] uint32	*lpl; 
	} LongArray_r;

	typedef struct {
		[range(0,100000)] uint32	cValues;
		[size_is(cValues)] Binary_r	*lpbin;
	} BinaryArray_r;

	typedef struct {
		[range(0,100000)]uint32		cValues;
		[size_is(cValues)] FlatUID_r	**lpguid; 
	} FlatUIDArray_r;

	typedef struct {
		[range(0,100000)] uint32	cValues;
		[size_is(cValues)] FILETIME	*lpft;
	} DateTimeArray_r;

	typedef [switch_type(uint32)] union {
		[case(PT_I2)]			uint16			i;
		[case(PT_LONG)]			uint32			l;
		[case(PT_BOOLEAN)]		uint8			b;
		[case(PT_STRING8)][unique][string,charset(DOS)] uint8	*lpszA;
		[case(PT_UNICODE)][string,charset(UTF16)] uint16	*lpszW;
		[case(PT_BINARY)]		Binary_r       		bin;
		[case(PT_SVREID)]		Binary_r		bin;
		[case(PT_CLSID)]		FlatUID_r      		*lpguid;
		[case(PT_SYSTIME)]		FILETIME		ft;
		[case(PT_ERROR)]		MAPISTATUS		err;
		[case(PT_MV_I2)]		ShortArray_r		MVi;
		[case(PT_MV_LONG)]		LongArray_r		MVl;
		[case(PT_MV_STRING8)]		StringArray_r		MVszA;
		[case(PT_MV_BINARY)]		BinaryArray_r		MVbin;
		[case(PT_MV_CLSID)]		FlatUIDArray_r		MVguid;
		[case(PT_MV_UNICODE)]		StringArrayW_r		MVszW;
		[case(PT_MV_SYSTIME)]		DateTimeArray_r		MVft;
		[case(PT_NULL)]			uint32			null;
	} PROP_VAL_UNION;

	typedef [public]struct {
		MAPITAGS ulPropTag;
		uint32 dwAlignPad;
		[switch_is(ulPropTag & 0xFFFF)] PROP_VAL_UNION value; 
	} PropertyValue_r;
	
	typedef struct {
		uint32					Reserved;
		[range(0,100000)] uint32		cValues;
		[size_is(cValues)] PropertyValue_r	*lpProps;
	} PropertyRow_r;

	typedef [public] struct {
		[range(0,100000)] uint32	cRows;
		[size_is(cRows)] PropertyRow_r	aRow[];
	} PropertyRowSet_r;
	
	typedef struct {
		[range(0,100000)] uint32		cRes;
		[size_is(cRes)] Restriction_r		*lpRes;
	} AndRestriction_r;

	typedef struct {
		[range(0,100000)] uint32		cRes;
		[size_is(cRes)] Restriction_r		*lpRes;
	} OrRestriction_r;

	typedef struct {
		Restriction_r				*lpRes;
	} NotRestriction_r;

	typedef struct {
		uint32					ulFuzzyLevel;
		MAPITAGS       				ulPropTag;
		PropertyValue_r				*lpProp;
	} ContentRestriction_r;

	typedef struct {
		uint32					relop;
		MAPITAGS				ulPropTag;
		PropertyValue_r				*lpProp;
	} PropertyRestriction_r;

	typedef struct {
		uint32					relop;
		MAPITAGS				ulPropTag1;
		MAPITAGS				ulPropTag2;
	} ComparePropsRestriction_r;

	typedef struct {
		uint32					relMBR;
		MAPITAGS				ulPropTag;
		uint32					ulMask;
	} BitMaskRestriction_r;

	typedef struct {
		uint32					relop;
		MAPITAGS				ulPropTag;
		uint32					cb;
	} SizeRestriction_r;

	typedef struct {
		uint32					ulReserved1;
		MAPITAGS				ulPropTag;
		uint32					ulReserved2;
	} ExistRestriction_r;

	typedef struct {
		uint32					ulSubObject;
		Restriction_r				*lpRes;
	} SubRestriction_r;

	typedef [v1_enum] enum {
		RES_AND			= 0x0,
		RES_OR			= 0x1,
		RES_NOT			= 0x2,
		RES_CONTENT		= 0x3,
		RES_PROPERTY		= 0x4,
		RES_COMPAREPROPS	= 0x5,
		RES_BITMASK		= 0x6,
		RES_SIZE		= 0x7,
		RES_EXIST		= 0x8,
		RES_SUBRESTRICTION	= 0x9,
		RES_COMMENT		= 0xA
	} RestrictionType_r;

	typedef [switch_type(uint32)] union {
		[case(RES_AND)]			AndRestriction_r		resAnd;
		[case(RES_OR)]			OrRestriction_r			resOr;
		[case(RES_NOT)]			NotRestriction_r		resNot;
		[case(RES_CONTENT)]		ContentRestriction_r		resContent;
		[case(RES_PROPERTY)]		PropertyRestriction_r		resProperty;
		[case(RES_COMPAREPROPS)]	ComparePropsRestriction_r	resCompareProps;
		[case(RES_BITMASK)]		BitMaskRestriction_r		resBitMask;
		[case(RES_SIZE)]		SizeRestriction_r		resSize;
		[case(RES_EXIST)]		ExistRestriction_r		resExist;
		[case(RES_SUBRESTRICTION)]	SubRestriction_r		resSub;
	} RestrictionUnion_r;

	typedef [public] struct _Restriction_r{
		RestrictionType_r      			rt;
		[switch_is(rt)] RestrictionUnion_r	res;
	} Restriction_r;


	/* Note:
	   Those structs are used only internally by libmapi, the server code
	   and the backend code, in order to provide 32 bits lengths to
	   certain members (contrarily to mapi_SPropValue) and enable
	   type-independence between different operations.
	   They are derived from the PropertyValue_r/Row_r/RowSet_r structs
	   and enhance them with certain types that are absent from NSPI and
	   would otherwise break the data alignment on wire operations.
	   However, they must be defined here as they make use of the same array types. */

	typedef [public] struct {
		[range(0,100000)] uint32	cValues;
		[size_is(cValues)] hyper	*lpui8; 
	} UI8Array_r;

	typedef [switch_type(uint32)] union {
		[case(PT_I2)]			uint16			i;
		[case(PT_LONG)]			uint32			l;
		[case(PT_DOUBLE)]		double			dbl;
		[case(PT_BOOLEAN)]		uint8			b;
		[case(PT_I8)]			dlong			d;
		[case(PT_STRING8)][unique][string,charset(DOS)] uint8	*lpszA;
		[case(PT_BINARY)]		Binary_r       		bin;
		[case(PT_SVREID)]		Binary_r		bin;
		[case(PT_UNICODE)][string,charset(UTF16)] uint16	*lpszW;
		[case(PT_CLSID)]		FlatUID_r      		*lpguid;
		[case(PT_SYSTIME)]		FILETIME		ft;
		[case(PT_ERROR)]		MAPISTATUS		err;
		[case(PT_MV_I2)]		ShortArray_r		MVi;
		[case(PT_MV_LONG)]		LongArray_r		MVl;
		[case(PT_MV_I8)]		UI8Array_r		MVui8;
		[case(PT_MV_STRING8)]		StringArray_r		MVszA;
		[case(PT_MV_BINARY)]		BinaryArray_r		MVbin;
		[case(PT_MV_CLSID)]		FlatUIDArray_r		MVguid;
		[case(PT_MV_UNICODE)]		StringArrayW_r		MVszW;
		[case(PT_MV_SYSTIME)]		DateTimeArray_r		MVft;
		[case(PT_NULL)]			uint32			null;
		[case(PT_OBJECT)]		uint32			object;
	} SPropValue_CTR;

	typedef [public] struct {
		MAPITAGS ulPropTag;
		uint32 dwAlignPad;
		[switch_is(ulPropTag & 0xFFFF)] SPropValue_CTR value; 
	} SPropValue;
	
	typedef [public] struct {
		uint32			       	ulAdrEntryPad;
		[range(0,100000)] uint32       	cValues;
		[size_is(cValues)]SPropValue	*lpProps;
	} SRow;

	typedef [public] struct {
		[range(0,100000)] uint32	cRows;
		[size_is(cRows)] SRow		aRow[];
	} SRowSet;
	/* /internal types */

	/*****************/
	/* Function 0x00 */
	typedef [bitmap32bit] bitmap {
		fAnonymousLogin	= 0x00000020
	} NspiBind_dwFlags;

	MAPISTATUS NspiBind(
		[in] NspiBind_dwFlags	dwFlags,
		[in] STAT		*pStat,
		[in,out,unique] GUID   	*mapiuid,
		[out] policy_handle    	*handle
		);

	/*****************/
	/* Function 0x01 */
	MAPISTATUS NspiUnbind(
		[in, out] policy_handle	*handle,
		[in] uint32	       	Reserved
		);

	/*****************/
	/* Function 0x02 */
	MAPISTATUS NspiUpdateStat(
		[in] policy_handle	*handle,
		[in] uint32		Reserved,
		[in,out] STAT		*pStat,
		[in,out,unique] int32	*plDelta
		);

	/*****************/
	/* Function 0x03 */
	typedef [bitmap32bit] bitmap {
		fSkipObjects	= 0x00000001,
		fEphID		= 0x00000002
	} NspiQueryRows_dwFlags;

	MAPISTATUS NspiQueryRows(
		[in]					policy_handle			*handle,
		[in]					NspiQueryRows_dwFlags		dwFlags,
		[in,out]				STAT				*pStat,
		[in,range(0,100000)]			uint32				dwETableCount,
 		[in,unique,size_is(dwETableCount)]	uint32				*lpETable,
		[in]					uint32				Count,
		[in,unique]    				SPropTagArray			*pPropTags,
		[out]					PropertyRowSet_r		**ppRows
		);

	/*****************/
	/* Function 0x04 */
	MAPISTATUS NspiSeekEntries(
		[in]		policy_handle		*handle,
		[in]		uint32			Reserved,
		[in,out]	STAT			*pStat,
		[in]		PropertyValue_r     	*pTarget,
		[in,unique]	PropertyTagArray_r	*lpETable,
		[in,unique]	SPropTagArray		*pPropTags,
		[out]		PropertyRowSet_r	**pRows
		);

	/*****************/
	/* Function 0x05 */
	MAPISTATUS NspiGetMatches(
		[in]		policy_handle		*handle,
		[in]		uint32			Reserved,
		[in,out]	STAT			*pStat,
		[in][unique]	SPropTagArray		*pReserved,
		[in]		uint32			Reserved2,
		[in][unique]	Restriction_r		*Filter,
 		[in][unique]	PropertyName_r		*lpPropName,
		[in]		uint32			ulRequested,
		[out]		PropertyTagArray_r	**ppOutMIds,
		[in][unique]	SPropTagArray		*pPropTags,
		[out]      	PropertyRowSet_r	**ppRows
		);

	/*****************/
	/* Function 0x06 */
	MAPISTATUS NspiResortRestriction(
		[in] policy_handle		*handle,
		[in] uint32			Reserved,
		[in,out] STAT			*pStat,
		[in] PropertyTagArray_r		*pInMIds,
		[in,out] PropertyTagArray_r	**ppMIds
		);

	/*****************/
	/* Function 0x07 */
	MAPISTATUS NspiDNToMId(
		[in] policy_handle		*handle,
		[in] uint32			Reserved,
		[in] StringsArray_r		*pNames,
		[out] PropertyTagArray_r	**ppMIds
		);

	/*****************/
	/* Function 0x08 */
	MAPISTATUS NspiGetPropList(
		[in] policy_handle	*handle,
		[in] uint32		dwFlags,
		[in] uint32		dwMId,
		[in] uint32		CodePage,
		[out] SPropTagArray	**ppPropTags
		);

	/*****************/
	/* Function 0x09 */
	MAPISTATUS NspiGetProps(
		[in]   	policy_handle			*handle,
		[in]   	uint32				dwFlags,
		[in]	STAT				*pStat,
		[in,unique] SPropTagArray		*pPropTags,
		[out]	PropertyRow_r			**ppRows
		);

	/*****************/
	/* Funcion 0xa   */
	MAPISTATUS NspiCompareMIds(
		[in] policy_handle     	*handle,
		[in] uint32	       	Reserved,
		[in] STAT	       	*pStat,
		[in] uint32	       	MId1,
		[in] uint32	       	MId2,
		[out] uint32	       	*plResult
		);

	/*****************/
	/* Function 0xb  */
	MAPISTATUS NspiModProps(
		[in] policy_handle		*handle,
		[in] uint32			Reserved,
		[in] STAT			*pStat,
		[in,unique] SPropTagArray	*pPropTags,
		[in] PropertyRow_r		*pRow
		);

	/*****************/
	/* Function 0x0c */
	typedef [bitmap32bit] bitmap {
		NspiAddressCreationTemplates	= 0x00000002,
		NspiUnicodeStrings		= 0x00000004
	} NspiGetSpecialTable_dwFlags;

	MAPISTATUS NspiGetSpecialTable(
		[in] policy_handle			*handle,
		[in] NspiGetSpecialTable_dwFlags       	dwFlags,
		[in] STAT				*pStat,
 		[in,out] uint32				*lpVersion,
 		[out] PropertyRowSet_r			**ppRows
		);

	/*******************/
	/* Function 0x0d   */
	typedef [bitmap32bit] bitmap {
		TI_TEMPLATE		= 0x00000001,
		TI_SCRIPT		= 0x00000004,
		TI_EMT			= 0x00000010,
		TI_HELPFILE_NAME	= 0x00000020,
		TI_HELPFILE_CONTENTS	= 0x00000040
	} TI_dwFlags;

	MAPISTATUS NspiGetTemplateInfo(
		[in] policy_handle			*handle,
		[in] TI_dwFlags				dwFlags,
		[in] uint32				ulType,
		[in,unique,string,charset(DOS)] uint8	*pDN,
		[in] uint32				dwCodePage,
		[in] uint32				dwLocaleID,
		[out] PropertyRow_r			**ppData
		);

	/*******************/
	/* Function 0x0e   */
	MAPISTATUS NspiModLinkAtt(
		[in] policy_handle			*handle,
		[in] uint32				dwFlags,
		[in] MAPITAGS				ulPropTag,
		[in] uint32				MId,
		[in] BinaryArray_r			*lpEntryIds
		);

	/*************************************/
	/* Function 0x0f: Not used on wire   */
	MAPISTATUS NspiDeleteEntries(
		[in] policy_handle			*Reserved1,
		[in] uint32				Reserved2,
		[in] uint32				Reserved3,
		[in] BinaryArray_r			*Reserved4
		);

	/*******************/
	/* Function 0x10   */
	typedef [bitmap32bit] bitmap {
		NspiUnicodeProptypes	= 0x80000000
	} NspiQueryColumns_dwFlags;

	MAPISTATUS NspiQueryColumns(
		[in] policy_handle			*handle,
		[in] uint32				Reserved,
		[in] NspiQueryColumns_dwFlags		dwFlags,
		[out] SPropTagArray      		**ppColumns
		);

	/*******************/
	/* Function 0x11   */
	MAPISTATUS NspiGetNamesFromIDs(
		[in] policy_handle			*handle,
		[in] uint32				Reserved,
		[in,unique] FlatUID_r			*lpGuid,
		[in,unique] SPropTagArray		*pPropTags,
		[out] SPropTagArray			**ppReturnedPropTags,
		[out] PropertyNameSet_r			**ppNames
		);

	/*******************/
	/* Function 0x12   */
	MAPISTATUS NspiGetIDsFromNames(
		[in] policy_handle			*handle,
		[in] uint32				Reserved,
		[in] uint32				dwFlags,
		[in,range(0,100000)] uint32		cPropNames,
		[in,size_is(cPropNames)] PropertyName_r	**ppNames,
		[out] SPropTagArray			**ppPropTags
		);

	/*****************/
	/* Function 0x13 */
	MAPISTATUS NspiResolveNames(
		[in] policy_handle		*handle,
		[in] uint32			Reserved,
		[in] STAT			*pStat,
		[in,unique] SPropTagArray	*pPropTags,
 		[in] StringsArray_r		*paStr,
		[out] PropertyTagArray_r	**ppMIds,
		[out] PropertyRowSet_r		**ppRows
	);

	/*****************/
	/* Function 0x14 */
	MAPISTATUS NspiResolveNamesW(
		[in] policy_handle		*handle,
		[in] uint32			Reserved,
		[in] STAT			*pStat,
		[in,unique] SPropTagArray      	*pPropTags,
		[in] StringsArrayW_r       	*paWStr,
		[out] PropertyTagArray_r	**ppMIds,
		[out] PropertyRowSet_r		**ppRows
		);
}

[
  uuid("a4f1db00-ca47-1067-b31f-00dd010662da"),
  pointer_default(unique),
  endpoint("ncacn_ip_tcp:"),
  authservice("exchangeMDB"),
  //version(0.81),
  version(5308416),
  helpstring("Exchange 5.5 EMSMDB")
] interface exchange_emsmdb
{
	/*****************/
	/* Function 0x00 */

	MAPISTATUS EcDoConnect(
 		[out]				policy_handle	*handle,
                [in,string,charset(DOS)]	uint8		szUserDN[],
		[in]				uint32		ulFlags,
		[in]				uint32		ulConMod,
		[in]				uint32		cbLimit,
		[in]				uint32		ulCpid,
		[in]				uint32		ulLcidString,
		[in]				uint32		ulLcidSort,
		[in]				uint32		ulIcxrLink,
		[in]				uint16		usFCanConvertCodePages,
		[out]				uint32		*pcmsPollsMax,
		[out]				uint32		*pcRetry,
		[out]				uint32		*pcmsRetryDelay,
		[out]				uint32		*picxr,
                [out,ref,string,charset(DOS)]uint8		**szDNPrefix,
                [out,ref,string,charset(DOS)]uint8		**szDisplayName,
                [out]				uint16          rgwServerVersion[3],
		[in,out]       			uint16          rgwClientVersion[3],
                [in,out]			uint32		*pullTimeStamp
		);

	/*****************/
	/* Function 0x01 */
	MAPISTATUS EcDoDisconnect(
		[in,out]   policy_handle   *handle
		);

	/*****************/
	/* Function 0x02 */

	/*
	  EcDoRpc opnums
	*/

	typedef [public, enum8bit, flag(NDR_PAHEX)] enum 
		{
			MAPI_STORE	= 0x1,
			MAPI_ADDRBOOK	= 0x2,
			MAPI_FOLDER	= 0x3,
			MAPI_ABCONT	= 0x4,
			MAPI_MESSAGE	= 0x5,
			MAPI_MAILUSER	= 0x6, /* Individual Recipient */
			MAPI_ATTACH	= 0x7,
			MAPI_DISTLIST	= 0x8,
			MAPI_PROFSECT	= 0x9,
			MAPI_STATUS	= 0xA,
			MAPI_SESSION	= 0xB,
			MAPI_FORMINFO	= 0xC
		} MAPI_OBJTYPE;

	typedef [public, v1_enum, flag(NDR_PAHEX)] enum 
		{
			RightsNone		= 0x00000000,
			RightsReadItems		= 0x00000001,
			RightsCreateItems	= 0x00000002,
			RightsEditOwn		= 0x00000008,
			RightsDeleteOwn		= 0x00000010,
			RightsEditAll		= 0x00000020,
			RightsDeleteAll		= 0x00000040,
			RightsCreateSubfolders	= 0x00000080,
			RightsFolderOwner	= 0x00000100,
			RightsFolderContact	= 0x00000200,
			RoleNone		= 0x00000400,
			RoleReviewer		= 0x00000401,
			RoleContributor		= 0x00000402,
			RoleNoneditingAuthor	= 0x00000413,
			RoleAuthor		= 0x0000041B,
			RoleEditor		= 0x0000047B,
			RolePublishAuthor	= 0x0000049B,
			RolePublishEditor	= 0x000004FB,
			RightsAll		= 0x000005FB,
			RoleOwner		= 0x000007FB,
			RightsFreeBusySimple    = 0x00000800,
			RightsFreeBusyDetailed  = 0x00001000
	       	} ACLRIGHTS;

	typedef [public, enum8bit, flag(NDR_PAHEX)] enum
		{
			op_MAPI_Release				= 0x1,
			op_MAPI_OpenFolder			= 0x2,
			op_MAPI_OpenMessage			= 0x3,
			op_MAPI_GetHierarchyTable		= 0x4,
			op_MAPI_GetContentsTable		= 0x5,
			op_MAPI_CreateMessage			= 0x6,
			op_MAPI_GetProps			= 0x7,
			op_MAPI_GetPropsAll			= 0x8,
			op_MAPI_GetPropList			= 0x9,
			op_MAPI_SetProps			= 0xa,
			op_MAPI_DeleteProps			= 0xb,
			op_MAPI_SaveChangesMessage		= 0xc,
			op_MAPI_RemoveAllRecipients		= 0xd,
			op_MAPI_ModifyRecipients		= 0xe,
			op_MAPI_ReadRecipients			= 0xf,
			op_MAPI_ReloadCachedInformation		= 0x10,
			op_MAPI_SetMessageReadFlag		= 0x11,
			op_MAPI_SetColumns			= 0x12,
			op_MAPI_SortTable			= 0x13,
			op_MAPI_Restrict			= 0x14,
			op_MAPI_QueryRows			= 0x15,
			op_MAPI_GetStatus			= 0x16,
			op_MAPI_QueryPosition			= 0x17,
			op_MAPI_SeekRow				= 0x18,
			op_MAPI_SeekRowBookmark			= 0x19,
			op_MAPI_SeekRowApprox			= 0x1a,
			op_MAPI_CreateBookmark			= 0x1b,
			op_MAPI_CreateFolder			= 0x1c,
			op_MAPI_DeleteFolder			= 0x1d,
			op_MAPI_DeleteMessages			= 0x1e,
			op_MAPI_GetMessageStatus		= 0x1f,
			op_MAPI_SetMessageStatus		= 0x20,
			op_MAPI_GetAttachmentTable		= 0x21,
			op_MAPI_OpenAttach			= 0x22,
			op_MAPI_CreateAttach			= 0x23,
			op_MAPI_DeleteAttach			= 0x24,
			op_MAPI_SaveChangesAttachment  		= 0x25,
			op_MAPI_SetReceiveFolder		= 0x26,
			op_MAPI_GetReceiveFolder		= 0x27,
			op_MAPI_RegisterNotification   		= 0x29,
			op_MAPI_Notify				= 0x2a,
			op_MAPI_OpenStream			= 0x2b,
			op_MAPI_ReadStream			= 0x2c,
			op_MAPI_WriteStream			= 0x2d,
			op_MAPI_SeekStream			= 0x2e,
			op_MAPI_SetStreamSize			= 0x2f,
			op_MAPI_SetSearchCriteria		= 0x30,
			op_MAPI_GetSearchCriteria		= 0x31,
			op_MAPI_SubmitMessage			= 0x32,
			op_MAPI_MoveCopyMessages		= 0x33,
			op_MAPI_AbortSubmit			= 0x34,
			op_MAPI_MoveFolder			= 0x35,
			op_MAPI_CopyFolder			= 0x36,
			op_MAPI_QueryColumnsAll			= 0x37,
			op_MAPI_Abort				= 0x38,
			op_MAPI_CopyTo				= 0x39,
			op_MAPI_CopyToStream			= 0x3a,
			op_MAPI_CloneStream			= 0x3b,
			op_MAPI_GetPermissionsTable		= 0x3e,
			op_MAPI_GetRulesTable			= 0x3f,
			op_MAPI_ModifyPermissions		= 0x40,
			op_MAPI_ModifyRules			= 0x41,
			op_MAPI_GetOwningServers		= 0x42,
			op_MAPI_LongTermIdFromId		= 0x43,
			op_MAPI_IdFromLongTermId		= 0x44,
			op_MAPI_PublicFolderIsGhosted		= 0x45,
			op_MAPI_OpenEmbeddedMessage		= 0x46,
			op_MAPI_SetSpooler			= 0x47,
			op_MAPI_SpoolerLockMessage		= 0x48,
			op_MAPI_AddressTypes			= 0x49,
			op_MAPI_TransportSend			= 0x4a,
			op_MAPI_FastTransferSourceCopyMessages	= 0x4b,
			op_MAPI_FastTransferSourceCopyFolder	= 0x4c,
			op_MAPI_FastTransferSourceCopyTo	= 0x4d,
			op_MAPI_FastTransferSourceGetBuffer	= 0x4e,
			op_MAPI_FindRow				= 0x4f,
			op_MAPI_Progress			= 0x50,
			op_MAPI_TransportNewMail		= 0x51,
			op_MAPI_GetValidAttachments		= 0x52,
			op_MAPI_FastTransferDestConfigure	= 0x53,
			op_MAPI_FastTransferDestPutBuffer	= 0x54,
			op_MAPI_GetNamesFromIDs			= 0x55,
			op_MAPI_GetIDsFromNames			= 0x56,
			op_MAPI_UpdateDeferredActionMessages	= 0x57,
			op_MAPI_EmptyFolder			= 0x58,
			op_MAPI_ExpandRow			= 0x59,
			op_MAPI_CollapseRow			= 0x5a,
			op_MAPI_LockRegionStream		= 0x5b,
			op_MAPI_UnlockRegionStream		= 0x5c,
			op_MAPI_CommitStream			= 0x5d,
			op_MAPI_GetStreamSize			= 0x5e,
			op_MAPI_QueryNamedProperties		= 0x5f,
			op_MAPI_GetPerUserLongTermIds		= 0x60,
			op_MAPI_GetPerUserGuid			= 0x61,
			op_MAPI_ReadPerUserInformation		= 0x63,
			op_MAPI_WritePerUserInformation		= 0x64,
			op_MAPI_SetReadFlags			= 0x66,
			op_MAPI_CopyProperties			= 0x67,
			op_MAPI_GetReceiveFolderTable		= 0x68,
			op_MAPI_FastTransferSourceCopyProps	= 0x69,
			op_MAPI_GetCollapseState		= 0x6b,
			op_MAPI_SetCollapseState		= 0x6c,
			op_MAPI_GetTransportFolder		= 0x6d,
			op_MAPI_Pending				= 0x6e,
			op_MAPI_OptionsData			= 0x6f,
			op_MAPI_SyncConfigure			= 0x70,
			op_MAPI_SyncImportMessageChange		= 0x72,
			op_MAPI_SyncImportHierarchyChange	= 0x73,
			op_MAPI_SyncImportDeletes		= 0x74,
			op_MAPI_SyncUploadStateStreamBegin	= 0x75,
			op_MAPI_SyncUploadStateStreamContinue	= 0x76,
			op_MAPI_SyncUploadStateStreamEnd	= 0x77,
			op_MAPI_SyncImportMessageMove		= 0x78,
			op_MAPI_SetPropertiesNoReplicate	= 0x79,
			op_MAPI_DeletePropertiesNoReplicate	= 0x7a,
			op_MAPI_GetStoreState			= 0x7b,
			op_MAPI_SyncOpenCollector		= 0x7e,
			op_MAPI_GetLocalReplicaIds		= 0x7f,
			op_MAPI_SyncImportReadStateChanges	= 0x80,
			op_MAPI_ResetTable			= 0x81,
			op_MAPI_SyncGetTransferState		= 0x82,
			op_MAPI_SyncOpenAdvisor			= 0x83,
			op_MAPI_TellVersion			= 0x86,
			op_MAPI_OpenPublicFolderByName		= 0x87,
			op_MAPI_SetSyncNotificationGuid		= 0x88,
			op_MAPI_FreeBookmark			= 0x89,
			op_MAPI_WriteAndCommitStream		= 0x90,
			op_MAPI_HardDeleteMessages		= 0x91,
			op_MAPI_HardDeleteMessagesAndSubfolders	= 0x92,
			op_MAPI_SetLocalReplicaMidsetDeleted	= 0x93,
			op_MAPI_Backoff				= 0xf9,
			op_MAPI_Logon				= 0xfe,
			op_MAPI_BufferTooSmall			= 0xff,
			/****** custom MAPI opnum for mapiproxy ******/
			op_MAPI_proxypack			= 0xa5
		} MAPI_OPNUM;


	typedef [public,noprint,flag(NDR_NOALIGN)] struct {
		uint16				cb;
		[flag(NDR_BUFFERS)]uint8	lpb[cb];
	} SBinary_short;

	typedef [public] struct {
		uint32 cValues;
		uint32 lpl[cValues]; 
	} mapi_MV_LONG_STRUCT;

	typedef struct {
		raw8string lppszA;
	} mapi_LPSTR;

	typedef [public] struct {
		uint32 cValues;
		mapi_LPSTR strings[cValues]; 
	} mapi_SLPSTRArray;

	typedef [public] struct {
		[flag(STR_NULLTERM)] string lppszW;
	} mapi_LPWSTR;

	typedef [public] struct {
		uint32 cValues;
		mapi_LPWSTR strings[cValues];
	} mapi_SLPSTRArrayW;
	
	typedef [public] struct {
		uint32		cValues;
		SBinary_short	bin[cValues];
	} mapi_SBinaryArray;

	typedef [public] struct {
		uint32		cValues;
		GUID		lpguid[cValues];
	} mapi_SGuidArray;

	/******* part of the no-pointer deep recursion hack *******/
	typedef [nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
		uint8 wrap[0x8000];
	} mapi_SRestriction_wrap;

	typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
		uint8	wrap[0x8000];
	} mapi_SPropValue_wrap;

	typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
		uint8	wrap[0x8000];
	} mapi_SPropValue_array_wrap;
	/**********************************************************/	

	typedef [enum8bit] enum {
		ActionType_OP_MOVE		= 0x1,
		ActionType_OP_COPY		= 0x2,
		ActionType_OP_REPLY		= 0x3,
		ActionType_OP_OOF_REPLY		= 0x4,
		ActionType_OP_DEFER_ACTION	= 0x5,
		ActionType_OP_BOUNCE		= 0x6,
		ActionType_OP_FORWARD		= 0x7,
		ActionType_OP_DELEGATE		= 0x8,
		ActionType_OP_TAG		= 0x9,
		ActionType_OP_DELETE		= 0xA,
		ActionType_OP_MARK_AS_READ	= 0xB
	} ActionType;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8		FolderInThisStore;
		SBinary_short		StoreEID;
		SBinary_short		FolderEID;
	} MoveCopy_Action;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper			ReplyTemplateFID;
		hyper			ReplyTemplateMID;
		GUID			ReplyTemplateGUID;			
	} ReplyOOF_Action;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				Reserved;
		mapi_SPropValue_array_wrap	PropertyValue;
	} RecipientBlock;

	typedef [flag(NDR_NOALIGN)] enum {
		BOUNCE_MESSAGE_TOO_LARGE	= 0x0000000d,
		BOUNCE_MESSAGE_NOT_DISPLAYED	= 0x0000001f,
		BOUNCE_MESSAGE_DENIED		= 0x00000026
	} BounceCode;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16			RecipientCount;
		RecipientBlock		RecipientBlock[RecipientCount];
	} ForwardDelegate_Action;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(ActionType_OP_MOVE)]		MoveCopy_Action			MoveAction;
		[case(ActionType_OP_COPY)]		MoveCopy_Action			CopyAction;
		[case(ActionType_OP_REPLY)]		ReplyOOF_Action			ReplyAction;
		[case(ActionType_OP_OOF_REPLY)]		ReplyOOF_Action			ReplyOOFAction;
		[case(ActionType_OP_DEFER_ACTION)][flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	DeferAction;
		[case(ActionType_OP_BOUNCE)]		BounceCode			BounceCode;
		[case(ActionType_OP_TAG)]		mapi_SPropValue_wrap	       	PropValue;
		[case(ActionType_OP_FORWARD)]		ForwardDelegate_Action		ForwardAction;
		[case(ActionType_OP_DELEGATE)]		ForwardDelegate_Action		DelegateAction;
		[case(ActionType_OP_DELETE)];
		[case(ActionType_OP_MARK_AS_READ)];
	} ActionData;

	typedef [flag(NDR_NOALIGN)] struct {
		ActionType				ActionType;
		uint32					ActionFlavor;
		uint32					ActionFlags;
		[switch_is(ActionType)] ActionData	ActionDataBuffer;
	} ActionBlockData;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16					ActionLength;
		[subcontext(0),subcontext_size(ActionLength),flag(NDR_REMAINING|NDR_NOALIGN)] ActionBlockData ActionBlockData;
	} ActionBlock;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		count;
		ActionBlock	ActionBlock[count];
	} RuleAction;

	typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
		[case(PT_NULL)];
		[case(PT_I2)]		uint16			i;
		[case(PT_LONG)]     	uint32			l;
		[case(PT_DOUBLE)]	double			dbl;
		[case(PT_ERROR)]       	uint32			err;
		[case(PT_BOOLEAN)]	uint8			b;
		[case(PT_I8)]		dlong			d;
		[case(PT_STRING8)]	raw8string		lpszA;
		[case(PT_UNICODE)][flag(STR_NULLTERM)] string	lpszW;
		[case(PT_SYSTIME)]	FILETIME		ft;
		[case(PT_CLSID)]	GUID			lpguid;
 		[case(PT_SRESTRICT)]	mapi_SRestriction_wrap 	Restrictions;
		[case(PT_ACTIONS)]	RuleAction		RuleAction;
  		[case(PT_BINARY)]	SBinary_short		bin;
		[case(PT_SVREID)]      	SBinary_short		bin;
		[case(PT_MV_LONG)]	mapi_MV_LONG_STRUCT	MVl;	
		[case(PT_MV_STRING8)]	mapi_SLPSTRArray	MVszA;
		[case(PT_MV_UNICODE)]	mapi_SLPSTRArrayW	MVszW;
		[case(PT_MV_CLSID)]	mapi_SGuidArray		MVguid;
		[case(PT_MV_BINARY)]	mapi_SBinaryArray      	MVbin;
	} mapi_SPropValue_CTR;

	typedef [public,flag(NDR_NOALIGN)] struct {
		MAPITAGS ulPropTag;
		[switch_is(ulPropTag & 0xFFFF)] mapi_SPropValue_CTR value; 
	} mapi_SPropValue;

	typedef [public,flag(NDR_NOALIGN)] struct {
		uint16					cValues;
		[flag(NDR_REMAINING|NDR_NOALIGN)]mapi_SPropValue	lpProps[cValues];
	} mapi_SPropValue_array;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16					cValues;
		MAPITAGS				aulPropTag[cValues];
	} mapi_SPropTagArray;

	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		ROW_ADD		=	0x1,
		ROW_MODIFY	=	0x2,
		ROW_REMOVE	=	0x4
	} ulRowFlags;

	/**************************/
	/* EcDoRpc Function 0x1   */
	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} Release_req;

	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} Release_repl;

	/**************************/
	/* EcDoRpc Function 0x2   */
	typedef [enum8bit] enum {
		OpenModeFlags_Folder		= 0x0,
		OpenModeFlags_SoftDeleted	= 0x4
	} OpenFolder_OpenModeFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		hyper				folder_id;
 		OpenFolder_OpenModeFlags	OpenModeFlags;
	} OpenFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ServerCount;
		uint16		CheapServerCount;
		astring		Servers[ServerCount];
	} OpenFolder_Replicas;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)] OpenFolder_Replicas	Replicas;
	} IsGhosted;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8		       	       	HasRules;
		boolean8			       	IsGhosted;
		[switch_is(IsGhosted)] IsGhosted	Ghost;
	} OpenFolder_repl;
	
	/**************************/
	/* EcDoRpc Function 0x3   */
	typedef [enum8bit] enum {
		StringType_NONE			= 0x0,
		StringType_EMPTY		= 0x1,
		StringType_STRING8		= 0x2,
		StringType_UNICODE_REDUCED	= 0x3,
		StringType_UNICODE		= 0x4
	} StringType;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)];
		[case(0x2)] raw8string			lpszA;
		[case(0x3)] raw8string			lpszW_reduced;
		[case(0x4)] [flag(STR_NULLTERM)] string	lpszW;
	} String;

	typedef [flag(NDR_NOALIGN)] struct {
		StringType			StringType;
		[switch_is(StringType)] String	String;
	} TypedString;

	typedef [enum8bit] enum {
		ReadOnly	= 0x0,
		ReadWrite	= 0x1,
		BestAccess	= 0x3,
		OpenSoftDelete	= 0x4
	} OpenMessage_OpenModeFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		uint16				CodePageId;
		hyper				FolderId;
		OpenMessage_OpenModeFlags	OpenModeFlags;
		hyper				MessageId;
	} OpenMessage_req;

	typedef [enum16bit, flag(NDR_PAHEX)] enum {
		CP_USASCII	= 0x04E4,
		CP_UNICODE	= 0x04B0,
		CP_JAUTODETECT	= 0xC6F4,
		CP_KAUTODETECT	= 0xC705,
		CP_ISO2022JPESC = 0xC42D,
		CP_ISO2022JPSIO	= 0xC42E
	} CODEPAGEID;

	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		MAPI_ORIG		= 0x0,
		MAPI_TO			= 0x1,
		MAPI_CC			= 0x2,
		MAPI_BCC		= 0x3
	} ulRecipClass;

	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		SINGLE_RECIPIENT	= 0x0,
		DISTRIBUTION_LIST	= 0x1
	} addr_type;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x1)] uint8	prefix_size;
		[default];
	} recipient_AddressPrefixUsed;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x1)] addr_type	display_type;
		[default];
	} recipient_DisplayType;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x1)] astring	recipient_x500name;
		[default];
	} recipient_X500DN;

	/* We're covering the PersonalDistributionList1 (0x0006) and PersonalDistributionList2
           (0x0007) variations here, since we mask off the low bit in the switch. */
	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x6)] SBinary_short			entryid;
		[default];
	} recipient_EntryId;

	/* We're covering the PersonalDistributionList1 (0x0006) and PersonalDistributionList2
           (0x0007) variations here, since we mask off the low bit in the switch. */
	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x6)] SBinary_short			searchkey;
		[default];
	} recipient_SearchKey;

	/* Present if the Type field is set to NoType (0x0) and the O flag (0x8000) is set */
	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x8000)] astring				lpszA;
		[default];
	} recipient_AddressType;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x400)] raw8string			lpszA;
		[case(0x600)][flag(STR_NULLTERM)] string	lpszW;
		[default];
	} recipient_SimpleDisplayName;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x20)] raw8string				lpszA;
		[case(0x220)][flag(STR_NULLTERM)] string	lpszW;
		[default];
	} recipient_TransmittableDisplayName;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x10)] raw8string				lpszA;
		[case(0x210)][flag(STR_NULLTERM)] string	lpszW;
		[default];
	} recipient_DisplayName;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x8)] astring				lpszA;
		[case(0x208)][flag(STR_NULLTERM)] string	lpszW;
		[default];
	} recipient_EmailAddress;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16									RecipientFlags;
		[switch_is(RecipientFlags & 0x0007)] recipient_AddressPrefixUsed	AddressPrefixUsed;
		[switch_is(RecipientFlags & 0x0007)] recipient_DisplayType		DisplayType;
		[switch_is(RecipientFlags & 0x0007)] recipient_X500DN			X500DN;
		[switch_is(RecipientFlags & 0x0006)] recipient_EntryId			EntryId;
		[switch_is(RecipientFlags & 0x0006)] recipient_SearchKey		SearchKey;
		[switch_is(RecipientFlags & 0x8007)] recipient_AddressType		AddressType;
		[switch_is(RecipientFlags & 0x0208)] recipient_EmailAddress		EmailAddress;
		[switch_is(RecipientFlags & 0x0210)] recipient_DisplayName		DisplayName;
		[switch_is(RecipientFlags & 0x0600)] recipient_SimpleDisplayName	SimpleDisplayName;
		[switch_is(RecipientFlags & 0x0220)] recipient_TransmittableDisplayName	TransmittableDisplayName;
		uint16									prop_count;
// TODO: figure out if "layout" can go
		uint8									layout;
// TODO: convert this to a proper structure - see if we already have one.
		[flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB						prop_values;
	} RecipientRow;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8		HasNamedProperties;
		TypedString		SubjectPrefix;
		TypedString		NormalizedSubject;
		uint16			RecipientCount;
		mapi_SPropTagArray	RecipientColumns;
		uint8			RowCount;
		OpenRecipientRow	RecipientRows[RowCount];
	} OpenMessage_repl;

	/**************************/
	/* EcDoRpc Function 0x4   */
	typedef [bitmap8bit] bitmap {
		TableFlags_Associated			= 0x2, /* only for GetContentsTable */
		TableFlags_Depth			= 0x4, /* only for GetHierarchyTable */
		TableFlags_DeferredErrors		= 0x8,
		TableFlags_NoNotifications		= 0x10,
		TableFlags_SoftDeletes			= 0x20,
		TableFlags_UseUnicode			= 0x40,
		TableFlags_SuppressNotifications	= 0x80
	} TableFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		TableFlags	TableFlags;
	} GetHierarchyTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		RowCount;
	} GetHierarchyTable_repl;

	/**************************/
	/* EcDoRpc Function 0x5   */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		TableFlags	TableFlags;
	} GetContentsTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		RowCount;
	} GetContentsTable_repl;

	/**************************/
	/* EcDoRpc Function 0x6   */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		uint16		CodePageId;
		hyper		FolderId;
		boolean8	AssociatedFlag;
	} CreateMessage_req;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)] hyper	MessageId;
	} CreateMessage_MessageId;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8						HasMessageId;
		[switch_is(HasMessageId)] CreateMessage_MessageId	MessageId;
	} CreateMessage_repl;

	/*************************/
	/* EcDoRpc Function 0x7  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertySizeLimit;
		uint16		WantUnicode;
		uint16		prop_count;
		MAPITAGS	properties[prop_count];
	} GetProps_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		layout;
		[flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB prop_data;
	} GetProps_repl;

	/*************************/
	/* EcDoRpc Function 0x8  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertySizeLimit;
		uint16		WantUnicode;
	} GetPropsAll_req;

	typedef [flag(NDR_NOALIGN)] struct {
		mapi_SPropValue_array	properties;
	} GetPropsAll_repl;

	/*************************/
	/* EcDoRpc Function 0x9  */
	typedef [flag(NDR_NOALIGN)] struct {
	} GetPropList_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		count;
		MAPITAGS	tags[count];
	} GetPropList_repl;

	/*************************/
	/* EcDoRpc Function 0xa  */
	typedef [flag(NDR_NOALIGN)] struct {
	  	uint32		index; 		/* index into array of property tags */
		MAPITAGS	property_tag;	/* property for which there was an error */
		MAPISTATUS	error_code; 	/* the error that occurred for this property */
	} PropertyProblem;

	typedef [flag(NDR_NOALIGN)] struct {
 		[subcontext(2)] mapi_SPropValue_array values;
	} SetProps_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];		
	} SetProps_repl;

	/*************************/
	/* EcDoRpc Function 0xb  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		count;
		MAPITAGS	tags[count];
	} DeleteProps_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];
	} DeleteProps_repl;

	/*************************/
	/* EcDoRpc Function 0xc  */
	typedef [enum8bit] enum {
		KeepOpenReadOnly	= 0x9,
		KeepOpenReadWrite	= 0xA,
		ForceSave		= 0xC
	} SaveFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		uint8		SaveFlags;
	} SaveChangesMessage_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		hyper		MessageId;
	} SaveChangesMessage_repl;

	/*************************/
	/* EcDoRpc Function 0xd  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		ulReserved;
	} RemoveAllRecipients_req;

	typedef [flag(NDR_NOALIGN)] struct {

	} RemoveAllRecipients_repl;

	/*************************/
	/* EcDoRpc Function 0xe  */

	/* 
	 * MODRECIP_NULL and INVALID are not part of the msdn flags
	 * but are added for printing support 
	 */
	typedef [enum8bit,flag(NDR_PAHEX)] enum {
		MODRECIP_NULL		= 0x0,
		MODRECIP_INVALID	= 0x1,
		MODRECIP_ADD		= 0x2,
		MODRECIP_MODIFY		= 0x4,
		MODRECIP_REMOVE		= 0x8
	} modrecip;

	typedef [flag(NDR_NOALIGN)]struct {
		uint32		idx;
		ulRecipClass	RecipClass;		
		[subcontext(2),flag(NDR_REMAINING|NDR_NOALIGN)] RecipientRow RecipientRow;
	} ModifyRecipientRow;

	typedef [flag(NDR_NOALIGN)] struct {
 		uint16				prop_count;
 		MAPITAGS			properties[prop_count];
		uint16				cValues;
		ModifyRecipientRow     		RecipientRow[cValues];
	} ModifyRecipients_req;

	typedef [flag(NDR_NOALIGN)] struct {

	} ModifyRecipients_repl;

	/*************************/
	/* EcDoRpc Function 0xf  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		RowId;
		uint16		ulReserved;
	} ReadRecipients_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32				RowId;
		ulRecipClass			RecipClass;
		CODEPAGEID			CodePageId;
		uint16				ulReserved;
		[subcontext(2)] RecipientRow	RecipientRow;
	} ReadRecipientRow;

	typedef [flag(NDR_NOALIGN)] struct {
 		uint8			RowCount;
 		ReadRecipientRow	RecipientRows[RowCount];
	} ReadRecipients_repl;

	/*************************/
	/* EcDoRpc Function 0x10 */
	typedef [public,flag(NDR_NOALIGN)] struct {
		ulRecipClass		RecipientType;
		CODEPAGEID		CodePageId;
		uint16			Reserved;
		[subcontext(2)]RecipientRow      	RecipientRow;
	} OpenRecipientRow;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		Reserved;
	} ReloadCachedInformation_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8		HasNamedProperties;
		TypedString		SubjectPrefix;
		TypedString		NormalizedSubject;
		uint16			RecipientCount;
		mapi_SPropTagArray	RecipientColumns;
		uint8			RowCount;
		OpenRecipientRow	RecipientRows[RowCount];
	} ReloadCachedInformation_repl;

	/*************************/
	/* EcDoRpc Function 0x11 */

	typedef [bitmap8bit] bitmap {
		SUPPRESS_RECEIPT	= 0x01,
		CLEAR_READ_FLAG		= 0x04,
		GENERATE_RECEIPT_ONLY	= 0x10,
		CLEAR_RN_PENDING	= 0x20,
	       	CLEAR_NRN_PENDING	= 0x40
	} MSGFLAG_READ;

	/* TODO: there is a variation that can provide "client data"
	   here clientdata is a uint8 ClientData[24], but its
	   existence within the request depends on flags associated to
	   logon_id: it the private flag set or not
	 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		MSGFLAG_READ			flags;
	        /* TEMP HACK for editing notes without crashing Outlook:
		   [flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	clientdata; */
	} SetMessageReadFlag_req;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)] uint8	LogonId;
	} SetMessageReadFlag_LogonId;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)] uint8	ClientData[24];
	} SetMessageReadFlag_ClientData;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8							ReadStatusChanged;
		[switch_is(ReadStatusChanged)] SetMessageReadFlag_LogonId	LogonId;
	        /* TEMP HACK for editing notes without crashing Outlook:
		   [switch_is(ReadStatusChanged)]
		   SetMessageReadFlag_ClientData	ClientData; */
	} SetMessageReadFlag_repl;

	/*************************/
	/* EcDoRpc Function 0x12 */
	typedef [enum8bit] enum {
		SetColumns_TBL_SYNC	= 0x0,
		SetColumns_TBL_ASYNC	= 0x1
	} SetColumnsFlags;
	
	typedef [enum8bit] enum {
		TBLSTAT_COMPLETE	= 0x0,
		TBLSTAT_SORTING		= 0x9,
		TBLSTAT_SORT_ERROR	= 0xA,
		TBLSTAT_SETTING_COLS	= 0xB,
		TBLSTAT_SETCOL_ERROR	= 0xD,
		TBLSTAT_RESTRICTING	= 0xE,
		TBLSTAT_RESTRICT_ERROR	= 0xF
	} TableStatus;

	typedef [flag(NDR_NOALIGN)] struct {
		SetColumnsFlags	SetColumnsFlags;
		uint16		prop_count;
		MAPITAGS	properties[prop_count];
	} SetColumns_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TableStatus	TableStatus;
	} SetColumns_repl;

	/**************************/
	/* EcDoRpc Function 0x13  */
        typedef [enum8bit, flag(NDR_PAHEX)] enum {
                TBL_ASYNC = 0x1,
                TBL_BATCH = 0x2
        } TBL_FLAGS;
	
        typedef [enum8bit, flag(NDR_PAHEX)] enum {
                TABLE_SORT_ASCEND = 0x0,
                TABLE_SORT_DESCEND = 0x1,
                TABLE_SORT_MAXIMUM_CATEGORY = 0x4
                /* old values :
                TABLE_SORT_COMBINE = 0x1,
                TABLE_SORT_DESCEND = 0x2
                */
        } TABLE_SORT;

        typedef [public, flag(NDR_NOALIGN)] struct _SSortOrder{
                MAPITAGS ulPropTag;
                TABLE_SORT ulOrder;
        } SSortOrder;

	typedef [public, flag(NDR_NOALIGN)] struct _SSortOrderSet {
 		uint16		cSorts;
 		uint16		cCategories;
 		uint16		cExpanded;
		SSortOrder	aSort[cSorts];
	} SSortOrderSet;

        typedef [flag(NDR_NOALIGN)] struct {
		uint8		SortTableFlags;
		SSortOrderSet	lpSortCriteria;
        } SortTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TableStatus	TableStatus;
	} SortTable_repl;

	/**************************/
	/* EcDoRpc Function 0x14  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16			cRes;
   		mapi_SRestriction_and	res[cRes];
	} mapi_SAndRestriction;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16	cRes;
    		mapi_SRestriction_or	res[cRes];
	} mapi_SOrRestriction;

	typedef [flag(NDR_NOALIGN)] struct {
		mapi_SRestriction_wrap	res;
	} mapi_SNotRestriction;

 	typedef [noprint, bitmap32bit] bitmap {
		FL_FULLSTRING		= 0x00000,
	       	FL_SUBSTRING		= 0x00001,
		FL_PREFIX		= 0x00002,
		FL_IGNORECASE		= 0x10000,
		FL_IGNORENONSPACE	= 0x20000,
		FL_LOOSE		= 0x40000
	} fuzzyLevel;

	typedef [flag(NDR_NOALIGN)] struct {
		fuzzyLevel	fuzzy;
		MAPITAGS	ulPropTag;
		mapi_SPropValue	lpProp;
	} mapi_SContentRestriction;

	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		BMR_EQZ = 0x0,
		BMR_NEZ = 0x1
	} relMBR;

	typedef [flag(NDR_NOALIGN)] struct {
		relMBR		relMBR;
		MAPITAGS	ulPropTag;
		uint32		ulMask;
	} mapi_SBitmaskRestriction;

	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		RELOP_LT = 0x0,		/* <  */
		RELOP_LE = 0x1,		/* <= */
		RELOP_GT = 0x2,		/* >  */
		RELOP_GE = 0x3,		/* >= */
		RELOP_EQ = 0x4,		/* == */
		RELOP_NE = 0x5,		/* != */
		RELOP_RE = 0x6		/* LIKE (Regular expression) */
	} CompareRelop;

	typedef [flag(NDR_NOALIGN)] struct {
		CompareRelop	relop;
		MAPITAGS	ulPropTag;
		uint32		size;
	} mapi_SSizeRestriction;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		relop;
		MAPITAGS	ulPropTag;
		mapi_SPropValue	lpProp;
	} mapi_SPropertyRestriction;

	typedef [flag(NDR_NOALIGN)] struct {
		CompareRelop   	relop;
		MAPITAGS	ulPropTag1;
		MAPITAGS	ulPropTag2;
	} mapi_SCompareProps;

	typedef [flag(NDR_NOALIGN)] struct {
		MAPITAGS	ulPropTag;
	} mapi_SExistRestriction;

	typedef [flag(NDR_NOALIGN)] struct {
 		MAPITAGS	       	ulSubObject;
  		mapi_SRestriction_sub  	res[ulSubObject - ulSubObject + 1]; /* nasty hack - generates fake pointer */
	} mapi_SSubRestriction;

	typedef [nopush,nopull,noprint,nodiscriminant] union {
		[case(0x0)];
		[case(0x1)] mapi_SRestriction_comment *res;
	} RestrictionVariable;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				TaggedValuesCount;
		mapi_SPropValue			TaggedValues[TaggedValuesCount];
		boolean8			RestrictionPresent;
		[switch_is(RestrictionPresent)] RestrictionVariable Restriction;
	} mapi_SCommentRestriction;

	typedef [public,nodiscriminant] union {
		[case(RES_AND)]			mapi_SAndRestriction		resAnd;
		[case(RES_OR)]			mapi_SOrRestriction		resOr;
 		[case(RES_NOT)]			mapi_SNotRestriction		resNot;
		[case(RES_CONTENT)]		mapi_SContentRestriction	resContent;
		[case(RES_PROPERTY)]		mapi_SPropertyRestriction	resProperty;
		[case(RES_COMPAREPROPS)]	mapi_SCompareProps		resCompareProps;
		[case(RES_BITMASK)]		mapi_SBitmaskRestriction	resBitmask;
		[case(RES_SIZE)]		mapi_SSizeRestriction		resSize;
		[case(RES_EXIST)]		mapi_SExistRestriction		resExist;
		[case(RES_SUBRESTRICTION)]	mapi_SSubRestriction		resSub;
		[case(RES_COMMENT)]		mapi_SCommentRestriction	resComment;
		[default];
	} mapi_SRestriction_CTR;

	typedef [public,flag(NDR_NOALIGN)] struct {
		uint8 rt;
		[switch_is(rt)] mapi_SRestriction_CTR res;
	} mapi_SRestriction;

	typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
		uint8 rt;
		[switch_is(rt)] mapi_SRestriction_CTR res;
	} mapi_SRestriction_and;

	typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
		uint8 rt;
		[switch_is(rt)] mapi_SRestriction_CTR res;
	} mapi_SRestriction_or;

	typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
		uint8 rt;
		[switch_is(rt)] mapi_SRestriction_CTR res;
	} mapi_SRestriction_sub;

	typedef [public,flag(NDR_NOALIGN)] struct _mapi_SRestriction {
		uint8 rt;
		[switch_is(rt)] mapi_SRestriction_CTR res;
	} mapi_SRestriction_comment;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8 handle_idx;
		[subcontext(2)] mapi_SRestriction  restrictions;
	} Restrict_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TableStatus	TableStatus;
	} Restrict_repl;

	/**************************/
	/* EcDoRpc Function 0x15  */
	typedef [v1_enum] enum {
                TBL_LEAF_ROW            = 0x1,
                TBL_EMPTY_CATEGORY      = 0x2,
                TBL_EXPANDED_CATEGORY   = 0x3,
                TBL_COLLAPSED_CATEGORY  = 0x4
        } RowType;

	typedef [enum8bit] enum {
		TBL_ADVANCE		= 0x0,
		TBL_NOADVANCE		= 0x1,
		TBL_ENABLEPACKEDBUFFERS = 0x2
	} QueryRowsFlags;

	typedef [enum8bit] enum {
		TBL_BACKWARD_READ	= 0x0,
		TBL_FORWARD_READ	= 0x1
	} ForwardRead;

	typedef [flag(NDR_NOALIGN)] struct {
		QueryRowsFlags	QueryRowsFlags;
		ForwardRead	ForwardRead;
		uint16		RowCount;
	} QueryRows_req;

	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
		uint8		Origin;
		uint16		RowCount;
		[flag(NDR_REMAINING|NDR_NOALIGN)]DATA_BLOB	RowData;
	} QueryRows_repl;

	/**************************/
	/* EcDoRpc Function 0x16  */
	typedef [flag(NDR_NOALIGN)] struct {
	} GetStatus_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TableStatus	TableStatus;
	} GetStatus_repl;

	/**************************/
	/* EcDoRpc Function 0x17  */
	typedef [flag(NDR_NOALIGN)] struct {
	} QueryPosition_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32	Numerator;
		uint32	Denominator;
	} QueryPosition_repl;

	/**************************/
	/* EcDoRpc Function 0x18  */
	typedef [enum8bit] enum {
		BOOKMARK_BEGINNING	= 0x0,
		BOOKMARK_CURRENT	= 0x1,
		BOOKMARK_END		= 0x2,
		BOOKMARK_USER		= 0x3
	} BOOKMARK;

	typedef [flag(NDR_NOALIGN)] struct {
		BOOKMARK	origin;
		int32		offset;
		boolean8	WantRowMovedCount;
	} SeekRow_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	HasSoughtLess;
		int32		RowsSought;
	} SeekRow_repl;

	/**************************/
	/* EcDoRpc Function 0x19  */
	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	Bookmark;
		uint32		RowCount;
		boolean8	WantRowMovedCount;
	} SeekRowBookmark_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	RowNoLongerVisible;
		boolean8	HasSoughtLess;
		uint32		RowsSought;
	} SeekRowBookmark_repl;

	/**************************/
	/* EcDoRpc Function 0x1a  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		ulNumerator;
		uint32		ulDenominator;
	} SeekRowApprox_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SeekRowApprox_repl;
	
	/**************************/
	/* EcDoRpc Function 0x1b  */
	typedef [flag(NDR_NOALIGN)] struct {
	} CreateBookmark_req;

	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	bookmark;
	} CreateBookmark_repl;

	/**************************/
	/* EcDoRpc Function 0x1c  */
	typedef [enum8bit] enum {
		FOLDER_GENERIC	= 0x1,
		FOLDER_SEARCH	= 0x2
	} FOLDER_TYPE;

	typedef [enum8bit] enum {
		MAPI_FOLDER_ANSI       	= 0x0,
		MAPI_FOLDER_UNICODE    	= 0x1
	} FOLDER_STRING;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(MAPI_FOLDER_ANSI)] raw8string			lpszA;
		[case(MAPI_FOLDER_UNICODE)][flag(STR_NULLTERM)] string	lpszW;
	} LPTSTR;

	typedef [enum16bit] enum {
		NONE		= 0x0000,
		OPEN_IF_EXISTS	= 0x0001
	} FOLDER_FLAGS;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		FOLDER_TYPE			ulFolderType;
		FOLDER_STRING			ulType;
		FOLDER_FLAGS	       		ulFlags;
		[switch_is(ulType)] LPTSTR	FolderName;
		[switch_is(ulType)] LPTSTR	FolderComment;
	} CreateFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8				HasRules;
		boolean8				IsGhosted;
		[switch_is(IsGhosted)] IsGhosted	Ghost;
	} CreateFolder_GhostInfo;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0x1)] CreateFolder_GhostInfo	GhostInfo;
	} CreateFolder_GhostUnion;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper							folder_id;
		boolean8						IsExistingFolder;
		[switch_is(IsExistingFolder)]	CreateFolder_GhostUnion	GhostUnion;
	} CreateFolder_repl;

	/**************************/
	/* EcDoRpc Function 0x1d  */
	typedef [bitmap8bit] bitmap {
		DEL_MESSAGES		= 0x1,
		DEL_FOLDERS		= 0x4,
		DELETE_HARD_DELETE	= 0x10
	} DeleteFolderFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		DeleteFolderFlags      	DeleteFolderFlags;
		hyper			FolderId;
	} DeleteFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8		PartialCompletion;
	} DeleteFolder_repl;

	/**************************/
	/* EcDoRpc Function 0x1e  */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantAsynchronous;
		boolean8	NotifyNonRead;
		uint16		cn_ids;
		hyper		message_ids[cn_ids];
	} DeleteMessages_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	PartialCompletion;
	} DeleteMessages_repl;

	/**************************/
	/* EcDoRpc Function 0x1f  */
	typedef [bitmap32bit] bitmap {
		MSGSTATUS_HIGHLIGHTED		= 0x1,
		MSGSTATUS_TAGGED		= 0x2,
		MSGSTATUS_HIDDEN		= 0x4,
	        MSGSTATUS_DELMARKED		= 0x8,
		MSGSTATUS_REMOTE_DOWNLOAD	= 0x1000,
		MSGSTATUS_REMOTE_DELETE		= 0x2000
	} ulMessageStatus;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		msgid;
	} GetMessageStatus_req;

	typedef [flag(NDR_NOALIGN)] struct {
		ulMessageStatus	MessageStatusFlags;
	} GetMessageStatus_repl;

	/**************************/
	/* EcDoRpc Function 0x20  */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		msgid;
		uint32		ulNewStatus;
		ulMessageStatus	ulNewStatusMask;
	} SetMessageStatus_req;

	typedef [flag(NDR_NOALIGN)] struct {
		ulMessageStatus	ulOldStatus;
	} SetMessageStatus_repl;

	/**************************/
	/* EcDoRpc Function 0x21  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		TableFlags	TableFlags;
	} GetAttachmentTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} GetAttachmentTable_repl;

	/*************************/
	/* EcDoRpc Function 0x22 */
	typedef [enum8bit] enum {
		OpenAttachmentFlags_ReadOnly	= 0x0,
		OpenAttachmentFlags_ReadWrite	= 0x1,
		OpenAttachmentFlags_BestAccess	= 0x3
	} OpenAttachmentFlags;

  	typedef [flag(NDR_NOALIGN)] struct {
		uint8			handle_idx;
		OpenAttachmentFlags	OpenAttachmentFlags;
		uint32			AttachmentID;
	} OpenAttach_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} OpenAttach_repl;

	/*************************/
	/* EcDoRpc Function 0x23 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8	handle_idx;
	} CreateAttach_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32	AttachmentID;
	} CreateAttach_repl;

	/*************************/
	/* EcDoRpc Function 0x24 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		AttachmentID;
	} DeleteAttach_req;


	typedef [flag(NDR_NOALIGN)] struct {
	} DeleteAttach_repl;

	/*************************/
	/* EcDoRpc Function 0x25 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		SaveFlags	SaveFlags;
	} SaveChangesAttachment_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SaveChangesAttachment_repl;

	/*************************/
	/* EcDoRpc Function 0x26 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		fid;
		raw8string	lpszMessageClass;
	} SetReceiveFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetReceiveFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x27 */
	typedef [flag(NDR_NOALIGN)] struct {
		astring		MessageClass;
	} GetReceiveFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		folder_id;
		astring		MessageClass;
	} GetReceiveFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x29 */
	typedef [bitmap16bit] bitmap {
		fnevCriticalError		= 0x0001,
		fnevNewMail			= 0x0002,
		fnevObjectCreated		= 0x0004,
		fnevObjectDeleted		= 0x0008,
		fnevObjectModified		= 0x0010,
		fnevObjectMoved			= 0x0020,
		fnevObjectCopied		= 0x0040,
		fnevSearchComplete		= 0x0080,
		fnevTableModified		= 0x0100,
		fnevStatusObjectModified	= 0x0200,
		fnevReserved			= 0x0400,
		fnevTbit       			= 0x1000,
		fnevUbit			= 0x2000,
		fnevSbit			= 0x4000,
		fnevMbit			= 0x8000
	} NotificationFlags;

	typedef [nodiscriminant,flag(NDR_NOALIGN)] union {
		[case(0x0)] hyper	ID;
		[case(0x1)];
	} hyperbool;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		NotificationFlags			NotificationFlags;
		boolean8				WantWholeStore;
		[switch_is(WantWholeStore)] hyperbool	FolderId;
		[switch_is(WantWholeStore)] hyperbool	MessageId;
	} RegisterNotification_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} RegisterNotification_repl;

	/*************************/
	/* EcDoRpc Function 0x2a */
	typedef [bitmap32bit] bitmap {
		MSGFLAG_READ		= 0x1,
		MSGFLAG_UNMODIFIED	= 0x2,
		MSGFLAG_SUBMIT		= 0x4,
		MSGFLAG_UNSENT		= 0x8,
		MSGFLAG_HASATTACH	= 0x10,
		MSGFLAG_FROMME		= 0x20,
		MSGFLAG_ASSOCIATED	= 0x40,
		MSGFLAG_RESEND		= 0x80,
		MSGFLAG_RN_PENDING	= 0x100,
	        MSGFLAG_NRN_PENDING	= 0x200
	} MsgFlags;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)] raw8string			lpszA;
		[case(0x1)][flag(STR_NULLTERM)] string	lpszW;
	} MessageClass;

	typedef [public,nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x1)] uint8	bytes[6];
		[default] dlong		value;
	} GLOBCNT;

	typedef [public,flag(NDR_NOALIGN)] struct {
		GUID			GUID;
		[switch_is(1)] GLOBCNT	GLOBCNT;
	} GID;

	typedef [public,flag(NDR_NOALIGN)] struct {
		uint16			ReplID;
		[switch_is(1)] GLOBCNT	GLOBCNT;
	} ShortTermID; /* MID, FID, CN */

	typedef [public,flag(NDR_NOALIGN)] struct {
		GUID			GUID;
		uint8			Size;
		uint8			Data[Size];
	} XID;

	typedef [enum16bit] enum {
		TABLE_CHANGED		=	0x1,
		TABLE_ROW_ADDED		=	0x3,
		TABLE_ROW_DELETED	=	0x4,
		TABLE_ROW_MODIFIED	=	0x5,
		TABLE_RESTRICT_DONE	=	0x7
	} RichTableNotificationType;

        typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[case(0xffff)];
		[default] MAPITAGS              Tags[level];
	} NotificationTags;

	/* NewMailNotification: case 0x2 and 0x8002 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		MsgFlags				MessageFlags;
		boolean8				UnicodeFlag;
		[switch_is(UnicodeFlag)] MessageClass	MessageClass;
	} NewMailNotification;

	/* FolderCreatedNotification: case 0x4 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					ParentFID;
		uint16					TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} FolderCreatedNotification;

	/* FolderDeletedNotification: case 0x8 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					ParentFID;
	} FolderDeletedNotification;

	/* FolderModifiedNotification: case 0x10 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		uint16			TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} FolderModifiedNotification_10;

	/* FolderMoveCopyNotification: case 0x20 and 0x40 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		hyper			ParentFID;
		hyper			OldFID;
		hyper			OldParentFID;
	} FolderMoveCopyNotification;

	/* SearchCompleteNotification: case 0x80 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
	} SearchCompleteNotification;

	/* HierarchyTable: case 0x100 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
		hyper				InsertAfterFID;
		uint16				ColumnSize;
		[subcontext(0),subcontext_size(ColumnSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	Columns;
	} HierarchyRowAddedNotification;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
	} HierarchyRowDeletedNotification;
	
	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
		hyper				InsertAfterFID;
		uint16				ColumnSize;
		[subcontext(0),subcontext_size(ColumnSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	Columns;
	} HierarchyRowModifiedNotification;

	typedef [nodiscriminant] union {
		[case(TABLE_ROW_ADDED)] HierarchyRowAddedNotification		HierarchyRowAddedNotification;
		[case(TABLE_ROW_DELETED)] HierarchyRowDeletedNotification	HierarchyRowDeletedNotification;
		[case(TABLE_ROW_MODIFIED)] HierarchyRowModifiedNotification	HierarchyRowModifiedNotification;
		[default];
	} HierarchyTableChangeUnion;

	typedef [flag(NDR_NOALIGN)] struct {
		RichTableNotificationType				TableEvent;
		[switch_is(TableEvent)] HierarchyTableChangeUnion	HierarchyTableChangeUnion;
	} HierarchyTableChange;

	/* IcsNotification: case 0x200 */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8       		HierChanged;
		uint32			GIDCount;
		GID			GID[GIDCount];
	} IcsNotification;

	/* FolderModifiedNotification: case 0x1010 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		uint16			TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
		uint32			TotalMessageCount;
	} FolderModifiedNotification_1010;

	/* FolderModifiedNotification: case 0x2010 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		uint16			TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
		uint32			UnreadMessageCount;
	} FolderModifiedNotification_2010;

	/* FolderModifiedNotification: case 0x3010 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		uint16			TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
		uint32			TotalMessageCount;
		uint32			UnreadMessageCount;
	} FolderModifiedNotification_3010;

	/* MessageCreatedNotification: case 0x8004 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		uint16					TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} MessageCreatedNotification;

	/* MessageDeletedNotification: case 0x8008 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
	} MessageDeletedNotification;

	/* MessageModifiedNotification: case 0x8010 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		uint16					TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} MessageModifiedNotification;

	/* MessageMoveCopyNotification: case 0x8020 and 0x8040 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FID;
		hyper			MID;
		hyper			OldFID;
		hyper			OldMID;
	} MessageMoveCopyNotification;	

	/* ContentsTableChange: case 0x8100 and 0xc100 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
		hyper				MID;
		uint32				Instance;
		hyper				InsertAfterFID;
		hyper				InsertAfterMID;
		uint32				InsertAfterInstance;
		uint16				ColumnSize;
		[subcontext(0),subcontext_size(ColumnSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	Columns;
	} ContentsRowAddedNotification;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
		hyper				MID;
		uint32				Instance;
	} ContentsRowDeletedNotification;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper				FID;
		hyper				MID;
		uint32				Instance;
		hyper				InsertAfterFID;
		hyper				InsertAfterMID;
		uint32				InsertAfterInstance;
		uint16				ColumnsSize;
		[subcontext(0),subcontext_size(ColumnsSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB Columns;
	} ContentsRowModifiedNotification;

	typedef [nodiscriminant] union {
		[case(TABLE_ROW_ADDED)] ContentsRowAddedNotification		ContentsRowAddedNotification;
		[case(TABLE_ROW_DELETED)] ContentsRowDeletedNotification	ContentsRowDeletedNotification;
		[case(TABLE_ROW_MODIFIED)] ContentsRowModifiedNotification	ContentsRowModifiedNotification;
		[default];
	} ContentsTableChangeUnion;

	typedef [flag(NDR_NOALIGN)] struct {
		RichTableNotificationType				TableEvent;
		[switch_is(TableEvent)] ContentsTableChangeUnion	ContentsTableChangeUnion;
	} ContentsTableChange;

	/* SearchMessageCreatedNotification: case 0xc004 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		hyper					SearchFID;
		uint16					TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} SearchMessageCreatedNotification;

	/* SearchMessageRemovedNotification: case 0xc008 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		hyper					SearchFID;
	} SearchMessageRemovedNotification;

	/* SearchMessageModifiedNotification: 0xc010 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper					FID;
		hyper					MID;
		uint16					TagCount;
                [switch_is(TagCount)] NotificationTags  NotificationTags;
	} SearchMessageModifiedNotification;

	typedef [nodiscriminant] union {
		[case(0x0002)] NewMailNotification			NewMailNotification;
		[case(0x0004)] FolderCreatedNotification		FolderCreatedNotification;
		[case(0x0008)] FolderDeletedNotification		FolderDeletedNotification;
		[case(0x0010)] FolderModifiedNotification_10		FolderModifiedNotification_10;
		[case(0x0020)] FolderMoveCopyNotification		FolderMoveNotification;
		[case(0x0040)] FolderMoveCopyNotification		FolderCopyNotification;
		[case(0x0080)] SearchCompleteNotification		SearchCompleteNotification;
		[case(0x0100)] HierarchyTableChange			HierarchyTableChange;
		[case(0x0200)] IcsNotification				IcsNotification;
		[case(0x1010)] FolderModifiedNotification_1010		FolderModifiedNotification_1010;
		[case(0x2010)] FolderModifiedNotification_2010		FolderModifiedNotification_2010;
		[case(0x3010)] FolderModifiedNotification_3010		FolderModifiedNotification_3010;
 		[case(0x8002)] NewMailNotification			NewMessageNotification;
		[case(0x8004)] MessageCreatedNotification		MessageCreatedNotification;
		[case(0x8008)] MessageDeletedNotification		MessageDeletedNotification;
		[case(0x8010)] MessageModifiedNotification		MessageModifiedNotification;
		[case(0x8020)] MessageMoveCopyNotification		MessageMoveNotification;
		[case(0x8040)] MessageMoveCopyNotification		MessageCopyNotification;
		[case(0x8100)] ContentsTableChange			ContentsTableChange;
		[case(0xc004)] SearchMessageCreatedNotification		SearchMessageCreatedNotification;
		[case(0xc008)] SearchMessageRemovedNotification		SearchMessageRemovedNotification;
		[case(0xc010)] SearchMessageModifiedNotification	SearchMessageModifiedNotification;
		[case(0xc100)] ContentsTableChange			SearchTableChange;
	} NotificationData;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32						NotificationHandle;
		uint8						LogonId;
		NotificationFlags				NotificationType;
		[switch_is(NotificationType)] NotificationData	NotificationData;
	} Notify_repl;

	/*************************/
	/* EcDoRpc Function 0x2b */
	typedef [enum8bit] enum {
		OpenStream_ReadOnly	= 0x0,
		OpenStream_ReadWrite	= 0x1,
		OpenStream_Create	= 0x2,
		OpenStream_BestAccess	= 0x3
	} OpenStream_OpenModeFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		MAPITAGS			PropertyTag;
		OpenStream_OpenModeFlags       	OpenModeFlags;
	} OpenStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		StreamSize;
	} OpenStream_repl;

	/*************************/
	/* EcDoRpc Function 0x2c */
	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0xBABE)] uint32	value;
		[default];
	} MaximumByteCount;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16						ByteCount;
		[switch_is(ByteCount)]	MaximumByteCount	MaximumByteCount;
	} ReadStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB data;
	} ReadStream_repl;

	/*************************/
	/* EcDoRpc Function 0x2d */
	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	data;
	} WriteStream_req;


	typedef [flag(NDR_NOALIGN)] struct {
		uint16		WrittenSize;
	} WriteStream_repl;

	/*************************/
	/* EcDoRpc Function 0x2e */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		Origin;
		hyper		Offset;
	} SeekStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		NewPosition;
	} SeekStream_repl;

	/*************************/
	/* EcDoRpc Function 0x2f */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		SizeStream;
	} SetStreamSize_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetStreamSize_repl;

	/*************************/
	/* EcDoRpc Function 0x30 */
	typedef [public, bitmap32bit, flag(NDR_PAHEX)] bitmap {
		STOP_SEARCH			= 0x00000001,
		RESTART_SEARCH			= 0x00000002,
		RECURSIVE_SEARCH		= 0x00000004,
		SHALLOW_SEARCH			= 0x00000008,
		FOREGROUND_SEARCH		= 0x00000010,
		BACKGROUND_SEARCH		= 0x00000020,
	        CONTENT_INDEXED_SEARCH		= 0x00010000,
		NON_CONTENT_INDEXED_SEARCH	= 0x00020000,
		STATIC_SEARCH			= 0x00040000
	} SearchFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2)] mapi_SRestriction	res;
		uint16					FolderIdCount;
		hyper					FolderIds[FolderIdCount];
		SearchFlags				SearchFlags;
	} SetSearchCriteria_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetSearchCriteria_repl;

	/*************************/
	/* EcDoRpc Function 0x31 */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	UseUnicode;
		boolean8	IncludeRestriction;
		boolean8	IncludeFolders;
	} GetSearchCriteria_req;

	typedef [nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
		uint16					RestrictionDataSize;
		[subcontext(0),subcontext_size(RestrictionDataSize)] mapi_SRestriction	RestrictionData;
 		uint8					LogonId;
		uint16					FolderIdCount;
		hyper					FolderIds[FolderIdCount];
		SearchFlags				SearchFlags;
	} GetSearchCriteria_repl;

	/*************************/
	/* EcDoRpc Function 0x32 */
	typedef [enum8bit] enum {
		None		= 0x0,	/* None */
		PreProcess	= 0x1,	/* Needs to be preprocessed by the server */
		NeedsSpooler	= 0x2	/* Is to be processed by a client spooler */
	} SubmitFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		SubmitFlags    	SubmitFlags;
	} SubmitMessage_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SubmitMessage_repl;

	/*************************/
	/* EcDoRpc Function 0x33 */
	typedef [flag(NDR_NOALIGN)] struct {
 		uint8		handle_idx;
 		uint16		count;
 		hyper		message_id[count];
		boolean8	WantAsynchronous;
		boolean8	WantCopy;
	} MoveCopyMessages_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8       	PartialCompletion;
	} MoveCopyMessages_repl;

	/*************************/
	/* EcDoRpc Function 0x34 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		FolderId;
		hyper		MessageId;
	} AbortSubmit_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} AbortSubmit_repl;

	/*************************/
	/* EcDoRpc Function 0x35 */
	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)] raw8string			lpszA;
		[case(0x1)][flag(STR_NULLTERM)] string	lpszW;
	} Folder_name;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		boolean8				WantAsynchronous;
		boolean8				UseUnicode;
		hyper					FolderId;
		[switch_is(UseUnicode)] Folder_name	NewFolderName;
	} MoveFolder_req;

	typedef [nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
		boolean8				HasDestHandleIndex;
		uint32					DestHandleIndex;
		boolean8				PartialCompletion;
	} MoveFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x36 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		boolean8				WantAsynchronous;
		boolean8				WantRecursive;
		boolean8				UseUnicode;
		hyper					FolderId;
		[switch_is(UseUnicode)] Folder_name	NewFolderName;
	} CopyFolder_req;

	typedef [nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
		boolean8				HasDestHandleIndex;
		uint32					DestHandleIndex;
		boolean8				PartialCompletion;
	} CopyFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x37 */
	typedef [flag(NDR_NOALIGN)] struct {
	} QueryColumnsAll_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyTagCount;
		MAPITAGS	PropertyTags[PropertyTagCount];
	} QueryColumnsAll_repl;

	/*************************/
	/* EcDoRpc Function 0x38 */
	typedef [flag(NDR_NOALIGN)] struct {
	} Abort_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TableStatus	TableStatus;
	} Abort_repl;

	/*************************/
	/* EcDoRpc Function 0x39 */
	typedef [bitmap8bit] bitmap {
		CopyFlagsMove		= 0x1,	/* Move properties */
		CopyFlagsNoOverwrite	= 0x2	/* Do not overwrite existing properties */
	} CopyFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8			handle_idx;
		boolean8		WantAsynchronous;
		boolean8		WantSubObjects;
		CopyFlags		CopyFlags;
		mapi_SPropTagArray	ExcludedTags;
	} CopyTo_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];
	} CopyTo_repl;

	/*************************/
	/* EcDoRpc Function 0x3a */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		hyper		ByteCount;
	} CopyToStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		ReadByteCount;
		hyper		WrittenByteCount;
	} CopyToStream_repl;

	/*************************/
	/* EcDoRpc Function 0x3b */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
	} CloneStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} CloneStream_repl;

	/*************************/
	/* EcDoRpc Function 0x3e */
	typedef [bitmap8bit] bitmap {
		IncludeFreeBusy	= 0x02
	} PermissionsTableFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8			handle_idx;
		PermissionsTableFlags	TableFlags;
	} GetPermissionsTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} GetPermissionsTable_repl;

	/*************************/
	/* EcDoRpc Function 0x3f */
	typedef [bitmap8bit] bitmap {
		RulesTableFlags_Unicode	= 0x40
	} RulesTableFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		RulesTableFlags	TableFlags;
	} GetRulesTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} GetRulesTable_repl;

	/*************************/
	/* EcDoRpc Function 0x40 */
	typedef [bitmap8bit] bitmap {
		ModifyPerms_IncludeFreeBusy     = 0x02,
		ModifyPerms_ReplaceRows         = 0x01
	} ModifyPermissionsFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		ulRowFlags              PermissionDataFlags;
		mapi_SPropValue_array   lpProps;
	} PermissionData;

	typedef [flag(NDR_NOALIGN)] struct {
		ModifyPermissionsFlags  ModifyFlags;
		uint16                  ModifyCount;
		PermissionData          PermissionsData[ModifyCount];
	} mapi_PermissionsData;

	typedef [flag(NDR_NOALIGN)] struct {
		mapi_PermissionsData    rowList;
	} ModifyPermissions_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} ModifyPermissions_repl;

	/*************************/
	/* EcDoRpc Function 0x41 */
	typedef [flag(NDR_NOALIGN)] struct {
		ulRowFlags     		RuleDataFlags;
		mapi_SPropValue_array	PropertyValues;
	} RuleData;

	typedef [bitmap8bit] bitmap {
		ModifyRulesFlag_Replace	= 0x01
	} ModifyRulesFlag;

	typedef [flag(NDR_NOALIGN)] struct {
		ModifyRulesFlag	ModifyRulesFlags;
		uint16		RulesCount;
 		RuleData	RulesData[RulesCount];
	} ModifyRules_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} ModifyRules_repl;

	/*************************/
	/* EcDoRpc Function 0x42 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		FolderId;
	} GetOwningServers_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		OwningServersCount;
		uint16		CheapServersCount;
		astring		OwningServers[OwningServersCount];
	} GetOwningServers_repl;

	/*************************/
	/* EcDoRpc Function 0x43 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper	Id;
	} LongTermIdFromId_req;

	typedef [flag(NDR_NOALIGN)] struct {
		GUID	DatabaseGuid;
		uint8	GlobalCounter[6];
		uint16	padding;
	} LongTermId;

	typedef [flag(NDR_NOALIGN)] struct {
		LongTermId	LongTermId;
	} LongTermIdFromId_repl;

	/*************************/
	/* EcDoRpc Function 0x44 */
	typedef [flag(NDR_NOALIGN)] struct {
		LongTermId	LongTermId;
	} IdFromLongTermId_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		Id;
	} IdFromLongTermId_repl;

	/*************************/
	/* EcDoRpc Function 0x45 */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		FolderId;
	} PublicFolderIsGhosted_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8				IsGhosted;
		[switch_is(IsGhosted)] IsGhosted	Ghost;
	} PublicFolderIsGhosted_repl;

	/*************************/
	/* EcDoRpc Function 0x46 */
	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		MAPI_READONLY   = 0x0,
		MAPI_READWRITE	= 0x1,
		MAPI_CREATE	= 0x2
	} OpenEmbeddedMessage_OpenModeFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		uint16					CodePageId;
		OpenEmbeddedMessage_OpenModeFlags	OpenModeFlags;
	} OpenEmbeddedMessage_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		       	Reserved;
		hyper		       	MessageId;
		boolean8	       	HasNamedProperties;
		TypedString	       	SubjectPrefix;
		TypedString	       	NormalizedSubject;
		uint16		       	RecipientCount;
                mapi_SPropTagArray      RecipientColumns;
		uint8		       	RowCount;
		OpenRecipientRow       	RecipientRows[RowCount];
	} OpenEmbeddedMessage_repl;

	/*************************/
	/* EcDoRpc Function 0x47 */
	typedef [flag(NDR_NOALIGN)] struct {
	} SetSpooler_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetSpooler_repl;

	/*************************/
	/* EcDoRpc Function 0x48 */
	typedef [enum8bit] enum {
		LockState_1stLock      	= 0x0,
		LockState_1stUnlock	= 0x1,
		LockState_1stFinished	= 0x2
	} LockState;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		MessageId;
		LockState	LockState;
	} SpoolerLockMessage_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SpoolerLockMessage_repl;

	/*************************/
	/* EcDoRpc Function 0x49 */
	typedef [flag(NDR_NOALIGN)] struct {
	} AddressTypes_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16 		cValues;
		uint16 		size;
		mapi_LPSTR	transport[cValues];
	} AddressTypes_repl;

	/**************************/
	/* EcDoRpc Function 0x4a  */
	typedef [flag(NDR_NOALIGN)] struct {
	} TransportSend_req;

	typedef [nodiscriminant] union {
		[case(0x0)] mapi_SPropValue_array	lpProps;
		[case(0x1)];
	} TransportSend_lpProps;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8						NoPropertiesReturned;
		[switch_is(NoPropertiesReturned)] TransportSend_lpProps	properties;
	} TransportSend_repl;

	/**************************/
	/* EcDoRpc Function 0x4b  */
	typedef [bitmap8bit] bitmap {
		FastTransferCopyMessage_Move		= 0x01,
		FastTransferCopyMessage_Unknown1	= 0x02,
		FastTransferCopyMessage_Unknown2	= 0x04,
		FastTransferCopyMessage_Unknown3	= 0x08,
		FastTransferCopyMessage_BestBody	= 0x10,
		FastTransferCopyMessage_SendEntryId	= 0x20
	} FastCopyMessagesCopyFlags;

	/* this one is used in a few ROPs */
	typedef [bitmap8bit] bitmap {
		FastTransfer_Unicode		= 0x01,
		FastTransfer_UseCpid		= 0x02,
		FastTransfer_ForUpload		= FastTransfer_Unicode | FastTransfer_UseCpid,
		FastTransfer_RecoverMode	= 0x04,
		FastTransfer_ForceUnicode	= 0x08,
		FastTransfer_PartialItem	= 0x10
	} FastCopySendOptions;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		uint16				MessageIdCount;
		hyper				MessageIds[MessageIdCount];
		FastCopyMessagesCopyFlags	CopyFlags;
		FastCopySendOptions		SendOptions;
	} FastTransferSourceCopyMessages_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FastTransferSourceCopyMessages_repl;

	/**************************/
	/* EcDoRpc Function 0x4c  */
	typedef [bitmap8bit] bitmap {
		FastTransferCopyFolder_Move		= 0x01,
		FastTransferCopyFolder_Unused1		= 0x02,
		FastTransferCopyFolder_Unused2		= 0x04,
		FastTransferCopyFolder_Unused3		= 0x08,
		FastTransferCopyFolder_CopySubfolders	= 0x10,
		FastTransferCopyFolder_NoGhostedContent	= 0x20
	} FastCopyFolderCopyFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		FastCopyFolderCopyFlags		CopyFlags;
		FastCopySendOptions		SendOptions;
	} FastTransferSourceCopyFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FastTransferSourceCopyFolder_repl;

	/**************************/
	/* EcDoRpc Function 0x4d  */
	typedef [bitmap32bit] bitmap {
		FastTransferCopyTo_Move		= 0x00000001,
		FastTransferCopyToUnused1	= 0x00000002,
		FastTransferCopyToUnused2	= 0x00000004,
		FastTransferCopyToUnused3	= 0x00000008,
		FastTransferCopyToUnused4	= 0x00000200,
		FastTransferCopyToUnused5	= 0x00000400,
		FastTransferCopyTo_BestBody	= 0x00002000
	} FastCopyToCopyFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8			handle_idx;
		uint8			Level;
		FastCopyToCopyFlags	CopyFlags;
		FastCopySendOptions	SendOptions;
		mapi_SPropTagArray	PropertyTags;
	} FastTransferSourceCopyTo_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FastTransferSourceCopyTo_repl;

	/**************************/
	/* EcDoRpc Function 0x4e  */
	typedef [nodiscriminant] union {
		[case(0xBABE)] uint16	MaximumBufferSize;
		[default];
	} FastTransferSourceGetBuffer_MaxBufferSize;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16								  BufferSize;
		[switch_is(BufferSize)] FastTransferSourceGetBuffer_MaxBufferSize MaximumBufferSize;
	} FastTransferSourceGetBuffer_req;

	typedef [enum16bit] enum {
		TransferStatus_Error	= 0x0000,
		TransferStatus_Partial	= 0x0001,
		TransferStatus_NoRoom	= 0x0002,
		TransferStatus_Done	= 0x0003
	} TransferStatus;

	typedef [flag(NDR_NOALIGN)] struct {
		TransferStatus	TransferStatus;
		uint16		InProgressCount;
		uint16		TotalStepCount;
		uint8		Reserved;
		uint16		TransferBufferSize;
		[subcontext(0),subcontext_size(TransferBufferSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB TransferBuffer;
	} FastTransferSourceGetBuffer_repl;

	/**************************/
	/* EcDoRpc Function 0x4f  */
	typedef [enum8bit] enum {
		DIR_FORWARD  = 0x0,
		DIR_BACKWARD = 0x1
	} FindRow_ulFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		FindRow_ulFlags	ulFlags;
  		[subcontext(2)] mapi_SRestriction res;
		BOOKMARK	origin;
		SBinary_short	bookmark;
	} FindRow_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		RowNoLongerVisible;
	  	uint8		HasRowData;
		[flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	row;
	} FindRow_repl;

	/**************************/
	/* EcDoRpc Function 0x50  */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantCancel;
	} Progress_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		CompletedTaskCount;
		uint32		TotalTaskCount;
	} Progress_repl;

	/**************************/
	/* EcDoRpc Function 0x51  */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		MessageId;
		hyper		FolderId;
		astring		MessageClass;
		uint32		MessageFlags;
	} TransportNewMail_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} TransportNewMail_repl;

	/**************************/
	/* EcDoRpc Function 0x52  */
	typedef [flag(NDR_NOALIGN)] struct {
	} GetValidAttachments_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		AttachmentIdCount;
		uint32		AttachmentIdArray[AttachmentIdCount];
	} GetValidAttachments_repl;

	/**************************/
	/* EcDoRpc Function 0x53  */
	typedef [enum8bit] enum {
		FastTransferDest_CopyTo	  	= 0x1,
		FastTransferDest_CopyProperties = 0x2,
		FastTransferDest_CopyMessages 	= 0x3,
		FastTransferDest_CopyFolder	= 0x4
	} FastTransferDestConfig_SourceOperation;

	typedef [bitmap8bit] bitmap {
		FastTransferDest_Move		= 0x01
	} FastTransferDestConfig_CopyFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		FastTransferDestConfig_SourceOperation	SourceOperation;
		FastTransferDestConfig_CopyFlags	CopyFlags;
	} FastTransferDestinationConfigure_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FastTransferDestinationConfigure_repl;

	/**************************/
	/* EcDoRpc Function 0x54  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		TransferBufferSize;
		[subcontext(0),subcontext_size(TransferBufferSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB TransferBuffer;
	} FastTransferDestinationPutBuffer_req;

	typedef [flag(NDR_NOALIGN)] struct {
		TransferStatus	TransferStatus;
		uint16		InProgressCount;
		uint16		TotalStepCount;
		uint8		Reserved;
		uint16		BufferUsedCount;
	} FastTransferDestinationPutBuffer_repl;

	/*************************/
	/* EcDoRpc Function 0x55 */
	typedef [enum8bit] enum {
		MNID_ID = 0,
		MNID_STRING = 1
	} ulKind;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				NameSize;
		[flag(STR_NULLTERM)] string	Name;
	} mapi_name;

	typedef [nodiscriminant] union {
		[case(MNID_ID)] uint32		lid;
		[case(MNID_STRING)] mapi_name	lpwstr;
	} Kind;
	
	typedef [flag(NDR_NOALIGN)] struct {
		ulKind				ulKind;
		GUID				lpguid;
		[switch_is(ulKind)] Kind	kind;
	} MAPINAMEID;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyIdCount;
		uint16		PropertyIds[PropertyIdCount];
	} GetNamesFromIDs_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		count;
		MAPINAMEID	nameid[count];
	} GetNamesFromIDs_repl;

	/*************************/
	/* EcDoRpc Function 0x56 */
	typedef [enum8bit, flag(NDR_PAHEX)] enum {
		GetIDsFromNames_GetOnly		= 0x00,
		GetIDsFromNames_GetOrCreate	= 0x02
	} GetIDsFromNamesFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		GetIDsFromNamesFlags	ulFlags;
		uint16			count;
		MAPINAMEID		nameid[count];
	} GetIDsFromNames_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		count;
		uint16		propID[count];
	} GetIDsFromNames_repl;

	/*************************/
	/* EcDoRpc Function 0x57 */
	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	ServerEntryId;
		SBinary_short	ClientEntryId;
	} UpdateDeferredActionMessages_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} UpdateDeferredActionMessages_repl;

	/*************************/
	/* EcDoRpc Function 0x58 */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantAsynchronous;
		boolean8	WantDeleteAssociated;
	} EmptyFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	PartialCompletion;
	} EmptyFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x59 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		MaxRowCount;
		hyper		CategoryId;
	} ExpandRow_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		ExpandedRowCount;
		uint16		RowCount;
		[flag(NDR_REMAINING|NDR_NOALIGN)]DATA_BLOB  RowData;
	} ExpandRow_repl;

	/*************************/
	/* EcDoRpc Function 0x5a */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		CategoryId;
	} CollapseRow_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		CollapsedRowCount;
	} CollapseRow_repl;

	/*************************/
	/* EcDoRpc Function 0x5b */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		RegionOffset;
		hyper		RegionSize;
		uint32		LockFlags;
	} LockRegionStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} LockRegionStream_repl;

	/*************************/
	/* EcDoRpc Function 0x5c */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		RegionOffset;
		hyper		RegionSize;
		uint32		LockFlags;
	} UnlockRegionStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} UnlockRegionStream_repl;

	/*************************/
	/* EcDoRpc Function 0x5d */
	typedef [flag(NDR_NOALIGN)] struct {
	} CommitStream_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} CommitStream_repl;

	/*************************/
	/* EcDoRpc Function 0x5e */
	typedef [flag(NDR_NOALIGN)] struct {
	} GetStreamSize_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		StreamSize;
	} GetStreamSize_repl;

	/*************************/
	/* EcDoRpc Function 0x5f */
	typedef [bitmap8bit] bitmap {
		NoStrings	= 0x01,
		NoIds	        = 0x02
	} QueryFlags;

	typedef [nodiscriminant] union {
		[case(0x0)];
	  	[case(0x1)] GUID guid;
	} QueryNamedProperties_guid;

	typedef [flag(NDR_NOALIGN)] struct {
		QueryFlags		QueryFlags;
		boolean8		HasGuid;
		[switch_is(HasGuid)]	QueryNamedProperties_guid PropertyGuid;
	} QueryNamedProperties_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		IdCount;
		uint16		PropertyIds[IdCount];
		MAPINAMEID	PropertyNames[IdCount];
	} QueryNamedProperties_repl;
  
	/*************************/
	/* EcDoRpc Function 0x60 */
	typedef [flag(NDR_NOALIGN)] struct {
		GUID	DatabaseGuid;
	} GetPerUserLongTermIds_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		LongTermIdCount;
		LongTermId	LongTermIds[LongTermIdCount];
	} GetPerUserLongTermIds_repl;

	/*************************/
	/* EcDoRpc Function 0x61 */
	typedef [flag(NDR_NOALIGN)] struct {
		LongTermId	LongTermId;
	} GetPerUserGuid_req;

	typedef [flag(NDR_NOALIGN)] struct {
		GUID		DatabaseGuid;
	} GetPerUserGuid_repl;

	/*************************/
	/* EcDoRpc Function 0x63 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		FolderId[24];
		boolean8	WhatIfChanged;
		uint32		DataOffset;
		uint16		MaxDataSize;
	} ReadPerUserInformation_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	HasFinished;
		uint16		DataSize;
		[subcontext(0), subcontext_size(DataSize), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB Data;
	} ReadPerUserInformation_repl;

	/*************************/
	/* EcDoRpc Function 0x64 */
	typedef [flag(NDR_NOALIGN)] struct {
		LongTermId	FolderId;
		boolean8	HasFinished;
		uint32		DataOffset;
		uint16		DataSize;
		[subcontext(0), subcontext_size(DataSize), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB Data;
		GUID		ReplGuid;	/* Note: ReplGuid gets only included under specific circumstances */
	} WritePerUserInformation_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} WritePerUserInformation_repl;

	/*************************/
	/* EcDoRpc Function 0x66 */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantAsynchronous;
	  	MSGFLAG_READ	ReadFlags;
	  	uint16		MessageIdCount;
	  	hyper		MessageIds[MessageIdCount];
	} SetReadFlags_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	PartialCompletion;
	} SetReadFlags_repl;

	/*************************/
	/* EcDoRpc Function 0x67 */
	typedef [flag(NDR_NOALIGN)] struct {
 		uint8			handle_idx;
		boolean8		WantAsynchronous;
	  	CopyFlags		CopyFlags;
		mapi_SPropTagArray	PropertyTags;
	} CopyProperties_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];
	} CopyProperties_repl;

	/*************************/
	/* EcDoRpc Function 0x68 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		flag;
		hyper		fid;
		astring		lpszMessageClass;
		FILETIME	modiftime;
	} ReceiveFolder;

	typedef [flag(NDR_NOALIGN)] struct {
	} GetReceiveFolderTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint32		cValues;
		ReceiveFolder	entries[cValues];
	} GetReceiveFolderTable_repl;

	/**************************/
	/* EcDoRpc Function 0x69  */
	typedef [bitmap8bit] bitmap {
		FastTransferCopyProperties_Move		= 0x01,
		FastTransferCopyProperties_Unused1 	= 0x02,
		FastTransferCopyProperties_Unused2	= 0x04,
		FastTransferCopyProperties_Unused3	= 0x08
	} FastCopyPropertiesCopyFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8				handle_idx;
		uint8				Level;
		FastCopyPropertiesCopyFlags	CopyFlags;
		FastCopySendOptions		SendOptions;
		mapi_SPropTagArray		PropertyTags;
	} FastTransferSourceCopyProperties_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FastTransferSourceCopyProperties_repl;

	/*************************/
	/* EcDoRpc Function 0x6b */
	typedef [flag(NDR_NOALIGN)] struct {
		hyper		RowId;
	  	uint32		RowInstanceNumber;
	} GetCollapseState_req;

	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	CollapseState;
	} GetCollapseState_repl;

	/*************************/
	/* EcDoRpc Function 0x6c */
	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	CollapseState;
	} SetCollapseState_req;

	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	bookmark;
	} SetCollapseState_repl;

	/*************************/
	/* EcDoRpc Function 0x6d */
	typedef [flag(NDR_NOALIGN)] struct {
	} GetTransportFolder_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		FolderId;
	} GetTransportFolder_repl;

	/*************************/
	/* EcDoRpc Function 0x6e */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16	SessionIndex;
	} Pending_repl;

	/*************************/
	/* EcDoRpc Function 0x6f */
	typedef [flag(NDR_NOALIGN)] struct {
		astring		AddressType;
		boolean8	WantWin32;
	} OptionsData_req;

	typedef [nodiscriminant, flag(NDR_NOALIGN)] union {
		[case(0x0)];
		[default]  raw8string	HelpFileName;
	} OptionsData_HelpFileName;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8							Reserved;
		SBinary_short						OptionsInfo;
		uint16							HelpFileSize;
		uint8                                           	HelpFile[HelpFileSize];
		[switch_is(HelpFileSize)] OptionsData_HelpFileName	HelpFileName;
	} OptionsData_repl;

	/*************************/
	/* EcDoRpc Function 0x70 */
	typedef [enum8bit] enum {
		Contents	= 0x1,
		Hierarchy	= 0x2
	} SynchronizationType;

	typedef [bitmap8bit] bitmap {
		SendOptions_Unicode		= 0x1,
		SendOptions_ForUpload		= 0x3,
		SendOptions_RecoverMode		= 0x4,
		SendOptions_ForceUnicode	= 0x8,
		SendOptions_Partial		= 0x10
	} SendOptions;

	typedef [bitmap16bit] bitmap {
		SynchronizationFlag_Unicode			= 0x1,
		SynchronizationFlag_NoDeletions			= 0x2,
		SynchronizationFlag_NoSoftDeletions		= 0x4,
	       	SynchronizationFlag_ReadState			= 0x8,
	       	SynchronizationFlag_FAI				= 0x10,
	       	SynchronizationFlag_Normal			= 0x20,
	       	SynchronizationFlag_OnlySpecifiedProperties	= 0x80,
	       	SynchronizationFlag_NoForeignIdentifiers	= 0x100,
	       	SynchronizationFlag_Reserved			= 0x1000,
	       	SynchronizationFlag_BestBody			= 0x2000,
	       	SynchronizationFlag_IgnoreSpecifiedOnFAI	= 0x4000,
	       	SynchronizationFlag_Progress			= 0x8000
	} SynchronizationFlag;

	typedef [bitmap32bit] bitmap {
		Eid			= 0x00000001,
		MessageSize		= 0x00000002,
		Cn			= 0x00000004,
	        OrderByDeliveryTime	= 0x00000008
	} SynchronizationExtraFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8					handle_idx;
		SynchronizationType			SynchronizationType;
		SendOptions				SendOptions;
		SynchronizationFlag			SynchronizationFlag;
		uint16					RestrictionSize;
 		[subcontext(0),subcontext_size(RestrictionSize),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	RestrictionData;
		SynchronizationExtraFlags		SynchronizationExtraFlags;
		mapi_SPropTagArray			PropertyTags;
	} SyncConfigure_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncConfigure_repl;

	/*************************/
	/* EcDoRpc Function 0x72 */
	typedef [bitmap8bit] bitmap {
		ImportFlag_Associated		= 0x10,
	       	ImportFlag_FailOnConflict	= 0x40
	} ImportFlag;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8			handle_idx;
		ImportFlag		ImportFlag;
		mapi_SPropValue_array	PropertyValues;
	} SyncImportMessageChange_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		MessageId;
	} SyncImportMessageChange_repl;

	/*************************/
	/* EcDoRpc Function 0x73 */
	typedef [flag(NDR_NOALIGN)] struct {
		mapi_SPropValue_array	HierarchyValues;
		mapi_SPropValue_array	PropertyValues;
	} SyncImportHierarchyChange_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper			FolderId;
	} SyncImportHierarchyChange_repl;

	/*************************/
	/* EcDoRpc Function 0x74 */
	typedef [bitmap8bit] bitmap {
		SyncImportDeletes_Hierarchy	= 0x01,
		SyncImportDeletes_HardDelete	= 0x02
	} SyncImportDeletesFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		SyncImportDeletesFlags	Flags;
		mapi_SPropValue_array	PropertyValues;
	} SyncImportDeletes_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncImportDeletes_repl;

	/*************************/
	/* EcDoRpc Function 0x75 */
	typedef [v1_enum,flag(NDR_PAHEX)] enum {
		SP_PidTagIdsetGiven	= 0x40170003,
		SP_PidTagCnsetSeen	= 0x67960102,
		SP_PidTagCnsetSeenFAI	= 0x67da0102,
		SP_PidTagCnsetRead	= 0x67d20102
	} StateProperty;

	typedef [v1_enum,flag(NDR_PAHEX)] enum {
		DP_PidTagIdsetDeleted		= 0x67e50102,
		DP_PidTagIdsetNoLongerInScope	= 0x40210102,
		DP_PidTagIdsetExpired		= 0x67930102,
		DP_PidTagIdsetRead		= 0x402d0102,
		DP_PidTagIdsetUnread		= 0x402e0102
	} DeltaProperty;

	typedef [flag(NDR_NOALIGN)] struct {
		StateProperty		StateProperty;
		uint32			TransferBufferSize;
	} SyncUploadStateStreamBegin_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncUploadStateStreamBegin_repl;

	/*************************/
	/* EcDoRpc Function 0x76 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32			StreamDataSize;
		uint8			StreamData[StreamDataSize];
	} SyncUploadStateStreamContinue_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncUploadStateStreamContinue_repl;

	/*************************/
	/* EcDoRpc Function 0x77 */
	typedef [flag(NDR_NOALIGN)] struct {
	} SyncUploadStateStreamEnd_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncUploadStateStreamEnd_repl;

	/*************************/
	/* EcDoRpc Function 0x78 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		SourceFolderIdSize;
		uint8		SourceFolderId[SourceFolderIdSize];
		uint32		SourceMessageIdSize;
		uint8		SourceMessageId[SourceMessageIdSize];
		uint32		PredecessorChangeListSize;
		uint8		PredecessorChangeList[PredecessorChangeListSize];
		uint32		DestinationMessageIdSize;
		uint8		DestinationMessageId[DestinationMessageIdSize];
		uint32		ChangeNumberSize;
		uint8		ChangeNumber[ChangeNumberSize];
	} SyncImportMessageMove_req;

	typedef [flag(NDR_NOALIGN)] struct {
		hyper		MessageId;
	} SyncImportMessageMove_repl;

	/*************************/
	/* EcDoRpc Function 0x79 */
	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2)] mapi_SPropValue_array	values;
	} SetPropertiesNoReplicate_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];
	} SetPropertiesNoReplicate_repl;

	/*************************/
	/* EcDoRpc Function 0x7a */
	typedef [flag(NDR_NOALIGN)] struct {
		mapi_SPropTagArray	PropertyTags;
	} DeletePropertiesNoReplicate_req;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		PropertyProblemCount;
		PropertyProblem	PropertyProblem[PropertyProblemCount];
	} DeletePropertiesNoReplicate_repl;

	/*************************/
	/* EcDoRpc Function 0x7b */
	typedef [public,bitmap32bit] bitmap {
		STORE_HAS_SEARCHES		= 0x010000000
	} StoreState;

	typedef [flag(NDR_NOALIGN)] struct {
	} GetStoreState_req;

	typedef [flag(NDR_NOALIGN)] struct {
		StoreState	StoreState;
	} GetStoreState_repl;

	/*************************/
	/* EcDoRpc Function 0x7e */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		boolean8	IsContentsCollector;
	} SyncOpenCollector_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncOpenCollector_repl;

	/*************************/
	/* EcDoRpc Function 0x7f */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		IdCount;
	} GetLocalReplicaIds_req;

	typedef [flag(NDR_NOALIGN)] struct {
		GUID		ReplGuid;
		uint8		GlobalCount[6];
	} GetLocalReplicaIds_repl;

	/*************************/
	/* EcDoRpc Function 0x80 */
	typedef [public,flag(NDR_NOALIGN)] struct {
		uint16		MessageIdSize;
		uint8		MessageId[MessageIdSize];
		boolean8	MarkAsRead;
	} MessageReadState;

	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2),flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB MessageReadStates;
	} SyncImportReadStateChanges_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncImportReadStateChanges_repl;

	/*************************/
	/* EcDoRpc Function 0x81 */
	typedef [flag(NDR_NOALIGN)] struct {
	} ResetTable_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} ResetTable_repl;

	/*************************/
	/* EcDoRpc Function 0x82 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
	} SyncGetTransferState_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncGetTransferState_repl;

	/*************************/
	/* EcDoRpc Function 0x83 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
	} SyncOpenAdvisor_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SyncOpenAdvisor_repl;

	/*************************/
	/* EcDoRpc Function 0x86 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		version[3];
	} TellVersion_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} TellVersion_repl;

	/*************************/
	/* EcDoRpc Function 0x87 */
	typedef [flag(NDR_NOALIGN)] struct {
		uint8		handle_idx;
		asclstr		name;
	} OpenPublicFolderByName_req; 

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8				HasRules;
		boolean8				IsGhosted;
		[switch_is(IsGhosted)] IsGhosted	Ghost;
	} OpenPublicFolderByName_repl;

	/*************************/
	/* EcDoRpc Function 0x88 */
	typedef [flag(NDR_NOALIGN)] struct {
		GUID	NotificationGuid;
	} SetSyncNotificationGuid_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetSyncNotificationGuid_repl;

	/*************************/
	/* EcDoRpc Function 0x89 */
	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	bookmark;
	} FreeBookmark_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} FreeBookmark_repl;

	/*************************/
	/* EcDoRpc Function 0x90 */
	typedef [flag(NDR_NOALIGN)] struct {
		[subcontext(2), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	data;
	} WriteAndCommitStream_req;


	typedef [flag(NDR_NOALIGN)] struct {
		uint16		WrittenSize;
	} WriteAndCommitStream_repl;

	/**************************/
	/* EcDoRpc Function 0x91  */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantAsynchronous;
		boolean8	NotifyNonRead;
		uint16		MessageIdCount;
		hyper		MessageIds[MessageIdCount];
	} HardDeleteMessages_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	PartialCompletion;
	} HardDeleteMessages_repl;

	/*************************/
	/* EcDoRpc Function 0x92 */
	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	WantAsynchronous;
		boolean8	WantDeleteAssociated;
	} HardDeleteMessagesAndSubfolders_req;

	typedef [flag(NDR_NOALIGN)] struct {
		boolean8	PartialCompletion;
	} HardDeleteMessagesAndSubfolders_repl;

	/*************************/
	/* EcDoRpc Function 0x93 */
	typedef [public,flag(NDR_NOALIGN)] struct {
		LongTermId	MinLongTermId;
		LongTermId	MaxLongTermId;
	} LongTermIdRange;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16			DataSize;
		uint32			LongTermIdRangeCount;
		LongTermIdRange		LongTermIdRanges[LongTermIdRangeCount];
	} SetLocalReplicaMidsetDeleted_req;

	typedef [flag(NDR_NOALIGN)] struct {
	} SetLocalReplicaMidsetDeleted_repl;

	/**************************/
	/* EcDoRpc Function 0xF9   */
	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} Backoff_req;

	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} Backoff_repl;

	/*************************/
	/* EcDoRpc Function 0xFE */
	typedef [public,bitmap8bit] bitmap {
		LogonPrivate	= 0x1,
		UnderCover	= 0x2,
		Ghosted		= 0x4,
		SpIProcess      = 0x8
	} LogonFlags;

	typedef [public,bitmap32bit] bitmap {
		PUBLIC				= 0x2,
		HOME_LOGON			= 0x4,
		TAKE_OWNERSHIP			= 0x8,
		ALTERNATE_SERVER		= 0x100,
		IGNORE_HOME_MDB			= 0x200,
		NO_MAIL				= 0x400,
		USE_PER_MDB_REPLID_MAPPING	= 0x01000000,
		SUPPORT_PROGRESS		= 0x20000000 
	} OpenFlags;

	typedef [enum8bit] enum {
		DayOfWeek_Sunday	= 0x0,
		DayOfWeek_Monday	= 0x1,
		DayOfWeek_Tuesday	= 0x2,
		DayOfWeek_Wednesday	= 0x3,
		DayOfWeek_Thursday	= 0x4,
		DayOfWeek_Friday	= 0x5,
		DayOfWeek_Saturday	= 0x6
	} DayOfWeek;

	typedef [flag(NDR_NOALIGN)] struct {
		uint8		Seconds;
		uint8		Minutes;
		uint8		Hour;
		DayOfWeek	DayOfWeek;
		uint8		Day;
		uint8		Month;
		uint16		Year;
	} LogonTime;

	typedef [bitmap8bit] bitmap {
		ResponseFlags_Reserved		= 0x1,
		ResponseFlags_OwnerRight	= 0x2,
		ResponseFlags_SendAsRight	= 0x4,
		ResponseFlags_OOF		= 0x10
	} ResponseFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		/* folders */
		hyper			Root;
		hyper			IPMSubTree;
		hyper			NonIPMSubTree;
		hyper			EFormsRegistry;
		hyper			FreeBusy;
		hyper			OAB;
		hyper			LocalizedEFormsRegistry;
		hyper			LocalFreeBusy;
		hyper			LocalOAB;
		hyper			NNTPIndex;
		hyper			_empty[3];

		uint16			ReplId;
		GUID			Guid;
		GUID			PerUserGuid;
	} store_pf;

	typedef [flag(NDR_NOALIGN)] struct {
		/* folders */
		hyper			Root;
		hyper			DeferredAction;
		hyper			SpoolerQueue;
		hyper			IPMSubTree;
		hyper			Inbox;
		hyper			Outbox;
		hyper			SentItems;
		hyper			DeletedItems;
		hyper			CommonViews;
		hyper			Schedule;
		hyper			Search;
		hyper			Views;
		hyper			Shortcuts;

		ResponseFlags		ResponseFlags;
		GUID			MailboxGuid;
		uint16			ReplId;
		GUID			ReplGUID;
		LogonTime		LogonTime;
		hyper			GwartTime;
		StoreState		StoreState;
	} store_mailbox;

	typedef [nodiscriminant] union {
		[case(0x0)]					store_pf	store_pf;
		[case(LogonPrivate)]				store_mailbox	store_mailbox;
		[case(UnderCover)]				store_pf	store_pf;
		[case(Ghosted)]					store_pf	store_pf;
		[case(SpIProcess)]				store_pf	store_pf;
		[case(LogonPrivate|UnderCover)]			store_mailbox	store_mailbox;
		[case(LogonPrivate|Ghosted)]			store_mailbox	store_mailbox;
		[case(LogonPrivate|UnderCover|SpIProcess)]	store_mailbox	store_mailbox;
		[case(LogonPrivate|Ghosted|SpIProcess)]		store_mailbox	store_mailbox;
		[case(LogonPrivate|SpIProcess)]			store_mailbox	store_mailbox;
	} LogonType;

	typedef [nopush,flag(NDR_NOALIGN)] struct {
		LogonFlags	LogonFlags;
		OpenFlags	OpenFlags;
		StoreState	StoreState;
		ascstr3		EssDN;
	} Logon_req;

	typedef [flag(NDR_NOALIGN)] struct {
		LogonFlags				LogonFlags;
		[switch_is(LogonFlags)] LogonType	LogonType;
	} Logon_repl;

	/* Logon redirect response buffer (error_code == ecWrongServer) */
	typedef [public,flag(NDR_NOALIGN)] struct {
		LogonFlags	LogonFlags;
		uint8		ServerNameSize;
		astring		ServerName;
	} Logon_redirect;

	/**************************/
	/* EcDoRpc Function 0xFF   */
	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} BufferTooSmall_req;

	typedef [nopush,nopull,flag(NDR_NOALIGN)] struct {
	} BufferTooSmall_repl;

	/*************************/
	/* EcDoRpc Function 0xA5 */
	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	bin;
	} proxypack_req;

	typedef [flag(NDR_NOALIGN)] struct {
		SBinary_short	bin;
	} proxypack_repl;

	typedef [public, nodiscriminant] union {
		[case(op_MAPI_Release)] Release_req mapi_Release;
		[case(op_MAPI_OpenFolder)] OpenFolder_req mapi_OpenFolder;
		[case(op_MAPI_OpenMessage)] OpenMessage_req mapi_OpenMessage;
		[case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_req mapi_GetHierarchyTable;
		[case(op_MAPI_GetContentsTable)] GetContentsTable_req mapi_GetContentsTable;
		[case(op_MAPI_CreateMessage)] CreateMessage_req mapi_CreateMessage;
		[case(op_MAPI_GetProps)] GetProps_req mapi_GetProps;
		[case(op_MAPI_GetPropsAll)] GetPropsAll_req mapi_GetPropsAll;
		[case(op_MAPI_GetPropList)] GetPropList_req mapi_GetPropList;
		[case(op_MAPI_SetProps)] SetProps_req mapi_SetProps;
		[case(op_MAPI_DeleteProps)] DeleteProps_req mapi_DeleteProps;
		[case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_req mapi_SaveChangesMessage;
		[case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_req mapi_SetMessageReadFlag;
		[case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_req mapi_ReloadCachedInformation;
		[case(op_MAPI_SetColumns)] SetColumns_req mapi_SetColumns;
		[case(op_MAPI_SortTable)] SortTable_req mapi_SortTable;
		[case(op_MAPI_Restrict)] Restrict_req mapi_Restrict;
		[case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_req mapi_RemoveAllRecipients;
		[case(op_MAPI_ModifyRecipients)] ModifyRecipients_req mapi_ModifyRecipients;
		[case(op_MAPI_ReadRecipients)] ReadRecipients_req mapi_ReadRecipients;
		[case(op_MAPI_QueryRows)] QueryRows_req mapi_QueryRows;
		[case(op_MAPI_GetStatus)] GetStatus_req mapi_GetStatus;
		[case(op_MAPI_QueryPosition)] QueryPosition_req mapi_QueryPosition;
		[case(op_MAPI_SeekRow)] SeekRow_req mapi_SeekRow;
		[case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_req mapi_SeekRowBookmark;
		[case(op_MAPI_SeekRowApprox)] SeekRowApprox_req mapi_SeekRowApprox;
		[case(op_MAPI_CreateBookmark)] CreateBookmark_req mapi_CreateBookmark;
		[case(op_MAPI_CreateFolder)] CreateFolder_req mapi_CreateFolder;
		[case(op_MAPI_DeleteFolder)] DeleteFolder_req mapi_DeleteFolder;
		[case(op_MAPI_DeleteMessages)] DeleteMessages_req mapi_DeleteMessages;
		[case(op_MAPI_GetMessageStatus)] GetMessageStatus_req mapi_GetMessageStatus;
		[case(op_MAPI_SetMessageStatus)] SetMessageStatus_req mapi_SetMessageStatus;
		[case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_req mapi_GetAttachmentTable;
		[case(op_MAPI_OpenAttach)] OpenAttach_req mapi_OpenAttach;
		[case(op_MAPI_CreateAttach)] CreateAttach_req mapi_CreateAttach;
		[case(op_MAPI_DeleteAttach)] DeleteAttach_req mapi_DeleteAttach;
		[case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_req mapi_SaveChangesAttachment;
		[case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_req mapi_SetReceiveFolder;
		[case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_req mapi_GetReceiveFolder;
		[case(op_MAPI_RegisterNotification)] RegisterNotification_req mapi_RegisterNotification;
		[case(op_MAPI_OpenStream)] OpenStream_req mapi_OpenStream;
		[case(op_MAPI_ReadStream)] ReadStream_req mapi_ReadStream;
		[case(op_MAPI_WriteStream)] WriteStream_req mapi_WriteStream;
		[case(op_MAPI_SeekStream)] SeekStream_req mapi_SeekStream;
		[case(op_MAPI_SetStreamSize)] SetStreamSize_req mapi_SetStreamSize;
		[case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_req mapi_SetSearchCriteria;
		[case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_req mapi_GetSearchCriteria;
		[case(op_MAPI_SubmitMessage)] SubmitMessage_req mapi_SubmitMessage;
		[case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_req mapi_MoveCopyMessages;
		[case(op_MAPI_AbortSubmit)] AbortSubmit_req mapi_AbortSubmit;
		[case(op_MAPI_MoveFolder)] MoveFolder_req mapi_MoveFolder;
		[case(op_MAPI_CopyFolder)] CopyFolder_req mapi_CopyFolder;
		[case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_req mapi_QueryColumnsAll;
		[case(op_MAPI_Abort)] Abort_req mapi_Abort;
		[case(op_MAPI_CopyTo)] CopyTo_req mapi_CopyTo;
		[case(op_MAPI_CopyToStream)] CopyToStream_req mapi_CopyToStream;
		[case(op_MAPI_CloneStream)] CloneStream_req mapi_CloneStream;
		[case(op_MAPI_GetPermissionsTable)] GetPermissionsTable_req mapi_GetPermissionsTable;
		[case(op_MAPI_GetRulesTable)] GetRulesTable_req mapi_GetRulesTable;
		[case(op_MAPI_ModifyPermissions)] ModifyPermissions_req mapi_ModifyPermissions;
		[case(op_MAPI_ModifyRules)] ModifyRules_req mapi_ModifyRules;
		[case(op_MAPI_GetOwningServers)] GetOwningServers_req mapi_GetOwningServers;
		[case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_req mapi_LongTermIdFromId;
		[case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_req mapi_IdFromLongTermId;
		[case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_req mapi_PublicFolderIsGhosted;
		[case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_req mapi_OpenEmbeddedMessage;
		[case(op_MAPI_SetSpooler)] SetSpooler_req mapi_SetSpooler;
		[case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_req mapi_SpoolerLockMessage;
		[case(op_MAPI_AddressTypes)] AddressTypes_req mapi_AddressTypes;
		[case(op_MAPI_TransportSend)] TransportSend_req mapi_TransportSend;
		[case(op_MAPI_FastTransferSourceCopyMessages)] FastTransferSourceCopyMessages_req mapi_FastTransferSourceCopyMessages;
		[case(op_MAPI_FastTransferSourceCopyFolder)] FastTransferSourceCopyFolder_req mapi_FastTransferSourceCopyFolder;
		[case(op_MAPI_FastTransferSourceCopyTo)] FastTransferSourceCopyTo_req mapi_FastTransferSourceCopyTo;
		[case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_req mapi_FastTransferSourceGetBuffer;
		[case(op_MAPI_FindRow)] FindRow_req mapi_FindRow;
		[case(op_MAPI_Progress)] Progress_req mapi_Progress;
		[case(op_MAPI_TransportNewMail)] TransportNewMail_req mapi_TransportNewMail;
		[case(op_MAPI_GetValidAttachments)] GetValidAttachments_req mapi_GetValidAttachments;
		[case(op_MAPI_FastTransferDestConfigure)] FastTransferDestinationConfigure_req mapi_FastTransferDestinationConfigure;
		[case(op_MAPI_FastTransferDestPutBuffer)] FastTransferDestinationPutBuffer_req mapi_FastTransferDestinationPutBuffer;
		[case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_req mapi_GetNamesFromIDs;
		[case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_req mapi_GetIDsFromNames;
		[case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_req mapi_UpdateDeferredActionMessages;
		[case(op_MAPI_EmptyFolder)] EmptyFolder_req mapi_EmptyFolder;
		[case(op_MAPI_ExpandRow)] ExpandRow_req mapi_ExpandRow;
		[case(op_MAPI_CollapseRow)] CollapseRow_req mapi_CollapseRow;
		[case(op_MAPI_LockRegionStream)] LockRegionStream_req mapi_LockRegionStream;
		[case(op_MAPI_UnlockRegionStream)] UnlockRegionStream_req mapi_UnlockRegionStream;
		[case(op_MAPI_CommitStream)] CommitStream_req mapi_CommitStream;
		[case(op_MAPI_GetStreamSize)] GetStreamSize_req mapi_GetStreamSize;
		[case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_req mapi_QueryNamedProperties;
		[case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_req mapi_GetPerUserLongTermIds;
		[case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_req mapi_GetPerUserGuid;
		[case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_req mapi_ReadPerUserInformation;
		[case(op_MAPI_WritePerUserInformation)] WritePerUserInformation_req mapi_WritePerUserInformation;
		[case(op_MAPI_SetReadFlags)] SetReadFlags_req mapi_SetReadFlags;
		[case(op_MAPI_CopyProperties)] CopyProperties_req mapi_CopyProperties;
		[case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_req mapi_GetReceiveFolderTable;
		[case(op_MAPI_FastTransferSourceCopyProps)] FastTransferSourceCopyProperties_req mapi_FastTransferSourceCopyProperties;
		[case(op_MAPI_GetCollapseState)] GetCollapseState_req mapi_GetCollapseState;
		[case(op_MAPI_SetCollapseState)] SetCollapseState_req mapi_SetCollapseState;
		[case(op_MAPI_GetTransportFolder)] GetTransportFolder_req mapi_GetTransportFolder;
		[case(op_MAPI_OptionsData)] OptionsData_req mapi_OptionsData;
		[case(op_MAPI_SyncConfigure)] SyncConfigure_req mapi_SyncConfigure;
		[case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_req mapi_SyncImportMessageChange;
		[case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_req mapi_SyncImportHierarchyChange;
		[case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_req mapi_SyncImportDeletes;
		[case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_req mapi_SyncUploadStateStreamBegin;
		[case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_req mapi_SyncUploadStateStreamContinue;
		[case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_req mapi_SyncUploadStateStreamEnd;
		[case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_req mapi_SyncImportMessageMove;
		[case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_req mapi_SetPropertiesNoReplicate;
		[case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_req mapi_DeletePropertiesNoReplicate;
		[case(op_MAPI_GetStoreState)] GetStoreState_req mapi_GetStoreState;
		[case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_req mapi_SyncOpenCollector;
		[case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_req mapi_GetLocalReplicaIds;
		[case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_req mapi_SyncImportReadStateChanges;
		[case(op_MAPI_ResetTable)] ResetTable_req mapi_ResetTable;
		[case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_req mapi_SyncGetTransferState;
		[case(op_MAPI_SyncOpenAdvisor)] SyncOpenAdvisor_req mapi_SyncOpenAdvisor;
		[case(op_MAPI_TellVersion)] TellVersion_req mapi_TellVersion;
		[case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_req mapi_OpenPublicFolderByName;
		[case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_req mapi_SetSyncNotificationGuid;
		[case(op_MAPI_FreeBookmark)] FreeBookmark_req mapi_FreeBookmark;
		[case(op_MAPI_WriteAndCommitStream)] WriteAndCommitStream_req mapi_WriteAndCommitStream;
		[case(op_MAPI_HardDeleteMessages)] HardDeleteMessages_req mapi_HardDeleteMessages;
		[case(op_MAPI_HardDeleteMessagesAndSubfolders)] HardDeleteMessagesAndSubfolders_req mapi_HardDeleteMessagesAndSubfolders;
		[case(op_MAPI_SetLocalReplicaMidsetDeleted)] SetLocalReplicaMidsetDeleted_req mapi_SetLocalReplicaMidsetDeleted;
		[case(op_MAPI_Backoff)] Backoff_req mapi_Backoff;
		[case(op_MAPI_Logon)] Logon_req mapi_Logon;
		[case(op_MAPI_BufferTooSmall)] BufferTooSmall_req mapi_BufferTooSmall;
		[case(op_MAPI_proxypack)] proxypack_req mapi_proxypack;
	} EcDoRpc_MAPI_REQ_UNION;

	typedef [public, nodiscriminant] union {
 		[case(op_MAPI_Release)] Release_repl mapi_Release;
		[case(op_MAPI_OpenFolder)] OpenFolder_repl mapi_OpenFolder;
		[case(op_MAPI_OpenMessage)] OpenMessage_repl mapi_OpenMessage;
		[case(op_MAPI_GetHierarchyTable)] GetHierarchyTable_repl mapi_GetHierarchyTable;
		[case(op_MAPI_GetContentsTable)] GetContentsTable_repl mapi_GetContentsTable;
		[case(op_MAPI_CreateMessage)] CreateMessage_repl mapi_CreateMessage;
		[case(op_MAPI_GetProps)] GetProps_repl mapi_GetProps;
		[case(op_MAPI_GetPropsAll)] GetPropsAll_repl mapi_GetPropsAll;
		[case(op_MAPI_GetPropList)] GetPropList_repl mapi_GetPropList;
		[case(op_MAPI_SetProps)] SetProps_repl mapi_SetProps;
		[case(op_MAPI_DeleteProps)] DeleteProps_repl mapi_DeleteProps;
		[case(op_MAPI_SaveChangesMessage)] SaveChangesMessage_repl mapi_SaveChangesMessage;
		[case(op_MAPI_RemoveAllRecipients)] RemoveAllRecipients_repl mapi_RemoveAllRecipients;
		[case(op_MAPI_ModifyRecipients)] ModifyRecipients_repl mapi_ModifyRecipients;
		[case(op_MAPI_ReadRecipients)] ReadRecipients_repl mapi_ReadRecipients;
		[case(op_MAPI_SetMessageReadFlag)] SetMessageReadFlag_repl mapi_SetMessageReadFlag;
		[case(op_MAPI_ReloadCachedInformation)] ReloadCachedInformation_repl mapi_ReloadCachedInformation;
		[case(op_MAPI_SetColumns)] SetColumns_repl mapi_SetColumns;
		[case(op_MAPI_SortTable)] SortTable_repl mapi_SortTable;
		[case(op_MAPI_Restrict)] Restrict_repl mapi_Restrict;
		[case(op_MAPI_QueryRows)] QueryRows_repl mapi_QueryRows;
		[case(op_MAPI_GetStatus)] GetStatus_repl mapi_GetStatus;
		[case(op_MAPI_QueryPosition)] QueryPosition_repl mapi_QueryPosition;
		[case(op_MAPI_SeekRow)] SeekRow_repl mapi_SeekRow;
		[case(op_MAPI_SeekRowBookmark)] SeekRowBookmark_repl mapi_SeekRowBookmark;
		[case(op_MAPI_SeekRowApprox)] SeekRowApprox_repl mapi_SeekRowApprox;
		[case(op_MAPI_CreateBookmark)] CreateBookmark_repl mapi_CreateBookmark;
		[case(op_MAPI_CreateFolder)] CreateFolder_repl mapi_CreateFolder;
		[case(op_MAPI_DeleteFolder)] DeleteFolder_repl mapi_DeleteFolder;
		[case(op_MAPI_DeleteMessages)] DeleteMessages_repl mapi_DeleteMessages;
		[case(op_MAPI_GetMessageStatus)] GetMessageStatus_repl mapi_GetMessageStatus;
		[case(op_MAPI_SetMessageStatus)] SetMessageStatus_repl mapi_SetMessageStatus;
		[case(op_MAPI_GetAttachmentTable)] GetAttachmentTable_repl mapi_GetAttachmentTable;
		[case(op_MAPI_OpenAttach)] OpenAttach_repl mapi_OpenAttach;
		[case(op_MAPI_CreateAttach)] CreateAttach_repl mapi_CreateAttach;
		[case(op_MAPI_DeleteAttach)] DeleteAttach_repl mapi_DeleteAttach;
		[case(op_MAPI_SaveChangesAttachment)] SaveChangesAttachment_repl mapi_SaveChangesAttachment;
		[case(op_MAPI_SetReceiveFolder)] SetReceiveFolder_repl mapi_SetReceiveFolder;
		[case(op_MAPI_GetReceiveFolder)] GetReceiveFolder_repl mapi_GetReceiveFolder;
		[case(op_MAPI_RegisterNotification)] RegisterNotification_repl mapi_RegisterNotification;
		[case(op_MAPI_Notify)] Notify_repl mapi_Notify;
		[case(op_MAPI_OpenStream)] OpenStream_repl mapi_OpenStream;
		[case(op_MAPI_ReadStream)] ReadStream_repl mapi_ReadStream;
		[case(op_MAPI_WriteStream)] WriteStream_repl mapi_WriteStream;
		[case(op_MAPI_SeekStream)] SeekStream_repl mapi_SeekStream;
		[case(op_MAPI_SetStreamSize)] SetStreamSize_repl mapi_SetStreamSize;
		[case(op_MAPI_SetSearchCriteria)] SetSearchCriteria_repl mapi_SetSearchCriteria;
		[case(op_MAPI_GetSearchCriteria)] GetSearchCriteria_repl mapi_GetSearchCriteria;
		[case(op_MAPI_SubmitMessage)] SubmitMessage_repl mapi_SubmitMessage;
		[case(op_MAPI_MoveCopyMessages)] MoveCopyMessages_repl mapi_MoveCopyMessages;
		[case(op_MAPI_AbortSubmit)] AbortSubmit_repl mapi_AbortSubmit;
		[case(op_MAPI_MoveFolder)] MoveFolder_repl mapi_MoveFolder;
		[case(op_MAPI_CopyFolder)] CopyFolder_repl mapi_CopyFolder;
		[case(op_MAPI_QueryColumnsAll)] QueryColumnsAll_repl mapi_QueryColumnsAll;
		[case(op_MAPI_Abort)] Abort_repl mapi_Abort;
		[case(op_MAPI_CopyTo)] CopyTo_repl mapi_CopyTo;
		[case(op_MAPI_CopyToStream)] CopyToStream_repl mapi_CopyToStream;
		[case(op_MAPI_CloneStream)] CloneStream_repl mapi_CloneStream;
		[case(op_MAPI_GetPermissionsTable)] GetPermissionsTable_repl mapi_GetPermissionsTable;
		[case(op_MAPI_GetRulesTable)] GetRulesTable_repl mapi_GetRulesTable;
		[case(op_MAPI_ModifyPermissions)] ModifyPermissions_repl mapi_ModifyPermissions;
		[case(op_MAPI_ModifyRules)] ModifyRules_repl mapi_ModifyRules;
		[case(op_MAPI_GetOwningServers)] GetOwningServers_repl mapi_GetOwningServers;
		[case(op_MAPI_LongTermIdFromId)] LongTermIdFromId_repl mapi_LongTermIdFromId;
		[case(op_MAPI_IdFromLongTermId)] IdFromLongTermId_repl mapi_IdFromLongTermId;
		[case(op_MAPI_PublicFolderIsGhosted)] PublicFolderIsGhosted_repl mapi_PublicFolderIsGhosted;
		[case(op_MAPI_OpenEmbeddedMessage)] OpenEmbeddedMessage_repl mapi_OpenEmbeddedMessage;
		[case(op_MAPI_SetSpooler)] SetSpooler_repl mapi_SetSpooler;
		[case(op_MAPI_SpoolerLockMessage)] SpoolerLockMessage_repl mapi_SpoolerLockMessage;
		[case(op_MAPI_AddressTypes)] AddressTypes_repl mapi_AddressTypes;
		[case(op_MAPI_TransportSend)] TransportSend_repl mapi_TransportSend;
		[case(op_MAPI_FastTransferSourceCopyMessages)] FastTransferSourceCopyMessages_repl mapi_FastTransferSourceCopyMessages;
		[case(op_MAPI_FastTransferSourceCopyFolder)] FastTransferSourceCopyFolder_repl mapi_FastTransferSourceCopyFolder;
		[case(op_MAPI_FastTransferSourceCopyTo)] FastTransferSourceCopyTo_repl mapi_FastTransferSourceCopyTo;
		[case(op_MAPI_FastTransferSourceGetBuffer)] FastTransferSourceGetBuffer_repl mapi_FastTransferSourceGetBuffer;
		[case(op_MAPI_FindRow)] FindRow_repl mapi_FindRow;
		[case(op_MAPI_Progress)] Progress_repl mapi_Progress;
		[case(op_MAPI_TransportNewMail)] TransportNewMail_repl mapi_TransportNewMail;
		[case(op_MAPI_GetValidAttachments)] GetValidAttachments_repl mapi_GetValidAttachments;
		[case(op_MAPI_FastTransferDestConfigure)] FastTransferDestinationConfigure_repl mapi_FastTransferDestinationConfigure;
		[case(op_MAPI_FastTransferDestPutBuffer)] FastTransferDestinationPutBuffer_repl mapi_FastTransferDestinationPutBuffer;
		[case(op_MAPI_GetNamesFromIDs)] GetNamesFromIDs_repl mapi_GetNamesFromIDs;
		[case(op_MAPI_GetIDsFromNames)] GetIDsFromNames_repl mapi_GetIDsFromNames;
		[case(op_MAPI_UpdateDeferredActionMessages)] UpdateDeferredActionMessages_repl mapi_UpdateDeferredActionMessages;
		[case(op_MAPI_EmptyFolder)] EmptyFolder_repl mapi_EmptyFolder;
		[case(op_MAPI_ExpandRow)] ExpandRow_repl mapi_ExpandRow;
		[case(op_MAPI_CollapseRow)] CollapseRow_repl mapi_CollapseRow;
		[case(op_MAPI_LockRegionStream)] LockRegionStream_repl mapi_LockRegionStream;
		[case(op_MAPI_UnlockRegionStream)] UnlockRegionStream_repl mapi_UnlockRegionStream;
		[case(op_MAPI_CommitStream)] CommitStream_repl mapi_CommitStream;
		[case(op_MAPI_GetStreamSize)] GetStreamSize_repl mapi_GetStreamSize;
		[case(op_MAPI_QueryNamedProperties)] QueryNamedProperties_repl mapi_QueryNamedProperties;
		[case(op_MAPI_GetPerUserLongTermIds)] GetPerUserLongTermIds_repl mapi_GetPerUserLongTermIds;
		[case(op_MAPI_GetPerUserGuid)] GetPerUserGuid_repl mapi_GetPerUserGuid;
		[case(op_MAPI_ReadPerUserInformation)] ReadPerUserInformation_repl mapi_ReadPerUserInformation;
		[case(op_MAPI_WritePerUserInformation)] WritePerUserInformation_repl mapi_WritePerUserInformation;
		[case(op_MAPI_SetReadFlags)] SetReadFlags_repl mapi_SetReadFlags;
		[case(op_MAPI_CopyProperties)] CopyProperties_repl mapi_CopyProperties;
		[case(op_MAPI_GetReceiveFolderTable)] GetReceiveFolderTable_repl mapi_GetReceiveFolderTable;
		[case(op_MAPI_Pending)] Pending_repl mapi_Pending;
		[case(op_MAPI_FastTransferSourceCopyProps)] FastTransferSourceCopyProperties_repl mapi_FastTransferSourceCopyProperties;
		[case(op_MAPI_GetCollapseState)] GetCollapseState_repl mapi_GetCollapseState;
		[case(op_MAPI_SetCollapseState)] SetCollapseState_repl mapi_SetCollapseState;
		[case(op_MAPI_GetTransportFolder)] GetTransportFolder_repl mapi_GetTransportFolder;
		[case(op_MAPI_OptionsData)] OptionsData_repl mapi_OptionsData;
		[case(op_MAPI_SyncConfigure)] SyncConfigure_repl mapi_SyncConfigure;
		[case(op_MAPI_SyncImportMessageChange)] SyncImportMessageChange_repl mapi_SyncImportMessageChange;
		[case(op_MAPI_SyncImportHierarchyChange)] SyncImportHierarchyChange_repl mapi_SyncImportHierarchyChange;
		[case(op_MAPI_SyncImportDeletes)] SyncImportDeletes_repl mapi_SyncImportDeletes;
		[case(op_MAPI_SyncUploadStateStreamBegin)] SyncUploadStateStreamBegin_repl mapi_SyncUploadStateStreamBegin;
		[case(op_MAPI_SyncUploadStateStreamContinue)] SyncUploadStateStreamContinue_repl mapi_SyncUploadStateStreamContinue;
		[case(op_MAPI_SyncUploadStateStreamEnd)] SyncUploadStateStreamEnd_repl mapi_SyncUploadStateStreamEnd;
		[case(op_MAPI_SyncImportMessageMove)] SyncImportMessageMove_repl mapi_SyncImportMessageMove;
		[case(op_MAPI_SetPropertiesNoReplicate)] SetPropertiesNoReplicate_repl mapi_SetPropertiesNoReplicate;
		[case(op_MAPI_DeletePropertiesNoReplicate)] DeletePropertiesNoReplicate_repl mapi_DeletePropertiesNoReplicate;
		[case(op_MAPI_GetStoreState)] GetStoreState_repl mapi_GetStoreState;
		[case(op_MAPI_SyncOpenCollector)] SyncOpenCollector_repl mapi_SyncOpenCollector;
		[case(op_MAPI_GetLocalReplicaIds)] GetLocalReplicaIds_repl mapi_GetLocalReplicaIds;
		[case(op_MAPI_SyncImportReadStateChanges)] SyncImportReadStateChanges_repl mapi_SyncImportReadStateChanges;
		[case(op_MAPI_ResetTable)] ResetTable_repl mapi_ResetTable;
		[case(op_MAPI_SyncGetTransferState)] SyncGetTransferState_repl mapi_SyncGetTransferState;
		[case(op_MAPI_SyncOpenAdvisor)] SyncOpenAdvisor_repl mapi_SyncOpenAdvisor;
		[case(op_MAPI_TellVersion)] TellVersion_repl mapi_TellVersion;
		[case(op_MAPI_OpenPublicFolderByName)] OpenPublicFolderByName_repl mapi_OpenPublicFolderByName;
		[case(op_MAPI_SetSyncNotificationGuid)] SetSyncNotificationGuid_repl mapi_SetSyncNotificationGuid;
		[case(op_MAPI_FreeBookmark)] FreeBookmark_repl mapi_FreeBookmark;
		[case(op_MAPI_WriteAndCommitStream)] WriteAndCommitStream_repl mapi_WriteAndCommitStream;
		[case(op_MAPI_HardDeleteMessages)] HardDeleteMessages_repl mapi_HardDeleteMessages;
		[case(op_MAPI_HardDeleteMessagesAndSubfolders)] HardDeleteMessagesAndSubfolders_repl mapi_HardDeleteMessagesAndSubfolders;
		[case(op_MAPI_SetLocalReplicaMidsetDeleted)] SetLocalReplicaMidsetDeleted_repl mapi_SetLocalReplicaMidsetDeleted;
		[case(op_MAPI_Backoff)] Backoff_repl mapi_Backoff;
		[case(op_MAPI_Logon)] Logon_repl mapi_Logon;
		[case(op_MAPI_BufferTooSmall)] BufferTooSmall_repl mapi_BufferTooSmall;
		[case(op_MAPI_proxypack)] proxypack_repl mapi_proxypack;

	} EcDoRpc_MAPI_REPL_UNION;

	typedef [public, nodiscriminant] union {
		[case(op_MAPI_Logon)] Logon_redirect mapi_Logon;
		[default];
	} EcDoRpc_MAPI_REPL_UNION_SPECIAL;

	typedef [public,flag(NDR_NOALIGN)] struct {
		uint8		opnum;
		uint8		logon_id;
		uint8		handle_idx;
		[switch_is(opnum)] EcDoRpc_MAPI_REQ_UNION u;
	} EcDoRpc_MAPI_REQ;

	typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct {
		uint8     	opnum;
		uint8		handle_idx;
		MAPISTATUS	error_code;
		[switch_is(opnum)] EcDoRpc_MAPI_REPL_UNION u;
		[switch_is(opnum)] EcDoRpc_MAPI_REPL_UNION_SPECIAL us;
	} EcDoRpc_MAPI_REPL;


	/*
	  Abstract way to represent MAPI content
	*/

  	typedef [public,nopull,nopush,noprint] struct {
		uint32			mapi_len;	/* whole mapi_data length */
		uint16			length;		/* content length */
		EcDoRpc_MAPI_REQ	*mapi_req;
		uint32			*handles;	/* handles id array */
	} mapi_request;

	typedef [public,nopull,nopush,noprint] struct {
		uint32			mapi_len;
		uint16			length;
		EcDoRpc_MAPI_REPL	*mapi_repl;
		uint32			*handles;
	} mapi_response;
	

	[public,nopull,nopush] MAPISTATUS EcDoRpc(
		[in,out]						policy_handle	*handle,
		[in,out]						uint32		size,
		[in,out]						uint32		offset,
	  	[in] [subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]	mapi_request	*mapi_request,
		[out][subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)]	mapi_response	*mapi_response,
		[in,out]						uint16		*length,
		[in]							uint16		max_data
		);

	/*****************/
	/* Function 0x03 */
	void EcGetMoreRpc();

	/*****************/
	/* Function 0x04 */

	/*
	  we could directly use a NOTIFKEY structure rather than
	  a uint8 array, but this makes the IDL more robust
	
	  sockaddr array is made of: 
	   - family (unsigned short in) sa_family_t
	   - address data sa_data[14];
	 */

	typedef struct {
		uint16		cb;
		uint8		ab[cb];
	} NOTIFKEY;

	MAPISTATUS EcRRegisterPushNotification(
               [in,out] policy_handle			*handle,
               [in] uint32				iRpc,
	       [in,size_is(cbContext)] uint8		rgbContext[*],
               [in] uint16				cbContext,
	       [in] uint32				grbitAdviseBits,
	       [in,size_is(cbCallbackAddress)] uint8	rgbCallbackAddress[*],
	       [in] uint16				cbCallbackAddress,
	       [out,ref] uint32				*hNotification
		);

	/*****************/
	/* Function 0x05 */
	MAPISTATUS EcRUnregisterPushNotification(
		[in,out]	policy_handle		*handle,
		[in]		uint32			unknown[2]
		);

	/*****************/
	/* Function 0x06 */
	MAPISTATUS EcDummyRpc();

	/*****************/
	/* Function 0x07 */
	void EcRGetDCName();

	/*****************/
	/* Function 0x08 */
	void EcRNetGetDCName();

	/*****************/
	/* Function 0x09 */
	[public,noprint] MAPISTATUS EcDoRpcExt (
		 [in,out] policy_handle						*handle,
		 [in,out] uint32						*pulFlags,
		 [in, size_is(cbIn)] uint8					rgbIn[],
		 [in] uint32							cbIn,
		 [out, length_is(*pcbOut), size_is(*pcbOut)] uint8		rgbOut[],
		 [in,out][range(0x0,0x40000)] uint32				*pcbOut,
		 [in,out,length_is(*Reserved1),size_is(*Reserved1)] uint8	Reserved0[],
		 [in,out] uint32						*Reserved1,
		 [out] uint32							*pulTransTime
		);

	/*****************/
	/* Function 0xa  */
	typedef [public,bitmap16bit] bitmap {
		RHEF_Compressed		= 0x0001,
		RHEF_XorMagic		= 0x0002,
		RHEF_Last		= 0x0004
	} RPC_HEADER_EXT_Flags;

	typedef [public] struct {
		uint16			Version;
		RPC_HEADER_EXT_Flags	Flags;
		uint16			Size;
		uint16			SizeActual;
	} RPC_HEADER_EXT;

	typedef [enum8bit,flag(NDR_PAHEX)] enum {
		AUX_TYPE_PERF_REQUESTID		= 0x01,
		AUX_TYPE_PERF_CLIENTDINFO	= 0x02,
		AUX_TYPE_PERF_SERVERINFO	= 0x03,
		AUX_TYPE_PERF_SESSIONINFO	= 0x04,
		AUX_TYPE_PERF_DEFMDB_SUCCESS	= 0x05,
		AUX_TYPE_PERF_DEFGC_SUCCESS	= 0x06,
		AUX_TYPE_PERF_MDB_SUCCESS	= 0x07,
		AUX_TYPE_PERF_GC_SUCCESS	= 0x08,
		AUX_TYPE_PERF_FAILURE		= 0x09,
		AUX_TYPE_CLIENT_CONTROL		= 0x0A,
		AUX_TYPE_PERF_PROCESSINFO	= 0x0B,
		AUX_TYPE_PERF_BG_DEFMDB_SUCCESS	= 0x0C,
		AUX_TYPE_PERF_BG_DEFGC_SUCCESS	= 0x0D,
		AUX_TYPE_PERF_BG_MDB_SUCCESS	= 0x0E,
		AUX_TYPE_PERF_BG_GC_SUCCESS	= 0x0F,
		AUX_TYPE_PERF_BG_FAILURE	= 0x10,
		AUX_TYPE_PERF_FG_DEFMDB_SUCCESS = 0x11,
		AUX_TYPE_PERF_FG_DEFGC_SUCCESS	= 0x12,
		AUX_TYPE_PERF_FG_MDB_SUCCESS	= 0x13,
		AUX_TYPE_PERF_FG_GC_SUCCESS	= 0x14,
		AUX_TYPE_PERF_FG_FAILURE	= 0x15,
		AUX_TYPE_OSVERSIONINFO		= 0x16,
		AUX_TYPE_EXORGINFO		= 0x17
	} AUX_HEADER_TYPE_1;
	
	typedef [enum8bit,flag(NDR_PAHEX)] enum {
		AUX_TYPE_PERF_SESSIONINFO_2	= 0x04,
		AUX_TYPE_PERF_MDB_SUCCESS_2	= 0x07,
		AUX_TYPE_PERF_GC_SUCCESS_2	= 0x08,
		AUX_TYPE_PERF_FAILURE_2		= 0x09
	} AUX_HEADER_TYPE_2;

	typedef [public,enum8bit,flag(NDR_PAHEX)] enum {
		AUX_VERSION_1	= 0x1,
		AUX_VERSION_2	= 0x2
	} AUX_VERSION;

	typedef [public,switch_type(uint8)] union {
		[case(AUX_VERSION_1)] AUX_HEADER_TYPE_1	Type;
		[case(AUX_VERSION_2)] AUX_HEADER_TYPE_2	Type_2;
		[default];
	} AUX_HEADER_TYPE_ENUM;

	/*************************/
	/* AUX_HEADER case (0x1) */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		SessionID;
		uint16		RequestID;
	} AUX_PERF_REQUESTID;
	
	/*************************/
	/* AUX_HEADER case (0x2) */
	typedef [public,enum16bit, flag(NDR_PAHEX)] enum {
		CLIENTMODE_UNKNOWN	=	0x0,
		CLIENTMODE_CLASSIC	=	0x1,
		CLIENTMODE_CACHED	=	0x2
	} ClientMode;

	typedef [public,flag(NDR_NOALIGN)] struct {
		uint32		AdapterSpeed;
		uint16		ClientID;
		uint16		MachineNameOffset;
		uint16		UserNameOffset;
		uint16		ClientIPSize;
		uint16		ClientIPOffset;
		uint16		ClientIPMaskSize;
		uint16		ClientIPMaskOffset;
		uint16		AdapterNameOffset;
		uint16		MacAddressSize;
		uint16		MacAddressOffset;
		ClientMode	ClientMode;
		uint16		Reserved;
		uint8		MacAddress[MacAddressSize];
		uint8		ClientIP[ClientIPSize];
		uint8		ClientIPMask[ClientIPMaskSize];
		nstring		MachineName;
		nstring		UserName;
		nstring		AdapterName;
	} AUX_PERF_CLIENTINFO;

	/*************************/
	/* AUX_HEADER case (0x3) */
	typedef [enum16bit,flag(NDR_PAHEX)] enum {
		SERVERTYPE_UNKNOWN		= 0x0,
		SERVERTYPE_PRIVATE		= 0x1,
		SERVERTYPE_PUBLIC		= 0x2,
		SERVERTYPE_DIRECTORY		= 0x3,
		SERVERTYPE_REFERRAL		= 0x4
	} SERVERINFO_ServerType;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16			ServerID;
		SERVERINFO_ServerType	ServerType;
		uint16			ServerDNOffset;
		uint16			ServerNameOffset;
		nstring			ServerDN;
		nstring			ServerName;
	} AUX_PERF_SERVERINFO;

	/*************************/
	/* AUX_HEADER case (0x4) */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		SessionID;
		uint16		Reserved;
		GUID		SessionGuid;
	} AUX_PERF_SESSIONINFO;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		SessionID;
		uint16		Reserved;
		GUID		SessionGuid;
		uint32		ConnectionID;
	} AUX_PERF_SESSIONINFO_V2;

	/**************************/
	/* AUX_HEADER case (0x5)  */
	/* AUX_HEADER case (0xC)  */
	/* AUX_HEADER case (0x11) */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
		uint16		RequestID;
		uint16		Reserved;
	} AUX_PERF_DEFMDB_SUCCESS;

	/**************************/
	/* AUX_HEADER case (0x6)  */
	/* AUX_HEADER case (0xD)  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ServerID;
		uint16		SessionID;
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
		uint8		RequestOperation;
		uint8		Reserved[3];
	} AUX_PERF_DEFGC_SUCCESS;
	
	/**************************/
	/* AUX_HEADER case (0x7)  */
	/* AUX_HEADER case (0xE)  */
	/* AUX_HEADER case (0x13) */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint16		RequestID;
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
	} AUX_PERF_MDB_SUCCESS;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ProcessID;
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint16		RequestID;
		uint16		Reserved;
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
	} AUX_PERF_MDB_SUCCESS_V2;

	/**************************/
	/* AUX_HEADER case (0x8)  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint16		Reserved_1;
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
		uint8		RequestOperation;
		uint8		Reserved_2[3];
	} AUX_PERF_GC_SUCCESS;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ProcessID;
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint32		TimeSinceRequest;
		uint32		TimeToCompleteRequest;
		uint8		RequestOperation;
		uint8		Reserved[3];
	} AUX_PERF_GC_SUCCESS_V2;

	/**************************/
	/* AUX_HEADER case (0x9)  */
	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint16		RequestID;
		uint32		TimeSinceRequest;
		uint32		TimeToFailRequest;
		MAPISTATUS	ResultCode;
		uint8		RequestOperation;
		uint8		Reserved[3];
	} AUX_PERF_FAILURE;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ProcessID;
		uint16		ClientID;
		uint16		ServerID;
		uint16		SessionID;
		uint16		RequestID;
		uint16		Reserved_1;
		uint32		TimeSinceRequest;
		uint32		TimeToFailRequest;
		MAPISTATUS	ResultCode;
		uint8		RequestOperation;
		uint8		Reserved_2[3];
	} AUX_PERF_FAILURE_V2;

	/**************************/
	/* AUX_HEADER case (0xA)  */
	typedef [bitmap32bit] bitmap {
		ENABLE_PERF_SENDTOSERVER	= 0x00000001,
		ENABLE_PERF_SENDTOMAILBOX	= 0x00000002,
		ENABLE_COMPRESSION		= 0x00000004,
		ENABLE_HTTP_TUNNELING		= 0x00000008,
		ENABLE_PERF_SENDGCDATA		= 0x00000010
	} CLIENT_CONTROL_EnableFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		CLIENT_CONTROL_EnableFlags	EnableFlags;
		uint32				ExpiryTime;
	} AUX_CLIENT_CONTROL;

	/*************************/
	/* AUX_HEADER case (0xB) */
	typedef [nodiscriminant] union {
		[case(0x0)];
		[default] nstring	ProcessName;
	} ProcessNameString;

	typedef [flag(NDR_NOALIGN)] struct {
		uint16		ProcessID;
		uint16		Reserved1;
		GUID		ProcessGuid;
		uint16		ProcessNameOffset;
		uint16		Reserved2;
		[switch_is(ProcessNameOffset)] ProcessNameString ProcessName;
	} AUX_PERF_PROCESSINFO;

	/**************************/
	/* AUX_HEADER case (0x16) */
	typedef [flag(NDR_NOALIGN)] struct {
		uint32		OSVersionInfoSize;
		uint32		MajorVersion;
		uint32		MinorVersion;
		uint32		BuildNumber;
		[subcontext(0), subcontext_size(132), flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB Reserved_1;
		uint16		ServicePackMajor;
		uint16		ServicePackMinor;
		uint32		Reserved_2;
	} AUX_OSVERSIONINFO;

	/**************************/
	/* AUX_HEADER case (0x17) */
	typedef [bitmap32bit] bitmap {
		PUBLIC_FOLDERS_ENABLED	= 0x00000001
	} EXORGINFO_OrgFlags;

	typedef [flag(NDR_NOALIGN)] struct {
		EXORGINFO_OrgFlags	OrgFlags;
	} AUX_EXORGINFO;

	typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
		[case(AUX_TYPE_PERF_REQUESTID)]		AUX_PERF_REQUESTID		AUX_PERF_REQUESTID;
	  //		[case(AUX_TYPE_PERF_CLIENTDINFO)]	AUX_PERF_CLIENTINFO		AUX_PERF_CLIENTINFO;
		[case(AUX_TYPE_PERF_SERVERINFO)]	AUX_PERF_SERVERINFO		AUX_PERF_SERVERINFO;
		[case(AUX_TYPE_PERF_SESSIONINFO)]	AUX_PERF_SESSIONINFO		AUX_PERF_SESSIONINFO;
		[case(AUX_TYPE_PERF_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_MDB_SUCCESS)]	AUX_PERF_MDB_SUCCESS		AUX_PERF_MDB_SUCCESS;
		[case(AUX_TYPE_PERF_GC_SUCCESS)]	AUX_PERF_GC_SUCCESS		AUX_PERF_GC_SUCCESS;
		[case(AUX_TYPE_PERF_FAILURE)]		AUX_PERF_FAILURE		AUX_PERF_FAILURE;
		[case(AUX_TYPE_CLIENT_CONTROL)]		AUX_CLIENT_CONTROL		AUX_CLIENT_CONTROL;
		[case(AUX_TYPE_PERF_PROCESSINFO)]	AUX_PERF_PROCESSINFO		AUX_PERF_PROCESSINFO;
		[case(AUX_TYPE_PERF_BG_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_BG_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_BG_MDB_SUCCESS)]	AUX_PERF_MDB_SUCCESS		AUX_PERF_MDB_SUCCESS;
		[case(AUX_TYPE_PERF_BG_GC_SUCCESS)]	AUX_PERF_GC_SUCCESS		AUX_PERF_GC_SUCCESS;
		[case(AUX_TYPE_PERF_BG_FAILURE)]	AUX_PERF_FAILURE		AUX_PERF_FAILURE;
		[case(AUX_TYPE_PERF_FG_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_FG_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_FG_MDB_SUCCESS)]	AUX_PERF_MDB_SUCCESS		AUX_PERF_MDB_SUCCESS;
		[case(AUX_TYPE_PERF_FG_GC_SUCCESS)]	AUX_PERF_GC_SUCCESS		AUX_PERG_GC_SUCCESS;
		[case(AUX_TYPE_PERF_FG_FAILURE)]	AUX_PERF_FAILURE		AUX_PERF_FAILURE;
		[case(AUX_TYPE_OSVERSIONINFO)]		AUX_OSVERSIONINFO		AUX_OSVERSIONINFO;
		[case(AUX_TYPE_EXORGINFO)]		AUX_EXORGINFO			AUX_EXORGINFO;
		[default][flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	Payload;
	} AUX_HEADER_TYPE_UNION_1;

	typedef [public,nodiscriminant,flag(NDR_NOALIGN)] union {
		[case(AUX_TYPE_PERF_REQUESTID)]		AUX_PERF_REQUESTID		AUX_PERF_REQUESTID;
	  //	[case(AUX_TYPE_PERF_CLIENTDINFO)]	AUX_PERF_CLIENTINFO		AUX_PERF_CLIENTINFO;
		[case(AUX_TYPE_PERF_SERVERINFO)]	AUX_PERF_SERVERINFO		AUX_PERF_SERVERINFO;
		[case(AUX_TYPE_PERF_SESSIONINFO_2)]	AUX_PERF_SESSIONINFO_V2		AUX_PERF_SESSIONINFO_V2;	/* V2 specific */
		[case(AUX_TYPE_PERF_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_MDB_SUCCESS_2)]	AUX_PERF_MDB_SUCCESS_V2		AUX_PERF_MDB_SUCCESS_V2;	/* V2 specific */
		[case(AUX_TYPE_PERF_GC_SUCCESS_2)]	AUX_PERF_GC_SUCCESS_V2		AUX_PERF_GC_SUCCESS_V2;		/* V2 specific */
		[case(AUX_TYPE_PERF_FAILURE_2)]		AUX_PERF_FAILURE_V2		AUX_PERF_FAILURE_V2;		/* V2 specific*/
		[case(AUX_TYPE_CLIENT_CONTROL)]		AUX_CLIENT_CONTROL		AUX_CLIENT_CONTROL;
		[case(AUX_TYPE_PERF_PROCESSINFO)]	AUX_PERF_PROCESSINFO		AUX_PERF_PROCESSINFO;
		[case(AUX_TYPE_PERF_BG_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_BG_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_BG_MDB_SUCCESS)]	AUX_PERF_MDB_SUCCESS		AUX_PERF_MDB_SUCCESS;
		[case(AUX_TYPE_PERF_BG_GC_SUCCESS)]	AUX_PERF_GC_SUCCESS		AUX_PERF_GC_SUCCESS;
		[case(AUX_TYPE_PERF_BG_FAILURE)]	AUX_PERF_FAILURE		AUX_PERF_FAILURE;
		[case(AUX_TYPE_PERF_FG_DEFMDB_SUCCESS)]	AUX_PERF_DEFMDB_SUCCESS		AUX_PERF_DEFMDB_SUCCESS;
		[case(AUX_TYPE_PERF_FG_DEFGC_SUCCESS)]	AUX_PERF_DEFGC_SUCCESS		AUX_PERF_DEFGC_SUCCESS;
		[case(AUX_TYPE_PERF_FG_MDB_SUCCESS)]	AUX_PERF_MDB_SUCCESS		AUX_PERF_MDB_SUCCESS;
		[case(AUX_TYPE_PERF_FG_GC_SUCCESS)]	AUX_PERF_GC_SUCCESS		AUX_PERG_GC_SUCCESS;
		[case(AUX_TYPE_PERF_FG_FAILURE)]	AUX_PERF_FAILURE		AUX_PERF_FAILURE;
		[case(AUX_TYPE_OSVERSIONINFO)]		AUX_OSVERSIONINFO		AUX_OSVERSIONINFO;
		[case(AUX_TYPE_EXORGINFO)]		AUX_EXORGINFO			AUX_EXORGINFO;
		[default][flag(NDR_REMAINING|NDR_NOALIGN)] DATA_BLOB	Payload;
	} AUX_HEADER_TYPE_UNION_2;

	typedef [public,nopull,nopush,noprint,flag(NDR_NOALIGN)] struct {
		uint16							Size;
		AUX_VERSION						Version;
		uint8							Type;
		[switch_is(Type)] AUX_HEADER_TYPE_UNION_1		Payload_1;
		[switch_is(Type)] AUX_HEADER_TYPE_UNION_2		Payload_2;
	} AUX_HEADER;

	typedef [public,nopull,nopush,noprint] struct {
		RPC_HEADER_EXT								RPC_HEADER_EXT;
		[subcontext(0), subcontext_size(RPC_HEADER_EXT.Size)] AUX_HEADER	*AUX_HEADER;
	} mapi2k7_AuxInfo;


	[public,nopull,nopush,noprint] MAPISTATUS EcDoConnectEx(
		[out]				policy_handle				*handle,
		[in,string,charset(DOS)]	uint8					szUserDN[],
		[in]				uint32					ulFlags,
		[in]				uint32					ulConMod,
		[in]				uint32					cbLimit,
		[in]				uint32					ulCpid,
		[in]				uint32					ulLcidString,
		[in]				uint32					ulLcidSort,
		[in]				uint32					ulIcxrLink,
		[in]				uint16					usFCanConvertCodePages,
		[out]				uint32					*pcmsPollsMax,
		[out]				uint32					*pcRetry,
		[out]				uint32					*pcmsRetryDelay,
		[out]				uint32					*picxr,
		[out,ref,string,charset(DOS)]uint8					**szDNPrefix,
		[out,ref,string,charset(DOS)]uint8					**szDisplayName,
		[in]				uint16					rgwClientVersion[3],
		[out]				uint16					rgwServerVersion[3],
		[out]				uint16					rgwBestVersion[3],
		[in,out]			uint32					*pulTimeStamp,
		[in,subcontext(4),flag(NDR_REMAINING|NDR_NOALIGN)] mapi2k7_AuxInfo	*rgbAuxIn,
		[in][range(0,0x1008)]		uint32					cbAuxIn,
		[out, length_is(*pcbAuxOut), size_is(*pcbAuxOut)] mapi2k7_AuxInfo	*rgbAuxOut,
		[in,out][range(0,0x1008)]	uint32					*pcbAuxOut
		);

	/*****************/
	/* Function 0xb  */
	typedef [public,bitmap32bit] bitmap {
		pulFlags_NoCompression	= 0x00000001,
		pulFlags_NoXorMagic	= 0x00000002,
		pulFlags_Chain		= 0x00000004
	} pulFlags;

	typedef [public,nopull] struct {
		RPC_HEADER_EXT							header;
		[subcontext(0),flag(NDR_REMAINING|NDR_NOALIGN)] mapi_request	*mapi_request;
	} mapi2k7_request;

	typedef [public,nopull] struct {
		RPC_HEADER_EXT							header;
		[subcontext(0),flag(NDR_REMAINING|NDR_NOALIGN)] mapi_response	*mapi_response;
	} mapi2k7_response;

	[public,noprint] MAPISTATUS EcDoRpcExt2(
		[in,out]					policy_handle	*handle,
		[in,out]					uint32		*pulFlags,
		[in, size_is(cbIn)]				uint8		rgbIn[],
		[in]						uint32		cbIn,
		[out, length_is(*pcbOut), size_is(*pcbOut)]	uint8		rgbOut[],
		[in,out][range(0x0,0x40000)]			uint32		*pcbOut,
		[in, size_is(cbAuxIn)]				uint8		rgbAuxIn[],
		[in]						uint32		cbAuxIn,
		[out, length_is(*pcbAuxOut), size_is(*pcbAuxOut)] uint8		rgbAuxOut[],
		[in,out][range(0x0,0x1008)]			uint32		*pcbAuxOut,
		[out]						uint32		*pulTransTime
		);

	/*****************/
	/* Function 0xc  */
	void EcUnknown0xC();

	/*****************/
	/* Function 0xd  */
	void EcUnknown0xD();

	/*****************/
	/* Function 0xe  */
	[public] MAPISTATUS EcDoAsyncConnectEx(
		[in] policy_handle	*handle,
		[out] policy_handle	*async_handle
		);

}

[
  uuid("c840a7dc-42c0-1a10-b4b9-08002b2fe182"),
  pointer_default(unique),
  helpstring("Unknown")
] interface exchange_unknown
{
	void unknown_dummy();
}
