mapispi.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /*
  2. * Copyright 2005 - 2016 Zarafa and its licensors
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Affero General Public License, version 3,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU Affero General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Affero General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. #ifndef __M4L_MAPISPI_H_
  18. #define __M4L_MAPISPI_H_
  19. #define MAPISPI_H
  20. #include <kopano/platform.h>
  21. #include <initializer_list>
  22. #include <mapidefs.h>
  23. #include <mapicode.h>
  24. #include <mapiguid.h>
  25. #include <mapitags.h>
  26. /* The MAPI SPI has a version number. MAPIX.DLL knows and supports
  27. * one or more versions of the SPI. Each provider supports one or
  28. * more versions of the SPI. Checks are performed in both MAPIX.DLL
  29. * and in the provider to ensure that they agree to use exactly one
  30. * version of the MAPI SPI.
  31. *
  32. * The SPI version number is composed of a major (8-bit) version,
  33. * minor (8-bit) version, and micro (16-bit) version. The first
  34. * retail ship of MAPI 1.0 is expected to be version 1.0.0.
  35. * The major version number changes rarely.
  36. * The minor version number changes opon each retail ship of
  37. * MAPI if the SPI has been modified.
  38. * The micro version number changes internally at Microsoft
  39. * during development of MAPI.
  40. *
  41. * The version of the SPI documented by this set of header files
  42. * is ALWAYS known as "CURRENT_SPI_VERSION". If you write a
  43. * service provider, and get a new set of header files, and update
  44. * your code to the new interface, you'll be at the "current" version.
  45. */
  46. #define CURRENT_SPI_VERSION 0x00010010L
  47. /* Here are some well-known SPI version numbers:
  48. * (These will eventually be useful for provider-writers who
  49. * might choose to make provider DLLs that support more than
  50. * one version of the MAPI SPI.
  51. */
  52. #define PDK1_SPI_VERSION 0x00010000L /* 0.1.0 MAPI PDK1 Spring 1993 */
  53. #define PDK2_SPI_VERSION 0x00010008L /* 0.1.8 MAPI PDK2 Spring 1994 */
  54. #define PDK3_SPI_VERSION 0x00010010L /* 0.1.16 MAPI PDK3 Fall 1994 */
  55. /*
  56. * Forward declaration of interface pointers specific to the service
  57. * provider interface.
  58. */
  59. class IMAPISupport;
  60. typedef IMAPISupport* LPMAPISUP;
  61. /*
  62. * IMAPISupport Interface
  63. */
  64. /* Notification key structure for the MAPI notification engine */
  65. struct NOTIFKEY {
  66. NOTIFKEY(void) = delete;
  67. template<typename _T> NOTIFKEY(std::initializer_list<_T>) = delete;
  68. ULONG cb; /* How big the key is */
  69. BYTE ab[MAPI_DIM]; /* Key contents */
  70. };
  71. typedef struct NOTIFKEY *LPNOTIFKEY;
  72. #define CbNewNOTIFKEY(_cb) (offsetof(NOTIFKEY,ab) + (_cb))
  73. #define CbNOTIFKEY(_lpkey) (offsetof(NOTIFKEY,ab) + (_lpkey)->cb)
  74. #define SizedNOTIFKEY(_cb, _name) \
  75. struct _NOTIFKEY_ ## _name { \
  76. ULONG cb; \
  77. BYTE ab[_cb]; \
  78. } _name
  79. /* For Subscribe() */
  80. #define NOTIFY_SYNC ((ULONG) 0x40000000)
  81. /* For Notify() */
  82. #define NOTIFY_CANCELED ((ULONG) 0x80000000)
  83. /* From the Notification Callback function (well, this is really a ulResult) */
  84. #define CALLBACK_DISCONTINUE ((ULONG) 0x80000000)
  85. /* For Transport's SpoolerNotify() */
  86. #define NOTIFY_NEWMAIL ((ULONG) 0x00000001)
  87. #define NOTIFY_READYTOSEND ((ULONG) 0x00000002)
  88. #define NOTIFY_SENTDEFERRED ((ULONG) 0x00000004)
  89. #define NOTIFY_CRITSEC ((ULONG) 0x00001000)
  90. #define NOTIFY_NONCRIT ((ULONG) 0x00002000)
  91. #define NOTIFY_CONFIG_CHANGE ((ULONG) 0x00004000)
  92. #define NOTIFY_CRITICAL_ERROR ((ULONG) 0x10000000)
  93. /* For Message Store's SpoolerNotify() */
  94. #define NOTIFY_NEWMAIL_RECEIVED ((ULONG) 0x20000000)
  95. /* For ModifyStatusRow() */
  96. #define STATUSROW_UPDATE ((ULONG) 0x10000000)
  97. /* For IStorageFromStream() */
  98. #define STGSTRM_RESET ((ULONG) 0x00000000)
  99. #define STGSTRM_CURRENT ((ULONG) 0x10000000)
  100. #define STGSTRM_MODIFY ((ULONG) 0x00000002)
  101. #define STGSTRM_CREATE ((ULONG) 0x00001000)
  102. /* For ReadReceipt() */
  103. #define MAPI_NON_READ ((ULONG) 0x00000001)
  104. /* Preprocessor calls: */
  105. /* PreprocessMessage, first ordinal in RegisterPreprocessor(). */
  106. typedef HRESULT (PREPROCESSMESSAGE)(
  107. LPVOID lpvSession,
  108. LPMESSAGE lpMessage,
  109. LPADRBOOK lpAdrBook,
  110. LPMAPIFOLDER lpFolder,
  111. LPALLOCATEBUFFER AllocateBuffer,
  112. LPALLOCATEMORE AllocateMore,
  113. LPFREEBUFFER FreeBuffer,
  114. ULONG* lpcOutbound,
  115. LPMESSAGE** lpppMessage,
  116. LPADRLIST* lppRecipList);
  117. /* RemovePreprocessInfo, second ordinal in RegisterPreprocessor(). */
  118. typedef HRESULT (REMOVEPREPROCESSINFO)(LPMESSAGE lpMessage);
  119. /* Function pointer for GetReleaseInfo */
  120. // we don't want this in linux
  121. //#warning "please correctly define LPSTORAGE!!"
  122. //#define LPSTORAGE void*
  123. class IMAPISupport : public virtual IUnknown {
  124. public:
  125. // virtual ~IMAPISupport() = 0;
  126. virtual HRESULT GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR * lppMAPIError) = 0;
  127. virtual HRESULT GetMemAllocRoutines(LPALLOCATEBUFFER * lpAllocateBuffer, LPALLOCATEMORE * lpAllocateMore,
  128. LPFREEBUFFER * lpFreeBuffer) = 0;
  129. virtual HRESULT Subscribe(LPNOTIFKEY lpKey, ULONG ulEventMask, ULONG ulFlags, LPMAPIADVISESINK lpAdviseSink,
  130. ULONG * lpulConnection) = 0;
  131. virtual HRESULT Unsubscribe(ULONG ulConnection) = 0;
  132. virtual HRESULT Notify(LPNOTIFKEY lpKey, ULONG cNotification, LPNOTIFICATION lpNotifications, ULONG * lpulFlags) = 0;
  133. virtual HRESULT ModifyStatusRow(ULONG cValues, LPSPropValue lpColumnVals, ULONG ulFlags) = 0;
  134. virtual HRESULT OpenProfileSection(LPMAPIUID lpUid, ULONG ulFlags, LPPROFSECT * lppProfileObj) = 0;
  135. virtual HRESULT RegisterPreprocessor(LPMAPIUID lpMuid, LPTSTR lpszAdrType, LPTSTR lpszDLLName, LPSTR lpszPreprocess,
  136. LPSTR lpszRemovePreprocessInfo, ULONG ulFlags) = 0;
  137. virtual HRESULT NewUID(LPMAPIUID lpMuid) = 0;
  138. virtual HRESULT MakeInvalid(ULONG ulFlags, LPVOID lpObject, ULONG ulRefCount, ULONG cMethods) = 0;
  139. virtual HRESULT SpoolerYield(ULONG ulFlags) = 0;
  140. virtual HRESULT SpoolerNotify(ULONG ulFlags, LPVOID lpvData) = 0;
  141. virtual HRESULT CreateOneOff(LPTSTR lpszName, LPTSTR lpszAdrType, LPTSTR lpszAddress, ULONG ulFlags,
  142. ULONG * lpcbEntryID, LPENTRYID * lppEntryID) = 0;
  143. virtual HRESULT SetProviderUID(LPMAPIUID lpProviderID, ULONG ulFlags) = 0;
  144. virtual HRESULT CompareEntryIDs(ULONG cbEntry1, LPENTRYID lpEntry1, ULONG cbEntry2, LPENTRYID lpEntry2,
  145. ULONG ulCompareFlags, ULONG * lpulResult) = 0;
  146. virtual HRESULT OpenTemplateID(ULONG cbTemplateID, LPENTRYID lpTemplateID, ULONG ulTemplateFlags, LPMAPIPROP lpMAPIPropData,
  147. LPCIID lpInterface, LPMAPIPROP * lppMAPIPropNew, LPMAPIPROP lpMAPIPropSibling) = 0;
  148. virtual HRESULT OpenEntry(ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulOpenFlags, ULONG * lpulObjType,
  149. LPUNKNOWN * lppUnk) = 0;
  150. virtual HRESULT GetOneOffTable(ULONG ulFlags, LPMAPITABLE * lppTable) = 0;
  151. virtual HRESULT Address(ULONG * lpulUIParam, LPADRPARM lpAdrParms, LPADRLIST * lppAdrList) = 0;
  152. virtual HRESULT Details(ULONG * lpulUIParam, LPFNDISMISS lpfnDismiss, LPVOID lpvDismissContext, ULONG cbEntryID,
  153. LPENTRYID lpEntryID, LPFNBUTTON lpfButtonCallback, LPVOID lpvButtonContext, LPTSTR lpszButtonText,
  154. ULONG ulFlags) = 0;
  155. virtual HRESULT NewEntry(ULONG ulUIParam, ULONG ulFlags, ULONG cbEIDContainer, LPENTRYID lpEIDContainer, ULONG cbEIDNewEntryTpl,
  156. LPENTRYID lpEIDNewEntryTpl, ULONG * lpcbEIDNewEntry, LPENTRYID * lppEIDNewEntry) = 0;
  157. virtual HRESULT DoConfigPropsheet(ULONG ulUIParam, ULONG ulFlags, LPTSTR lpszTitle, LPMAPITABLE lpDisplayTable,
  158. LPMAPIPROP lpCOnfigData, ULONG ulTopPage) = 0;
  159. virtual HRESULT CopyMessages(LPCIID lpSrcInterface, LPVOID lpSrcFolder, LPENTRYLIST lpMsgList, LPCIID lpDestInterface,
  160. LPVOID lpDestFolder, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) = 0;
  161. virtual HRESULT CopyFolder(LPCIID lpSrcInterface, LPVOID lpSrcFolder, ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpDestInterface,
  162. LPVOID lpDestFolder, LPTSTR lszNewFolderName, ULONG ulUIParam, LPMAPIPROGRESS lpProgress,
  163. ULONG ulFlags) = 0;
  164. virtual HRESULT DoCopyTo(LPCIID lpSrcInterface, LPVOID lpSrcObj, ULONG ciidExclude, LPCIID rgiidExclude, const SPropTagArray *lpExcludeProps, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpDestInterface, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) = 0;
  165. virtual HRESULT DoCopyProps(LPCIID lpSrcInterface, LPVOID lpSrcObj, const SPropTagArray *lpIncludeProps, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, LPCIID lpDestInterface, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) = 0;
  166. virtual HRESULT DoProgressDialog(ULONG ulUIParam, ULONG ulFlags, LPMAPIPROGRESS * lppProgress) = 0;
  167. virtual HRESULT ReadReceipt(ULONG ulFlags, LPMESSAGE lpReadMessage, LPMESSAGE * lppEmptyMessage) = 0;
  168. virtual HRESULT PrepareSubmit(LPMESSAGE lpMessage, ULONG * lpulFlags) = 0;
  169. virtual HRESULT ExpandRecips(LPMESSAGE lpMessage, ULONG * lpulFlags) = 0;
  170. virtual HRESULT UpdatePAB(ULONG ulFlags, LPMESSAGE lpMessage) = 0;
  171. virtual HRESULT DoSentMail(ULONG ulFlags, LPMESSAGE lpMessage) = 0;
  172. virtual HRESULT OpenAddressBook(LPCIID lpInterface, ULONG ulFlags, LPADRBOOK * lppAdrBook) = 0;
  173. virtual HRESULT Preprocess(ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) = 0;
  174. virtual HRESULT CompleteMsg(ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) = 0;
  175. virtual HRESULT StoreLogoffTransports(ULONG * lpulFlags) = 0;
  176. virtual HRESULT StatusRecips(LPMESSAGE lpMessage, LPADRLIST lpRecipList) = 0;
  177. virtual HRESULT WrapStoreEntryID(ULONG cbOrigEntry, LPENTRYID lpOrigEntry, ULONG * lpcbWrappedEntry,
  178. LPENTRYID * lppWrappedEntry) = 0;
  179. virtual HRESULT ModifyProfile(ULONG ulFlags) = 0;
  180. virtual HRESULT IStorageFromStream(LPUNKNOWN lpUnkIn, LPCIID lpInterface, ULONG ulFlags, LPSTORAGE * lppStorageOut) = 0;
  181. virtual HRESULT GetSvcConfigSupportObj(ULONG ulFlags, LPMAPISUP * lppSvcSupport) = 0;
  182. };
  183. /********************************************************************/
  184. /* */
  185. /* ADDRESS BOOK SPI */
  186. /* */
  187. /********************************************************************/
  188. /* Address Book Provider ------------------------------------------------- */
  189. /* OpenTemplateID() */
  190. #define FILL_ENTRY ((ULONG) 0x00000001)
  191. /* For Logon() */
  192. class IABProvider;
  193. typedef IABProvider* LPABPROVIDER;
  194. class IABLogon;
  195. typedef IABLogon* LPABLOGON;
  196. class IABProvider : public IUnknown {
  197. public:
  198. // virtual ~IABProvider() = 0;
  199. virtual HRESULT Shutdown(ULONG * lpulFlags) = 0;
  200. virtual HRESULT Logon(LPMAPISUP lpMAPISup, ULONG ulUIParam, LPTSTR lpszProfileName, ULONG ulFlags, ULONG * lpulpcbSecurity,
  201. LPBYTE * lppbSecurity, LPMAPIERROR * lppMAPIError, LPABLOGON * lppABLogon) = 0;
  202. };
  203. class IABLogon : public IUnknown {
  204. public:
  205. // virtual ~IABLogon() = 0;
  206. virtual HRESULT GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR * lppMAPIError) = 0;
  207. virtual HRESULT Logoff(ULONG ulFlags) = 0;
  208. virtual HRESULT OpenEntry(ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType,
  209. LPUNKNOWN * lppUnk) = 0;
  210. virtual HRESULT CompareEntryIDs(ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2,
  211. ULONG ulFlags, ULONG * lpulResult) = 0;
  212. virtual HRESULT Advise(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink,
  213. ULONG * lpulConnection) = 0;
  214. virtual HRESULT Unadvise(ULONG ulConnection) = 0;
  215. virtual HRESULT OpenStatusEntry(LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType, LPMAPISTATUS * lppEntry) = 0;
  216. virtual HRESULT OpenTemplateID(ULONG cbTemplateID, LPENTRYID lpTemplateID, ULONG ulTemplateFlags, LPMAPIPROP lpMAPIPropData,
  217. LPCIID lpInterface, LPMAPIPROP * lppMAPIPropNew, LPMAPIPROP lpMAPIPropSibling) = 0;
  218. virtual HRESULT GetOneOffTable(ULONG ulFlags, LPMAPITABLE * lppTable) = 0;
  219. virtual HRESULT PrepareRecips(ULONG ulFlags, const SPropTagArray *lpPropTagArray, LPADRLIST lpRecipList) = 0;
  220. };
  221. extern "C" {
  222. typedef HRESULT (ABPROVIDERINIT)(
  223. HINSTANCE hInstance,
  224. LPMALLOC lpMalloc,
  225. LPALLOCATEBUFFER lpAllocateBuffer,
  226. LPALLOCATEMORE lpAllocateMore,
  227. LPFREEBUFFER lpFreeBuffer,
  228. ULONG ulFlags,
  229. ULONG ulMAPIVer,
  230. ULONG * lpulProviderVer,
  231. LPABPROVIDER * lppABProvider
  232. );
  233. ABPROVIDERINIT ABProviderInit;
  234. }
  235. /********************************************************************/
  236. /* */
  237. /* TRANSPORT SPI */
  238. /* */
  239. /********************************************************************/
  240. /* For DeinitTransport */
  241. #define DEINIT_NORMAL ((ULONG) 0x00000001)
  242. #define DEINIT_HURRY ((ULONG) 0x80000000)
  243. /* For TransportLogon */
  244. /* Flags that the Spooler may pass to the transport: */
  245. #define LOGON_NO_DIALOG ((ULONG) 0x00000001)
  246. #define LOGON_NO_CONNECT ((ULONG) 0x00000004)
  247. #define LOGON_NO_INBOUND ((ULONG) 0x00000008)
  248. #define LOGON_NO_OUTBOUND ((ULONG) 0x00000010)
  249. /*#define MAPI_UNICODE ((ULONG) 0x80000000) in mapidefs.h */
  250. /* Flags that the transport may pass to the Spooler: */
  251. #define LOGON_SP_IDLE ((ULONG) 0x00010000)
  252. #define LOGON_SP_POLL ((ULONG) 0x00020000)
  253. #define LOGON_SP_RESOLVE ((ULONG) 0x00040000)
  254. class IXPProvider;
  255. typedef IXPProvider* LPXPPROVIDER;
  256. class IXPLogon;
  257. typedef IXPLogon* LPXPLOGON;
  258. class IXPProvider : public IUnknown {
  259. public:
  260. // virtual ~IXPProvider() = 0;
  261. virtual HRESULT Shutdown(ULONG * lpulFlags) = 0;
  262. virtual HRESULT TransportLogon(LPMAPISUP lpMAPISup, ULONG ulUIParam, LPTSTR lpszProfileName,
  263. ULONG * lpulFlags, LPMAPIERROR * lppMAPIError, LPXPLOGON * lppXPLogon) = 0;
  264. };
  265. /* OptionData returned from call to RegisterOptions */
  266. #define OPTION_TYPE_RECIPIENT ((ULONG) 0x00000001)
  267. #define OPTION_TYPE_MESSAGE ((ULONG) 0x00000002)
  268. struct OPTIONDATA {
  269. ULONG ulFlags; /* MAPI_RECIPIENT, MAPI_MESSAGE */
  270. LPGUID lpRecipGUID; /* Same as returned by AddressTypes() */
  271. LPTSTR lpszAdrType; /* Same as returned by AddressTypes() */
  272. LPTSTR lpszDLLName; /* Options DLL */
  273. ULONG ulOrdinal; /* Ordinal in that DLL */
  274. ULONG cbOptionsData; /* Count of bytes in lpbOptionsData */
  275. LPBYTE lpbOptionsData; /* Providers per [recip|message] option data */
  276. ULONG cOptionsProps; /* Count of Options default prop values */
  277. LPSPropValue lpOptionsProps; /* Default Options property values */
  278. };
  279. typedef struct OPTIONDATA *LPOPTIONDATA;
  280. typedef SCODE (OPTIONCALLBACK)(
  281. HINSTANCE hInst,
  282. LPMALLOC lpMalloc,
  283. ULONG ulFlags,
  284. ULONG cbOptionData,
  285. LPBYTE lpbOptionData,
  286. LPMAPISUP lpMAPISup,
  287. LPMAPIPROP lpDataSource,
  288. LPMAPIPROP * lppWrappedSource,
  289. LPMAPIERROR * lppMAPIError);
  290. /* For TransportNotify */
  291. #define NOTIFY_ABORT_DEFERRED ((ULONG) 0x40000000)
  292. #define NOTIFY_CANCEL_MESSAGE ((ULONG) 0x80000000)
  293. #define NOTIFY_BEGIN_INBOUND ((ULONG) 0x00000001)
  294. #define NOTIFY_END_INBOUND ((ULONG) 0x00010000)
  295. #define NOTIFY_BEGIN_OUTBOUND ((ULONG) 0x00000002)
  296. #define NOTIFY_END_OUTBOUND ((ULONG) 0x00020000)
  297. #define NOTIFY_BEGIN_INBOUND_FLUSH ((ULONG) 0x00000004)
  298. #define NOTIFY_END_INBOUND_FLUSH ((ULONG) 0x00040000)
  299. #define NOTIFY_BEGIN_OUTBOUND_FLUSH ((ULONG) 0x00000008)
  300. #define NOTIFY_END_OUTBOUND_FLUSH ((ULONG) 0x00080000)
  301. /* For TransportLogoff */
  302. #define LOGOFF_NORMAL ((ULONG) 0x00000001)
  303. #define LOGOFF_HURRY ((ULONG) 0x80000000)
  304. /* For SubmitMessage */
  305. #define BEGIN_DEFERRED ((ULONG) 0x00000001)
  306. /* For EndMessage */
  307. /* Flags that the Spooler may pass to the Transport: */
  308. /* Flags that the transport may pass to the Spooler: */
  309. #define END_RESEND_NOW ((ULONG) 0x00010000)
  310. #define END_RESEND_LATER ((ULONG) 0x00020000)
  311. #define END_DONT_RESEND ((ULONG) 0x00040000)
  312. class IXPLogon : public IUnknown {
  313. public:
  314. // virtual ~IXPLogon() = 0;
  315. virtual HRESULT AddressTypes(ULONG * lpulFlags, ULONG * lpcAdrType, LPTSTR** lpppAdrTypeArray,
  316. ULONG * lpcMAPIUID, LPMAPIUID * * lpppUIDArray) = 0;
  317. virtual HRESULT RegisterOptions(ULONG * lpulFlags, ULONG * lpcOptions, LPOPTIONDATA * lppOptions) = 0;
  318. virtual HRESULT TransportNotify(ULONG * lpulFlags, LPVOID * lppvData) = 0;
  319. virtual HRESULT Idle(ULONG ulFlags) = 0;
  320. virtual HRESULT TransportLogoff(ULONG ulFlags) = 0;
  321. virtual HRESULT SubmitMessage(ULONG ulFlags, LPMESSAGE lpMessage, ULONG * lpulMsgRef, ULONG * lpulReturnParm) = 0;
  322. virtual HRESULT EndMessage(ULONG ulMsgRef, ULONG * lpulFlags) = 0;
  323. virtual HRESULT Poll(ULONG * lpulIncoming) = 0;
  324. virtual HRESULT StartMessage(ULONG ulFlags, LPMESSAGE lpMessage, ULONG * lpulMsgRef) = 0;
  325. virtual HRESULT OpenStatusEntry(LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType, LPMAPISTATUS * lppEntry) = 0;
  326. virtual HRESULT ValidateState(ULONG ulUIParam, ULONG ulFlags) = 0;
  327. virtual HRESULT FlushQueues(ULONG ulUIParam, ULONG cbTargetTransport, LPENTRYID lpTargetTransport, ULONG ulFlags) = 0;
  328. };
  329. /* Transport Provider Entry Point */
  330. extern "C" {
  331. typedef HRESULT (XPPROVIDERINIT)(
  332. HINSTANCE hInstance,
  333. LPMALLOC lpMalloc,
  334. LPALLOCATEBUFFER lpAllocateBuffer,
  335. LPALLOCATEMORE lpAllocateMore,
  336. LPFREEBUFFER lpFreeBuffer,
  337. ULONG ulFlags,
  338. ULONG ulMAPIVer,
  339. ULONG * lpulProviderVer,
  340. LPXPPROVIDER * lppXPProvider);
  341. XPPROVIDERINIT XPProviderInit;
  342. }
  343. /********************************************************************/
  344. /* */
  345. /* MESSAGE STORE SPI */
  346. /* */
  347. /********************************************************************/
  348. /* Flags and enums */
  349. /* GetCredentials, SetCredentials */
  350. #define LOGON_SP_TRANSPORT ((ULONG) 0x00000001)
  351. #define LOGON_SP_PROMPT ((ULONG) 0x00000002)
  352. #define LOGON_SP_NEWPW ((ULONG) 0x00000004)
  353. #define LOGON_CHANGED ((ULONG) 0x00000008)
  354. /* DoMCDialog */
  355. #define DIALOG_FOLDER ((ULONG) 0x00000001)
  356. #define DIALOG_MESSAGE ((ULONG) 0x00000002)
  357. #define DIALOG_PROP ((ULONG) 0x00000004)
  358. #define DIALOG_ATTACH ((ULONG) 0x00000008)
  359. #define DIALOG_MOVE ((ULONG) 0x00000010)
  360. #define DIALOG_COPY ((ULONG) 0x00000020)
  361. #define DIALOG_DELETE ((ULONG) 0x00000040)
  362. #define DIALOG_ALLOW_CANCEL ((ULONG) 0x00000080)
  363. #define DIALOG_CONFIRM_CANCEL ((ULONG) 0x00000100)
  364. /* ExpandRecips */
  365. #define NEEDS_PREPROCESSING ((ULONG) 0x00000001)
  366. #define NEEDS_SPOOLER ((ULONG) 0x00000002)
  367. /* PrepareSubmit */
  368. #define CHECK_SENDER ((ULONG) 0x00000001)
  369. #define NON_STANDARD ((ULONG) 0x00010000)
  370. class IMSLogon;
  371. typedef IMSLogon* LPMSLOGON;
  372. class IMSProvider;
  373. typedef IMSProvider* LPMSPROVIDER;
  374. /* Message Store Provider Interface (IMSPROVIDER) */
  375. class IMSProvider : public IUnknown {
  376. public:
  377. // virtual ~IMSProvider() = 0;
  378. virtual HRESULT Shutdown(ULONG * lpulFlags) = 0;
  379. virtual HRESULT Logon(LPMAPISUP lpMAPISup, ULONG ulUIParam, LPTSTR lpszProfileName, ULONG cbEntryID, LPENTRYID lpEntryID,
  380. ULONG ulFlags, LPCIID lpInterface, ULONG * lpcbSpoolSecurity, LPBYTE * lppbSpoolSecurity,
  381. LPMAPIERROR * lppMAPIError, LPMSLOGON * lppMSLogon, LPMDB * lppMDB) = 0;
  382. virtual HRESULT SpoolerLogon(LPMAPISUP lpMAPISup, ULONG ulUIParam, LPTSTR lpszProfileName, ULONG cbEntryID,
  383. LPENTRYID lpEntryID, ULONG ulFlags, LPCIID lpInterface, ULONG cbSpoolSecurity,
  384. LPBYTE lpbSpoolSecurity, LPMAPIERROR * lppMAPIError, LPMSLOGON * lppMSLogon, LPMDB * lppMDB) = 0;
  385. virtual HRESULT CompareStoreIDs(ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2,
  386. ULONG ulFlags, ULONG * lpulResult) = 0;
  387. };
  388. /* The MSLOGON object is returned by the Logon() method of the
  389. * MSPROVIDER interface. This object is for use by MAPIX.DLL.
  390. */
  391. class IMSLogon : public IUnknown {
  392. public:
  393. // virtual ~IMSLogon() = 0;
  394. virtual HRESULT GetLastError(HRESULT hResult, ULONG ulFlags, LPMAPIERROR * lppMAPIError) = 0;
  395. virtual HRESULT Logoff(ULONG * lpulFlags) = 0;
  396. virtual HRESULT OpenEntry(ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType,
  397. LPUNKNOWN * lppUnk) = 0;
  398. virtual HRESULT CompareEntryIDs(ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2,
  399. ULONG ulFlags, ULONG * lpulResult) = 0;
  400. virtual HRESULT Advise(ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink,
  401. ULONG * lpulConnection) = 0;
  402. virtual HRESULT Unadvise(ULONG ulConnection) = 0;
  403. virtual HRESULT OpenStatusEntry(LPCIID lpInterface, ULONG ulFlags, ULONG * lpulObjType, LPVOID * lppEntry) = 0;
  404. };
  405. /* Message Store Provider Entry Point */
  406. extern "C" {
  407. typedef HRESULT (MSPROVIDERINIT)(
  408. HINSTANCE hInstance,
  409. LPMALLOC lpMalloc, /* AddRef() if you keep it */
  410. LPALLOCATEBUFFER lpAllocateBuffer, /* -> AllocateBuffer */
  411. LPALLOCATEMORE lpAllocateMore, /* -> AllocateMore */
  412. LPFREEBUFFER lpFreeBuffer, /* -> FreeBuffer */
  413. ULONG ulFlags,
  414. ULONG ulMAPIVer,
  415. ULONG * lpulProviderVer,
  416. LPMSPROVIDER * lppMSProvider
  417. );
  418. MSPROVIDERINIT MSProviderInit;
  419. }
  420. /********************************************************************/
  421. /* */
  422. /* MESSAGE SERVICE CONFIGURATION */
  423. /* */
  424. /********************************************************************/
  425. /* Flags for service configuration entry point */
  426. #define MSG_SERVICE_UI_READ_ONLY 0x00000008 /* display parameters only */
  427. #define SERVICE_LOGON_FAILED 0x00000020 /* reconfigure provider */
  428. /* Contexts for service configuration entry point */
  429. #define MSG_SERVICE_INSTALL 0x00000001
  430. #define MSG_SERVICE_CREATE 0x00000002
  431. #define MSG_SERVICE_CONFIGURE 0x00000003
  432. #define MSG_SERVICE_DELETE 0x00000004
  433. #define MSG_SERVICE_UNINSTALL 0x00000005
  434. #define MSG_SERVICE_PROVIDER_CREATE 0x00000006
  435. #define MSG_SERVICE_PROVIDER_DELETE 0x00000007
  436. /* Prototype for service configuration entry point */
  437. extern "C" {
  438. typedef HRESULT (MSGSERVICEENTRY)(
  439. HINSTANCE hInstance,
  440. LPMALLOC lpMalloc,
  441. LPMAPISUP lpMAPISup,
  442. ULONG ulUIParam,
  443. ULONG ulFlags,
  444. ULONG ulContext,
  445. ULONG cValues,
  446. LPSPropValue lpProps,
  447. LPPROVIDERADMIN lpProviderAdmin,
  448. LPMAPIERROR *lppMapiError
  449. );
  450. typedef MSGSERVICEENTRY *LPMSGSERVICEENTRY;
  451. }
  452. #endif /* MAPISPI_H */