Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

891 lines
25 KiB

  1. #ifndef __SEODISP_H__
  2. #define __SEODISP_H__
  3. #include <smtpevents.h>
  4. #include "smtpseo.h"
  5. #include <smtpevent.h>
  6. #include "smtpguid.h"
  7. #include <comcat.h>
  8. #include "seolib2.h"
  9. #include "cdo.h"
  10. #include <baseobj.h>
  11. class __declspec(uuid("B226CEB5-0BBF-11d2-A011-00C04FA37348")) CStoreDispatcherData : public IUnknown {
  12. public:
  13. CStoreDispatcherData() {
  14. m_pvServer = NULL;
  15. m_dwServerInstance = 0;
  16. };
  17. HRESULT STDMETHODCALLTYPE GetData(LPVOID *ppvServer, DWORD *pdwServerInstance) {
  18. if (ppvServer) {
  19. *ppvServer = NULL;
  20. }
  21. if (pdwServerInstance) {
  22. *pdwServerInstance = 0;
  23. }
  24. if (!m_pvServer) {
  25. return (E_FAIL);
  26. }
  27. if (ppvServer) {
  28. *ppvServer = m_pvServer;
  29. }
  30. if (pdwServerInstance) {
  31. *pdwServerInstance = m_dwServerInstance;
  32. }
  33. return (S_OK);
  34. };
  35. HRESULT STDMETHODCALLTYPE SetData(LPVOID pvServer, DWORD dwServerInstance) {
  36. m_pvServer = pvServer;
  37. m_dwServerInstance = dwServerInstance;
  38. return (S_OK);
  39. };
  40. private:
  41. LPVOID m_pvServer;
  42. DWORD m_dwServerInstance;
  43. };
  44. class CStoreDispatcher :
  45. public CEventBaseDispatcher,
  46. public CComObjectRootEx<CComMultiThreadModelNoCS>,
  47. public IServerDispatcher,
  48. public IMailTransportNotify,
  49. public IClassFactory,
  50. public IEventDispatcherChain,
  51. public CStoreDispatcherData
  52. {
  53. public:
  54. DECLARE_PROTECT_FINAL_CONSTRUCT();
  55. DECLARE_GET_CONTROLLING_UNKNOWN();
  56. DECLARE_NOT_AGGREGATABLE(CStoreDispatcher);
  57. BEGIN_COM_MAP(CStoreDispatcher)
  58. COM_INTERFACE_ENTRY(IEventDispatcher)
  59. COM_INTERFACE_ENTRY(IServerDispatcher)
  60. COM_INTERFACE_ENTRY(IMailTransportNotify)
  61. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  62. COM_INTERFACE_ENTRY(IClassFactory)
  63. COM_INTERFACE_ENTRY(IEventDispatcherChain)
  64. COM_INTERFACE_ENTRY_IID(__uuidof(CStoreDispatcherData),CStoreDispatcherData)
  65. END_COM_MAP()
  66. // this code gets called during initialization
  67. HRESULT FinalConstruct()
  68. {
  69. // we need to do this to signal that we are free threaded
  70. return (CoCreateFreeThreadedMarshaler(GetControllingUnknown(), &m_pUnkMarshaler.p));
  71. }
  72. // this has the global destructor code in it
  73. void FinalRelease() {}
  74. virtual HRESULT AllocBinding(REFGUID rguidEventType,
  75. IEventBinding *piBinding,
  76. CBinding **ppNewBinding)
  77. {
  78. if (ppNewBinding)
  79. *ppNewBinding = NULL;
  80. if (!piBinding || !ppNewBinding)
  81. return E_POINTER;
  82. *ppNewBinding = new CStoreBinding;
  83. if (*ppNewBinding == NULL)
  84. return E_OUTOFMEMORY;
  85. return S_OK;
  86. }
  87. //
  88. // Local binding class
  89. //
  90. class CStoreBinding : public CEventBaseDispatcher::CBinding
  91. {
  92. public:
  93. CStoreBinding();
  94. ~CStoreBinding();
  95. virtual HRESULT Init(IEventBinding *piBinding);
  96. LPSTR GetRuleString() { return(m_szRule); }
  97. private:
  98. HRESULT GetAnsiStringFromVariant(CComVariant &vString, LPSTR *ppszString);
  99. public:
  100. LPSTR m_szRule;
  101. };
  102. //
  103. // Parameter abstract base class
  104. //
  105. #define SIGNATURE_VALID_CSTOREPARAMS (DWORD)'CSPa'
  106. #define SIGNATURE_INVALID_CSTOREPARAMS (DWORD)'aPSC'
  107. class CStoreBaseParams :
  108. public CEventBaseDispatcher::CParams,
  109. public CBaseObject
  110. {
  111. public:
  112. virtual HRESULT CallObject(IEventManager *pManager, CBinding&
  113. bBinding);
  114. virtual HRESULT CallObject(CBinding& bBinding, IUnknown
  115. *punkObject) = 0;
  116. virtual HRESULT CallDefault() = 0;
  117. virtual HRESULT CallCompletion(HRESULT hrStatus)
  118. {
  119. //
  120. // Free this Params object (Referenced in CStoreDispatcher::OnEvent)
  121. //
  122. CBaseObject::Release();
  123. return S_OK;
  124. }
  125. virtual HRESULT Init(PVOID pContext) = 0;
  126. HRESULT CheckMailMsgRule(
  127. CBinding *pBinding,
  128. IMailMsgProperties *pIMsgProps);
  129. HRESULT CheckMailMsgRecipientsRule(
  130. IUnknown *pIMsg,
  131. LPSTR pszPatterns);
  132. HRESULT CheckSignature()
  133. {
  134. return (m_dwSignature == SIGNATURE_VALID_CSTOREPARAMS) ? S_OK : E_FAIL;
  135. }
  136. HRESULT MatchEmailOrDomainName(
  137. LPSTR szEmail,
  138. LPSTR szPattern,
  139. BOOL fIsEmail);
  140. public:
  141. CStoreBaseParams();
  142. ~CStoreBaseParams();
  143. HRESULT InitParamData(
  144. LPVOID pContext,
  145. DWORD dwEventType,
  146. IMailTransportNotify *pINotify,
  147. CStoreDispatcher *pDispatcher,
  148. REFIID rguidEventType);
  149. public:
  150. DWORD m_dwSignature;
  151. // This indicates which event type we are raising so that
  152. // the proper sink can be QI'd
  153. DWORD m_dwEventType;
  154. public:
  155. // Data needed for async sink operation:
  156. // How many sinks to skip on the next async sink completion
  157. DWORD m_dwIdx_SinkSkip;
  158. // Indicates wether or not default processing has been called
  159. BOOL m_fDefaultProcessingCalled;
  160. // The IMailTransportNotify interface to pass to async capable sinks
  161. IMailTransportNotify *m_pINotify;
  162. // Our event type guid -- pass to dispatcher function
  163. GUID m_rguidEventType;
  164. // A pointer to the sink currently in asynchronous operation.
  165. // Must be NULL when no sinks are in async operation.
  166. IUnknown *m_pIUnknownSink;
  167. // store dispatcher that owns us
  168. CStoreDispatcher *m_pDispatcher;
  169. };
  170. //
  171. // Parameter class
  172. //
  173. class CStoreParams :
  174. public CStoreBaseParams,
  175. public IMailMsgNotify
  176. {
  177. public:
  178. CStoreParams()
  179. {
  180. m_pContext = NULL;
  181. m_fCopiedContext = FALSE;
  182. }
  183. ~CStoreParams() {
  184. // clean up from CopyContext
  185. if (m_fCopiedContext) {
  186. _ASSERT(m_pContext == &m_context);
  187. if (m_context.m_RecipientCount) {
  188. delete[] m_context.pdwRecipIndexes;
  189. }
  190. if (m_context.IMsgPtr) {
  191. ((IMailMsgProperties *) m_context.IMsgPtr)->Release();
  192. }
  193. if (m_context.m_EventSmtpServer) {
  194. ((ISMTPServer *) m_context.m_EventSmtpServer)->Release();
  195. }
  196. }
  197. }
  198. virtual HRESULT CallObject(IEventManager *pManager, CBinding&
  199. bBinding);
  200. virtual HRESULT CallObject(CBinding& bBinding, IUnknown
  201. *punkObject);
  202. HRESULT CallDefault();
  203. virtual HRESULT CallCompletion(HRESULT hrStatus);
  204. // this needs to be done when we expect to use m_pContext in async
  205. // operations (such as local delivery)
  206. HRESULT CopyContext() {
  207. TraceFunctEnter("CStoreParams::CopyContext");
  208. // copying twice will screw things up
  209. if (m_fCopiedContext) {
  210. TraceFunctLeave();
  211. return S_OK;
  212. }
  213. _ASSERT(&m_context != m_pContext);
  214. memcpy(&m_context, m_pContext, sizeof(SMTP_ALLOC_PARAMS));
  215. if (m_context.m_RecipientCount) {
  216. // this is the only operation that can fail, so we do
  217. // it first.
  218. m_context.pdwRecipIndexes =
  219. new DWORD[m_context.m_RecipientCount];
  220. if (m_context.pdwRecipIndexes == NULL) {
  221. ErrorTrace((LPARAM) this, "out of mem copying context");
  222. TraceFunctLeave();
  223. return E_OUTOFMEMORY;
  224. }
  225. memcpy(m_context.pdwRecipIndexes,
  226. m_pContext->pdwRecipIndexes,
  227. sizeof(DWORD) * m_context.m_RecipientCount);
  228. }
  229. // we need to hold onto these pointers
  230. if (m_context.IMsgPtr) {
  231. ((IMailMsgProperties *) m_context.IMsgPtr)->AddRef();
  232. }
  233. if (m_context.m_EventSmtpServer) {
  234. ((ISMTPServer *) m_context.m_EventSmtpServer)->AddRef();
  235. }
  236. m_fCopiedContext = TRUE;
  237. m_pContext = &m_context;
  238. TraceFunctLeave();
  239. return S_OK;
  240. }
  241. HRESULT Init(PVOID pContext)
  242. {
  243. m_pContext = (SMTP_ALLOC_PARAMS* )pContext;
  244. // AddRef our notification interface. This is released in
  245. // CallCompletion.
  246. IMailMsgNotify *pNotify = (IMailMsgNotify *) m_pContext->m_pNotify;
  247. if (pNotify) {
  248. pNotify->AddRef();
  249. }
  250. return S_OK;
  251. }
  252. // IUnknown
  253. HRESULT __stdcall QueryInterface( const IID& iid, VOID** ppv )
  254. {
  255. if ( iid == IID_IUnknown ) {
  256. *ppv = static_cast<IMailMsgNotify*>(this);
  257. } else if ( iid == IID_IMailMsgNotify ) {
  258. *ppv = static_cast<IMailMsgNotify*>(this);
  259. } else {
  260. *ppv = NULL;
  261. return E_NOINTERFACE;
  262. }
  263. reinterpret_cast<IUnknown*>(*ppv)->AddRef();
  264. return S_OK;
  265. }
  266. STDMETHOD_(ULONG, AddRef)(void) {return CBaseObject::AddRef();};
  267. STDMETHOD_(ULONG, Release)(void) {return CBaseObject::Release();};
  268. // IMailMsgNotify
  269. HRESULT STDMETHODCALLTYPE Notify(HRESULT hrStatus);
  270. public:
  271. SMTP_ALLOC_PARAMS * m_pContext;
  272. SMTP_ALLOC_PARAMS m_context;
  273. BOOL m_fCopiedContext;
  274. };
  275. //
  276. // Parameter class - OnPreCategorize
  277. //
  278. class CMailTransportPreCategorizeParams : public CStoreBaseParams
  279. {
  280. public:
  281. HRESULT CallObject(CBinding& bBinding, IUnknown
  282. *punkObject);
  283. HRESULT CallDefault();
  284. HRESULT CallCompletion(HRESULT hrStatus);
  285. HRESULT Init(PVOID pContext)
  286. {
  287. CopyMemory(&m_Context, pContext, sizeof(EVENTPARAMS_PRECATEGORIZE));
  288. return S_OK;
  289. }
  290. HRESULT CheckRule(CBinding &bBinding);
  291. private:
  292. EVENTPARAMS_PRECATEGORIZE m_Context;
  293. };
  294. //
  295. // Parameter class - OnPostCategorize
  296. //
  297. class CMailTransportPostCategorizeParams : public CStoreBaseParams
  298. {
  299. public:
  300. HRESULT CallObject(CBinding& bBinding, IUnknown
  301. *punkObject);
  302. HRESULT CallDefault();
  303. HRESULT CallCompletion(HRESULT hrStatus);
  304. HRESULT Init(PVOID pContext)
  305. {
  306. CopyMemory(&m_Context, pContext, sizeof(EVENTPARAMS_POSTCATEGORIZE));
  307. return S_OK;
  308. }
  309. HRESULT CheckRule(CBinding &bBinding);
  310. private:
  311. EVENTPARAMS_POSTCATEGORIZE m_Context;
  312. };
  313. // ------------------------------------------------------------
  314. // Categorizer Parameter classes
  315. // ------------------------------------------------------------
  316. class CMailTransportCatRegisterParams : public CStoreBaseParams
  317. {
  318. public:
  319. HRESULT CallObject(CBinding& bBinding, IUnknown
  320. *punkObject);
  321. HRESULT CallDefault();
  322. HRESULT Init(PVOID pContext)
  323. {
  324. m_pContext = (PEVENTPARAMS_CATREGISTER) pContext;
  325. return S_OK;
  326. }
  327. private:
  328. PEVENTPARAMS_CATREGISTER m_pContext;
  329. };
  330. //
  331. // Parameter class
  332. //
  333. class CMailTransportCatBeginParams : public CStoreBaseParams
  334. {
  335. public:
  336. HRESULT CallObject(CBinding& bBinding, IUnknown
  337. *punkObject);
  338. HRESULT CallDefault();
  339. HRESULT Init(PVOID pContext)
  340. {
  341. m_pContext = (PEVENTPARAMS_CATBEGIN) pContext;
  342. return S_OK;
  343. }
  344. private:
  345. PEVENTPARAMS_CATBEGIN m_pContext;
  346. };
  347. //
  348. // Parameter class
  349. //
  350. class CMailTransportCatEndParams : public CStoreBaseParams
  351. {
  352. public:
  353. HRESULT CallObject(CBinding& bBinding, IUnknown
  354. *punkObject);
  355. HRESULT CallDefault();
  356. HRESULT Init(PVOID pContext)
  357. {
  358. m_pContext = (PEVENTPARAMS_CATEND) pContext;
  359. return S_OK;
  360. }
  361. private:
  362. PEVENTPARAMS_CATEND m_pContext;
  363. };
  364. //
  365. // Parameter class
  366. //
  367. class CMailTransportCatBuildQueryParams : public CStoreBaseParams
  368. {
  369. public:
  370. HRESULT CallObject(CBinding& bBinding, IUnknown
  371. *punkObject);
  372. HRESULT CallDefault();
  373. HRESULT Init(PVOID pContext)
  374. {
  375. m_pContext = (PEVENTPARAMS_CATBUILDQUERY) pContext;
  376. return S_OK;
  377. }
  378. private:
  379. PEVENTPARAMS_CATBUILDQUERY m_pContext;
  380. };
  381. //
  382. // Parameter class
  383. //
  384. class CMailTransportCatBuildQueriesParams : public CStoreBaseParams
  385. {
  386. public:
  387. HRESULT CallObject(CBinding& bBinding, IUnknown
  388. *punkObject);
  389. HRESULT CallDefault();
  390. HRESULT Init(PVOID pContext)
  391. {
  392. m_pContext = (PEVENTPARAMS_CATBUILDQUERIES) pContext;
  393. return S_OK;
  394. }
  395. private:
  396. PEVENTPARAMS_CATBUILDQUERIES m_pContext;
  397. };
  398. //
  399. // Parameter class
  400. //
  401. class CMailTransportCatSendQueryParams : public CStoreBaseParams
  402. {
  403. public:
  404. HRESULT CallObject(CBinding& bBinding, IUnknown
  405. *punkObject);
  406. HRESULT CallDefault();
  407. HRESULT CallCompletion(HRESULT hrStatus);
  408. HRESULT Init(PVOID pContext)
  409. {
  410. CopyMemory(&m_Context, pContext, sizeof(EVENTPARAMS_CATSENDQUERY));
  411. //
  412. // Setup async params (so ICatAsyncContext can call back into dispatcher)
  413. //
  414. m_Context.pIMailTransportNotify = m_pINotify;
  415. m_Context.pvNotifyContext = (PVOID)this;
  416. return S_OK;
  417. }
  418. private:
  419. EVENTPARAMS_CATSENDQUERY m_Context;
  420. };
  421. //
  422. // Parameter class
  423. //
  424. class CMailTransportCatSortQueryResultParams : public CStoreBaseParams
  425. {
  426. public:
  427. HRESULT CallObject(CBinding& bBinding, IUnknown
  428. *punkObject);
  429. HRESULT CallDefault();
  430. HRESULT Init(PVOID pContext)
  431. {
  432. m_pContext = (PEVENTPARAMS_CATSORTQUERYRESULT) pContext;
  433. return S_OK;
  434. }
  435. private:
  436. PEVENTPARAMS_CATSORTQUERYRESULT m_pContext;
  437. };
  438. //
  439. // Parameter class
  440. //
  441. class CMailTransportCatProcessItemParams : public CStoreBaseParams
  442. {
  443. public:
  444. HRESULT CallObject(CBinding& bBinding, IUnknown
  445. *punkObject);
  446. HRESULT CallDefault();
  447. HRESULT Init(PVOID pContext)
  448. {
  449. m_pContext = (PEVENTPARAMS_CATPROCESSITEM) pContext;
  450. return S_OK;
  451. }
  452. private:
  453. PEVENTPARAMS_CATPROCESSITEM m_pContext;
  454. };
  455. //
  456. // Parameter class
  457. //
  458. class CMailTransportCatExpandItemParams : public CStoreBaseParams
  459. {
  460. public:
  461. HRESULT CallObject(CBinding& bBinding, IUnknown
  462. *punkObject);
  463. HRESULT CallDefault();
  464. HRESULT CallCompletion(HRESULT hrStatus);
  465. HRESULT Init(PVOID pContext)
  466. {
  467. m_fAsyncCompletion = FALSE;
  468. CopyMemory(&m_Context, pContext, sizeof(EVENTPARAMS_CATEXPANDITEM));
  469. m_Context.pIMailTransportNotify = m_pINotify;
  470. m_Context.pvNotifyContext = (PVOID)this;
  471. return S_OK;
  472. }
  473. private:
  474. BOOL m_fAsyncCompletion;
  475. EVENTPARAMS_CATEXPANDITEM m_Context;
  476. };
  477. //
  478. // Parameter class
  479. //
  480. class CMailTransportCatCompleteItemParams : public CStoreBaseParams
  481. {
  482. public:
  483. HRESULT CallObject(CBinding& bBinding, IUnknown
  484. *punkObject);
  485. HRESULT CallDefault();
  486. HRESULT Init(PVOID pContext)
  487. {
  488. m_pContext = (PEVENTPARAMS_CATCOMPLETEITEM) pContext;
  489. return S_OK;
  490. }
  491. private:
  492. PEVENTPARAMS_CATCOMPLETEITEM m_pContext;
  493. };
  494. //
  495. // Parameter class
  496. //
  497. class CMailTransportSubmissionParams : public CStoreBaseParams
  498. {
  499. public:
  500. CMailTransportSubmissionParams()
  501. {
  502. m_pCDOMessage = NULL;
  503. }
  504. ~CMailTransportSubmissionParams()
  505. {
  506. if(m_pCDOMessage)
  507. m_pCDOMessage->Release();
  508. }
  509. HRESULT CallObject(CBinding& bBinding, IUnknown
  510. *punkObject);
  511. HRESULT CallDefault();
  512. HRESULT CallCompletion(HRESULT hrStatus);
  513. HRESULT Init(PVOID pContext)
  514. {
  515. CopyMemory(&m_Context, pContext, sizeof(EVENTPARAMS_SUBMISSION));
  516. return S_OK;
  517. }
  518. HRESULT CheckRule(CBinding &bBinding);
  519. private:
  520. HRESULT CallCDOSink(IUnknown *pSink);
  521. EVENTPARAMS_SUBMISSION m_Context;
  522. IMessage *m_pCDOMessage;
  523. };
  524. //
  525. // Create options class - Routing
  526. //
  527. class CRouterCreateOptions : public CEventCreateOptionsBase
  528. {
  529. public:
  530. CRouterCreateOptions(PEVENTPARAMS_ROUTER pContext)
  531. {
  532. _ASSERT (pContext != NULL);
  533. m_pContext = pContext;
  534. }
  535. private:
  536. HRESULT STDMETHODCALLTYPE Init(
  537. REFIID iidDesired,
  538. IUnknown **ppUnkObject,
  539. IEventBinding *,
  540. IUnknown *);
  541. PEVENTPARAMS_ROUTER m_pContext;
  542. };
  543. //
  544. // Parameter class - Routing
  545. //
  546. class CMailTransportRouterParams : public CStoreBaseParams
  547. {
  548. public:
  549. virtual HRESULT CallObject(IEventManager *pManager, CBinding&
  550. bBinding);
  551. virtual HRESULT CallObject(CBinding& bBinding, IUnknown
  552. *punkObject);
  553. HRESULT CallDefault();
  554. HRESULT Init(PVOID pContext)
  555. {
  556. m_pContext = (PEVENTPARAMS_ROUTER) pContext;
  557. //
  558. // Make sure caller initialized pIMessageRouter to NULL
  559. //
  560. _ASSERT(m_pContext->pIMessageRouter == NULL);
  561. return S_OK;
  562. }
  563. private:
  564. PEVENTPARAMS_ROUTER m_pContext;
  565. };
  566. //
  567. // Parameter class
  568. //
  569. class CStoreAllocParams : public CEventBaseDispatcher::CParams
  570. {
  571. public:
  572. CStoreAllocParams();
  573. ~CStoreAllocParams();
  574. virtual HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  575. public:
  576. PFIO_CONTEXT m_hContent;
  577. };
  578. //
  579. // Parameter class for msgTrackLog
  580. //
  581. class CMsgTrackLogParams : public CStoreBaseParams
  582. {
  583. public:
  584. CMsgTrackLogParams()
  585. {
  586. m_pContext = NULL;
  587. }
  588. HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  589. HRESULT CallDefault();
  590. HRESULT Init(PVOID pContext)
  591. {
  592. m_pContext = (PEVENTPARAMS_MSGTRACKLOG) pContext;
  593. return S_OK;
  594. }
  595. private:
  596. PEVENTPARAMS_MSGTRACKLOG m_pContext;
  597. };
  598. //
  599. // Parameter class for mx records
  600. //
  601. class CDnsResolverRecordParams : public CStoreBaseParams
  602. {
  603. public:
  604. CDnsResolverRecordParams()
  605. {
  606. m_pContext = NULL;
  607. }
  608. HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  609. HRESULT CallDefault();
  610. HRESULT Init(PVOID pContext)
  611. {
  612. m_pContext = (PEVENTPARAMS_DNSRESOLVERRECORD) pContext;
  613. return S_OK;
  614. }
  615. private:
  616. PEVENTPARAMS_DNSRESOLVERRECORD m_pContext;
  617. };
  618. //
  619. // Parameter class for max msg size exceeded event
  620. //
  621. class CSmtpMaxMsgSizeParams : public CStoreBaseParams
  622. {
  623. public:
  624. CSmtpMaxMsgSizeParams()
  625. {
  626. m_pContext = NULL;
  627. }
  628. HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  629. HRESULT CallDefault();
  630. HRESULT Init(PVOID pContext)
  631. {
  632. m_pContext = (PEVENTPARAMS_MAXMSGSIZE) pContext;
  633. return S_OK;
  634. }
  635. private:
  636. PEVENTPARAMS_MAXMSGSIZE m_pContext;
  637. };
  638. //
  639. // Parameter class for log event
  640. //
  641. class CSmtpLogParams : public CStoreBaseParams
  642. {
  643. public:
  644. CSmtpLogParams()
  645. {
  646. m_pContext = NULL;
  647. }
  648. HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  649. HRESULT CallDefault();
  650. HRESULT Init(PVOID pContext)
  651. {
  652. m_pContext = (PEVENTPARAMS_LOG) pContext;
  653. return S_OK;
  654. }
  655. private:
  656. PEVENTPARAMS_LOG m_pContext;
  657. };
  658. //
  659. // Parameter class for Get Aux Domain Info Flags event
  660. //
  661. class CSmtpGetAuxDomainInfoFlagsParams : public CStoreBaseParams
  662. {
  663. public:
  664. CSmtpGetAuxDomainInfoFlagsParams()
  665. {
  666. m_pContext = NULL;
  667. }
  668. HRESULT CallObject(CBinding& bBinding, IUnknown *punkObject);
  669. HRESULT CallDefault();
  670. HRESULT Init(PVOID pContext)
  671. {
  672. m_pContext = (PEVENTPARAMS_GET_AUX_DOMAIN_INFO_FLAGS) pContext;
  673. return S_OK;
  674. }
  675. private:
  676. PEVENTPARAMS_GET_AUX_DOMAIN_INFO_FLAGS m_pContext;
  677. };
  678. HRESULT CreateCParams(
  679. DWORD dwEventType,
  680. LPVOID pContext,
  681. IMailTransportNotify *pINotify,
  682. REFIID rGuidEventType,
  683. CStoreBaseParams **ppCParams);
  684. HRESULT STDMETHODCALLTYPE OnEvent(
  685. REFIID iidEvent,
  686. DWORD dwEventType,
  687. LPVOID pvContext);
  688. HRESULT STDMETHODCALLTYPE Dispatcher(
  689. REFIID rguidEventType,
  690. CStoreBaseParams *pParams);
  691. HRESULT STDMETHODCALLTYPE Notify(
  692. HRESULT hrStatus,
  693. PVOID pvContext);
  694. // IClassFactory methods
  695. public:
  696. HRESULT STDMETHODCALLTYPE CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, void * * ppvObj)
  697. {
  698. return CComObject<CStoreDispatcher>::_CreatorClass::CreateInstance(pUnkOuter, riid, ppvObj);
  699. }
  700. HRESULT STDMETHODCALLTYPE LockServer (int fLock)
  701. {
  702. _ASSERT(FALSE);
  703. return E_NOTIMPL;
  704. }
  705. // IEventDispatcherChain methods
  706. public:
  707. HRESULT STDMETHODCALLTYPE SetPrevious(IUnknown *pUnkPrevious, IUnknown **ppUnkPreload);
  708. // IEventDispatcher methods
  709. public:
  710. HRESULT STDMETHODCALLTYPE SetContext(REFGUID guidEventType,
  711. IEventRouter *piRouter,
  712. IEventBindings *pBindings);
  713. private:
  714. CComPtr<IUnknown> m_pUnkMarshaler;
  715. };
  716. class CStoreDispatcherClassFactory : public IClassFactory
  717. {
  718. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void * * ppvObj)
  719. {
  720. _ASSERT(FALSE);
  721. return E_NOTIMPL;
  722. }
  723. unsigned long STDMETHODCALLTYPE AddRef () { _ASSERT(FALSE); return 0; }
  724. unsigned long STDMETHODCALLTYPE Release () { _ASSERT(FALSE); return 0; }
  725. // *** IClassFactory methods ***
  726. HRESULT STDMETHODCALLTYPE CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, void * * ppvObj)
  727. {
  728. return CComObject<CStoreDispatcher>::_CreatorClass::CreateInstance(pUnkOuter, riid, ppvObj);
  729. }
  730. HRESULT STDMETHODCALLTYPE LockServer (int fLock)
  731. {
  732. _ASSERT(FALSE);
  733. return E_NOTIMPL;
  734. }
  735. };
  736. // helper functions
  737. //
  738. // jstamerj 980603 10:45:21: TriggerServerEvent with async callback
  739. // support for completion
  740. //
  741. HRESULT TriggerServerEvent(IEventRouter *pRouter,
  742. DWORD dwEventType,
  743. PVOID pvContext);
  744. //
  745. // register a new SEO instance. if the instance is already registered
  746. // this function will detect it and won't register it again. it should
  747. // be called for each instance at service startup and when each instance
  748. // is created.
  749. //
  750. HRESULT RegisterPlatSEOInstance(DWORD dwInstanceID);
  751. //
  752. // unregister an SEO instance. this should be called when an SEO
  753. // instance is being deleted.
  754. //
  755. HRESULT UnregisterPlatSEOInstance(DWORD dwInstanceID);
  756. #endif