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.

93 lines
2.8 KiB

  1. /*---------------------------------------------------------------------------
  2. File: DCTDispatcher.h
  3. Comments: COM object that remotely installs and starts the EDA agent.
  4. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  5. Proprietary and confidential to Mission Critical Software, Inc.
  6. REVISION LOG ENTRY
  7. Revision By: Christy Boles
  8. Revised on 02/15/99 11:23:57
  9. ---------------------------------------------------------------------------
  10. */
  11. // DCTDispatcher.h : Declaration of the CDCTDispatcher
  12. #ifndef __DCTDISPATCHER_H_
  13. #define __DCTDISPATCHER_H_
  14. #include "resource.h" // main symbols
  15. #include <mtx.h>
  16. #include <vector>
  17. class TJobDispatcher;
  18. //#import "\bin\McsVarSetMin.tlb" no_namespace , named_guids
  19. #import "VarSet.tlb" no_namespace , named_guids rename("property", "aproperty")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CDCTDispatcher
  22. class ATL_NO_VTABLE CDCTDispatcher :
  23. public CComObjectRootEx<CComMultiThreadModel>,
  24. public CComCoClass<CDCTDispatcher, &CLSID_DCTDispatcher>,
  25. public IDispatchImpl<IDCTDispatcher, &IID_IDCTDispatcher, &LIBID_MCSDISPATCHERLib>
  26. {
  27. public:
  28. CDCTDispatcher()
  29. {
  30. m_pUnkMarshaler = NULL;
  31. m_hMutex = CreateMutex(0, 0, 0);
  32. }
  33. ~CDCTDispatcher() { ::CloseHandle(m_hMutex); }
  34. DECLARE_REGISTRY_RESOURCEID(IDR_DCTDISPATCHER)
  35. DECLARE_NOT_AGGREGATABLE(CDCTDispatcher)
  36. DECLARE_GET_CONTROLLING_UNKNOWN()
  37. DECLARE_PROTECT_FINAL_CONSTRUCT()
  38. BEGIN_COM_MAP(CDCTDispatcher)
  39. COM_INTERFACE_ENTRY(IDCTDispatcher)
  40. COM_INTERFACE_ENTRY(IDispatch)
  41. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler.p)
  42. END_COM_MAP()
  43. HRESULT FinalConstruct()
  44. {
  45. return CoCreateFreeThreadedMarshaler(
  46. GetControllingUnknown(), &m_pUnkMarshaler.p);
  47. }
  48. void FinalRelease()
  49. {
  50. m_pUnkMarshaler.Release();
  51. }
  52. CComPtr<IUnknown> m_pUnkMarshaler;
  53. // IDCTDispatcher
  54. public:
  55. STDMETHOD(GetStartedAgentsInfo)(long* nNumStartedAgents, SAFEARRAY** ppbstrStartedAgents, SAFEARRAY** ppbstrJobid, SAFEARRAY** ppbstrFailedAgents, SAFEARRAY** ppbstrFailureDesc);
  56. STDMETHOD(AllAgentsStarted)(long* bAllAgentsStarted);
  57. STDMETHOD(DispatchToServers)(IUnknown ** ppWorkItem);
  58. protected:
  59. std::vector<CComBSTR> m_startFailedVector;
  60. std::vector<CComBSTR> m_failureDescVector;
  61. std::vector<CComBSTR> m_startedVector;
  62. std::vector<CComBSTR> m_jobidVector;
  63. TJobDispatcher* m_pThreadPool;
  64. HANDLE m_hMutex;
  65. HRESULT BuildInputFile(IVarSet * pVarSet);
  66. void MergeServerList(IVarSet * pVarSet);
  67. STDMETHOD(Process)(
  68. IUnknown * pWorkItem, // in - varset containing job information and list of servers
  69. IUnknown ** ppResponse, // out- not used
  70. UINT * pDisposition // out- not used
  71. );
  72. };
  73. #endif //__DCTDISPATCHER_H_