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.

477 lines
18 KiB

  1. /*
  2. * M A P I . H
  3. *
  4. * Messaging Applications Programming Interface.
  5. *
  6. * Copyright 1993-1995 Microsoft Corporation. All Rights Reserved.
  7. *
  8. * Purpose:
  9. *
  10. * This file defines the structures and constants used by that
  11. * subset of the Messaging Applications Programming Interface
  12. * which is supported under Windows by Microsoft Mail for PC
  13. * Networks version 3.x.
  14. */
  15. #ifndef MAPI_H
  16. #define MAPI_H
  17. /*
  18. * Types.
  19. */
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. typedef unsigned long FAR * LPULONG;
  24. typedef unsigned long FLAGS;
  25. #ifndef __LHANDLE
  26. #define __LHANDLE
  27. typedef unsigned long LHANDLE, FAR * LPLHANDLE;
  28. #endif
  29. typedef unsigned char FAR * LPBYTE;
  30. #define lhSessionNull ((LHANDLE)0)
  31. typedef struct
  32. {
  33. ULONG ulReserved; /* Reserved for future use (must be 0) */
  34. ULONG flFlags; /* Flags */
  35. ULONG nPosition; /* character in text to be replaced by attachment */
  36. LPSTR lpszPathName; /* Full path name of attachment file */
  37. LPSTR lpszFileName; /* Original file name (optional) */
  38. LPVOID lpFileType; /* Attachment file type (can be lpMapiFileTagExt) */
  39. } MapiFileDescA, FAR * lpMapiFileDescA;
  40. #ifdef WIN32
  41. typedef struct
  42. {
  43. ULONG ulReserved; /* Reserved for future use (must be 0) */
  44. ULONG flFlags; /* Flags */
  45. ULONG nPosition; /* character in text to be replaced by attachment */
  46. LPWSTR lpszPathName; /* Full path name of attachment file */
  47. LPWSTR lpszFileName; /* Original file name (optional) */
  48. LPVOID lpFileType; /* Attachment file type (can be lpMapiFileTagExt) */
  49. } MapiFileDescW, FAR * lpMapiFileDescW;
  50. #endif /* WIN32 */
  51. #ifdef UNICODE
  52. #define MapiFileDesc MapiFileDescW
  53. #define lpMapiFileDesc lpMapiFileDescW
  54. #else
  55. #define MapiFileDesc MapiFileDescA
  56. #define lpMapiFileDesc lpMapiFileDescA
  57. #endif
  58. #define MAPI_OLE 0x00000001
  59. #define MAPI_OLE_STATIC 0x00000002
  60. typedef struct
  61. {
  62. ULONG ulReserved; /* Reserved, must be zero. */
  63. ULONG cbTag; /* Size (in bytes) of */
  64. LPBYTE lpTag; /* X.400 OID for this attachment type */
  65. ULONG cbEncoding; /* Size (in bytes) of */
  66. LPBYTE lpEncoding; /* X.400 OID for this attachment's encoding */
  67. } MapiFileTagExt, FAR *lpMapiFileTagExt;
  68. typedef struct
  69. {
  70. ULONG ulReserved; /* Reserved for future use */
  71. ULONG ulRecipClass; /* Recipient class */
  72. /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */
  73. LPSTR lpszName; /* Recipient name */
  74. LPSTR lpszAddress; /* Recipient address (optional) */
  75. ULONG ulEIDSize; /* Count in bytes of size of pEntryID */
  76. LPVOID lpEntryID; /* System-specific recipient reference */
  77. } MapiRecipDescA, FAR * lpMapiRecipDescA;
  78. #ifdef WIN32
  79. typedef struct
  80. {
  81. ULONG ulReserved; /* Reserved for future use */
  82. ULONG ulRecipClass; /* Recipient class */
  83. /* MAPI_TO, MAPI_CC, MAPI_BCC, MAPI_ORIG */
  84. LPWSTR lpszName; /* Recipient name */
  85. LPWSTR lpszAddress; /* Recipient address (optional) */
  86. ULONG ulEIDSize; /* Count in bytes of size of pEntryID */
  87. LPVOID lpEntryID; /* System-specific recipient reference */
  88. } MapiRecipDescW, FAR * lpMapiRecipDescW;
  89. #endif /* WIN32 */
  90. #ifdef UNICODE
  91. #define MapiRecipDesc MapiRecipDescW
  92. #define lpMapiRecipDesc lpMapiRecipDescW
  93. #else
  94. #define MapiRecipDesc MapiRecipDescA
  95. #define lpMapiRecipDesc lpMapiRecipDescA
  96. #endif
  97. #ifndef MAPI_ORIG /* also defined in mapix.h */
  98. #define MAPI_ORIG 0 /* Recipient is message originator */
  99. #define MAPI_TO 1 /* Recipient is a primary recipient */
  100. #define MAPI_CC 2 /* Recipient is a copy recipient */
  101. #define MAPI_BCC 3 /* Recipient is blind copy recipient */
  102. #define MAPI_DISCRETE 0x10000000/* Recipient is a P1 resend recipient */
  103. #endif
  104. typedef struct
  105. {
  106. ULONG ulReserved; /* Reserved for future use (M.B. 0) */
  107. LPSTR lpszSubject; /* Message Subject */
  108. LPSTR lpszNoteText; /* Message Text */
  109. LPSTR lpszMessageType; /* Message Class */
  110. LPSTR lpszDateReceived; /* in YYYY/MM/DD HH:MM format */
  111. LPSTR lpszConversationID; /* conversation thread ID */
  112. FLAGS flFlags; /* unread,return receipt */
  113. lpMapiRecipDesc lpOriginator; /* Originator descriptor */
  114. ULONG nRecipCount; /* Number of recipients */
  115. lpMapiRecipDesc lpRecips; /* Recipient descriptors */
  116. ULONG nFileCount; /* # of file attachments */
  117. lpMapiFileDesc lpFiles; /* Attachment descriptors */
  118. } MapiMessageA, FAR * lpMapiMessageA;
  119. #ifdef WIN32
  120. typedef struct
  121. {
  122. ULONG ulReserved; /* Reserved for future use (M.B. 0) */
  123. LPWSTR lpszSubject; /* Message Subject */
  124. LPWSTR lpszNoteText; /* Message Text */
  125. LPWSTR lpszMessageType; /* Message Class */
  126. LPWSTR lpszDateReceived; /* in YYYY/MM/DD HH:MM format */
  127. LPWSTR lpszConversationID; /* conversation thread ID */
  128. FLAGS flFlags; /* unread,return receipt */
  129. lpMapiRecipDesc lpOriginator; /* Originator descriptor */
  130. ULONG nRecipCount; /* Number of recipients */
  131. lpMapiRecipDesc lpRecips; /* Recipient descriptors */
  132. ULONG nFileCount; /* # of file attachments */
  133. lpMapiFileDesc lpFiles; /* Attachment descriptors */
  134. } MapiMessageW, FAR * lpMapiMessageW;
  135. #endif /* WIN32 */
  136. #ifdef UNICODE
  137. #define MapiMessage MapiMessageW
  138. #define lpMapiMessage lpMapiMessageW
  139. #else
  140. #define MapiMessage MapiMessageA
  141. #define lpMapiMessage lpMapiMessageA
  142. #endif
  143. #define MAPI_UNREAD 0x00000001
  144. #define MAPI_RECEIPT_REQUESTED 0x00000002
  145. #define MAPI_SENT 0x00000004
  146. /*
  147. * Entry points.
  148. */
  149. /*
  150. * flFlags values for Simple MAPI entry points. All documented flags are
  151. * shown for each call. Duplicates are commented out but remain present
  152. * for every call.
  153. */
  154. /* MAPILogon() flags. */
  155. #define MAPI_LOGON_UI 0x00000001 /* Display logon UI */
  156. #ifndef MAPI_PASSWORD_UI
  157. #define MAPI_PASSWORD_UI 0x00020000 /* prompt for password only */
  158. #endif
  159. #define MAPI_NEW_SESSION 0x00000002 /* Don't use shared session */
  160. #define MAPI_FORCE_DOWNLOAD 0x00001000 /* Get new mail before return */
  161. #define MAPI_ALLOW_OTHERS 0x00000008 /* Make this a shared session */
  162. #define MAPI_EXPLICIT_PROFILE 0x00000010 /* Don't use default profile */
  163. #define MAPI_EXTENDED 0x00000020 /* Extended MAPI Logon */
  164. #define MAPI_USE_DEFAULT 0x00000040 /* Use default profile in logon */
  165. #define MAPI_SIMPLE_DEFAULT (MAPI_LOGON_UI | MAPI_FORCE_DOWNLOAD | MAPI_ALLOW_OTHERS)
  166. #define MAPI_SIMPLE_EXPLICIT (MAPI_NEW_SESSION | MAPI_FORCE_DOWNLOAD | MAPI_EXPLICIT_PROFILE)
  167. /* MAPILogoff() flags. */
  168. #define MAPI_LOGOFF_SHARED 0x00000001 /* Close all shared sessions */
  169. #define MAPI_LOGOFF_UI 0x00000002 /* It's OK to present UI */
  170. /* MAPISendMail() flags. */
  171. /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */
  172. /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */
  173. #ifndef MAPI_DIALOG /* also defined in property.h */
  174. #define MAPI_DIALOG 0x00000008 /* Display a send note UI */
  175. #endif
  176. /*# define MAPI_USE_DEFAULT 0x00000040 Use default profile in logon */
  177. /* MAPIFindNext() flags. */
  178. #define MAPI_UNREAD_ONLY 0x00000020 /* Only unread messages */
  179. #define MAPI_GUARANTEE_FIFO 0x00000100 /* use date order */
  180. #define MAPI_LONG_MSGID 0x00004000 /* allow 512 char returned ID */
  181. /* MAPIReadMail() flags. */
  182. #define MAPI_PEEK 0x00000080 /* Do not mark as read. */
  183. #define MAPI_SUPPRESS_ATTACH 0x00000800 /* header + body, no files */
  184. #define MAPI_ENVELOPE_ONLY 0x00000040 /* Only header information */
  185. #define MAPI_BODY_AS_FILE 0x00000200
  186. /* MAPISaveMail() flags. */
  187. /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */
  188. /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */
  189. /* #define MAPI_LONG_MSGID 0x00004000 /* allow 512 char returned ID */
  190. /* MAPIAddress() flags. */
  191. /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */
  192. /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */
  193. /* MAPIDetails() flags. */
  194. /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */
  195. /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */
  196. #define MAPI_AB_NOMODIFY 0x00000400 /* Don't allow mods of AB entries */
  197. /* MAPIResolveName() flags. */
  198. /* #define MAPI_LOGON_UI 0x00000001 Display logon UI */
  199. /* #define MAPI_NEW_SESSION 0x00000002 Don't use shared session */
  200. /* #define MAPI_DIALOG 0x00000008 Prompt for choices if ambiguous */
  201. /* #define MAPI_AB_NOMODIFY 0x00000400 Don't allow mods of AB entries */
  202. #ifndef MAPILogon
  203. typedef ULONG (FAR PASCAL MAPILOGONA)(
  204. ULONG ulUIParam,
  205. LPSTR lpszProfileName,
  206. LPSTR lpszPassword,
  207. FLAGS flFlags,
  208. ULONG ulReserved,
  209. LPLHANDLE lplhSession
  210. );
  211. typedef MAPILOGONA FAR *LPMAPILOGONA;
  212. MAPILOGONA MAPILogonA;
  213. #ifdef WIN32
  214. typedef ULONG (FAR PASCAL MAPILOGONW)(
  215. ULONG ulUIParam,
  216. LPWSTR lpszProfileName,
  217. LPWSTR lpszPassword,
  218. FLAGS flFlags,
  219. ULONG ulReserved,
  220. LPLHANDLE lplhSession
  221. );
  222. typedef MAPILOGONW FAR *LPMAPILOGONW;
  223. MAPILOGONW MAPILogonW;
  224. #endif
  225. #ifdef UNICODE
  226. #define MAPILogon MAPILogonW
  227. #else
  228. #define MAPILogon MAPILogonA
  229. #endif
  230. #endif /* MAPILogon */
  231. ULONG FAR PASCAL MAPILogoff(LHANDLE lhSession, ULONG ulUIParam, FLAGS flFlags,
  232. ULONG ulReserved);
  233. ULONG FAR PASCAL MAPISendMailA(LHANDLE lhSession, ULONG ulUIParam,
  234. lpMapiMessageA lpMessage, FLAGS flFlags,
  235. ULONG ulReserved);
  236. #ifdef WIN32
  237. ULONG FAR PASCAL MAPISendMailW(LHANDLE lhSession, ULONG ulUIParam,
  238. lpMapiMessageW lpMessage, FLAGS flFlags,
  239. ULONG ulReserved);
  240. #endif
  241. #ifdef UNICODE
  242. #define MAPISendMail MAPISendMailW
  243. #else
  244. #define MAPISendMail MAPISendMailA
  245. #endif
  246. ULONG FAR PASCAL MAPISendDocumentsA(ULONG ulUIParam, LPSTR lpszDelimChar,
  247. LPSTR lpszFilePaths, LPSTR lpszFileNames,
  248. ULONG ulReserved);
  249. #ifdef WIN32
  250. ULONG FAR PASCAL MAPISendDocumentsW(ULONG ulUIParam, LPWSTR lpszDelimChar,
  251. LPWSTR lpszFilePaths, LPWSTR lpszFileNames,
  252. ULONG ulReserved);
  253. #endif
  254. #ifdef UNICODE
  255. #define MAPISendDocuments MAPISendDocumentsW
  256. #else
  257. #define MAPISendDocuments MAPISendDocumentsA
  258. #endif
  259. ULONG FAR PASCAL MAPIFindNextA(LHANDLE lhSession, ULONG ulUIParam,
  260. LPSTR lpszMessageType, LPSTR lpszSeedMessageID,
  261. FLAGS flFlags, ULONG ulReserved,
  262. LPSTR lpszMessageID);
  263. #ifdef WIN32
  264. ULONG FAR PASCAL MAPIFindNextW(LHANDLE lhSession, ULONG ulUIParam,
  265. LPWSTR lpszMessageType, LPWSTR lpszSeedMessageID,
  266. FLAGS flFlags, ULONG ulReserved,
  267. LPWSTR lpszMessageID);
  268. #endif
  269. #ifdef UNICODE
  270. #define MAPIFindNext MAPIFindNextW
  271. #else
  272. #define MAPIFindNext MAPIFindNextA
  273. #endif
  274. ULONG FAR PASCAL MAPIReadMailA(LHANDLE lhSession, ULONG ulUIParam,
  275. LPSTR lpszMessageID, FLAGS flFlags,
  276. ULONG ulReserved, lpMapiMessageA FAR *lppMessage);
  277. #ifdef WIN32
  278. ULONG FAR PASCAL MAPIReadMailW(LHANDLE lhSession, ULONG ulUIParam,
  279. LPWSTR lpszMessageID, FLAGS flFlags,
  280. ULONG ulReserved, lpMapiMessageW FAR *lppMessage);
  281. #endif
  282. #ifdef UNICODE
  283. #define MAPIReadMail MAPIReadMailW
  284. #else
  285. #define MAPIReadMail MAPIReadMailA
  286. #endif
  287. ULONG FAR PASCAL MAPISaveMailA(LHANDLE lhSession, ULONG ulUIParam,
  288. lpMapiMessageA lpMessage, FLAGS flFlags,
  289. ULONG ulReserved, LPSTR lpszMessageID);
  290. #ifdef WIN32
  291. ULONG FAR PASCAL MAPISaveMailW(LHANDLE lhSession, ULONG ulUIParam,
  292. lpMapiMessageW lpMessage, FLAGS flFlags,
  293. ULONG ulReserved, LPWSTR lpszMessageID);
  294. #endif
  295. #ifdef UNICODE
  296. #define MAPISaveMail MAPISaveMailW
  297. #else
  298. #define MAPISaveMail MAPISaveMailA
  299. #endif
  300. ULONG FAR PASCAL MAPIDeleteMailA(LHANDLE lhSession, ULONG ulUIParam,
  301. LPSTR lpszMessageID, FLAGS flFlags,
  302. ULONG ulReserved);
  303. #ifdef WIN32
  304. ULONG FAR PASCAL MAPIDeleteMailW(LHANDLE lhSession, ULONG ulUIParam,
  305. LPWSTR lpszMessageID, FLAGS flFlags,
  306. ULONG ulReserved);
  307. #endif
  308. #ifdef UNICODE
  309. #define MAPIDeleteMail MAPIDeleteMailW
  310. #else
  311. #define MAPIDeleteMail MAPIDeleteMailA
  312. #endif
  313. ULONG FAR PASCAL MAPIFreeBuffer(LPVOID pv);
  314. ULONG FAR PASCAL MAPIAddressA(LHANDLE lhSession, ULONG ulUIParam,
  315. LPSTR lpszCaption, ULONG nEditFields,
  316. LPSTR lpszLabels, ULONG nRecips,
  317. lpMapiRecipDescA lpRecips, FLAGS flFlags, ULONG ulReserved,
  318. LPULONG lpnNewRecips, lpMapiRecipDescA FAR *lppNewRecips);
  319. #ifdef WIN32
  320. ULONG FAR PASCAL MAPIAddressW(LHANDLE lhSession, ULONG ulUIParam,
  321. LPWSTR lpszCaption, ULONG nEditFields,
  322. LPWSTR lpszLabels, ULONG nRecips,
  323. lpMapiRecipDescW lpRecips, FLAGS flFlags, ULONG ulReserved,
  324. LPULONG lpnNewRecips, lpMapiRecipDescW FAR *lppNewRecips);
  325. #endif
  326. #ifdef UNICODE
  327. #define MAPIAddress MAPIAddressW
  328. #else
  329. #define MAPIAddress MAPIAddressA
  330. #endif
  331. ULONG FAR PASCAL MAPIDetailsA(LHANDLE lhSession, ULONG ulUIParam,
  332. lpMapiRecipDescA lpRecip, FLAGS flFlags, ULONG ulReserved);
  333. #ifdef WIN32
  334. ULONG FAR PASCAL MAPIDetailsW(LHANDLE lhSession, ULONG ulUIParam,
  335. lpMapiRecipDescW lpRecip, FLAGS flFlags, ULONG ulReserved);
  336. #endif
  337. #ifdef UNICODE
  338. #define MAPIDetails MAPIDetailsW
  339. #else
  340. #define MAPIDetails MAPIDetailsA
  341. #endif
  342. ULONG FAR PASCAL MAPIResolveNameA(LHANDLE lhSession, ULONG ulUIParam,
  343. LPSTR lpszName, FLAGS flFlags,
  344. ULONG ulReserved, lpMapiRecipDescA FAR *lppRecip);
  345. #ifdef WIN32
  346. ULONG FAR PASCAL MAPIResolveNameW(LHANDLE lhSession, ULONG ulUIParam,
  347. LPWSTR lpszName, FLAGS flFlags,
  348. ULONG ulReserved, lpMapiRecipDescW FAR *lppRecip);
  349. #endif
  350. #ifdef UNICODE
  351. #define MAPIResolveName MAPIResolveNameW
  352. #else
  353. #define MAPIResolveName MAPIResolveNameA
  354. #endif
  355. #ifndef SUCCESS_SUCCESS
  356. #define SUCCESS_SUCCESS 0
  357. #endif
  358. #define MAPI_USER_ABORT 1
  359. #define MAPI_E_USER_ABORT MAPI_USER_ABORT
  360. #define MAPI_E_FAILURE 2
  361. #define MAPI_E_LOGON_FAILURE 3
  362. #define MAPI_E_LOGIN_FAILURE MAPI_E_LOGON_FAILURE
  363. #define MAPI_E_DISK_FULL 4
  364. #define MAPI_E_INSUFFICIENT_MEMORY 5
  365. #define MAPI_E_ACCESS_DENIED 6
  366. #define MAPI_E_TOO_MANY_SESSIONS 8
  367. #define MAPI_E_TOO_MANY_FILES 9
  368. #define MAPI_E_TOO_MANY_RECIPIENTS 10
  369. #define MAPI_E_ATTACHMENT_NOT_FOUND 11
  370. #define MAPI_E_ATTACHMENT_OPEN_FAILURE 12
  371. #define MAPI_E_ATTACHMENT_WRITE_FAILURE 13
  372. #define MAPI_E_UNKNOWN_RECIPIENT 14
  373. #define MAPI_E_BAD_RECIPTYPE 15
  374. #define MAPI_E_NO_MESSAGES 16
  375. #define MAPI_E_INVALID_MESSAGE 17
  376. #define MAPI_E_TEXT_TOO_LARGE 18
  377. #define MAPI_E_INVALID_SESSION 19
  378. #define MAPI_E_TYPE_NOT_SUPPORTED 20
  379. #define MAPI_E_AMBIGUOUS_RECIPIENT 21
  380. #define MAPI_E_AMBIG_RECIP MAPI_E_AMBIGUOUS_RECIPIENT
  381. #define MAPI_E_MESSAGE_IN_USE 22
  382. #define MAPI_E_NETWORK_FAILURE 23
  383. #define MAPI_E_INVALID_EDITFIELDS 24
  384. #define MAPI_E_INVALID_RECIPS 25
  385. #define MAPI_E_NOT_SUPPORTED 26
  386. #ifdef __cplusplus
  387. } /* extern "C" */
  388. #endif
  389. #endif /* MAPI_H */