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.

80 lines
2.5 KiB

  1. #ifndef __WBEM_EVENTLOG_CONSUMER__H_
  2. #define __WBEM_EVENTLOG_CONSUMER__H_
  3. #include <unk.h>
  4. #include <wbemidl.h>
  5. #include "txttempl.h"
  6. #include <stdio.h>
  7. class CEventLogConsumer : public CUnk
  8. {
  9. protected:
  10. class XProvider : public CImpl<IWbemEventConsumerProvider, CEventLogConsumer>
  11. {
  12. public:
  13. XProvider(CEventLogConsumer* pObj)
  14. : CImpl<IWbemEventConsumerProvider, CEventLogConsumer>(pObj){}
  15. HRESULT STDMETHODCALLTYPE FindConsumer(
  16. IWbemClassObject* pLogicalConsumer,
  17. IWbemUnboundObjectSink** ppConsumer);
  18. } m_XProvider;
  19. friend XProvider;
  20. public:
  21. CEventLogConsumer(CLifeControl* pControl = NULL, IUnknown* pOuter = NULL)
  22. : CUnk(pControl, pOuter), m_XProvider(this)
  23. {}
  24. ~CEventLogConsumer(){}
  25. void* GetInterface(REFIID riid);
  26. };
  27. class CEventLogSink : public CUnk
  28. {
  29. protected:
  30. class XSink : public CImpl<IWbemUnboundObjectSink, CEventLogSink>
  31. {
  32. public:
  33. XSink(CEventLogSink* pObj) :
  34. CImpl<IWbemUnboundObjectSink, CEventLogSink>(pObj){}
  35. HRESULT STDMETHODCALLTYPE IndicateToConsumer(
  36. IWbemClassObject* pLogicalConsumer, long lNumObjects,
  37. IWbemClassObject** apObjects);
  38. private:
  39. void GetDatData(IWbemClassObject* pEventObj, WCHAR* dataName,
  40. VARIANT& vData, BYTE*& pData, DWORD& dataSize);
  41. void GetDatSID(IWbemClassObject* pEventObj, WCHAR* dataName, PSID& pSid);
  42. HRESULT GetDatDataVariant(IWbemClassObject* pEventObj, WCHAR* dataName, VARIANT& vData);
  43. HRESULT GetDatEmbeddedObjectOut(IWbemClassObject* pObject, WCHAR* objectName, IWbemClassObject*& pEmbeddedObject);
  44. } m_XSink;
  45. friend XSink;
  46. protected:
  47. DWORD m_dwType;
  48. DWORD m_dwCategory;
  49. DWORD m_dwEventId;
  50. DWORD m_dwNumTemplates;
  51. CTextTemplate* m_aTemplates;
  52. PSID m_pSidCreator;
  53. WString m_dataName; // name of property in event, property is handed off to the 'additional data' block in nt event log
  54. WString m_sidName; // name of property in event, property is handed off to the 'user sid' block in nt event log
  55. HANDLE m_hEventLog;
  56. public:
  57. CEventLogSink(CLifeControl* pControl = NULL)
  58. : CUnk(pControl), m_XSink(this), m_aTemplates(NULL), m_hEventLog(NULL), m_pSidCreator(NULL)
  59. {}
  60. HRESULT Initialize(IWbemClassObject* pLogicalConsumer);
  61. ~CEventLogSink();
  62. void* GetInterface(REFIID riid);
  63. };
  64. #endif