Source code of Windows XP (NT5)
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.

63 lines
1.7 KiB

  1. // ConnectionManager.h : Declaration of the CConnectionManager
  2. #ifndef __CONNECTIONMANAGER_H_
  3. #define __CONNECTIONMANAGER_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CConnectionManager
  7. class ATL_NO_VTABLE CConnectionManager :
  8. public CComObjectRootEx<CComMultiThreadModel>,
  9. public CComCoClass<CConnectionManager, &CLSID_ConnectionManager>,
  10. public IConnectionManager
  11. {
  12. public:
  13. CConnectionManager();
  14. virtual ~CConnectionManager();
  15. DECLARE_REGISTRY_RESOURCEID(IDR_CONNECTIONMANAGER)
  16. BEGIN_COM_MAP(CConnectionManager)
  17. COM_INTERFACE_ENTRY(IConnectionManager)
  18. END_COM_MAP()
  19. // IConnectionManager
  20. public:
  21. STDMETHOD(RegisterEventNotification)
  22. (/*[in]*/BSTR bsMachineName,
  23. /*[in]*/BSTR bsQuery,
  24. /*[in]*/IWbemObjectSink* pSink);
  25. STDMETHOD(GetConnection)
  26. (/*[in]*/BSTR bsMachineName,
  27. /*[out]*/IWbemServices __RPC_FAR *__RPC_FAR * ppIWbemServices,
  28. /*[out]*/long* lStatus);
  29. STDMETHOD(RemoveConnection)
  30. (/*[in]*/ BSTR bsMachineName,
  31. /*[in]*/IWbemObjectSink* pSink);
  32. // CComObjectRootEx
  33. HRESULT FinalConstruct();
  34. void FinalRelease();
  35. // Create/Destroy
  36. public:
  37. STDMETHOD(ConnectToNamespace)(BSTR bsNamespace, IWbemServices** ppService);
  38. STDMETHOD(ExecQueryAsync)(/*[in]*/BSTR bsMachineName, /*[in]*/BSTR bsQuery, /*[in]*/IWbemObjectSink* pSink);
  39. void Destroy();
  40. // Implementation Operations
  41. protected:
  42. HRESULT CreateLocator();
  43. BOOL ValidMachine(BSTR& bsMachine);
  44. CTypedPtrMap<CMapStringToPtr,CString,CConnection*> m_ConnectionMap;
  45. IWbemLocator* m_pIWbemLocator;
  46. };
  47. #endif //__CONNECTIONMANAGER_H_