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.

92 lines
2.1 KiB

  1. /*++
  2. Copyright (C) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. //***************************************************************************
  8. //
  9. // EVCONS.H
  10. //
  11. // Test event consumer shell.
  12. //
  13. // raymcc 4-Jun-98
  14. //
  15. //***************************************************************************
  16. #ifndef _EVCONS_H_
  17. #define _EVCONS_H_
  18. class CMySink;
  19. class CMyEventConsumer : public IWbemEventConsumerProvider, public IWbemProviderInit
  20. {
  21. ULONG m_cRef;
  22. CMySink *m_pConsumer1;
  23. CMySink *m_pConsumer2;
  24. public:
  25. CMyEventConsumer();
  26. ~CMyEventConsumer();
  27. //
  28. // IUnknown members
  29. //
  30. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  31. STDMETHODIMP_(ULONG) AddRef(void);
  32. STDMETHODIMP_(ULONG) Release(void);
  33. virtual HRESULT STDMETHODCALLTYPE FindConsumer(
  34. /* [in] */ IWbemClassObject __RPC_FAR *pLogicalConsumer,
  35. /* [out] */ IWbemUnboundObjectSink __RPC_FAR *__RPC_FAR *ppConsumer
  36. );
  37. virtual HRESULT STDMETHODCALLTYPE CMyEventConsumer::Initialize(
  38. /* [in] */ LPWSTR pszUser,
  39. /* [in] */ LONG lFlags,
  40. /* [in] */ LPWSTR pszNamespace,
  41. /* [in] */ LPWSTR pszLocale,
  42. /* [in] */ IWbemServices __RPC_FAR *pNamespace,
  43. /* [in] */ IWbemContext __RPC_FAR *pCtx,
  44. /* [in] */ IWbemProviderInitSink __RPC_FAR *pInitSink
  45. );
  46. };
  47. class CMySink : public IWbemUnboundObjectSink
  48. {
  49. ULONG m_cRef;
  50. char *m_pszLogFile;
  51. public:
  52. CMySink(char *pLogFile) { m_cRef = 0; m_pszLogFile = strcpy(new char[128], pLogFile); }
  53. ~CMySink() { delete [] m_pszLogFile; }
  54. //
  55. // IUnknown members
  56. //
  57. STDMETHODIMP QueryInterface(REFIID, LPVOID *);
  58. STDMETHODIMP_(ULONG) AddRef(void);
  59. STDMETHODIMP_(ULONG) Release(void);
  60. virtual HRESULT STDMETHODCALLTYPE IndicateToConsumer(
  61. /* [in] */ IWbemClassObject __RPC_FAR *pLogicalConsumer,
  62. /* [in] */ long lNumObjects,
  63. /* [size_is][in] */ IWbemClassObject __RPC_FAR *__RPC_FAR *apObjects
  64. );
  65. };
  66. #endif