Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

375 lines
11 KiB

  1. /*
  2. * T N E F . H
  3. *
  4. *
  5. * This file contains structure and function definitions for the
  6. * MAPI implementation of the Transport Neutral Encapsilation Format
  7. * used by MAPI providers for the neutral serialization of a MAPI
  8. * message. This implementation sits on top of the IStream object as
  9. * documented in the OLE 2 Specs.
  10. *
  11. * Copyright 1986-1999 Microsoft Corporation. All Rights Reserved.
  12. */
  13. #ifndef TNEF_H
  14. #define TNEF_H
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. #ifndef BEGIN_INTERFACE
  22. #define BEGIN_INTERFACE
  23. #endif
  24. /* ------------------------------------ */
  25. /* TNEF Problem and TNEF Problem Arrays */
  26. /* ------------------------------------ */
  27. typedef struct _STnefProblem
  28. {
  29. ULONG ulComponent;
  30. ULONG ulAttribute;
  31. ULONG ulPropTag;
  32. SCODE scode;
  33. } STnefProblem;
  34. typedef struct _STnefProblemArray
  35. {
  36. ULONG cProblem;
  37. STnefProblem aProblem[MAPI_DIM];
  38. } STnefProblemArray, FAR * LPSTnefProblemArray;
  39. #define CbNewSTnefProblemArray(_cprob) \
  40. (offsetof(STnefProblemArray,aProblem) + (_cprob)*sizeof(STnefProblem))
  41. #define CbSTnefProblemArray(_lparray) \
  42. (offsetof(STnefProblemArray,aProblem) + \
  43. (UINT) ((_lparray)->cProblem*sizeof(STnefProblem)))
  44. /* Pointers to TNEF Interface ---------------------------------------- */
  45. DECLARE_MAPI_INTERFACE_PTR(ITnef, LPITNEF);
  46. /* OpenTNEFStream */
  47. #define TNEF_DECODE ((ULONG) 0)
  48. #define TNEF_ENCODE ((ULONG) 2)
  49. #define TNEF_PURE ((ULONG) 0x00010000)
  50. #define TNEF_COMPATIBILITY ((ULONG) 0x00020000)
  51. #define TNEF_BEST_DATA ((ULONG) 0x00040000)
  52. #define TNEF_COMPONENT_ENCODING ((ULONG) 0x80000000)
  53. /* AddProps, ExtractProps */
  54. #define TNEF_PROP_INCLUDE ((ULONG) 0x00000001)
  55. #define TNEF_PROP_EXCLUDE ((ULONG) 0x00000002)
  56. #define TNEF_PROP_CONTAINED ((ULONG) 0x00000004)
  57. #define TNEF_PROP_MESSAGE_ONLY ((ULONG) 0x00000008)
  58. #define TNEF_PROP_ATTACHMENTS_ONLY ((ULONG) 0x00000010)
  59. #define TNEF_PROP_CONTAINED_TNEF ((ULONG) 0x00000040)
  60. /* FinishComponent */
  61. #define TNEF_COMPONENT_MESSAGE ((ULONG) 0x00001000)
  62. #define TNEF_COMPONENT_ATTACHMENT ((ULONG) 0x00002000)
  63. #define MAPI_ITNEF_METHODS(IPURE) \
  64. MAPIMETHOD(AddProps) \
  65. (THIS_ ULONG ulFlags, \
  66. ULONG ulElemID, \
  67. LPVOID lpvData, \
  68. LPSPropTagArray lpPropList) IPURE; \
  69. MAPIMETHOD(ExtractProps) \
  70. (THIS_ ULONG ulFlags, \
  71. LPSPropTagArray lpPropList, \
  72. LPSTnefProblemArray FAR * lpProblems) IPURE; \
  73. MAPIMETHOD(Finish) \
  74. (THIS_ ULONG ulFlags, \
  75. WORD FAR * lpKey, \
  76. LPSTnefProblemArray FAR * lpProblems) IPURE; \
  77. MAPIMETHOD(OpenTaggedBody) \
  78. (THIS_ LPMESSAGE lpMessage, \
  79. ULONG ulFlags, \
  80. LPSTREAM FAR * lppStream) IPURE; \
  81. MAPIMETHOD(SetProps) \
  82. (THIS_ ULONG ulFlags, \
  83. ULONG ulElemID, \
  84. ULONG cValues, \
  85. LPSPropValue lpProps) IPURE; \
  86. MAPIMETHOD(EncodeRecips) \
  87. (THIS_ ULONG ulFlags, \
  88. LPMAPITABLE lpRecipientTable) IPURE; \
  89. MAPIMETHOD(FinishComponent) \
  90. (THIS_ ULONG ulFlags, \
  91. ULONG ulComponentID, \
  92. LPSPropTagArray lpCustomPropList, \
  93. LPSPropValue lpCustomProps, \
  94. LPSPropTagArray lpPropList, \
  95. LPSTnefProblemArray FAR * lpProblems) IPURE; \
  96. #undef INTERFACE
  97. #define INTERFACE ITnef
  98. DECLARE_MAPI_INTERFACE_(ITnef, IUnknown)
  99. {
  100. BEGIN_INTERFACE
  101. MAPI_IUNKNOWN_METHODS(PURE)
  102. MAPI_ITNEF_METHODS(PURE)
  103. };
  104. STDMETHODIMP OpenTnefStream(
  105. LPVOID lpvSupport,
  106. LPSTREAM lpStream,
  107. LPTSTR lpszStreamName,
  108. ULONG ulFlags,
  109. LPMESSAGE lpMessage,
  110. WORD wKeyVal,
  111. LPITNEF FAR * lppTNEF);
  112. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENTNEFSTREAM) (
  113. LPVOID lpvSupport,
  114. LPSTREAM lpStream,
  115. LPTSTR lpszStreamName,
  116. ULONG ulFlags,
  117. LPMESSAGE lpMessage,
  118. WORD wKeyVal,
  119. LPITNEF FAR * lppTNEF);
  120. STDMETHODIMP OpenTnefStreamEx(
  121. LPVOID lpvSupport,
  122. LPSTREAM lpStream,
  123. LPTSTR lpszStreamName,
  124. ULONG ulFlags,
  125. LPMESSAGE lpMessage,
  126. WORD wKeyVal,
  127. LPADRBOOK lpAdressBook,
  128. LPITNEF FAR * lppTNEF);
  129. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENTNEFSTREAMEX) (
  130. LPVOID lpvSupport,
  131. LPSTREAM lpStream,
  132. LPTSTR lpszStreamName,
  133. ULONG ulFlags,
  134. LPMESSAGE lpMessage,
  135. WORD wKeyVal,
  136. LPADRBOOK lpAdressBook,
  137. LPITNEF FAR * lppTNEF);
  138. STDMETHODIMP GetTnefStreamCodepage (
  139. LPSTREAM lpStream,
  140. ULONG FAR * lpulCodepage,
  141. ULONG FAR * lpulSubCodepage);
  142. typedef HRESULT (STDMETHODCALLTYPE FAR * LPGETTNEFSTREAMCODEPAGE) (
  143. LPSTREAM lpStream,
  144. ULONG FAR * lpulCodepage,
  145. ULONG FAR * lpulSubCodepage);
  146. #define OPENTNEFSTREAM "OpenTnefStream"
  147. #define OPENTNEFSTREAMEX "OpenTnefStreamEx"
  148. #define GETTNEFSTREAMCODEPAGE "GetTnefStreamCodePage"
  149. /* -------------------------- */
  150. /* TNEF Signature and Version */
  151. /* -------------------------- */
  152. #define MAKE_TNEF_VERSION(_mj,_mn) (((ULONG)(0x0000FFFF & _mj) << 16) | (ULONG)(0x0000FFFF & _mn))
  153. #define TNEF_SIGNATURE ((ULONG) 0x223E9F78)
  154. #define TNEF_VERSION ((ULONG) MAKE_TNEF_VERSION(1,0))
  155. /* ------------------------------------------- */
  156. /* TNEF Down-level Attachment Types/Structures */
  157. /* ------------------------------------------- */
  158. typedef WORD ATYP;
  159. enum { atypNull, atypFile, atypOle, atypPicture, atypMax };
  160. #define MAC_BINARY ((DWORD) 0x00000001)
  161. #include <pshpack1.h>
  162. typedef struct _renddata
  163. {
  164. ATYP atyp;
  165. ULONG ulPosition;
  166. WORD dxWidth;
  167. WORD dyHeight;
  168. DWORD dwFlags;
  169. } RENDDATA, *PRENDDATA;
  170. #include <poppack.h>
  171. /* ----------------------------------- */
  172. /* TNEF Down-level Date/Time Structure */
  173. /* ----------------------------------- */
  174. #include <pshpack1.h>
  175. typedef struct _dtr
  176. {
  177. WORD wYear;
  178. WORD wMonth;
  179. WORD wDay;
  180. WORD wHour;
  181. WORD wMinute;
  182. WORD wSecond;
  183. WORD wDayOfWeek;
  184. } DTR;
  185. #include <poppack.h>
  186. /* ----------------------------- */
  187. /* TNEF Down-level Message Flags */
  188. /* ----------------------------- */
  189. #define fmsNull ((BYTE) 0x00)
  190. #define fmsModified ((BYTE) 0x01)
  191. #define fmsLocal ((BYTE) 0x02)
  192. #define fmsSubmitted ((BYTE) 0x04)
  193. #define fmsRead ((BYTE) 0x20)
  194. #define fmsHasAttach ((BYTE) 0x80)
  195. /* ----------------------------------------- */
  196. /* TNEF Down-level Triple Address Structures */
  197. /* ----------------------------------------- */
  198. #define trpidNull ((WORD) 0x0000)
  199. #define trpidUnresolved ((WORD) 0x0001)
  200. #define trpidResolvedNSID ((WORD) 0x0002)
  201. #define trpidResolvedAddress ((WORD) 0x0003)
  202. #define trpidOneOff ((WORD) 0x0004)
  203. #define trpidGroupNSID ((WORD) 0x0005)
  204. #define trpidOffline ((WORD) 0x0006)
  205. #define trpidIgnore ((WORD) 0x0007)
  206. #define trpidClassEntry ((WORD) 0x0008)
  207. #define trpidResolvedGroupAddress ((WORD) 0x0009)
  208. typedef struct _trp
  209. {
  210. WORD trpid;
  211. WORD cbgrtrp;
  212. WORD cch;
  213. WORD cbRgb;
  214. } TRP, *PTRP, *PGRTRP, FAR * LPTRP;
  215. #define CbOfTrp(_p) (sizeof(TRP) + (_p)->cch + (_p)->cbRgb)
  216. #define LpszOfTrp(_p) ((LPSTR)(((LPTRP) (_p)) + 1))
  217. #define LpbOfTrp(_p) (((LPBYTE)(((LPTRP)(_p)) + 1)) + (_p)->cch)
  218. #define LptrpNext(_p) ((LPTRP)((LPBYTE)(_p) + CbOfTrp(_p)))
  219. typedef DWORD XTYPE;
  220. #define xtypeUnknown ((XTYPE) 0)
  221. #define xtypeInternet ((XTYPE) 6)
  222. #define cbDisplayName 41
  223. #define cbEmailName 11
  224. #define cbSeverName 12
  225. typedef struct _ADDR_ALIAS
  226. {
  227. char rgchName[cbDisplayName];
  228. char rgchEName[cbEmailName];
  229. char rgchSrvr[cbSeverName];
  230. ULONG dibDetail;
  231. WORD type;
  232. } ADDRALIAS, FAR * LPADDRALIAS;
  233. #define cbALIAS sizeof(ALIAS)
  234. #define cbTYPE 16
  235. #define cbMaxIdData 200
  236. typedef struct _NSID
  237. {
  238. DWORD dwSize;
  239. unsigned char uchType[cbTYPE];
  240. XTYPE xtype;
  241. LONG lTime;
  242. union
  243. {
  244. ADDRALIAS alias;
  245. char rgchInterNet[1];
  246. } address;
  247. } NSID, * LPNSID;
  248. #define cbNSID sizeof(NSID)
  249. /* -------------------------- */
  250. /* TNEF Down-level Priorities */
  251. /* -------------------------- */
  252. #define prioLow 3
  253. #define prioNorm 2
  254. #define prioHigh 1
  255. /* ------------------------------------- */
  256. /* TNEF Down-level Attributes/Properties */
  257. /* ------------------------------------- */
  258. #define atpTriples ((WORD) 0x0000)
  259. #define atpString ((WORD) 0x0001)
  260. #define atpText ((WORD) 0x0002)
  261. #define atpDate ((WORD) 0x0003)
  262. #define atpShort ((WORD) 0x0004)
  263. #define atpLong ((WORD) 0x0005)
  264. #define atpByte ((WORD) 0x0006)
  265. #define atpWord ((WORD) 0x0007)
  266. #define atpDword ((WORD) 0x0008)
  267. #define atpMax ((WORD) 0x0009)
  268. #define LVL_MESSAGE ((BYTE) 0x01)
  269. #define LVL_ATTACHMENT ((BYTE) 0x02)
  270. #define ATT_ID(_att) ((WORD) ((_att) & 0x0000FFFF))
  271. #define ATT_TYPE(_att) ((WORD) (((_att) >> 16) & 0x0000FFFF))
  272. #define ATT(_atp, _id) ((((DWORD) (_atp)) << 16) | ((WORD) (_id)))
  273. #define attNull ATT( 0, 0x0000)
  274. #define attFrom ATT( atpTriples, 0x8000) /* PR_ORIGINATOR_RETURN_ADDRESS */
  275. #define attSubject ATT( atpString, 0x8004) /* PR_SUBJECT */
  276. #define attDateSent ATT( atpDate, 0x8005) /* PR_CLIENT_SUBMIT_TIME */
  277. #define attDateRecd ATT( atpDate, 0x8006) /* PR_MESSAGE_DELIVERY_TIME */
  278. #define attMessageStatus ATT( atpByte, 0x8007) /* PR_MESSAGE_FLAGS */
  279. #define attMessageClass ATT( atpWord, 0x8008) /* PR_MESSAGE_CLASS */
  280. #define attMessageID ATT( atpString, 0x8009) /* PR_MESSAGE_ID */
  281. #define attParentID ATT( atpString, 0x800A) /* PR_PARENT_ID */
  282. #define attConversationID ATT( atpString, 0x800B) /* PR_CONVERSATION_ID */
  283. #define attBody ATT( atpText, 0x800C) /* PR_BODY */
  284. #define attPriority ATT( atpShort, 0x800D) /* PR_IMPORTANCE */
  285. #define attAttachData ATT( atpByte, 0x800F) /* PR_ATTACH_DATA_xxx */
  286. #define attAttachTitle ATT( atpString, 0x8010) /* PR_ATTACH_FILENAME */
  287. #define attAttachMetaFile ATT( atpByte, 0x8011) /* PR_ATTACH_RENDERING */
  288. #define attAttachCreateDate ATT( atpDate, 0x8012) /* PR_CREATION_TIME */
  289. #define attAttachModifyDate ATT( atpDate, 0x8013) /* PR_LAST_MODIFICATION_TIME */
  290. #define attDateModified ATT( atpDate, 0x8020) /* PR_LAST_MODIFICATION_TIME */
  291. #define attAttachTransportFilename ATT( atpByte, 0x9001) /* PR_ATTACH_TRANSPORT_NAME */
  292. #define attAttachRenddata ATT( atpByte, 0x9002)
  293. #define attMAPIProps ATT( atpByte, 0x9003)
  294. #define attRecipTable ATT( atpByte, 0x9004) /* PR_MESSAGE_RECIPIENTS */
  295. #define attAttachment ATT( atpByte, 0x9005)
  296. #define attTnefVersion ATT( atpDword, 0x9006)
  297. #define attOemCodepage ATT( atpByte, 0x9007)
  298. #define attOriginalMessageClass ATT( atpWord, 0x0006) /* PR_ORIG_MESSAGE_CLASS */
  299. #define attOwner ATT( atpByte, 0x0000) /* PR_RCVD_REPRESENTING_xxx or
  300. PR_SENT_REPRESENTING_xxx */
  301. #define attSentFor ATT( atpByte, 0x0001) /* PR_SENT_REPRESENTING_xxx */
  302. #define attDelegate ATT( atpByte, 0x0002) /* PR_RCVD_REPRESENTING_xxx */
  303. #define attDateStart ATT( atpDate, 0x0006) /* PR_DATE_START */
  304. #define attDateEnd ATT( atpDate, 0x0007) /* PR_DATE_END */
  305. #define attAidOwner ATT( atpLong, 0x0008) /* PR_OWNER_APPT_ID */
  306. #define attRequestRes ATT( atpShort, 0x0009) /* PR_RESPONSE_REQUESTED */
  307. #ifdef __cplusplus
  308. }
  309. #endif
  310. #endif /* defined TNEF_H */