Source code of Windows XP (NT5)
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.

886 lines
25 KiB

  1. /*
  2. * M A P I U T I L . H
  3. *
  4. * Definitions and prototypes for utility functions provided by MAPI
  5. * in MAPI[xx].DLL.
  6. *
  7. * Copyright 1986-1999 Microsoft Corporation. All Rights Reserved.
  8. */
  9. #ifndef _MAPIUTIL_H_
  10. #define _MAPIUTIL_H_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif
  14. #if defined (WIN32) && !defined (_WIN32)
  15. #define _WIN32
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. #ifndef MAPIX_H
  21. #include <mapix.h>
  22. #endif
  23. #ifdef WIN16
  24. #include <storage.h>
  25. #endif
  26. #ifndef BEGIN_INTERFACE
  27. #define BEGIN_INTERFACE
  28. #endif
  29. /* IMAPITable in memory */
  30. /* ITableData Interface ---------------------------------------------------- */
  31. DECLARE_MAPI_INTERFACE_PTR(ITableData, LPTABLEDATA);
  32. typedef void (STDAPICALLTYPE CALLERRELEASE)(
  33. ULONG ulCallerData,
  34. LPTABLEDATA lpTblData,
  35. LPMAPITABLE lpVue
  36. );
  37. #define MAPI_ITABLEDATA_METHODS(IPURE) \
  38. MAPIMETHOD(HrGetView) \
  39. (THIS_ LPSSortOrderSet lpSSortOrderSet, \
  40. CALLERRELEASE FAR * lpfCallerRelease, \
  41. ULONG ulCallerData, \
  42. LPMAPITABLE FAR * lppMAPITable) IPURE; \
  43. MAPIMETHOD(HrModifyRow) \
  44. (THIS_ LPSRow) IPURE; \
  45. MAPIMETHOD(HrDeleteRow) \
  46. (THIS_ LPSPropValue lpSPropValue) IPURE; \
  47. MAPIMETHOD(HrQueryRow) \
  48. (THIS_ LPSPropValue lpsPropValue, \
  49. LPSRow FAR * lppSRow, \
  50. ULONG FAR * lpuliRow) IPURE; \
  51. MAPIMETHOD(HrEnumRow) \
  52. (THIS_ ULONG ulRowNumber, \
  53. LPSRow FAR * lppSRow) IPURE; \
  54. MAPIMETHOD(HrNotify) \
  55. (THIS_ ULONG ulFlags, \
  56. ULONG cValues, \
  57. LPSPropValue lpSPropValue) IPURE; \
  58. MAPIMETHOD(HrInsertRow) \
  59. (THIS_ ULONG uliRow, \
  60. LPSRow lpSRow) IPURE; \
  61. MAPIMETHOD(HrModifyRows) \
  62. (THIS_ ULONG ulFlags, \
  63. LPSRowSet lpSRowSet) IPURE; \
  64. MAPIMETHOD(HrDeleteRows) \
  65. (THIS_ ULONG ulFlags, \
  66. LPSRowSet lprowsetToDelete, \
  67. ULONG FAR * cRowsDeleted) IPURE; \
  68. #undef INTERFACE
  69. #define INTERFACE ITableData
  70. DECLARE_MAPI_INTERFACE_(ITableData, IUnknown)
  71. {
  72. BEGIN_INTERFACE
  73. MAPI_IUNKNOWN_METHODS(PURE)
  74. MAPI_ITABLEDATA_METHODS(PURE)
  75. };
  76. /* Entry Point for in memory ITable */
  77. /* CreateTable()
  78. * Creates the internal memory structures and object handle
  79. * to bring a new table into existence.
  80. *
  81. * lpInterface
  82. * Interface ID of the TableData object (IID_IMAPITableData)
  83. *
  84. * lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer
  85. * Function addresses are provided by the caller so that
  86. * this DLL allocates/frees memory appropriately.
  87. * lpvReserved
  88. * Reserved. Should be NULL.
  89. * ulTableType
  90. * TBLTYPE_DYNAMIC, etc. Visible to the calling application
  91. * as part of the GetStatus return data on its views
  92. * ulPropTagIndexColumn
  93. * Index column for use when changing the data
  94. * lpSPropTagArrayColumns
  95. * Column proptags for the minimum set of columns in the table
  96. * lppTableData
  97. * Address of the pointer which will receive the TableData object
  98. */
  99. STDAPI_(SCODE)
  100. CreateTable( LPCIID lpInterface,
  101. ALLOCATEBUFFER FAR * lpAllocateBuffer,
  102. ALLOCATEMORE FAR * lpAllocateMore,
  103. FREEBUFFER FAR * lpFreeBuffer,
  104. LPVOID lpvReserved,
  105. ULONG ulTableType,
  106. ULONG ulPropTagIndexColumn,
  107. LPSPropTagArray lpSPropTagArrayColumns,
  108. LPTABLEDATA FAR * lppTableData );
  109. /* HrGetView()
  110. * This function obtains a new view on the underlying data
  111. * which supports the IMAPITable interface. All rows and columns
  112. * of the underlying table data are initially visible
  113. * lpSSortOrderSet
  114. * if specified, results in the view being sorted
  115. * lpfCallerRelease
  116. * pointer to a routine to be called when the view is released, or
  117. * NULL.
  118. * ulCallerData
  119. * arbitrary data the caller wants saved with this view and returned in
  120. * the Release callback.
  121. */
  122. /* HrModifyRows()
  123. * Add or modify a set of rows in the table data
  124. * ulFlags
  125. * Must be zero
  126. * lpSRowSet
  127. * Each row in the row set contains all the properties for one row
  128. * in the table. One of the properties must be the index column. Any
  129. * row in the table with the same value for its index column is
  130. * replaced, or if there is no current row with that value the
  131. * row is added.
  132. * Each row in LPSRowSet MUST have a unique Index column!
  133. * If any views are open, the view is updated as well.
  134. * The properties do not have to be in the same order as the
  135. * columns in the current table
  136. */
  137. /* HrModifyRow()
  138. * Add or modify one row in the table
  139. * lpSRow
  140. * This row contains all the properties for one row in the table.
  141. * One of the properties must be the index column. Any row in
  142. * the table with the same value for its index column is
  143. * replaced, or if there is no current row with that value the
  144. * row is added
  145. * If any views are open, the view is updated as well.
  146. * The properties do not have to be in the same order as the
  147. * columns in the current table
  148. */
  149. /* HrDeleteRows()
  150. * Delete a row in the table.
  151. * ulFlags
  152. * TAD_ALL_ROWS - Causes all rows in the table to be deleted
  153. * lpSRowSet is ignored in this case.
  154. * lpSRowSet
  155. * Each row in the row set contains all the properties for one row
  156. * in the table. One of the properties must be the index column. Any
  157. * row in the table with the same value for its index column is
  158. * deleted.
  159. * Each row in LPSRowSet MUST have a unique Index column!
  160. * If any views are open, the view is updated as well.
  161. * The properties do not have to be in the same order as the
  162. * columns in the current table
  163. */
  164. #define TAD_ALL_ROWS 1
  165. /* HrDeleteRow()
  166. * Delete a row in the table.
  167. * lpSPropValue
  168. * This property value specifies the row which has this value
  169. * for its index column
  170. */
  171. /* HrQueryRow()
  172. * Returns the values of a specified row in the table
  173. * lpSPropValue
  174. * This property value specifies the row which has this value
  175. * for its index column
  176. * lppSRow
  177. * Address of where to return a pointer to an SRow
  178. * lpuliRow
  179. * Address of where to return the row number. This can be NULL
  180. * if the row number is not required.
  181. *
  182. */
  183. /* HrEnumRow()
  184. * Returns the values of a specific (numbered) row in the table
  185. * ulRowNumber
  186. * Indicates row number 0 to n-1
  187. * lppSRow
  188. * Address of where to return a pointer to a SRow
  189. */
  190. /* HrInsertRow()
  191. * Inserts a row into the table.
  192. * uliRow
  193. * The row number before which this row will be inserted into the table.
  194. * Row numbers can be from 0 to n where o to n-1 result in row insertion
  195. * a row number of n results in the row being appended to the table.
  196. * lpSRow
  197. * This row contains all the properties for one row in the table.
  198. * One of the properties must be the index column. Any row in
  199. * the table with the same value for its index column is
  200. * replaced, or if there is no current row with that value the
  201. * row is added
  202. * If any views are open, the view is updated as well.
  203. * The properties do not have to be in the same order as the
  204. * columns in the current table
  205. */
  206. /* IMAPIProp in memory */
  207. /* IPropData Interface ---------------------------------------------------- */
  208. #define MAPI_IPROPDATA_METHODS(IPURE) \
  209. MAPIMETHOD(HrSetObjAccess) \
  210. (THIS_ ULONG ulAccess) IPURE; \
  211. MAPIMETHOD(HrSetPropAccess) \
  212. (THIS_ LPSPropTagArray lpPropTagArray, \
  213. ULONG FAR * rgulAccess) IPURE; \
  214. MAPIMETHOD(HrGetPropAccess) \
  215. (THIS_ LPSPropTagArray FAR * lppPropTagArray, \
  216. ULONG FAR * FAR * lprgulAccess) IPURE; \
  217. MAPIMETHOD(HrAddObjProps) \
  218. (THIS_ LPSPropTagArray lppPropTagArray, \
  219. LPSPropProblemArray FAR * lprgulAccess) IPURE;
  220. #undef INTERFACE
  221. #define INTERFACE IPropData
  222. DECLARE_MAPI_INTERFACE_(IPropData, IMAPIProp)
  223. {
  224. BEGIN_INTERFACE
  225. MAPI_IUNKNOWN_METHODS(PURE)
  226. MAPI_IMAPIPROP_METHODS(PURE)
  227. MAPI_IPROPDATA_METHODS(PURE)
  228. };
  229. DECLARE_MAPI_INTERFACE_PTR(IPropData, LPPROPDATA);
  230. /* Entry Point for in memory IMAPIProp */
  231. /* CreateIProp()
  232. * Creates the internal memory structures and object handle
  233. * to bring a new property interface into existance.
  234. *
  235. * lpInterface
  236. * Interface ID of the TableData object (IID_IMAPIPropData)
  237. *
  238. * lpAllocateBuffer, lpAllocateMore, and lpFreeBuffer
  239. * Function addresses are provided by the caller so that
  240. * this DLL allocates/frees memory appropriately.
  241. * lppPropData
  242. * Address of the pointer which will receive the IPropData object
  243. * lpvReserved
  244. * Reserved. Should be NULL.
  245. */
  246. STDAPI_(SCODE)
  247. CreateIProp( LPCIID lpInterface,
  248. ALLOCATEBUFFER FAR * lpAllocateBuffer,
  249. ALLOCATEMORE FAR * lpAllocateMore,
  250. FREEBUFFER FAR * lpFreeBuffer,
  251. LPVOID lpvReserved,
  252. LPPROPDATA FAR * lppPropData );
  253. /*
  254. * Defines for prop/obj access
  255. */
  256. #define IPROP_READONLY ((ULONG) 0x00000001)
  257. #define IPROP_READWRITE ((ULONG) 0x00000002)
  258. #define IPROP_CLEAN ((ULONG) 0x00010000)
  259. #define IPROP_DIRTY ((ULONG) 0x00020000)
  260. /*
  261. - HrSetPropAccess
  262. -
  263. * Sets access right attributes on a per-property basis. By default,
  264. * all properties are read/write.
  265. *
  266. */
  267. /*
  268. - HrSetObjAccess
  269. -
  270. * Sets access rights for the object itself. By default, the object has
  271. * read/write access.
  272. *
  273. */
  274. #ifndef NOIDLEENGINE
  275. /* Idle time scheduler */
  276. /*
  277. * PRI
  278. *
  279. * Priority of an idle task.
  280. * The idle engine sorts tasks by priority, and the one with the higher
  281. * value runs first. Within a priority level, the functions are called
  282. * round-robin.
  283. */
  284. #define PRILOWEST -32768
  285. #define PRIHIGHEST 32767
  286. #define PRIUSER 0
  287. /*
  288. * IRO
  289. *
  290. * Idle routine options. This is a combined bit mask consisting of
  291. * individual firo's. Listed below are the possible bit flags.
  292. *
  293. * FIROWAIT and FIROINTERVAL are mutually exclusive.
  294. * If neither of the flags are specified, the default action
  295. * is to ignore the time parameter of the idle function and
  296. * call it as often as possible if firoPerBlock is not set;
  297. * otherwise call it one time only during the idle block
  298. * once the time constraint has been set. FIROINTERVAL
  299. * is also incompatible with FIROPERBLOCK.
  300. *
  301. * FIROWAIT - time given is minimum idle time before calling
  302. * for the first time in the block of idle time,
  303. * afterwhich call as often as possible.
  304. * FIROINTERVAL - time given is minimum interval between each
  305. * successive call
  306. * FIROPERBLOCK - called only once per contiguous block of idle
  307. * time
  308. * FIRODISABLED - initially disabled when registered, the
  309. * default is to enable the function when registered.
  310. * FIROONCEONLY - called only one time by the scheduler and then
  311. * deregistered automatically.
  312. */
  313. #define IRONULL ((USHORT) 0x0000)
  314. #define FIROWAIT ((USHORT) 0x0001)
  315. #define FIROINTERVAL ((USHORT) 0x0002)
  316. #define FIROPERBLOCK ((USHORT) 0x0004)
  317. #define FIRODISABLED ((USHORT) 0x0020)
  318. #define FIROONCEONLY ((USHORT) 0x0040)
  319. /*
  320. * IRC
  321. *
  322. * Idle routine change options. This is a combined bit mask consisting
  323. * of individual firc's; each one identifies an aspect of the idle task
  324. * that can be changed.
  325. *
  326. */
  327. #define IRCNULL ((USHORT) 0x0000)
  328. #define FIRCPFN ((USHORT) 0x0001) /* change function pointer */
  329. #define FIRCPV ((USHORT) 0x0002) /* change parameter block */
  330. #define FIRCPRI ((USHORT) 0x0004) /* change priority */
  331. #define FIRCCSEC ((USHORT) 0x0008) /* change time */
  332. #define FIRCIRO ((USHORT) 0x0010) /* change routine options */
  333. /*
  334. * Type definition for idle functions. An idle function takes one
  335. * parameter, an PV, and returns a BOOL value.
  336. */
  337. typedef BOOL (STDAPICALLTYPE FNIDLE) (LPVOID);
  338. typedef FNIDLE FAR *PFNIDLE;
  339. /*
  340. * FTG
  341. *
  342. * Function Tag. Used to identify a registered idle function.
  343. *
  344. */
  345. typedef void FAR *FTG;
  346. typedef FTG FAR *PFTG;
  347. #define FTGNULL ((FTG) NULL)
  348. /*
  349. - MAPIInitIdle/MAPIDeinitIdle
  350. -
  351. * Purpose:
  352. * Initialises the idle engine
  353. * If the initialisation succeded, returns 0, else returns -1
  354. *
  355. * Arguments:
  356. * lpvReserved Reserved, must be NULL.
  357. */
  358. STDAPI_(LONG)
  359. MAPIInitIdle (LPVOID lpvReserved);
  360. STDAPI_(VOID)
  361. MAPIDeinitIdle (VOID);
  362. /*
  363. * FtgRegisterIdleRoutine
  364. *
  365. * Registers the function pfn of type PFNIDLE, i.e., (BOOL (*)(LPVOID))
  366. * as an idle function.
  367. *
  368. * The idle function will be called with the parameter pv by the
  369. * idle engine. The function has initial priority priIdle,
  370. * associated time csecIdle, and options iroIdle.
  371. */
  372. STDAPI_(FTG)
  373. FtgRegisterIdleRoutine (PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  374. short priIdle, ULONG csecIdle, USHORT iroIdle);
  375. /*
  376. * DeregisterIdleRoutine
  377. *
  378. * Removes the given routine from the list of idle routines.
  379. * The routine will not be called again. It is the responsibility
  380. * of the caller to clean up any data structures pointed to by the
  381. * pvIdleParam parameter; this routine does not free the block.
  382. */
  383. STDAPI_(void)
  384. DeregisterIdleRoutine (FTG ftg);
  385. /*
  386. * EnableIdleRoutine
  387. *
  388. * Enables or disables an idle routine.
  389. */
  390. STDAPI_(void)
  391. EnableIdleRoutine (FTG ftg, BOOL fEnable);
  392. /*
  393. * ChangeIdleRoutine
  394. *
  395. * Changes some or all of the characteristics of the given idle
  396. * function. The changes to make are indicated with flags in the
  397. * ircIdle parameter.
  398. */
  399. STDAPI_(void)
  400. ChangeIdleRoutine (FTG ftg, PFNIDLE lpfnIdle, LPVOID lpvIdleParam,
  401. short priIdle, ULONG csecIdle, USHORT iroIdle, USHORT ircIdle);
  402. #endif /* ! NOIDLEENGINE */
  403. /* IMalloc Utilities */
  404. STDAPI_(LPMALLOC) MAPIGetDefaultMalloc(VOID);
  405. /* StreamOnFile (SOF) */
  406. /*
  407. * Methods and #define's for implementing an OLE 2.0 storage stream
  408. * (as defined in the OLE 2.0 specs) on top of a system file.
  409. */
  410. #define SOF_UNIQUEFILENAME ((ULONG) 0x80000000)
  411. STDMETHODIMP OpenStreamOnFile(
  412. LPALLOCATEBUFFER lpAllocateBuffer,
  413. LPFREEBUFFER lpFreeBuffer,
  414. ULONG ulFlags,
  415. LPTSTR lpszFileName,
  416. LPTSTR lpszPrefix,
  417. LPSTREAM FAR * lppStream);
  418. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENSTREAMONFILE) (
  419. LPALLOCATEBUFFER lpAllocateBuffer,
  420. LPFREEBUFFER lpFreeBuffer,
  421. ULONG ulFlags,
  422. LPTSTR lpszFileName,
  423. LPTSTR lpszPrefix,
  424. LPSTREAM FAR * lppStream);
  425. #ifdef _WIN32
  426. #define OPENSTREAMONFILE "OpenStreamOnFile"
  427. #endif
  428. #ifdef WIN16
  429. #define OPENSTREAMONFILE "_OPENSTREAMONFILE"
  430. #endif
  431. /* Property interface utilities */
  432. /*
  433. * Copies a single SPropValue from Src to Dest. Handles all the various
  434. * types of properties and will link its allocations given the master
  435. * allocation object and an allocate more function.
  436. */
  437. STDAPI_(SCODE)
  438. PropCopyMore( LPSPropValue lpSPropValueDest,
  439. LPSPropValue lpSPropValueSrc,
  440. ALLOCATEMORE * lpfAllocMore,
  441. LPVOID lpvObject );
  442. /*
  443. * Returns the size in bytes of structure at lpSPropValue, including the
  444. * Value.
  445. */
  446. STDAPI_(ULONG)
  447. UlPropSize( LPSPropValue lpSPropValue );
  448. STDAPI_(BOOL)
  449. FEqualNames( LPMAPINAMEID lpName1, LPMAPINAMEID lpName2 );
  450. #if defined(_WIN32) && !defined(_WINNT) && !defined(_WIN95) && !defined(_MAC)
  451. #define _WINNT
  452. #endif
  453. STDAPI_(void)
  454. GetInstance(LPSPropValue lpPropMv, LPSPropValue lpPropSv, ULONG uliInst);
  455. extern char rgchCsds[];
  456. extern char rgchCids[];
  457. extern char rgchCsdi[];
  458. extern char rgchCidi[];
  459. STDAPI_(BOOL)
  460. FPropContainsProp( LPSPropValue lpSPropValueDst,
  461. LPSPropValue lpSPropValueSrc,
  462. ULONG ulFuzzyLevel );
  463. STDAPI_(BOOL)
  464. FPropCompareProp( LPSPropValue lpSPropValue1,
  465. ULONG ulRelOp,
  466. LPSPropValue lpSPropValue2 );
  467. STDAPI_(LONG)
  468. LPropCompareProp( LPSPropValue lpSPropValueA,
  469. LPSPropValue lpSPropValueB );
  470. STDAPI_(HRESULT)
  471. HrAddColumns( LPMAPITABLE lptbl,
  472. LPSPropTagArray lpproptagColumnsNew,
  473. LPALLOCATEBUFFER lpAllocateBuffer,
  474. LPFREEBUFFER lpFreeBuffer);
  475. STDAPI_(HRESULT)
  476. HrAddColumnsEx( LPMAPITABLE lptbl,
  477. LPSPropTagArray lpproptagColumnsNew,
  478. LPALLOCATEBUFFER lpAllocateBuffer,
  479. LPFREEBUFFER lpFreeBuffer,
  480. void (FAR *lpfnFilterColumns)(LPSPropTagArray ptaga));
  481. /* Notification utilities */
  482. /*
  483. * Function that creates an advise sink object given a notification
  484. * callback function and context.
  485. */
  486. STDAPI
  487. HrAllocAdviseSink( LPNOTIFCALLBACK lpfnCallback,
  488. LPVOID lpvContext,
  489. LPMAPIADVISESINK FAR *lppAdviseSink );
  490. /*
  491. * Wraps an existing advise sink with another one which guarantees
  492. * that the original advise sink will be called in the thread on
  493. * which it was created.
  494. */
  495. STDAPI
  496. HrThisThreadAdviseSink( LPMAPIADVISESINK lpAdviseSink,
  497. LPMAPIADVISESINK FAR *lppAdviseSink);
  498. /*
  499. * Allows a client and/or provider to force notifications
  500. * which are currently queued in the MAPI notification engine
  501. * to be dispatched without doing a message dispatch.
  502. */
  503. STDAPI HrDispatchNotifications (ULONG ulFlags);
  504. /* Service Provider Utilities */
  505. /*
  506. * Structures and utility function for building a display table
  507. * from resources.
  508. */
  509. typedef struct {
  510. ULONG ulCtlType; /* DTCT_LABEL, etc. */
  511. ULONG ulCtlFlags; /* DT_REQUIRED, etc. */
  512. LPBYTE lpbNotif; /* pointer to notification data */
  513. ULONG cbNotif; /* count of bytes of notification data */
  514. LPTSTR lpszFilter; /* character filter for edit/combobox */
  515. ULONG ulItemID; /* to validate parallel dlg template entry */
  516. union { /* ulCtlType discriminates */
  517. LPVOID lpv; /* Initialize this to avoid warnings */
  518. LPDTBLLABEL lplabel;
  519. LPDTBLEDIT lpedit;
  520. LPDTBLLBX lplbx;
  521. LPDTBLCOMBOBOX lpcombobox;
  522. LPDTBLDDLBX lpddlbx;
  523. LPDTBLCHECKBOX lpcheckbox;
  524. LPDTBLGROUPBOX lpgroupbox;
  525. LPDTBLBUTTON lpbutton;
  526. LPDTBLRADIOBUTTON lpradiobutton;
  527. LPDTBLMVLISTBOX lpmvlbx;
  528. LPDTBLMVDDLBX lpmvddlbx;
  529. LPDTBLPAGE lppage;
  530. } ctl;
  531. } DTCTL, FAR *LPDTCTL;
  532. typedef struct {
  533. ULONG cctl;
  534. LPTSTR lpszResourceName; /* as usual, may be an integer ID */
  535. union { /* as usual, may be an integer ID */
  536. LPTSTR lpszComponent;
  537. ULONG ulItemID;
  538. };
  539. LPDTCTL lpctl;
  540. } DTPAGE, FAR *LPDTPAGE;
  541. STDAPI
  542. BuildDisplayTable( LPALLOCATEBUFFER lpAllocateBuffer,
  543. LPALLOCATEMORE lpAllocateMore,
  544. LPFREEBUFFER lpFreeBuffer,
  545. LPMALLOC lpMalloc,
  546. HINSTANCE hInstance,
  547. UINT cPages,
  548. LPDTPAGE lpPage,
  549. ULONG ulFlags,
  550. LPMAPITABLE * lppTable,
  551. LPTABLEDATA * lppTblData );
  552. /* MAPI structure validation/copy utilities */
  553. /*
  554. * Validate, copy, and adjust pointers in MAPI structures:
  555. * notification
  556. * property value array
  557. * option data
  558. */
  559. STDAPI_(SCODE)
  560. ScCountNotifications(int cNotifications, LPNOTIFICATION lpNotifications,
  561. ULONG FAR *lpcb);
  562. STDAPI_(SCODE)
  563. ScCopyNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  564. LPVOID lpvDst, ULONG FAR *lpcb);
  565. STDAPI_(SCODE)
  566. ScRelocNotifications(int cNotification, LPNOTIFICATION lpNotifications,
  567. LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb);
  568. STDAPI_(SCODE)
  569. ScCountProps(int cValues, LPSPropValue lpPropArray, ULONG FAR *lpcb);
  570. STDAPI_(LPSPropValue)
  571. LpValFindProp(ULONG ulPropTag, ULONG cValues, LPSPropValue lpPropArray);
  572. STDAPI_(SCODE)
  573. ScCopyProps(int cValues, LPSPropValue lpPropArray, LPVOID lpvDst,
  574. ULONG FAR *lpcb);
  575. STDAPI_(SCODE)
  576. ScRelocProps(int cValues, LPSPropValue lpPropArray,
  577. LPVOID lpvBaseOld, LPVOID lpvBaseNew, ULONG FAR *lpcb);
  578. STDAPI_(SCODE)
  579. ScDupPropset(int cValues, LPSPropValue lpPropArray,
  580. LPALLOCATEBUFFER lpAllocateBuffer, LPSPropValue FAR *lppPropArray);
  581. /* General utility functions */
  582. /* Related to the OLE Component object model */
  583. STDAPI_(ULONG) UlAddRef(LPVOID lpunk);
  584. STDAPI_(ULONG) UlRelease(LPVOID lpunk);
  585. /* Related to the MAPI interface */
  586. STDAPI HrGetOneProp(LPMAPIPROP lpMapiProp, ULONG ulPropTag,
  587. LPSPropValue FAR *lppProp);
  588. STDAPI HrSetOneProp(LPMAPIPROP lpMapiProp,
  589. LPSPropValue lpProp);
  590. STDAPI_(BOOL) FPropExists(LPMAPIPROP lpMapiProp, ULONG ulPropTag);
  591. STDAPI_(LPSPropValue) PpropFindProp(LPSPropValue lpPropArray, ULONG cValues,
  592. ULONG ulPropTag);
  593. STDAPI_(void) FreePadrlist(LPADRLIST lpAdrlist);
  594. STDAPI_(void) FreeProws(LPSRowSet lpRows);
  595. STDAPI HrQueryAllRows(LPMAPITABLE lpTable,
  596. LPSPropTagArray lpPropTags,
  597. LPSRestriction lpRestriction,
  598. LPSSortOrderSet lpSortOrderSet,
  599. LONG crowsMax,
  600. LPSRowSet FAR *lppRows);
  601. /* Create or validate the IPM folder tree in a message store */
  602. #define MAPI_FORCE_CREATE 1
  603. #define MAPI_FULL_IPM_TREE 2
  604. STDAPI HrValidateIPMSubtree(LPMDB lpMDB, ULONG ulFlags,
  605. ULONG FAR *lpcValues, LPSPropValue FAR *lppValues,
  606. LPMAPIERROR FAR *lpperr);
  607. /* Encoding and decoding strings */
  608. STDAPI_(BOOL) FBinFromHex(LPTSTR lpsz, LPBYTE lpb);
  609. STDAPI_(SCODE) ScBinFromHexBounded(LPTSTR lpsz, LPBYTE lpb, ULONG cb);
  610. STDAPI_(void) HexFromBin(LPBYTE lpb, int cb, LPTSTR lpsz);
  611. STDAPI_(ULONG) UlFromSzHex(LPCTSTR lpsz);
  612. /* Encoding and decoding entry IDs */
  613. STDAPI HrEntryIDFromSz(LPTSTR lpsz, ULONG FAR *lpcb,
  614. LPENTRYID FAR *lppEntryID);
  615. STDAPI HrSzFromEntryID(ULONG cb, LPENTRYID lpEntryID,
  616. LPTSTR FAR *lpsz);
  617. STDAPI HrComposeEID(LPMAPISESSION lpSession,
  618. ULONG cbStoreRecordKey, LPBYTE lpStoreRecordKey,
  619. ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  620. ULONG FAR *lpcbEID, LPENTRYID FAR *lppEntryID);
  621. STDAPI HrDecomposeEID(LPMAPISESSION lpSession,
  622. ULONG cbEntryID, LPENTRYID lpEntryID,
  623. ULONG FAR *lpcbStoreEntryID,
  624. LPENTRYID FAR *lppStoreEntryID,
  625. ULONG FAR *lpcbMsgEntryID,
  626. LPENTRYID FAR *lppMsgEntryID);
  627. STDAPI HrComposeMsgID(LPMAPISESSION lpSession,
  628. ULONG cbStoreSearchKey, LPBYTE pStoreSearchKey,
  629. ULONG cbMsgEntryID, LPENTRYID lpMsgEntryID,
  630. LPTSTR FAR *lpszMsgID);
  631. STDAPI HrDecomposeMsgID(LPMAPISESSION lpSession,
  632. LPTSTR lpszMsgID,
  633. ULONG FAR *lpcbStoreEntryID,
  634. LPENTRYID FAR *lppStoreEntryID,
  635. ULONG FAR *lppcbMsgEntryID,
  636. LPENTRYID FAR *lppMsgEntryID);
  637. /* C runtime substitutes */
  638. STDAPI_(LPTSTR) SzFindCh(LPCTSTR lpsz, USHORT ch); /* strchr */
  639. STDAPI_(LPTSTR) SzFindLastCh(LPCTSTR lpsz, USHORT ch); /* strrchr */
  640. STDAPI_(LPTSTR) SzFindSz(LPCTSTR lpsz, LPCTSTR lpszKey); /*strstr */
  641. STDAPI_(unsigned int) UFromSz(LPCTSTR lpsz); /* atoi */
  642. STDAPI_(SCODE) ScUNCFromLocalPath(LPSTR lpszLocal, LPSTR lpszUNC,
  643. UINT cchUNC);
  644. STDAPI_(SCODE) ScLocalPathFromUNC(LPSTR lpszUNC, LPSTR lpszLocal,
  645. UINT cchLocal);
  646. /* 64-bit arithmetic with times */
  647. STDAPI_(FILETIME) FtAddFt(FILETIME ftAddend1, FILETIME ftAddend2);
  648. STDAPI_(FILETIME) FtMulDwDw(DWORD ftMultiplicand, DWORD ftMultiplier);
  649. STDAPI_(FILETIME) FtMulDw(DWORD ftMultiplier, FILETIME ftMultiplicand);
  650. STDAPI_(FILETIME) FtSubFt(FILETIME ftMinuend, FILETIME ftSubtrahend);
  651. STDAPI_(FILETIME) FtNegFt(FILETIME ft);
  652. /* Message composition */
  653. STDAPI_(SCODE) ScCreateConversationIndex (ULONG cbParent,
  654. LPBYTE lpbParent,
  655. ULONG FAR * lpcbConvIndex,
  656. LPBYTE FAR * lppbConvIndex);
  657. /* Store support */
  658. STDAPI WrapStoreEntryID (ULONG ulFlags, LPTSTR lpszDLLName, ULONG cbOrigEntry,
  659. LPENTRYID lpOrigEntry, ULONG *lpcbWrappedEntry, LPENTRYID *lppWrappedEntry);
  660. /* RTF Sync Utilities */
  661. #define RTF_SYNC_RTF_CHANGED ((ULONG) 0x00000001)
  662. #define RTF_SYNC_BODY_CHANGED ((ULONG) 0x00000002)
  663. STDAPI_(HRESULT)
  664. RTFSync (LPMESSAGE lpMessage, ULONG ulFlags, BOOL FAR * lpfMessageUpdated);
  665. /* Flags for WrapCompressedRTFStream() */
  666. /****** MAPI_MODIFY ((ULONG) 0x00000001) mapidefs.h */
  667. /****** STORE_UNCOMPRESSED_RTF ((ULONG) 0x00008000) mapidefs.h */
  668. STDAPI_(HRESULT)
  669. WrapCompressedRTFStream (LPSTREAM lpCompressedRTFStream,
  670. ULONG ulFlags, LPSTREAM FAR * lpUncompressedRTFStream);
  671. /* Storage on Stream */
  672. #if defined(_WIN32) || defined(WIN16)
  673. STDAPI_(HRESULT)
  674. HrIStorageFromStream (LPUNKNOWN lpUnkIn,
  675. LPCIID lpInterface, ULONG ulFlags, LPSTORAGE FAR * lppStorageOut);
  676. #endif
  677. /*
  678. * Setup and cleanup.
  679. *
  680. * Providers never need to make these calls.
  681. *
  682. * Test applications and the like which do not call MAPIInitialize
  683. * may want to call them, so that the few utility functions which
  684. * need MAPI allocators (and do not ask for them explicitly)
  685. * will work.
  686. */
  687. /* All flags are reserved for ScInitMapiUtil. */
  688. STDAPI_(SCODE) ScInitMapiUtil(ULONG ulFlags);
  689. STDAPI_(VOID) DeinitMapiUtil(VOID);
  690. /*
  691. * Entry point names.
  692. *
  693. * These are for new entry points defined since MAPI first shipped
  694. * in Windows 95. Using these names in a GetProcAddress call makes
  695. * it easier to write code which uses them optionally.
  696. */
  697. #if defined (WIN16)
  698. #define szHrDispatchNotifications "HrDispatchNotifications"
  699. #elif defined (_WIN32) && defined (_X86_)
  700. #define szHrDispatchNotifications "_HrDispatchNotifications@4"
  701. #elif defined (_ALPHA_) || defined (_MIPS_) || defined (_PPC_) || defined(_IA64_)
  702. #define szHrDispatchNotifications "HrDispatchNotifications"
  703. #endif
  704. typedef HRESULT (STDAPICALLTYPE DISPATCHNOTIFICATIONS)(ULONG ulFlags);
  705. typedef DISPATCHNOTIFICATIONS FAR * LPDISPATCHNOTIFICATIONS;
  706. #if defined (WIN16)
  707. #define szScCreateConversationIndex "ScCreateConversationIndex"
  708. #elif defined (_WIN32) && defined (_X86_)
  709. #define szScCreateConversationIndex "_ScCreateConversationIndex@16"
  710. #elif defined (_ALPHA_) || defined (_MIPS_) || defined (_PPC_) || defined(_IA64_)
  711. #define szScCreateConversationIndex "ScCreateConversationIndex"
  712. #endif
  713. typedef SCODE (STDAPICALLTYPE CREATECONVERSATIONINDEX)(ULONG cbParent,
  714. LPBYTE lpbParent, ULONG FAR *lpcbConvIndex, LPBYTE FAR *lppbConvIndex);
  715. typedef CREATECONVERSATIONINDEX FAR *LPCREATECONVERSATIONINDEX;
  716. #ifdef __cplusplus
  717. }
  718. #endif
  719. #endif /* _MAPIUTIL_H_ */