home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / wabutil.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  24.2 KB  |  846 lines

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