mapiutil.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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_MAPIUTIL_H_
  18. #define __M4L_MAPIUTIL_H_
  19. #define MAPIUTIL_H
  20. #include <kopano/zcdefs.h>
  21. #include <kopano/platform.h>
  22. #include <mapix.h>
  23. /* IMAPITable in memory */
  24. /*
  25. * ITableData Interface
  26. */
  27. class ITableData;
  28. typedef ITableData* LPTABLEDATA;
  29. typedef void (CALLERRELEASE)(
  30. ULONG ulCallerData,
  31. LPTABLEDATA lpTblData,
  32. LPMAPITABLE lpVue
  33. );
  34. class ITableData : public IUnknown {
  35. public:
  36. // virtual ~ITableData() = 0;
  37. virtual HRESULT HrGetView(LPSSortOrderSet lpSSortOrderSet, CALLERRELEASE* lpfCallerRelease, ULONG ulCallerData,
  38. LPMAPITABLE* lppMAPITable) = 0;
  39. virtual HRESULT HrModifyRow(LPSRow) = 0;
  40. virtual HRESULT HrDeleteRow(LPSPropValue lpSPropValue) = 0;
  41. virtual HRESULT HrQueryRow(LPSPropValue lpsPropValue, LPSRow* lppSRow, ULONG* lpuliRow) = 0;
  42. virtual HRESULT HrEnumRow(ULONG ulRowNumber, LPSRow* lppSRow) = 0;
  43. virtual HRESULT HrNotify(ULONG ulFlags, ULONG cValues, LPSPropValue lpSPropValue) = 0;
  44. virtual HRESULT HrInsertRow(ULONG uliRow, LPSRow lpSRow) = 0;
  45. virtual HRESULT HrModifyRows(ULONG ulFlags, LPSRowSet lpSRowSet) = 0;
  46. virtual HRESULT HrDeleteRows(ULONG ulFlags, LPSRowSet lprowsetToDelete, ULONG* cRowsDeleted) = 0;
  47. };
  48. /* Entry Point for in memory ITable */
  49. SCODE CreateTable(LPCIID lpInterface,
  50. ALLOCATEBUFFER* lpAllocateBuffer,
  51. ALLOCATEMORE* lpAllocateMore,
  52. FREEBUFFER* lpFreeBuffer,
  53. LPVOID lpvReserved,
  54. ULONG ulTableType,
  55. ULONG ulPropTagIndexColumn,
  56. LPSPropTagArray lpSPropTagArrayColumns,
  57. LPTABLEDATA* lppTableData );
  58. #define TAD_ALL_ROWS 1
  59. /* IMAPIProp in memory */
  60. /*
  61. * IPropData Interface
  62. */
  63. class IPropData : public IMAPIProp {
  64. public:
  65. virtual HRESULT HrSetObjAccess(ULONG ulAccess) = 0;
  66. virtual HRESULT HrSetPropAccess(const SPropTagArray *lpPropTagArray, ULONG *rgulAccess) = 0;
  67. virtual HRESULT HrGetPropAccess(LPSPropTagArray* lppPropTagArray, ULONG** lprgulAccess) = 0;
  68. virtual HRESULT HrAddObjProps(const SPropTagArray *lppPropTagArray, SPropProblemArray **lprgulAccess) = 0;
  69. };
  70. typedef IPropData* LPPROPDATA;
  71. extern "C" {
  72. /* Entry Point for in memory IMAPIProp */
  73. SCODE CreateIProp(LPCIID lpInterface,
  74. ALLOCATEBUFFER * lpAllocateBuffer,
  75. ALLOCATEMORE * lpAllocateMore,
  76. FREEBUFFER * lpFreeBuffer,
  77. LPVOID lpvReserved,
  78. LPPROPDATA * lppPropData );
  79. /*
  80. * Defines for prop/obj access
  81. */
  82. #define IPROP_READONLY ((ULONG) 0x00000001)
  83. #define IPROP_READWRITE ((ULONG) 0x00000002)
  84. #define IPROP_CLEAN ((ULONG) 0x00010000)
  85. #define IPROP_DIRTY ((ULONG) 0x00020000)
  86. /*
  87. - HrSetPropAccess
  88. -
  89. * Sets access right attributes on a per-property basis. By default,
  90. * all properties are read/write.
  91. *
  92. */
  93. /*
  94. - HrSetObjAccess
  95. -
  96. * Sets access rights for the object itself. By default, the object has
  97. * read/write access.
  98. *
  99. */
  100. #ifndef NOIDLEENGINE
  101. /* Idle time scheduler */
  102. /*
  103. * PRI
  104. *
  105. * Priority of an idle task.
  106. * The idle engine sorts tasks by priority, and the one with the higher
  107. * value runs first. Within a priority level, the functions are called
  108. * round-robin.
  109. */
  110. #define PRILOWEST -32768
  111. #define PRIHIGHEST 32767
  112. #define PRIUSER 0
  113. /*
  114. * IRO
  115. *
  116. * Idle routine options. This is a combined bit mask consisting of
  117. * individual firo's. Listed below are the possible bit flags.
  118. *
  119. * FIROWAIT and FIROINTERVAL are mutually exclusive.
  120. * If neither of the flags are specified, the default action
  121. * is to ignore the time parameter of the idle function and
  122. * call it as often as possible if firoPerBlock is not set;
  123. * otherwise call it one time only during the idle block
  124. * once the time constraint has been set. FIROINTERVAL
  125. * is also incompatible with FIROPERBLOCK.
  126. *
  127. * FIROWAIT - time given is minimum idle time before calling
  128. * for the first time in the block of idle time,
  129. * afterwhich call as often as possible.
  130. * FIROINTERVAL - time given is minimum interval between each
  131. * successive call
  132. * FIROPERBLOCK - called only once per contiguous block of idle
  133. * time
  134. * FIRODISABLED - initially disabled when registered, the
  135. * default is to enable the function when registered.
  136. * FIROONCEONLY - called only one time by the scheduler and then
  137. * deregistered automatically.
  138. */
  139. #define IRONULL ((USHORT) 0x0000)
  140. #define FIROWAIT ((USHORT) 0x0001)
  141. #define FIROINTERVAL ((USHORT) 0x0002)
  142. #define FIROPERBLOCK ((USHORT) 0x0004)
  143. #define FIRODISABLED ((USHORT) 0x0020)
  144. #define FIROONCEONLY ((USHORT) 0x0040)
  145. /*
  146. * IRC
  147. *
  148. * Idle routine change options. This is a combined bit mask consisting
  149. * of individual firc's; each one identifies an aspect of the idle task
  150. * that can be changed.
  151. *
  152. */
  153. #define IRCNULL ((USHORT) 0x0000)
  154. #define FIRCPFN ((USHORT) 0x0001) /* change function pointer */
  155. #define FIRCPV ((USHORT) 0x0002) /* change parameter block */
  156. #define FIRCPRI ((USHORT) 0x0004) /* change priority */
  157. #define FIRCCSEC ((USHORT) 0x0008) /* change time */
  158. #define FIRCIRO ((USHORT) 0x0010) /* change routine options */
  159. /*
  160. * Type definition for idle functions. An idle function takes one
  161. * parameter, a PV, and returns a BOOL value.
  162. */
  163. typedef BOOL (FNIDLE)(LPVOID);
  164. typedef FNIDLE *PFNIDLE;
  165. /*
  166. * FTG
  167. *
  168. * Function Tag. Used to identify a registered idle function.
  169. *
  170. */
  171. typedef void *FTG;
  172. typedef FTG *PFTG;
  173. #define FTGNULL ((FTG) NULL)
  174. /*
  175. - MAPIInitIdle/MAPIDeinitIdle
  176. -
  177. * Purpose:
  178. * Initialises the idle engine
  179. * If the initialisation succeded, returns 0, else returns -1
  180. *
  181. * Arguments:
  182. * lpvReserved Reserved, must be NULL.
  183. */
  184. LONG MAPIInitIdle (LPVOID lpvReserved);
  185. void MAPIDeinitIdle (void);
  186. /*
  187. * FtgRegisterIdleRoutine
  188. *
  189. * Registers the function pfn of type PFNIDLE, i.e., (BOOL (*)(LPVOID))
  190. * as an idle function.
  191. *
  192. * The idle function will be called with the parameter pv by the
  193. * idle engine. The function has initial priority priIdle,
  194. * associated time csecIdle, and options iroIdle.
  195. */
  196. FTG FtgRegisterIdleRoutine (PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  197. short priIdle, ULONG csecIdle, USHORT iroIdle);
  198. /*
  199. * DeregisterIdleRoutine
  200. *
  201. * Removes the given routine from the list of idle routines.
  202. * The routine will not be called again. It is the responsibility
  203. * of the caller to clean up any data structures pointed to by the
  204. * pvIdleParam parameter; this routine does not free the block.
  205. */
  206. void DeregisterIdleRoutine (FTG ftg);
  207. /*
  208. * EnableIdleRoutine
  209. *
  210. * Enables or disables an idle routine.
  211. */
  212. void EnableIdleRoutine (FTG ftg, BOOL fEnable);
  213. /*
  214. * ChangeIdleRoutine
  215. *
  216. * Changes some or all of the characteristics of the given idle
  217. * function. The changes to make are indicated with flags in the
  218. * ircIdle parameter.
  219. */
  220. void ChangeIdleRoutine (FTG ftg, PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  221. short priIdle, ULONG csecIdle, USHORT iroIdle, USHORT ircIdle);
  222. #endif /* ! NOIDLEENGINE */
  223. /* IMalloc Utilities */
  224. LPMALLOC MAPIGetDefaultMalloc(void);
  225. /* StreamOnFile (SOF) */
  226. /*
  227. * Methods and #define's for implementing an OLE 2.0 storage stream
  228. * (as defined in the OLE 2.0 specs) on top of a system file.
  229. */
  230. #define SOF_UNIQUEFILENAME ((ULONG) 0x80000000)
  231. HRESULT OpenStreamOnFile(
  232. LPALLOCATEBUFFER lpAllocateBuffer,
  233. LPFREEBUFFER lpFreeBuffer,
  234. ULONG ulFlags,
  235. LPTSTR lpszFileName,
  236. LPTSTR lpszPrefix,
  237. LPSTREAM * lppStream);
  238. // uh?
  239. typedef HRESULT (*LPOPENSTREAMONFILE) (
  240. LPALLOCATEBUFFER lpAllocateBuffer,
  241. LPFREEBUFFER lpFreeBuffer,
  242. ULONG ulFlags,
  243. LPTSTR lpszFileName,
  244. LPTSTR lpszPrefix,
  245. LPSTREAM * lppStream);
  246. #define OPENSTREAMONFILE "OpenStreamOnFile"
  247. /* Property interface utilities */
  248. /*
  249. * Copies a single SPropValue from Src to Dest. Handles all the various
  250. * types of properties and will link its allocations given the master
  251. * allocation object and an allocate more function.
  252. */
  253. SCODE PropCopyMore(LPSPropValue lpSPropValueDest,
  254. LPSPropValue lpSPropValueSrc,
  255. ALLOCATEMORE * lpfAllocMore,
  256. LPVOID lpvObject );
  257. /*
  258. * Returns the size in bytes of structure at lpSPropValue, including the
  259. * Value.
  260. */
  261. ULONG UlPropSize(LPSPropValue lpSPropValue);
  262. BOOL FEqualNames( LPMAPINAMEID lpName1, LPMAPINAMEID lpName2 );
  263. void GetInstance(LPSPropValue lpPropMv, LPSPropValue lpPropSv, ULONG uliInst);
  264. extern char rgchCsds[];
  265. extern char rgchCids[];
  266. extern char rgchCsdi[];
  267. extern char rgchCidi[];
  268. BOOL
  269. FPropContainsProp( LPSPropValue lpSPropValueDst,
  270. LPSPropValue lpSPropValueSrc,
  271. ULONG ulFuzzyLevel );
  272. BOOL
  273. FPropCompareProp( LPSPropValue lpSPropValue1,
  274. ULONG ulRelOp,
  275. LPSPropValue lpSPropValue2 );
  276. LONG
  277. LPropCompareProp( LPSPropValue lpSPropValueA,
  278. LPSPropValue lpSPropValueB );
  279. extern HRESULT HrAddColumns(LPMAPITABLE lptbl, const SPropTagArray *lpproptagColumnsNew, LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer);
  280. extern HRESULT HrAddColumnsEx(LPMAPITABLE lptbl, const SPropTagArray *lpproptagColumnsNew, LPALLOCATEBUFFER lpAllocateBuffer, LPFREEBUFFER lpFreeBuffer, void (*)(const SPropTagArray *ptaga));
  281. /* Notification utilities */
  282. /*
  283. * Function that creates an advise sink object given a notification
  284. * callback function and context.
  285. */
  286. extern _kc_export HRESULT HrAllocAdviseSink(LPNOTIFCALLBACK, LPVOID ctx, LPMAPIADVISESINK *);
  287. /*
  288. * Wraps an existing advise sink with another one which guarantees
  289. * that the original advise sink will be called in the thread on
  290. * which it was created.
  291. */
  292. HRESULT
  293. HrThisThreadAdviseSink( LPMAPIADVISESINK lpAdviseSink,
  294. LPMAPIADVISESINK *lppAdviseSink);
  295. /*
  296. * Allows a client and/or provider to force notifications
  297. * which are currently queued in the MAPI notification engine
  298. * to be dispatched without doing a message dispatch.
  299. */
  300. HRESULT HrDispatchNotifications (ULONG ulFlags);
  301. /* Service Provider Utilities */
  302. /*
  303. * Structures and utility function for building a display table
  304. * from resources.
  305. */
  306. struct DTCTL {
  307. ULONG ulCtlType; /* DTCT_LABEL, etc. */
  308. ULONG ulCtlFlags; /* DT_REQUIRED, etc. */
  309. LPBYTE lpbNotif; /* pointer to notification data */
  310. ULONG cbNotif; /* count of bytes of notification data */
  311. LPTSTR lpszFilter; /* character filter for edit/combobox */
  312. ULONG ulItemID; /* to validate parallel dlg template entry */
  313. union { /* ulCtlType discriminates */
  314. LPVOID lpv; /* Initialize this to avoid warnings */
  315. LPDTBLLABEL lplabel;
  316. LPDTBLEDIT lpedit;
  317. LPDTBLLBX lplbx;
  318. LPDTBLCOMBOBOX lpcombobox;
  319. LPDTBLDDLBX lpddlbx;
  320. LPDTBLCHECKBOX lpcheckbox;
  321. LPDTBLGROUPBOX lpgroupbox;
  322. LPDTBLBUTTON lpbutton;
  323. LPDTBLRADIOBUTTON lpradiobutton;
  324. LPDTBLMVLISTBOX lpmvlbx;
  325. LPDTBLMVDDLBX lpmvddlbx;
  326. LPDTBLPAGE lppage;
  327. } ctl;
  328. };
  329. typedef struct DTCTL *LPDTCTL;
  330. struct DTPAGE {
  331. ULONG cctl;
  332. LPTSTR lpszResourceName; /* as usual, may be an integer ID */
  333. union { /* as usual, may be an integer ID */
  334. LPTSTR lpszComponent;
  335. ULONG ulItemID;
  336. };
  337. LPDTCTL lpctl;
  338. };
  339. typedef struct DTPAGE *LPDTPAGE;
  340. HRESULT
  341. BuildDisplayTable( LPALLOCATEBUFFER lpAllocateBuffer,
  342. LPALLOCATEMORE lpAllocateMore,
  343. LPFREEBUFFER lpFreeBuffer,
  344. LPMALLOC lpMalloc,
  345. HINSTANCE hInstance,
  346. UINT cPages,
  347. LPDTPAGE lpPage,
  348. ULONG ulFlags,
  349. LPMAPITABLE * lppTable,
  350. LPTABLEDATA * lppTblData );
  351. /* MAPI structure validation/copy utilities */
  352. /*
  353. * Validate, copy, and adjust pointers in MAPI structures:
  354. * notification
  355. * property value array
  356. * option data
  357. */
  358. SCODE
  359. ScCountNotifications(int cNotifications, LPNOTIFICATION lpNotifications,
  360. ULONG *lpcb);
  361. SCODE
  362. ScCopyNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  363. LPVOID lpvDst, ULONG *lpcb);
  364. SCODE
  365. ScRelocNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  366. LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG *lpcb);
  367. SCODE
  368. ScCountProps(int cValues, LPSPropValue lpPropArray, ULONG *lpcb);
  369. LPSPropValue
  370. LpValFindProp(ULONG ulPropTag, ULONG cValues, LPSPropValue lpPropArray);
  371. SCODE
  372. ScCopyProps(int cValues, LPSPropValue lpPropArray, LPVOID lpvDst,
  373. ULONG *lpcb);
  374. SCODE
  375. ScRelocProps(int cValues, LPSPropValue lpPropArray,
  376. LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG *lpcb);
  377. SCODE
  378. ScDupPropset(int cValues, LPSPropValue lpPropArray,
  379. LPALLOCATEBUFFER lpAllocateBuffer, LPSPropValue *lppPropArray);
  380. /* General utility functions */
  381. /* Related to the OLE Component object model */
  382. ULONG UlAddRef(LPVOID lpunk);
  383. ULONG UlRelease(LPVOID lpunk);
  384. /* Related to the MAPI interface */
  385. extern _kc_export HRESULT HrGetOneProp(LPMAPIPROP mprop, ULONG tag, LPSPropValue *ret);
  386. extern _kc_export HRESULT HrSetOneProp(LPMAPIPROP mprop, const SPropValue *prop);
  387. extern _kc_export BOOL FPropExists(LPMAPIPROP mprop, ULONG tag);
  388. extern _kc_export LPSPropValue PpropFindProp(LPSPropValue props, ULONG vals, ULONG tag);
  389. extern _kc_export const SPropValue *PCpropFindProp(const SPropValue *, ULONG vals, ULONG tag);
  390. extern _kc_export void FreePadrlist(LPADRLIST);
  391. extern _kc_export void FreeProws(LPSRowSet rows);
  392. extern _kc_export HRESULT HrQueryAllRows(LPMAPITABLE table, const SPropTagArray *tags, LPSRestriction, const SSortOrderSet *, LONG rows_max, LPSRowSet *rows);
  393. /* Create or validate the IPM folder tree in a message store */
  394. #define MAPI_FORCE_CREATE 1
  395. #define MAPI_FULL_IPM_TREE 2
  396. HRESULT HrValidateIPMSubtree(LPMDB lpMDB, ULONG ulFlags,
  397. ULONG *lpcValues, LPSPropValue *lppValues,
  398. LPMAPIERROR *lpperr);
  399. /* Encoding and decoding strings */
  400. BOOL FBinFromHex(LPTSTR lpsz, LPBYTE lpb);
  401. SCODE ScBinFromHexBounded(LPTSTR lpsz, LPBYTE lpb, ULONG cb);
  402. void HexFromBin(LPBYTE lpb, int cb, LPTSTR lpsz);
  403. ULONG UlFromSzHex(LPCTSTR lpsz);
  404. /* Encoding and decoding entry IDs */
  405. HRESULT HrEntryIDFromSz(LPTSTR lpsz, ULONG *lpcb,
  406. LPENTRYID *lppEntryID);
  407. HRESULT HrSzFromEntryID(ULONG cb, LPENTRYID lpEntryID,
  408. LPTSTR *lpsz);
  409. HRESULT HrComposeEID(LPMAPISESSION lpSession,
  410. ULONG cbStoreRecordKey, LPBYTE lpStoreRecordKey,
  411. ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  412. ULONG *lpcbEID, LPENTRYID *lppEntryID);
  413. HRESULT HrDecomposeEID(LPMAPISESSION lpSession,
  414. ULONG cbEntryID, LPENTRYID lpEntryID,
  415. ULONG *lpcbStoreEntryID,
  416. LPENTRYID *lppStoreEntryID,
  417. ULONG *lpcbMsgEntryID,
  418. LPENTRYID *lppMsgEntryID);
  419. HRESULT HrComposeMsgID(LPMAPISESSION lpSession,
  420. ULONG cbStoreSearchKey, LPBYTE pStoreSearchKey,
  421. ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  422. LPTSTR *lpszMsgID);
  423. HRESULT HrDecomposeMsgID(LPMAPISESSION lpSession,
  424. LPTSTR lpszMsgID,
  425. ULONG *lpcbStoreEntryID,
  426. LPENTRYID *lppStoreEntryID,
  427. ULONG *lppcbMsgEntryID,
  428. LPENTRYID *lppMsgEntryID);
  429. /* Other encodings */
  430. ULONG CbOfEncoded(LPCSTR lpszEnc);
  431. ULONG CchOfEncoding(LPCSTR lpszEnd);
  432. LPWSTR EncodeID(ULONG cbEID, LPENTRYID rgbID, LPWSTR *lpWString);
  433. void FDecodeID(LPCSTR lpwEncoded, LPENTRYID *lpDecoded, ULONG *cbEncoded);
  434. /* C runtime substitutes */
  435. LPTSTR SzFindCh(LPCTSTR lpsz, USHORT ch); /* strchr */
  436. LPTSTR SzFindLastCh(LPCTSTR lpsz, USHORT ch); /* strrchr */
  437. LPTSTR SzFindSz(LPCTSTR lpsz, LPCTSTR lpszKey); /*strstr */
  438. unsigned int UFromSz(LPCTSTR lpsz); /* atoi */
  439. SCODE ScUNCFromLocalPath(LPSTR lpszLocal, LPSTR lpszUNC,
  440. UINT cchUNC);
  441. SCODE ScLocalPathFromUNC(LPSTR lpszUNC, LPSTR lpszLocal,
  442. UINT cchLocal);
  443. /* Windows Unicode string functions */
  444. int __stdcall MNLS_CompareStringW(LCID Locale, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2);
  445. int __stdcall MNLS_lstrlenW(LPCWSTR lpString);
  446. int __stdcall MNLS_lstrlen(LPCSTR lpString);
  447. int __stdcall MNLS_lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2);
  448. LPWSTR __stdcall MNLS_lstrcpyW(LPWSTR lpString1, LPCWSTR lpString2);
  449. /* 64-bit arithmetic with times */
  450. FILETIME FtAddFt(FILETIME ftAddend1, FILETIME ftAddend2);
  451. FILETIME FtMulDwDw(DWORD ftMultiplicand, DWORD ftMultiplier);
  452. FILETIME FtMulDw(DWORD ftMultiplier, FILETIME ftMultiplicand);
  453. FILETIME FtSubFt(FILETIME ftMinuend, FILETIME ftSubtrahend);
  454. FILETIME FtNegFt(FILETIME ft);
  455. FILETIME FtDivFtBogus(FILETIME f, FILETIME f2, DWORD n);
  456. /* Message composition */
  457. extern _kc_export SCODE ScCreateConversationIndex(ULONG parent_size, LPBYTE parent, ULONG *conv_index_size, LPBYTE *conv_index);
  458. /* Store support */
  459. extern _kc_export HRESULT WrapStoreEntryID(ULONG flags, LPTSTR dllname, ULONG eid_size, LPENTRYID eid, ULONG *ret_size, LPENTRYID *ret);
  460. /* RTF Sync Utilities */
  461. #define RTF_SYNC_RTF_CHANGED ((ULONG) 0x00000001)
  462. #define RTF_SYNC_BODY_CHANGED ((ULONG) 0x00000002)
  463. extern _kc_export HRESULT RTFSync(LPMESSAGE, ULONG flags, BOOL *msg_updated);
  464. /* Flags for WrapCompressedRTFStream() */
  465. /****** MAPI_MODIFY ((ULONG) 0x00000001) mapidefs.h */
  466. /****** STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) mapidefs.h */
  467. extern _kc_export HRESULT WrapCompressedRTFStream(LPSTREAM compr_rtf_strm, ULONG flags, LPSTREAM *uncompr_rtf_strm);
  468. /*
  469. * Setup and cleanup.
  470. *
  471. * Providers never need to make these calls.
  472. *
  473. * Test applications and the like which do not call MAPIInitialize
  474. * may want to call them, so that the few utility functions which
  475. * need MAPI allocators (and do not ask for them explicitly)
  476. * will work.
  477. */
  478. /* All flags are reserved for ScInitMAPIUtil. */
  479. SCODE ScInitMAPIUtil(ULONG ulFlags);
  480. void DeinitMAPIUtil(void);
  481. SCODE __stdcall ScInitMapiUtil(ULONG ulFlags);
  482. void __stdcall DeinitMapiUtil(void);
  483. /*
  484. * Entry point names.
  485. *
  486. * These are for new entry points defined since MAPI first shipped
  487. * in Windows 95. Using these names in a GetProcAddress call makes
  488. * it easier to write code which uses them optionally.
  489. */
  490. #define szHrDispatchNotifications "_HrDispatchNotifications@4"
  491. typedef HRESULT (DISPATCHNOTIFICATIONS)(ULONG ulFlags);
  492. typedef DISPATCHNOTIFICATIONS* LPDISPATCHNOTIFICATIONS;
  493. #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
  494. typedef SCODE (CREATECONVERSATIONINDEX)(ULONG cbParent,
  495. LPBYTE lpbParent,
  496. ULONG *lpcbConvIndex,
  497. LPBYTE *lppbConvIndex);
  498. typedef CREATECONVERSATIONINDEX* LPCREATECONVERSATIONINDEX;
  499. /* ********************************************************* */
  500. /* and this is from ol2e.h */
  501. extern _kc_export HRESULT CreateStreamOnHGlobal(void *global, BOOL delete_on_release, LPSTREAM *);
  502. HRESULT BuildDisplayTable(LPALLOCATEBUFFER lpAllocateBuffer, LPALLOCATEMORE lpAllocateMore,
  503. LPFREEBUFFER lpFreeBuffer, LPMALLOC lpMalloc,
  504. HINSTANCE hInstance, UINT cPages,
  505. LPDTPAGE lpPage, ULONG ulFlags,
  506. LPMAPITABLE * lppTable, LPTABLEDATA * lppTblData);
  507. } // EXTERN "C"
  508. #endif /* _MAPIUTIL_H_ */