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.

84 lines
2.8 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 0
  11. /////////////////////////////////////////////////////////////////////////////////////////////
  12. class CWMIEvent
  13. {
  14. protected:
  15. long m_lRef;
  16. IWbemObjectSink __RPC_FAR * m_pEventHandler;
  17. IWbemServices __RPC_FAR * m_pEventServices;
  18. IWbemContext __RPC_FAR * m_pEventCtx;
  19. CHandleMap m_HandleMap;
  20. int m_nType;
  21. BOOL m_fReadyForInternalEvents;
  22. public:
  23. CWMIEvent(int nType);
  24. ~CWMIEvent();
  25. void ReleaseAllPointers();
  26. inline void ReadyForInternalEvents(BOOL fFlag ) { m_fReadyForInternalEvents = fFlag; }
  27. BOOL IsGuidInListIfSoGetCorrectContext(GUID gGuid, WMIEventRequest *& pEvent );
  28. BOOL IsGuidInList(WCHAR *Guids, WMIEventRequest *& pEvent);
  29. BOOL RegisterForInternalEvents( );
  30. HRESULT RegisterForRequestedEvent(DWORD dwId, WCHAR * wcsClasss, WORD wType);
  31. HRESULT RemoveWMIEvent(DWORD dwId);
  32. HRESULT DeleteBinaryMofResourceEvent();
  33. HRESULT DeleteAllLeftOverEvents();
  34. int NoMoreEventConsumersRegistered(GUID gGuid);
  35. void WMIEventCallback(PWNODE_HEADER WnodeHeader);
  36. void SetEventHandler(IWbemObjectSink __RPC_FAR * pHandler);
  37. void SetEventServices(IWbemServices __RPC_FAR * pServices);
  38. void SetEventContext(IWbemContext __RPC_FAR * pCtx);
  39. inline IWbemServices __RPC_FAR * GetServices() {return m_pEventServices;}
  40. inline IWbemContext __RPC_FAR * GetContext() {return m_pEventCtx;}
  41. };
  42. class CWMIEventProvider : public CWMIEvent, public IWbemEventProvider, public IWbemEventProviderQuerySink, public IWbemProviderInit, public IWbemEventProviderSecurity
  43. {
  44. private:
  45. HANDLE m_hResyncEvent;
  46. public:
  47. STDMETHOD(QueryInterface)(REFIID riid, void** ppv);
  48. STDMETHOD_(ULONG, AddRef)();
  49. STDMETHOD_(ULONG, Release)();
  50. STDMETHOD(NewQuery)(DWORD dwId, WBEM_WSTR wszLanguage, WBEM_WSTR wszQuery);
  51. STDMETHOD(CancelQuery)(DWORD dwId);
  52. STDMETHOD(ProvideEvents)( IWbemObjectSink __RPC_FAR *pSink,long lFlags);
  53. STDMETHOD (Initialize)(LPWSTR wszUser, long lFlags,
  54. LPWSTR wszNamespace,
  55. LPWSTR wszLocale, IWbemServices* pNamespace, IWbemContext* pCtx,
  56. IWbemProviderInitSink* pSink);
  57. STDMETHOD(AccessCheck)(WBEM_CWSTR wszLanguage, WBEM_CWSTR wszQuery, long lSidLength, const BYTE* aSid);
  58. CWMIEventProvider(int nType);
  59. ~CWMIEventProvider() ;
  60. };
  61. #endif