[Evolution-hackers] Exchange 5.5 - network reverse engineering underway (MAPI, Nspi)
- From: Luke Kenneth Casson Leighton <lkcl lkcl net>
- To: evolution-hackers lists ximian com
- Subject: [Evolution-hackers] Exchange 5.5 - network reverse engineering underway (MAPI, Nspi)
- Date: Tue, 1 Feb 2005 15:06:41 +0000
hi,
i've begun the network-reverse-engineering necessary to interoperating
with Exchange 5.5 and Outlook.
i have a basic test client and a basic server which is able to return
hard coded data structures.
the key difference between the present attempt and all previous ones is
that i have started from FreeDCE not from decoding MSRPC on-wire, so i
have a 99.5% IDL file (2 actually) which define the interfaces. FreeDCE
turns that into c code, and it's a matter of filling in the blanks.
unfortunately there are a lot of blanks. _fortunately_, the data
structures of emsabp.idl (the Nspi interface) are IDENTICAL to those
used in mapidefs.h - see Wine's include/windows/mapidefs.h
anybody interested in helping out please contact me.
in particular, help with tying in MAPI which is actually MS-TNEF which
is winmail.dat which is therefore directly relevant to evolution,
much appreciated.
l.
--
--
<a href="http://lkcl.net">http://lkcl.net</a>
--
[ uuid(f5cc5a18-4264-101a-8c59-08002b2f8426),
version(56.0),
implicit_handle(handle_t rpc_binding)
] interface emsabp
{
/* this is mostly identical to wine/include/mapidefs.h,
* up until MAPIERROR, at which point it looks completely
* unfamiliar and alien.
*
* the functions in the IMAPITable only look _vaguely_
* familiar but are like, utterly different.
* really odd. same data structures. different functions.
* oh well.
*/
#define PR_ENTRYID 0x0fff0102
#define PR_OBJECTID 0xfffd0003
#define PR_DISPLAY_NAME 0x3001001e
#define PT_CONTAINER_FLAGS 0x36000003 /* PCF_ISCONTAINER | PCF_HASCHILDCONTAINER */
#define PR_DEPTH 0x30050003
#define PR_PARENTENTRYID 0xfffc0102
typedef unsigned short WCHAR;
typedef struct {
long element_1;
long element_2;
long element_3;
long element_4;
long element_5;
long element_6;
long element_7;
long element_8;
long element_9;
} EMS_MAPI_UNIDENTIFIED;
typedef struct {
char ab[16];
} MAPIUID;
typedef [context_handle] void *emsabp_hnd_t;
long NspiBind(
[in] handle_t element_11,
[in] long element_12,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_13,
[in,out, unique] MAPIUID *element_14,
[out] emsabp_hnd_t *element_15
);
long NspiUnbind(
[in,out] emsabp_hnd_t *element_16,
[in] long element_17
);
long NspiUpdateStat(
[in] emsabp_hnd_t element_18,
[in] long element_19,
[in,out, ref] EMS_MAPI_UNIDENTIFIED *element_20,
[in,out, unique] long *element_21
);
/* typedef [ptr, string] unsigned long *EMS_SPropTagArray;*/
/* this is probably an SPropTagArray. although it doesn't match
* up with the definition in wine/includes/mapidefs.h, it also
* is the data structure i've had the most difficulty with, matching
* it to on-wire format.
*/
typedef struct {
[unique, length_is(cValues), size_is(cValues)] long *aulPropTag;
long cValues;
/*long element_24;*/
} EMS_SPropTagArray;
typedef [unique] EMS_SPropTagArray *EMS_LPSPropTagArray ;
typedef struct {
long cb;
[size_is(cb), ptr] char *lpb;
} EMS_SBinary;
typedef struct {
long dwLowDateTime;
long dwHighDateTime;
} EMS_FILETIME;
typedef struct {
long cValues;
[size_is(cValues), ptr] short *lpi;
} EMS_SShortArray;
typedef struct {
long cValues;
[size_is(cValues), ptr] long *lpl;
} EMS_MULTIVALUE_LONG_STRUCT;
typedef struct {
long cValues;
[size_is(cValues), ptr] long *lppszA; /* this doesn't look right: should be a LPSTR */
} EMS_SLPSTRArray;
typedef struct {
long cValues;
[size_is(cValues), ptr] EMS_SBinary *lpbin;
} EMS_SBinaryArray;
typedef struct {
long cValues;
[size_is(cValues), ptr] long *lpguid; /* this doesn't look right: it should be a GUID* */
} EMS_SGuidArray;
typedef struct {
long cValues;
[size_is(cValues), ptr] long *lpi; /* this doesn't look right: it should be a LPWSTR* */
} EMS_MULTIVALUE_UNICODE_STRUCT;
typedef struct {
long cValues;
[size_is(cValues), ptr] EMS_FILETIME *lpft;
} EMS_SDateTimeArray;
typedef [ptr, string] unsigned short *WSTRING;
typedef [ptr, string] char *STRING;
#define PT_UNSPECIFIED 0x0000
#define PT_NULL 0x0001
#define PT_I2 0002
#define PT_LONG 0003
#define PT_R4 0004
#define PT_DOUBLE 0x0005
#define PT_CURRENCY 0x0006
#define PT_APPTIME 0x0007
/*#define PT_CLSID 0x0008 */
#define PT_ERROR 0x000a
/*
means in a response package, that the given attribute contains no value,
or not exists.
-> So it won't be contained in the enumeration of the attrib. values array.
*/
#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_BINARY 0x0102 /*(the corresponding ???HDR entry is 4 bytes longer in this case!) 1??? */
/* MV means MultiValued*/
#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 [switch_type(long)] union {
[case(PT_I2)] short i;
[case(PT_LONG)] long l;
[case(PT_BOOLEAN)] short b;
[case(PT_STRING8)] STRING lpszA;
[case(PT_BINARY)] EMS_SBinary bin;
[case(PT_UNICODE)] WSTRING lpszW;
[case(PT_CLSID), ptr] MAPIUID *lpguid;
[case(PT_SYSTIME)] EMS_FILETIME ft;
[case(PT_ERROR)] long err;
[case(PT_MV_I2)] EMS_SShortArray MVi;
[case(PT_MV_LONG)] EMS_MULTIVALUE_LONG_STRUCT MVl;
[case(PT_MV_STRING8)] EMS_SLPSTRArray MVszA;
[case(PT_MV_BINARY)] EMS_SBinaryArray MVbin;
[case(PT_MV_CLSID)] EMS_SGuidArray MVguid;
[case(PT_MV_UNICODE)] EMS_MULTIVALUE_UNICODE_STRUCT MVszW;
[case(PT_MV_SYSTIME)] EMS_SDateTimeArray MVft;
[case(PT_NULL)] long null;
[case(PT_OBJECT)] long object;
} EMS_SPropValue_CTR;
typedef struct {
long ulPropTag;
long dwAlignPad;
[switch_is(ulPropTag)] EMS_SPropValue_CTR Value;
} EMS_SPropValue;
typedef struct {
long ulAdrEntryPad;
long cValues;
[size_is(cValues), unique] EMS_SPropValue *lpProps;
} EMS_SRow;
typedef [unique] EMS_SRow *EMS_SRow_PTR ;
typedef struct {
long cRows;
[size_is(cRows)] EMS_SRow aRow[*];
} EMS_SRowSet;
typedef [unique] EMS_SRowSet *EMS_SRowSet_PTR ;
long NspiQueryRows(
[in] emsabp_hnd_t element_69,
[in] long element_70,
[in,out, ref] EMS_MAPI_UNIDENTIFIED *element_71,
[in] long lRows,
[in, size_is(lRows), unique] long *element_73,
[in] long element_74,
[in, ref] EMS_SPropTagArray *element_75,
[out, ref] EMS_SRowSet_PTR *element_76
);
long NspiSeekEntries(
[in] emsabp_hnd_t element_77,
[in] long element_78,
[in,out, ref] EMS_MAPI_UNIDENTIFIED *element_79,
[in, ref] EMS_SPropValue *element_80,
[in, unique] EMS_SPropTagArray *element_81,
[in, unique] EMS_SPropTagArray *element_82,
[out, ref] EMS_SRowSet_PTR *element_83
);
typedef [ptr] struct _SRestriction *LPSRestriction;
typedef struct {
long cRes;
[size_is(cRes)] LPSRestriction lpRes;
} EMS_SAndRestriction;
typedef struct {
long cRes;
[size_is(cRes)] LPSRestriction lpRes;
} EMS_SOrRestriction;
typedef struct {
/* ULONG ulReserved - perhaps an [ignore] property on this one? */
LPSRestriction lpRes;
} EMS_SNotRestriction;
typedef struct {
long ulFuzzyLevel;
long ulPropTag;
[ptr] EMS_SPropValue *lpProp;
} EMS_SContentRestriction;
typedef struct {
long relop;
long ulPropTag;
[ptr] EMS_SPropValue *lpProp;
} EMS_SPropertyRestriction;
typedef struct {
long ulReserved1;
long ulPropTag;
long ulReserved2;
} EMS_SExistRestriction;
typedef struct {
long relop;
long ulPropTag;
long cb;
} EMS_SSizeRestriction;
typedef struct {
long relBMR;
long ulPropTag;
long ulMask;
} EMS_SBitMaskRestriction;
typedef struct {
long relop;
long ulPropTag1;
long ulPropTag2;
} EMS_SComparePropsRestriction;
typedef struct {
long ulSubObject;
LPSRestriction lpRes;
} EMS_SSubRestriction;
typedef struct {
[unique] MAPIUID *lpguid;
long ulKind;
long lID; /* this is actually a union in mapidefs.h */
} EMS_MAPINAMEID;
/* Restriction types */
#define RES_AND 0U
#define RES_OR 1U
#define RES_NOT 2U
#define RES_CONTENT 3U
#define RES_PROPERTY 4U
#define RES_COMPAREPROPS 5U
#define RES_BITMASK 6U
#define RES_SIZE 7U
#define RES_EXIST 8U
#define RES_SUBRESTRICTION 9U
#define RES_COMMENT 10U
typedef [switch_type(long)] union {
[case(RES_AND) ] EMS_SAndRestriction resAnd;
[case(RES_OR) ] EMS_SOrRestriction resOr;
[case(RES_NOT) ] EMS_SNotRestriction resNot;
[case(RES_CONTENT) ] EMS_SContentRestriction resContent;
[case(RES_PROPERTY) ] EMS_SPropertyRestriction resProperty;
[case(RES_COMPAREPROPS) ] EMS_SComparePropsRestriction resCompareProps;
[case(RES_BITMASK) ] EMS_SBitMaskRestriction resBitMask;
[case(RES_SUBRESTRICTION)] EMS_SSubRestriction resSub;
[case(RES_SIZE) ] EMS_SSizeRestriction resSize;
[case(RES_EXIST) ] EMS_SExistRestriction resExist;
/* case SCommentRestriction is missing! */
} EMS_SRestriction_CTR;
typedef struct _SRestriction {
long rt;
[switch_is(rt)] EMS_SRestriction_CTR res;
} EMS_SRestriction;
long NspiGetMatches(
[in] emsabp_hnd_t element_110,
[in] long element_111,
[in,out, ref] EMS_MAPI_UNIDENTIFIED *element_112,
[in, unique] EMS_SPropTagArray *element_113,
[in] long element_114,
[in, unique] EMS_SRestriction *element_115,
[in, unique] EMS_MAPINAMEID *element_116,
[in] long element_117,
[out, ref] EMS_SPropTagArray *element_118,
[in, ref] EMS_SPropTagArray *element_119,
[out, ref] EMS_SRowSet_PTR *element_120
);
long NspiResortRestriction(
[in] emsabp_hnd_t element_121,
[in] long element_122,
[in,out, ref] EMS_MAPI_UNIDENTIFIED *element_123,
[in, ref] EMS_SPropTagArray *element_124,
[in,out, ref] EMS_LPSPropTagArray *element_125
);
typedef struct {
long element_126;
[unique, string] char *element_127;
} EMS_NAME_STRING;
long NspiDNToEph(
[in] emsabp_hnd_t element_128,
[in] long element_129,
[in, ref] EMS_NAME_STRING *element_130,
[out, ref] EMS_SPropTagArray *element_131
);
long NspiGetPropList(
[in] emsabp_hnd_t element_132,
[in] long element_133,
[in] long element_134,
[in] long element_135,
[out, ref] EMS_LPSPropTagArray *element_136
);
long NspiGetProps(
[in] emsabp_hnd_t element_137,
[in] long element_138,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_139,
[in, unique] EMS_SPropTagArray *element_140,
[out, ref] EMS_SRow_PTR *element_141
);
long NspiCompareDNTs(
[in] emsabp_hnd_t element_142,
[in] long element_143,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_144,
[in] long element_145,
[in] long element_146,
[out, ref] long *element_147
);
long NspiModProps(
[in] emsabp_hnd_t element_148,
[in] long element_149,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_150,
[in, unique] EMS_SPropTagArray *element_151,
[in, ref] EMS_SRow *element_152
);
long NspiGetHierarchyInfo(
[in] emsabp_hnd_t element_153,
[in] long element_154,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_155,
[in,out, ref] long *element_156,
[out, ref] EMS_SRowSet_PTR *element_157
);
long NspiGetTemplateInfo(
[in] emsabp_hnd_t element_158,
[in] long element_159,
[in] long element_160,
[in, unique, string] char *element_161,
[in] long element_162,
[in] long element_163,
[out, ref] EMS_SRow_PTR *element_164
);
long NspiModLInkAtt(
[in] emsabp_hnd_t element_165,
[in] long element_166,
[in] long element_167,
[in] long element_168,
[in, ref] EMS_SBinaryArray *element_169
);
long NspiDeleteEntries(
[in] emsabp_hnd_t element_170,
[in] long element_171,
[in] long element_172,
[in, ref] EMS_SBinaryArray *element_173
);
long NspiQueryColumns(
[in] emsabp_hnd_t element_174,
[in] long element_175,
[in] long element_176,
[out, ref] EMS_LPSPropTagArray *element_177
);
typedef struct {
long element_178;
[unique] MAPIUID *element_179;
} EMS_NAME_CLSID;
typedef [ptr] EMS_NAME_CLSID *EMS_NAME_CLSID_PTR;
long NspiGetNamesFromIDs(
[in] emsabp_hnd_t element_180,
[in] long element_181,
[in, unique] MAPIUID *element_182,
[in, unique] EMS_SPropTagArray *element_183,
[out, ref] EMS_LPSPropTagArray *element_184,
[out, ref] EMS_NAME_CLSID_PTR *element_185
);
long NspiGetIDsFromNames(
[in] emsabp_hnd_t element_186,
[in] long element_187,
[in] long element_188,
[in] long element_189,
[in, size_is(element_189), ref] long *element_190,
[out, ref] EMS_LPSPropTagArray *element_191
);
long NspiResolveNames(
[in] emsabp_hnd_t element_192,
[in] long element_193,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_194,
[in, unique] EMS_SPropTagArray *element_195,
[in, ref] EMS_NAME_STRING *element_196,
[out, ref] EMS_LPSPropTagArray *element_197,
[out, ref] EMS_SRowSet_PTR *element_198
);
typedef struct {
long element_199;
[unique, string] WCHAR *element_200;
} EMS_NAME_UNICODE;
long NspiResolveNamesW(
[in] emsabp_hnd_t element_201,
[in] long element_202,
[in, ref] EMS_MAPI_UNIDENTIFIED *element_203,
[in, unique] EMS_SPropTagArray *element_204,
[in, ref] EMS_NAME_UNICODE *element_205,
[out, ref] EMS_LPSPropTagArray *element_206,
[out, ref] EMS_SRowSet_PTR *element_207
);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]