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.

64 lines
1.5 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright: Microsoft Corp. 1997-1999. All rights reserved
  4. //
  5. /////////////////////////////////////////////////////////////////////////////
  6. // Log.h : Declaration of the CLog
  7. #ifndef __LOG_H_
  8. #define __LOG_H_
  9. #include "resource.h" // main symbols
  10. #include "Events.h"
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CLog
  13. class ATL_NO_VTABLE CLog :
  14. public CComObjectRootEx<CComSingleThreadModel>,
  15. public CComCoClass<CLog, &CLSID_Log>,
  16. public ISupportErrorInfo,
  17. public IDispatchImpl<ILog, &IID_ILog, &LIBID_EventLogUtilities>
  18. {
  19. private:
  20. CComObject<CEvents>* m_pEvents;
  21. HANDLE m_hLog;
  22. public:
  23. _bstr_t m_Name;
  24. _bstr_t m_ServerName;
  25. CLog() : m_hLog(NULL)
  26. {
  27. m_pEvents = new CComObject<CEvents>;
  28. if (m_pEvents)
  29. m_pEvents->AddRef();
  30. }
  31. ~CLog()
  32. {
  33. if (m_hLog) CloseEventLog(m_hLog);
  34. if (m_pEvents) m_pEvents->Release();
  35. }
  36. DECLARE_REGISTRY_RESOURCEID(IDR_LOG)
  37. DECLARE_PROTECT_FINAL_CONSTRUCT()
  38. BEGIN_COM_MAP(CLog)
  39. COM_INTERFACE_ENTRY(ILog)
  40. COM_INTERFACE_ENTRY(IDispatch)
  41. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  42. END_COM_MAP()
  43. // ISupportsErrorInfo
  44. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  45. // ILog: Interface methods and properties
  46. STDMETHOD(get_Events)(/*[out, retval]*/ VARIANT *pVal);
  47. STDMETHOD(get_Server)(/*[out, retval]*/ BSTR *pVal);
  48. STDMETHOD(put_Server)(/*[in]*/ BSTR newVal);
  49. STDMETHOD(get_Name)(/*[out, retval]*/ BSTR *pVal);
  50. STDMETHOD(Clear)();
  51. };
  52. #endif //__LOG_H_