home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / tnef.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  13.9 KB  |  374 lines

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