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.

87 lines
2.6 KiB

  1. //***************************************************************************
  2. //
  3. // Copyright � Microsoft Corporation. All rights reserved.
  4. //
  5. // EventProvider.CPP
  6. //
  7. // Purpose: Implementation of EventProvider class
  8. //
  9. //***************************************************************************
  10. #include "precomp.h"
  11. #ifdef EVENT_PROVIDER_ENABLED
  12. #include <EventProvider.h>
  13. EventProvider::EventProvider( const CHString& name, LPCWSTR pszNameSpace /* = NULL */ )
  14. :Provider(name, pszNameSpace)
  15. {
  16. CWbemProviderGlue::FrameworkLoginEventProvider( name, this, pszNameSpace );
  17. }
  18. EventProvider::~EventProvider( void )
  19. {
  20. // get out of the framework's hair
  21. CWbemProviderGlue::FrameworkLogoffEventProvider( m_name, LPCWSTR m_strNameSpace );
  22. }
  23. ////////////////////////////////////////////////////////////////////////
  24. //
  25. // Function: KickoffEvents
  26. //
  27. // Inputs:
  28. //
  29. // Outputs:
  30. //
  31. // Return:
  32. //
  33. // Comments: prep for ProvideEvents, validates flags
  34. // TODO: begin a new thread, return synchronously.
  35. //
  36. ////////////////////////////////////////////////////////////////////////
  37. HRESULT EventProvider::KickoffEvents( MethodContext *pContext, long lFlags /*= 0L*/ )
  38. {
  39. HRESULT sc = ValidateProvideEventsFlags(lFlags);
  40. // Make sure we've got Managed Object Services avaliable, as we will need
  41. // it to get WBEMClassObjects for constructing Instances.
  42. if ( SUCCEEDED(sc) )
  43. {
  44. if (ValidateIMOSPointer())
  45. sc = ProvideEvents( pContext, lFlags );
  46. else
  47. sc = WBEM_E_FAILED;
  48. }
  49. return sc;
  50. }
  51. // override of the base class' pure virtuals, return WBEM_E_PROVIDER_NOT_CAPABLE
  52. // logic is that an event provider will not want to support them in the general case
  53. HRESULT EventProvider::EnumerateInstances(MethodContext *pMethodContext, long lFlags /* = 0L */)
  54. {
  55. return WBEM_E_PROVIDER_NOT_CAPABLE;
  56. }
  57. // override of the base class' pure virtuals, return WBEM_E_PROVIDER_NOT_CAPABLE
  58. // logic is that an event provider will not want to support them in the general case
  59. HRESULT EventProvider::GetObject(CInstance *pInstance, long lFlags /* = 0L*/ )
  60. {
  61. return WBEM_E_PROVIDER_NOT_CAPABLE;
  62. }
  63. HRESULT EventProvider::ValidateProvideEventsFlags(long lFlags)
  64. {
  65. // TODO: Fix cast hack, maybe base level fcn is wrong?
  66. return ValidateFlags(lFlags, (Provider::FlagDefs)0);
  67. }
  68. HRESULT EventProvider::ValidateQueryEventsFlags(long lFlags)
  69. {
  70. // TODO: Fix cast hack, maybe base level fcn is wrong?
  71. return ValidateFlags(lFlags, (Provider::FlagDefs)0);
  72. }
  73. #endif //EVENT_PROVIDER_ENABLED