home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / MAPIUTIL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-08  |  28.5 KB  |  848 lines

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