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.

95 lines
3.2 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  4. //
  5. //***************************************************************************
  6. #ifndef __WBEM_WMI_EVENT_PROVIDER__H_
  7. #define __WBEM_WMI_EVENT_PROVIDER__H_
  8. #define WMIEVENT 1
  9. #define WMI_EVENT_CLASS L"WMIEvent"
  10. #define BINARY_MOF_ID static_cast < DWORD > ( -1 )
  11. /////////////////////////////////////////////////////////////////////////////////////////////
  12. class CWMIEvent
  13. {
  14. protected:
  15. long m_lRef;
  16. IWbemObjectSink __RPC_FAR * m_pEventHandler;
  17. IWbemServices __RPC_FAR * m_pEventServices;
  18. IWbemServices __RPC_FAR * m_pEventRepository;
  19. IWbemContext __RPC_FAR * m_pEventCtx;
  20. CHandleMap m_HandleMap;
  21. int m_nType;
  22. BOOL m_bInitialized ;
  23. public:
  24. inline BOOL Initialized ()
  25. {
  26. return m_bInitialized ;
  27. }
  28. CWMIEvent(int nType);
  29. ~CWMIEvent();
  30. void ReleaseAllPointers();
  31. BOOL IsGuidInListIfSoGetCorrectContext(GUID gGuid, WMIEventRequest *& pEvent );
  32. BOOL IsGuidInList(WCHAR *Guids, WMIEventRequest *& pEvent);
  33. BOOL RegisterForInternalEvents( );
  34. HRESULT RegisterForRequestedEvent(DWORD dwId, WCHAR * wcsClasss, WORD wType);
  35. HRESULT RemoveWMIEvent(DWORD dwId);
  36. HRESULT DeleteBinaryMofResourceEvent();
  37. HRESULT DeleteAllLeftOverEvents();
  38. int NoMoreEventConsumersRegistered(GUID gGuid);
  39. void WMIEventCallback(PWNODE_HEADER WnodeHeader);
  40. void SetEventHandler(IWbemObjectSink __RPC_FAR * pHandler);
  41. void SetEventServices(IWbemServices __RPC_FAR * pServices);
  42. void SetEventRepository(IWbemServices __RPC_FAR * pServices);
  43. void SetEventContext(IWbemContext __RPC_FAR * pCtx);
  44. inline IWbemServices __RPC_FAR * GetServices() {return m_pEventServices;}
  45. inline IWbemServices __RPC_FAR * GetRepository() {return m_pEventRepository;}
  46. inline IWbemContext __RPC_FAR * GetContext() {return m_pEventCtx;}
  47. private:
  48. BOOL IsIndexInList ( WCHAR *Guid, DWORD dwIndex ) ;
  49. };
  50. class CWMIEventProvider : public CWMIEvent, public IWbemEventProvider, public IWbemEventProviderQuerySink, public IWbemProviderInit, public IWbemEventProviderSecurity
  51. {
  52. private:
  53. HANDLE m_hResyncEvent;
  54. public:
  55. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  56. STDMETHOD_(ULONG, AddRef)();
  57. STDMETHOD_(ULONG, Release)();
  58. STDMETHOD(NewQuery)(DWORD dwId, WBEM_WSTR wszLanguage, WBEM_WSTR wszQuery);
  59. STDMETHOD(CancelQuery)(DWORD dwId);
  60. STDMETHOD(ProvideEvents)( IWbemObjectSink __RPC_FAR *pSink,long lFlags);
  61. STDMETHOD (Initialize)(LPWSTR wszUser, long lFlags,
  62. LPWSTR wszNamespace,
  63. LPWSTR wszLocale, IWbemServices* pNamespace, IWbemContext* pCtx,
  64. IWbemProviderInitSink* pSink);
  65. STDMETHOD(AccessCheck)(WBEM_CWSTR wszLanguage, WBEM_CWSTR wszQuery, long lSidLength, const BYTE* aSid);
  66. CWMIEventProvider(int nType);
  67. ~CWMIEventProvider() ;
  68. };
  69. #endif