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.

101 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Abstract:
  4. @doc
  5. @module evtlogwriter.hxx | Declaration of the Event Log writer
  6. @end
  7. Author:
  8. Stefan Steiner [SSteiner] 07/26/2001
  9. TBD:
  10. Follows the similar style as the sql writer.
  11. Revision History:
  12. Name Date Comments
  13. ssteiner 07/26/2001 created
  14. --*/
  15. ////////////////////////////////////////////////////////////////////////
  16. // Standard foo for file name aliasing. This code block must be after
  17. // all includes of VSS header files.
  18. //
  19. #ifdef VSS_FILE_ALIAS
  20. #undef VSS_FILE_ALIAS
  21. #endif
  22. #define VSS_FILE_ALIAS "INCEVTWH"
  23. //
  24. ////////////////////////////////////////////////////////////////////////
  25. #ifndef __EVTWRITER_H_
  26. #define __EVTWRITER_H_
  27. class CEventLogWriter :
  28. public CVssWriter
  29. {
  30. private:
  31. STDMETHODCALLTYPE CEventLogWriter()
  32. {
  33. }
  34. public:
  35. virtual STDMETHODCALLTYPE ~CEventLogWriter()
  36. { FreeLogs(); }
  37. virtual bool STDMETHODCALLTYPE OnIdentify(IVssCreateWriterMetadata *pMetadata);
  38. virtual bool STDMETHODCALLTYPE OnPrepareSnapshot();
  39. virtual bool STDMETHODCALLTYPE OnFreeze();
  40. virtual bool STDMETHODCALLTYPE OnThaw();
  41. virtual bool STDMETHODCALLTYPE OnAbort();
  42. bool IsPathInSnapshot(const WCHAR *path) throw();
  43. public:
  44. static HRESULT CreateWriter();
  45. static void DestroyWriter();
  46. private:
  47. HRESULT STDMETHODCALLTYPE Initialize();
  48. HRESULT STDMETHODCALLTYPE Uninitialize();
  49. void TranslateWriterError(HRESULT hr);
  50. void ScanLogs();
  51. void FreeLogs();
  52. void AddExcludes(IVssCreateWriterMetadata* pMetadata);
  53. void AddLogs(IVssCreateWriterMetadata* pMetadata);
  54. void BackupLogs();
  55. static DWORD InitializeThreadFunc( VOID *pv );
  56. struct EventLog
  57. {
  58. EventLog() : m_pwszName(NULL), m_pwszFileName(NULL)
  59. {}
  60. EventLog(VSS_PWSZ name, VSS_PWSZ fileName) : m_pwszName(name), m_pwszFileName(fileName)
  61. {}
  62. VSS_PWSZ m_pwszName;
  63. VSS_PWSZ m_pwszFileName;
  64. };
  65. CSimpleArray<EventLog> m_eventLogs;
  66. static CEventLogWriter *sm_pWriter; // singleton writer object
  67. static HRESULT sm_hrInitialize;
  68. };
  69. #endif // _EVTWRITER_H_