home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / wabutil.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  25KB  |  844 lines

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