home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / dbmsg / mapi / manager.sh / _smh.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-11  |  26.0 KB  |  746 lines

  1. /*
  2.  *  _ S M H . H
  3.  *
  4.  *  Sample mail handling hook
  5.  *  Copyright 1992-95 Microsoft Corporation.  All Rights Reserved.
  6.  */
  7.  
  8. /* RICHEDIT OLE callback object method definitions */
  9. /* IRichEditOleCallback Interface --------------------------------------------- */
  10.  
  11. #define MAPI_IRICHEDITOLECALLBACK_METHODS(IPURE)                        \
  12.     MAPIMETHOD(GetNewStorage)                                           \
  13.         (THIS_  LPSTORAGE FAR * lppstg) IPURE;                          \
  14.     MAPIMETHOD(GetInPlaceContext)                                       \
  15.         (THIS_  LPOLEINPLACEFRAME FAR * ppipframe,                      \
  16.                 LPOLEINPLACEUIWINDOW FAR * ppipuiDoc,                   \
  17.                 LPOLEINPLACEFRAMEINFO pipfinfo) IPURE;                  \
  18.     MAPIMETHOD(ShowContainerUI)                                         \
  19.         (THIS_  BOOL fShow) IPURE;                                      \
  20.     MAPIMETHOD(QueryInsertObject)                                       \
  21.         (THIS_  LPCLSID pclsid,                                         \
  22.                 LPSTORAGE pstg,                                         \
  23.                 LONG cp) IPURE;                                         \
  24.     MAPIMETHOD(DeleteObject)                                            \
  25.         (THIS_  LPOLEOBJECT poleobj) IPURE;                             \
  26.     MAPIMETHOD(QueryAcceptData)                                         \
  27.         (THIS_  LPDATAOBJECT lpdataobj,                                 \
  28.                 CLIPFORMAT FAR * lpcfFormat,                            \
  29.                 DWORD reco,                                             \
  30.                 BOOL fReally,                                           \
  31.                 HGLOBAL hMetaPict) IPURE;                               \
  32.     MAPIMETHOD(ContextSensitiveHelp)                                    \
  33.         (THIS_  BOOL fEnterMode) IPURE;                                 \
  34.     MAPIMETHOD(GetClipboardData)                                        \
  35.         (THIS_  CHARRANGE FAR * lpchrg,                                 \
  36.                 DWORD reco,                                             \
  37.                 LPDATAOBJECT FAR * lppdataobj);                         \
  38.     MAPIMETHOD(GetDragDropEffect)                                       \
  39.         (THIS_  BOOL fDrag,                                             \
  40.                 DWORD grfKeyState,                                      \
  41.                 LPDWORD pdwEffect) IPURE;                               \
  42.     MAPIMETHOD(GetContextMenu)                                          \
  43.         (THIS_  WORD seltype,                                           \
  44.                 LPOLEOBJECT lpoleobj,                                   \
  45.                 CHARRANGE FAR * lpchrg,                                 \
  46.                 HMENU FAR * lphmenu) IPURE;                             \
  47.                                                                         
  48. /*
  49. /*  Object Vtable definition and declairation
  50.  */
  51. #undef  INTERFACE
  52. #define INTERFACE struct _REOC
  53. #undef  MAPIMETHOD_
  54. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, REOC_)
  55.         MAPI_IUNKNOWN_METHODS (IMPL)
  56.         MAPI_IRICHEDITOLECALLBACK_METHODS (IMPL)
  57. #undef  MAPIMETHOD_
  58. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, REOC_)
  59.         MAPI_IUNKNOWN_METHODS (IMPL)
  60.         MAPI_IRICHEDITOLECALLBACK_METHODS (IMPL)
  61. #undef  MAPIMETHOD_
  62. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  63. DECLARE_MAPI_INTERFACE (REOC_)
  64. {
  65.     MAPI_IUNKNOWN_METHODS (IMPL)
  66.     MAPI_IRICHEDITOLECALLBACK_METHODS (IMPL)
  67. };
  68.  
  69.  
  70. /*
  71.  *  Object Vtable definition and declairation
  72.  */
  73. #undef  INTERFACE
  74. #define INTERFACE struct _SMH
  75. #undef  MAPIMETHOD_
  76. #define MAPIMETHOD_(type, method)   MAPIMETHOD_DECLARE(type, method, SMH_)
  77.         MAPI_IUNKNOWN_METHODS (IMPL)
  78.         MAPI_ISPOOLERHOOK_METHODS (IMPL)
  79. #undef  MAPIMETHOD_
  80. #define MAPIMETHOD_(type, method)   MAPIMETHOD_TYPEDEF(type, method, SMH_)
  81.         MAPI_IUNKNOWN_METHODS (IMPL)
  82.         MAPI_ISPOOLERHOOK_METHODS (IMPL)
  83. #undef  MAPIMETHOD_
  84. #define MAPIMETHOD_(type, method)   STDMETHOD_(type, method)
  85. DECLARE_MAPI_INTERFACE (SMH_)
  86. {
  87.     MAPI_IUNKNOWN_METHODS (IMPL)
  88.     MAPI_ISPOOLERHOOK_METHODS (IMPL)
  89. };
  90.  
  91. /*
  92.  *  Misc. Defines
  93.  *
  94.  *  GROW_SIZE is the incremental amount to grow buffers that hold arrays
  95.  *  of structures.  This is used to reduce the number of allocations in
  96.  *  certain situations (ie. configuration)
  97.  */
  98. #define GROW_SIZE   4
  99.  
  100. /*
  101.  *  cStoMax is the maximum number of stores per profile supported by SMH.
  102.  *  This limit is purely an imposed limit and can be increased or
  103.  *  decreased with no other changes required.
  104.  */
  105. #define cStoMax     64
  106.  
  107. /*
  108.  *  cchNameMax is used to limit the names and values of filters.
  109.  */
  110. #define cchNameMax  MAX_PATH
  111.  
  112. /*
  113.  *  Store table structure definitions
  114.  *
  115.  *  STOENTRY
  116.  *      This structure is used as a part of the STOTABLE structure.
  117.  *      The union component to the structure allows SMH to cast an
  118.  *      LPSPropValue pointer to a LPSTOENTRY where the first property
  119.  *      is dropped in favor of storing an LPMDB.
  120.  *
  121.  *  STO
  122.  *      This stucture is defined such that SMH can cast an SRow pointer
  123.  *      to an LPSTO.  Again, this construct is used extensively by the
  124.  *      STOTABLE implementation.
  125.  *
  126.  *  STOTABLE
  127.  *      This stucture can be mapped to an SRowSet.  The store table
  128.  *      implementation uses this to let MAPI allocate the memory needed
  129.  *      for keeping pointers to open stores.
  130.  */
  131. typedef struct _STOENTRY
  132. {
  133.     union
  134.     {
  135.         LPMDB           lpmdb;
  136.         SPropValue      valPad;
  137.     };
  138.     SPropValue          lpProps[];
  139.  
  140. } STOENTRY, FAR * LPSTOENTRY;
  141.  
  142. typedef struct _STO
  143. {
  144.     ULONG               ulReserved;
  145.     ULONG               cValues;
  146.     union
  147.     {
  148.         LPSTOENTRY      lpstoe;
  149.         LPSPropValue    lpProps;
  150.     };
  151.  
  152. } STO, FAR * LPSTO;
  153.  
  154. typedef struct _STOTABLE
  155. {
  156.     ULONG               cSto;
  157.     STO                 aSto[cStoMax];
  158.  
  159. } STOTABLE, FAR * LPSTOTABLE;
  160.  
  161.  
  162. /*
  163.  *  Archive bucket structures definitions
  164.  *
  165.  *  DFT
  166.  *      The DFT structure contains two FILETIMEs that define the delta of
  167.  *      time supported by the archive folder.
  168.  *
  169.  *  BKIT
  170.  *      The BKIT structure contains all the information required to
  171.  *      process the archival of a message into that bucket.
  172.  *
  173.  *      The EntryID of the parent folder, the year folder, and the
  174.  *      monthly folder are all cashed as is the MAPIFOLDER object.  The
  175.  *      DFT for the year and month are cached as well.
  176.  */
  177. typedef struct _DFT
  178. {
  179.     FILETIME            ftStart;
  180.     FILETIME            ftEnd;
  181.  
  182. } DFT, FAR * LPDFT;
  183.  
  184. typedef struct _BKIT
  185. {
  186.     ULONG               cbeid;
  187.     LPENTRYID           lpeid;
  188.     LPMAPIFOLDER        lpfldr;
  189.     DFT                 dft;
  190.  
  191.     ULONG               cbeidYr;
  192.     LPENTRYID           lpeidYr;
  193.     LPMAPIFOLDER        lpfldrYr;
  194.     DFT                 dftYr;
  195.  
  196.     ULONG               cbeidParent;
  197.     LPENTRYID           lpeidParent;
  198.     LPMAPIFOLDER        lpfldrParent;
  199.  
  200. } BKIT, FAR * LPBKIT;
  201.  
  202.  
  203. /*
  204.  *  SMH stucture definitions
  205.  *  
  206.  *  WB
  207.  *      The WB (wastebasket) structure contains the information
  208.  *      required to archive deleted mail on any given message store
  209.  *  
  210.  *  RULE
  211.  *      The RULE structure contains the information required to filter an
  212.  *      inbound message into the desired target folder
  213.  *  
  214.  *  OOF
  215.  *      The OOF structure contains the information required to generate
  216.  *      out-of-office responses to incoming messages
  217.  *  
  218.  *  SMH
  219.  *      The SMH object is supports the ISpoolerHook interface and is the
  220.  *      object handed to mapi to facilitate all message filtering.
  221.  *  
  222.  */
  223. typedef struct _WB
  224. {
  225.     struct _WB FAR *    wbNext;         /* next pointer */
  226.     struct _SMH FAR *   lpsmh;          /* owning SMH object */
  227.  
  228.     LPMDB               lpmdb;          /* MDB on which this WB applies */
  229.     LPMAPITABLE         lptbl;          /* contents table of the wastebasket */
  230.     LPMAPIFOLDER        lpfldr;         /* folder object of the wastebasket */
  231.     LPSPropValue        lpvalEid;       /* entryid of the wastebasket */
  232.     ULONG               ulAdvz;         /* connection ID returned from Advise() */
  233.     BKIT                bkit;           /* bucket cache for this WB */
  234.     HANDLE              ht;             /* filtering thread */
  235.     BOOL                fBail;          /* bailout flag */
  236.  
  237. } WB, FAR * LPWB;
  238.  
  239. typedef struct _RULE
  240. {
  241.     struct _RULE FAR *  rlNext;         /* next pointer */
  242.  
  243.     MAPIUID             muid;           /* profile section UID */
  244.     UINT                rlTyp;          /* rule type */
  245.     ULONG               ulFlags;        /* rule attributes */
  246.     SRestriction FAR *  lpres;          /* recipient rule restriction */
  247.     LPTSTR              lpszData;       /* value to filter against */
  248.     LPTSTR              rgszSnd[3];     /* sound to play */
  249.     LPMDB               lpmdb;          /* MDB owning the target folder */
  250.     LPMAPIFOLDER        lpfldr;         /* target folder for filter */
  251.     LPSPropValue        lpvalEid;       /* entryid of target folder */
  252.     LPTSTR              lpszAnno;       /* auto-response annotation */
  253.     LPBYTE              lpbRTF;         /* auto-response RTF */
  254.     ULONG               cbRTF;          /* auto-response RTF size */
  255.     ULONG               cvalRecip;      /* auto-response recip prop count */
  256.     LPSPropValue        lpvalRecip;     /* auto-response recip */
  257.     BKIT                bkit;           /* bucket cache for rule */
  258.  
  259. } RULE, FAR * LPRULE;
  260.  
  261. typedef struct _OOF
  262. {
  263.     LPTABLEDATA         lptad;          /* Table data object */
  264.     LPMAPITABLE         lptbl;          /* Table data view */
  265.     ULONG               cRecips;        /* Count of recips */
  266.     LPTSTR              lpszBody;       /* Oof Body Text */
  267.     LPBYTE              lpbRTF;         /* Body RTF */
  268.     ULONG               cbRTF;          /* RTF size */
  269.  
  270. } OOF, FAR * LPOOF;
  271.  
  272. typedef struct _SMH
  273. {
  274.     SMH_Vtbl FAR *      lpVtbl;
  275.     ULONG               lcInit;         /* object refcount */
  276.     HINSTANCE           hinst;          /* DLL instance */
  277.     HANDLE              hevtCfg;        /* configuration event */
  278.  
  279.     LPMAPISESSION       lpsess;         /* client session */
  280.     LPALLOCATEBUFFER    lpfnAlloc;      /* MAPIAllocateBuffer */
  281.     LPALLOCATEMORE      lpfnAllocMore;  /* MAPIAllocateMore */
  282.     LPFREEBUFFER        lpfnFree;       /* MAPIFreeBuffer */
  283.     MAPIUID             muid;           /* hook provider section UID */
  284.  
  285.     unsigned int        fCatSm:1;       /* options flags */
  286.     unsigned int        fCatSmByYr:1;
  287.     unsigned int        fCatWb:1;
  288.     unsigned int        fOof:1;
  289.     unsigned int        fAtp:1;
  290.     LPSTOTABLE          lpstotbl;       /* store table */
  291.     SPropValue          valEx;          /* msg class exclustions */
  292.     LPWB                lstWb;          /* list pointer of WBs */
  293.     LPRULE              lstRl;          /* list pointer of rules */
  294.     BKIT                bkitSm;         /* bucket cache for sent mail */
  295.     OOF                 oof;            /* OOF information */
  296.  
  297. } SMH, FAR * LPSMH;
  298.  
  299. /*
  300.  *  Configuration dialog structure definition
  301.  *  
  302.  *  REOC
  303.  *      The Richedit OLE Callback structure refers to an object that is
  304.  *      used by the configuration dialogs that support RTF edit controls
  305.  *  
  306.  *  SCD (SMH Configuration Dialog)
  307.  *      The SMH Configuration Dialog structure is used to pass
  308.  *      important information in and out of the configuration dialogs
  309.  *      and property sheets.
  310.  */
  311. typedef struct _SCD
  312. {
  313.     HINSTANCE           hinst;          /* DLL instance */
  314.     HWND                hwnd;           /* parent window */
  315.  
  316.     LPALLOCATEBUFFER    lpfnAlloc;      /* MAPIAllocateBuffer */
  317.     LPALLOCATEMORE      lpfnAllocMore;  /* MAPIAllocateMore */
  318.     LPFREEBUFFER        lpfnFree;       /* MAPIFreeBuffer */
  319.     LPMALLOC            lpmalloc;       /* pointer to LPMALLOC obj */
  320.     LPMAPISUP           lpsup;          /* pointer to support obj */
  321.     LPPROVIDERADMIN     lpadmin;        /* pointer to profile admin obj */
  322.     LPPROFSECT          lpsec;          /* profile section obj */
  323.  
  324.     LPMAPISESSION       lpsess;         /* session pointer used in filters */
  325.  
  326.     TCHAR               rgch[cchNameMax];
  327.     LPSPropValue        lpval;          /* current set of property values */
  328.  
  329.     UINT                crl;            /* count of current rules */
  330.     UINT                crlMax;         /* count of maximum rules */
  331.     LPTSTR FAR *        lppsz;          /* pointer to array of names */
  332.     LPSBinary           lpbin;          /* pointer to array of muids */
  333.  
  334.     ULONG               ulFlags;        /* configuration flags */
  335.     SCODE               sc;             /* dialog failure error code */
  336.  
  337. } SCD, FAR * LPSCD;
  338.  
  339. typedef struct _FORMATBAR
  340. {
  341.     LPSCD               lpscd;          /* owning config dialog */
  342.     CHARFORMAT          cf;             /* character format */
  343.     HBRUSH              hbrBtnFace;     /* button face color brush */
  344.     HDC                 hdc;            /* device context */
  345.     HMENU               hmnuColor;      /* color picker menu */
  346.     HWND                hwndEdit;       /* associated edit control */
  347.     HWND                hwndFont;       /* font name combo */
  348.     HWND                hwndFrame;      /* toolbar HWND */
  349.     HWND                hwndSize;       /* font size combo */
  350.     HWND                hwndTb;         /* toolbar */
  351.     HANDLE              hfnt;           /* toolbar font */
  352.     PARAFORMAT          pf;             /* paragraph format */
  353.     UINT                cSize;          /* font entry count */
  354.     WNDPROC             lpfnToolbar;    /* subclassed toolbar proc */
  355.     struct _REOC FAR *  lpreoc;         /* richedit ole callback */
  356.  
  357. } FORMATBAR, FAR * LPFORMATBAR;
  358.  
  359. typedef struct _REOC
  360. {
  361.     REOC_Vtbl FAR *     lpVtbl;
  362.     ULONG               lcInit;         /* object refcount */
  363.     LPSTORAGE           lpstg;          /* root storage obj */
  364.     UINT                cSub;           /* count of sub obj's */
  365.     LPALLOCATEBUFFER    lpfnAlloc;      /* MAPIAllocateBuffer */
  366.     LPALLOCATEMORE      lpfnAllocMore;  /* MAPIAllocateMore */
  367.     LPFREEBUFFER        lpfnFree;       /* MAPIFreeBuffer */
  368.     LPFORMATBAR         lpfb;           /* formatting bar */
  369.  
  370. } REOC, FAR * LPREOC;
  371.  
  372. typedef struct _RTFS
  373. {
  374.     LPALLOCATEBUFFER    lpfnAlloc;      /* MAPIAllocateBuffer */
  375.     LPFREEBUFFER        lpfnFree;       /* MAPIFreeBuffer */
  376.     LPBYTE              lpb;            /* stream data */
  377.     LONG                cb;             /* stream data size */
  378.     LONG                cbMax;          /* max stream size */
  379.     
  380. } RTFS, FAR * LPRTFS;
  381.  
  382. /*
  383.  *  SMH proptags
  384.  */
  385. #define PR_SMH_FLAGS                    PROP_TAG(PT_LONG,       0x6600)
  386. #define PR_SMH_RULES                    PROP_TAG(PT_MV_BINARY,  0x6601)
  387. #define PR_SMH_EXCLUSIONS               PROP_TAG(PT_MV_TSTRING, 0x6602)
  388. #define PR_SMH_EXCLUSIONS_A             PROP_TAG(PT_MV_STRING8, 0x6602)
  389. #define PR_SMH_EXCLUSIONS_W             PROP_TAG(PT_MV_UNICODE, 0x6602)
  390. #define PR_SMH_RULE_NAMES               PROP_TAG(PT_MV_TSTRING, 0x6603)
  391. #define PR_SMH_RULE_NAMES_A             PROP_TAG(PT_MV_STRING8, 0x6603)
  392. #define PR_SMH_RULE_NAMES_W             PROP_TAG(PT_MV_UNICODE, 0x6603)
  393. #define PR_SMH_OOF_ENABLED              PROP_TAG(PT_BOOLEAN,    0x6604)
  394. #define PR_SMH_OOF_TEXT                 PROP_TAG(PT_TSTRING,    0x6605)
  395. #define PR_SMH_OOF_TEXT_A               PROP_TAG(PT_STRING8,    0x6605)
  396. #define PR_SMH_OOF_TEXT_W               PROP_TAG(PT_UNICODE,    0x6605)
  397. #define PR_SMH_OOF_RTF                  PROP_TAG(PT_BINARY,     0x6606)
  398. #define PR_SMH_SOUND_SCHEMES            PROP_TAG(PT_MV_BINARY,  0x6607)
  399. #define PR_SMH_REPFWD_SCHEMES           PROP_TAG(PT_MV_BINARY,  0x6608)
  400.  
  401. /*
  402.  *  Value for PR_SMH_VERSION
  403.  */
  404. #define MAKE_SMH_VERSION(_mj,_mn)       (((ULONG)(0x0000FFFF & _mj) << 16) | \
  405.                                             (ULONG)(0x0000FFFF & _mn))
  406. #define SMH_VERSION                     MAKE_SMH_VERSION (1,0)
  407.  
  408. /*
  409.  *  Values for PR_SMH_FLAGS
  410.  */
  411. #define SMH_ADD_TO_PAB                  ((ULONG)0x00000001)
  412. #define SMH_FILTER_DELETED              ((ULONG)0x00000010)
  413. #define SMH_FILTER_DELETED_YR           ((ULONG)0x00000020)
  414. #define SMH_FILTER_INBOUND              ((ULONG)0x00000100)
  415. #define SMH_FILTER_SENTMAIL             ((ULONG)0x00001000)
  416. #define SMH_FILTER_SENTMAIL_YR          ((ULONG)0x00002000)
  417. #define SMH_UNREAD_VIEWER               ((ULONG)0x00010000)
  418.  
  419. /*
  420.  *  Filtering rule proptags
  421.  */
  422. #define PR_RULE_TYPE                    PROP_TAG(PT_LONG,       0x6610)
  423. #define PR_RULE_DATA                    PROP_TAG(PT_BINARY,     0x6611)
  424. #define PR_RULE_FLAGS                   PROP_TAG(PT_LONG,       0x6612)
  425. #define PR_RULE_TARGET_ENTRYID          PROP_TAG(PT_BINARY,     0x6613)
  426. #define PR_RULE_TARGET_PATH             PROP_TAG(PT_TSTRING,    0x6614)
  427. #define PR_RULE_TARGET_PATH_A           PROP_TAG(PT_STRING8,    0x6614)
  428. #define PR_RULE_TARGET_PATH_W           PROP_TAG(PT_UNICODE,    0x6614)
  429. #define PR_RULE_STORE_ENTRYID           PROP_TAG(PT_BINARY,     0x6615)
  430. #define PR_RULE_STORE_DISPLAY_NAME      PROP_TAG(PT_TSTRING,    0x6616)
  431. #define PR_RULE_STORE_DISPLAY_NAME_A    PROP_TAG(PT_STRING8,    0x6616)
  432. #define PR_RULE_STORE_DISPLAY_NAME_W    PROP_TAG(PT_UNICODE,    0x6616)
  433. #define PR_RULE_SOUND_NORMAL            PROP_TAG(PT_TSTRING,    0x6617)
  434. #define PR_RULE_SOUND_NORMAL_A          PROP_TAG(PT_STRING8,    0x6617)
  435. #define PR_RULE_SOUND_NORMAL_W          PROP_TAG(PT_UNICODE,    0x6617)
  436. #define PR_RULE_SOUND_HIPRI             PROP_TAG(PT_TSTRING,    0x6618)
  437. #define PR_RULE_SOUND_HIPRI_A           PROP_TAG(PT_STRING8,    0x6618)
  438. #define PR_RULE_SOUND_HIPRI_W           PROP_TAG(PT_UNICODE,    0x6618)
  439. #define PR_RULE_SOUND_LOPRI             PROP_TAG(PT_TSTRING,    0x6619)
  440. #define PR_RULE_SOUND_LOPRI_A           PROP_TAG(PT_STRING8,    0x6619)
  441. #define PR_RULE_SOUND_LOPRI_W           PROP_TAG(PT_UNICODE,    0x6619)
  442.  
  443. #define PR_RULE_FORWARD_RECIP           PROP_TAG(PT_TSTRING,    0x6620)
  444. #define PR_RULE_FORWARD_RECIP_A         PROP_TAG(PT_STRING8,    0x6620)
  445. #define PR_RULE_FORWARD_RECIP_W         PROP_TAG(PT_UNICODE,    0x6620)
  446. #define PR_RULE_FORWARD_RECIP_ENTRYID   PROP_TAG(PT_BINARY,     0x6621)
  447. #define PR_RULE_REP_FWD_TEXT            PROP_TAG(PT_TSTRING,    0x6624)
  448. #define PR_RULE_REP_FWD_TEXT_A          PROP_TAG(PT_STRING8,    0x6624)
  449. #define PR_RULE_REP_FWD_TEXT_W          PROP_TAG(PT_UNICODE,    0x6624)
  450. #define PR_RULE_REP_FWD_RTF             PROP_TAG(PT_BINARY,     0x6625)
  451.  
  452. /*
  453.  *  Values for PR_RULE_TYPE
  454.  */
  455. #define RL_ANY_RECIP                    ((UINT)0x0001)
  456. #define RL_BCC_RECIP                    ((UINT)0x0002)
  457. #define RL_BODY                         ((UINT)0x0003)
  458. #define RL_CC_RECIP                     ((UINT)0x0004)
  459. #define RL_HAS_ATTACH                   ((UINT)0x0005)
  460. #define RL_MSG_CLASS                    ((UINT)0x0006)
  461. #define RL_SENDER                       ((UINT)0x0007)
  462. #define RL_SUBJECT                      ((UINT)0x0008)
  463. #define RL_TO_RECIP                     ((UINT)0x0009)
  464. #define RL_TYPE_MAX                     ((UINT)0x0010)
  465.  
  466. /*
  467.  *  Values for PR_RULE_FLAGS
  468.  */
  469. #define RULE_ARCHIVED                   ((ULONG)0x00000001)
  470. #define RULE_ARCHIVED_BY_YEAR           ((ULONG)0x00000002)
  471. #define RULE_NOT                        ((ULONG)0x00000004)
  472. #define RULE_DELETE                     ((ULONG)0x00000008)
  473. #define RULE_AUTO_RESPONSE              ((ULONG)0x00000010)
  474. #define RULE_AUTO_REPLY                 ((ULONG)0x00000020)
  475. #define RULE_AUTO_FORWARD               ((ULONG)0x00000040)
  476. #define RULE_AUTO_APPEND_ORIG           ((ULONG)0x00000080)
  477. #define RULE_PLAY_SOUNDS                ((ULONG)0x00000100)
  478. #define RULE_NO_MOVE                    ((ULONG)0x10000000)
  479. #define RULE_TERMINAL                   ((ULONG)0x80000000)
  480.  
  481. /*
  482.  *  Rule configuration flags
  483.  */
  484. #define NEW_RULE                        ((UINT)1)
  485. #define EDIT_RULE                       ((UINT)2)
  486.  
  487. /* Logon properties */
  488.  
  489. enum {
  490.     ipProfile,
  491.     ipFlags,
  492.     ipRules,
  493.     ipNames,
  494.     ipOof,
  495.     ipOofEnabled,
  496.     ipOofRtf,
  497.     ipSounds,
  498.     ipRepFwd,
  499.     ipExc,
  500.     cpMax
  501. };
  502.  
  503. /* Rule properties */
  504.  
  505. enum {
  506.     ipRLDisp,
  507.     ipRLType,
  508.     ipRLData,
  509.     ipRLFlags,
  510.     ipRLEid,
  511.     ipRLPath,
  512.     ipRLSEid,
  513.     ipRLStore,
  514.     ipRLLoPri,
  515.     ipRLSound,
  516.     ipRLHiPri,
  517.     ipRLFwdRecip,
  518.     ipRLFwdEid,
  519.     ipRLRepFwdRTF,
  520.     ipRLRepFwd,
  521.     cpRLMax
  522. };
  523.  
  524. enum {
  525.     isndLo,         /*  IMPORTANCE_LOW      */
  526.     isndNorm,       /*  IMPORTANCE_NORMAL   */
  527.     isndHi,         /*  IMPORTANCE_HIGH     */
  528.     csndMax
  529. };
  530.  
  531. /* Message properties */
  532.  
  533. enum {
  534.     ipMsgFlgs,
  535.     ipMsgSubj,
  536.     ipMsgSentRep,
  537.     ipMsgSentRepEA,
  538.     ipPriority,
  539.     cpMsgPrps
  540. };
  541.  
  542. /* Recipient restriction enums */
  543.  
  544. enum {ivRecip, ivEmail, ivDispNm, cvMax };
  545. enum {iresAnd, iresRecip, iresOr, iresEmail, iresDispNm, cresMax };
  546.  
  547.  
  548. /*
  549.  *  Configuration dialogs
  550.  */
  551.  
  552. typedef HRESULT (STDMETHODCALLTYPE FAR * LPOPENPROFSECT) (
  553.     LPVOID              lpvOPSCtxt,
  554.     LPMAPIUID           lpUID,
  555.     LPCIID              lpInterface,
  556.     ULONG               ulFlags,
  557.     LPPROFSECT FAR *    lppProfSect);
  558.  
  559. HRESULT
  560. HrUpdateProfileFormat (LPVOID lpvOPSCtxt,
  561.     LPOPENPROFSECT lpfnOpenProfSect,
  562.     LPALLOCATEMORE lpfnMore,
  563.     LPFREEBUFFER lpfnFree,
  564.     LPSPropValue lpvalNew,
  565.     LPSPropValue lpvalOld);
  566.  
  567. extern LPVOID lpCtl3D;
  568. #if 0
  569. #if !defined (_WIN95)
  570. #define RegDlg3D(_inst)         Ctl3dRegister (_inst);
  571. #define MakeDlg3D(_dlg)         Ctl3dSubclassDlgEx(_dlg, CTL3D_ALL)
  572. #define UnregDlg3D(_inst)       Ctl3dUnregister (_inst);
  573. #else
  574. #define RegDlg3D(_inst)
  575. #define MakeDlg3D(_dlg)
  576. #define UnregDlg3D(_inst)
  577. #endif
  578. #endif
  579.  
  580. #ifdef  WIN32
  581. #define FWin4Shell()    ((GetVersion() & 0x000000FF) >= 0x04)
  582. #else
  583. #define FWin4Shell()    (FALSE)
  584. #endif
  585.  
  586. #define FHandleWm(_fn,_dlg,_wm,_wp,_lp) HANDLE_WM_##_wm(_dlg,_wp,_lp,_fn##_##_wm)
  587. HRESULT HrDisplayPropSheets (HINSTANCE hinst, HWND hwnd, LPSCD lpscd);
  588. STDMETHODIMP_(SCODE) ScCreateToolbar (LPSCD lpscd, HWND hwnd, UINT idPeg, BOOL fPropsheet, LPFORMATBAR FAR *);
  589. STDMETHODIMP_(BOOL) EXPORT FDoRTFCommand (HWND hctrl, UINT id, UINT command);
  590. void UpdateFormatBar (HWND hdlg);
  591.  
  592. SCODE ScExportFilters (LPSCD lpscd, HWND hwnd);
  593. SCODE ScImportFilters (LPSCD lpscd, HWND hwnd, HWND hctrl);
  594.  
  595. DWORD CALLBACK WriteRTFToBuffer (DWORD dwCookie, LPBYTE lpb, LONG cb, LONG FAR * lpcb);
  596. DWORD CALLBACK ReadRTFFromBuffer (DWORD dwCookie, LPBYTE lpb, LONG cb, LONG FAR * lpcb);
  597.  
  598. HRESULT HrInitOof (LPSMH lpsmh, LPSPropValue lpvalAnno, LPSPropValue lpvalRTF);
  599.  
  600.  
  601. /*
  602.  *  Configuration Events
  603.  */
  604. #ifdef  _WIN32
  605. HRESULT HrGetConfigEvent (HANDLE FAR *);
  606. VOID SignalConfigChanged (VOID);
  607. BOOL FConfigChanged (HANDLE);
  608. #endif
  609.  
  610. /*
  611.  *  FLpszContainsLpsz()
  612.  *
  613.  *  Purpose:
  614.  *
  615.  *      Finds the given sub-string in the passed in string.
  616.  *
  617.  *  Arguments:
  618.  *
  619.  *      _s  source string
  620.  *      _p  pattern string
  621.  *
  622.  *  Returns:
  623.  *
  624.  *      FALSE iff the string was not found, TRUE otherwise.
  625.  */
  626. #define FLpszContainsLpsz(_s,_p) FRKFindSubpsz(_s,lstrlen(_s),_p,lstrlen(_p),FL_IGNORECASE)
  627.  
  628.  
  629. /*
  630.  *  Message Archive Functions
  631.  */
  632. HRESULT
  633. HrArchiveMessage (LPSMH lpsmh,
  634.     LPMESSAGE lpmsg,
  635.     LPMAPIFOLDER lpfldrDef,
  636.     LPMDB lpmdbDef,
  637.     LPBKIT lpbkit,
  638.     BOOL fCatByYear,
  639.     ULONG FAR * lpcbeid,
  640.     LPBYTE FAR * lppeid);
  641.  
  642. HRESULT
  643. HrArchiveByDate (LPSMH lpsmh,
  644.     FILETIME FAR * lpft,
  645.     LPMAPIFOLDER lpfldrDef,
  646.     LPMDB lpmdbDef,
  647.     LPBKIT lpbkit,
  648.     BOOL fCatByYear,
  649.     ULONG cbeid,
  650.     LPBYTE lpeid);
  651.  
  652.  
  653. HRESULT HrInitDeletedMailFilter (LPSMH lpsmh);
  654.  
  655. BOOL
  656. FRKFindSubpsz (LPSTR pszTarget,
  657.     ULONG cbTarget,
  658.     LPSTR pszPattern,
  659.     ULONG cbPattern,
  660.     ULONG ulFuzzyLevel);
  661.  
  662. /*
  663.  *  Stores table
  664.  */
  665. HRESULT HrInitStoresTable (LPSMH, LPMAPISESSION);
  666. HRESULT HrOpenMdbFromEid (LPSMH, ULONG, LPENTRYID, LPMDB FAR *);
  667. HRESULT HrOpenMdbFromName (LPSMH, LPTSTR, LPMDB FAR *);
  668. HRESULT HrOpenStoEntry (LPMAPISESSION, LPSTO, LPMDB FAR *);
  669. VOID ReleaseStoresTable (LPSMH);
  670.  
  671.  
  672. /*
  673.  *  Automated Response Functions
  674.  */
  675. HRESULT HrGenerateResponse (LPSMH lpsmf, LPRULE lprl, LPMAPIFOLDER lpfldr, LPMESSAGE lpmsg);
  676. VOID ReleaseOof (LPOOF lpoof);
  677.  
  678.  
  679. /*
  680.  *  Automated PAB additions
  681.  */
  682. HRESULT HrAddEntriesToPab (LPSMH, LPMESSAGE);
  683.  
  684.  
  685. /*
  686.  *  RTF\Richedit Components
  687.  */
  688. #ifdef  _WIN32
  689. #define RICHEDIT_LIB    "RICHED32.DLL"
  690. #else
  691. #define RICHEDIT_LIB    "RICHED.DLL"
  692. #endif
  693.  
  694. STDMETHODIMP_(SCODE)
  695. ScNewRicheditCallback (LPFORMATBAR lpfb,
  696.     LPALLOCATEBUFFER lpfnAlloc,
  697.     LPALLOCATEMORE lpfnMore,
  698.     LPFREEBUFFER lpfnFree,
  699.     LPREOC FAR * lppreoc);
  700.  
  701. /*
  702.  *  WM_NOTIFY #defines (taken from WINUSER.H)
  703.  */
  704. #ifdef  WIN16
  705. #define WM_NOTIFY   0x004E
  706. #define HANDLE_WM_NOTIFY(hwnd,wParam,lParam,fn) (fn)((hwnd),(int)(wParam),(NMHDR FAR*)(lParam))
  707.  
  708. /*
  709.  *  Mapped bitmapi #defines (taken from COMMCTRL.H)
  710.  */
  711. typedef struct
  712. {
  713.     COLORREF from;
  714.     COLORREF to;
  715. } COLORMAP, FAR * LPCOLORMAP;
  716.  
  717. /*
  718.  *  Toolbar button #defines (taken from COMMCTRL.H)
  719.  */
  720. typedef struct _TBBUTTON {
  721.     int iBitmap;
  722.     int idCommand;
  723.     BYTE fsState;
  724.     BYTE fsStyle;
  725.     BYTE bReserved[2];
  726.     DWORD dwData;
  727.     int iString;
  728. } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
  729. typedef const TBBUTTON FAR* LPCTBBUTTON;
  730. #define TBSTATE_ENABLED         0x04
  731. #define TBSTYLE_BUTTON          0x00
  732. #define TBSTYLE_SEP             0x01
  733. #define TBSTYLE_CHECK           0x02
  734. #define TB_CHECKBUTTON      (WM_USER + 2)
  735. #define TB_GETITEMRECT      (WM_USER + 29)
  736. #define CCS_TOP         0x00000001L
  737.  
  738. WINCOMMCTRLAPI HWND WINAPI CreateToolbarEx (HWND hwnd, DWORD ws, UINT wID, int nBitmaps,
  739.     HINSTANCE hBMInst, UINT wBMID, LPCTBBUTTON lpButtons,
  740.     int iNumButtons, int dxButton, int dyButton,
  741.     int dxBitmap, int dyBitmap, UINT uStructSize);
  742.  
  743. HBITMAP WINAPI CreateMappedBitmap (HINSTANCE hInstance, INT idBitmap, BOOL bDiscardable,
  744.     LPCOLORMAP lpColorMap, INT iNumMaps);
  745. #endif  /* WIN16 */
  746.