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.

75 lines
1.8 KiB

  1. //=================================================================
  2. //
  3. // EventProvider.h -- Generic class for eventing
  4. //
  5. // Copyright (c) 2000-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #ifndef _EVENT_PROVIDER_H
  9. #define _EVENT_PROVIDER_H
  10. //
  11. class CEventProvider :
  12. public IWbemProviderInit,
  13. public IWbemEventProvider
  14. {
  15. private:
  16. long m_ReferenceCount ;
  17. IWbemObjectSinkPtr m_pHandler ;
  18. IWbemClassObjectPtr m_pClass ;
  19. CCritSec m_cs ;
  20. // sink management
  21. void SetHandler( IWbemObjectSink __RPC_FAR *a_pHandler ) ;
  22. // class management
  23. void SetClass( IWbemClassObject __RPC_FAR *a_pClass ) ;
  24. protected:
  25. public:
  26. CEventProvider() ;
  27. ~CEventProvider() ;
  28. STDMETHOD(QueryInterface)( REFIID a_riid, void **a_ppv ) ;
  29. STDMETHODIMP_( ULONG ) AddRef() ;
  30. STDMETHODIMP_( ULONG ) Release() ;
  31. STDMETHOD(ProvideEvents)( IWbemObjectSink __RPC_FAR *a_pSink,
  32. long a_lFlags ) ;
  33. STDMETHOD (Initialize)( LPWSTR a_wszUser,
  34. long a_lFlags,
  35. LPWSTR a_wszNamespace,
  36. LPWSTR a_wszLocale,
  37. IWbemServices *a_pNamespace,
  38. IWbemContext *a_pCtx,
  39. IWbemProviderInitSink *a_pSink ) ;
  40. // sink retrieval
  41. IWbemObjectSink __RPC_FAR * GetHandler() ;
  42. // class retrieval
  43. IWbemClassObject __RPC_FAR * GetClass() ;
  44. IWbemClassObject __RPC_FAR * GetInstance() ;
  45. // implementor must supply the class name
  46. virtual BSTR GetClassName() = 0 ;
  47. // implementor must supply this function. Normally, it will be
  48. // one line: delete this;
  49. virtual void OnFinalRelease() = 0;
  50. // notification to begin eventing
  51. virtual void ProvideEvents() = 0 ;
  52. };
  53. #endif // _EVENT_PROVIDER_H