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.7 KiB

  1. #ifndef _INC_DSKQUOTA_EVENTLOG_H
  2. #define _INC_DSKQUOTA_EVENTLOG_H
  3. ///////////////////////////////////////////////////////////////////////////////
  4. /* File: eventlog.h
  5. Description: Header for eventlog.cpp.
  6. See eventlog.cpp for functional description.
  7. Revision History:
  8. Date Description Programmer
  9. -------- --------------------------------------------------- ----------
  10. 02/14/98 Initial creation. BrianAu
  11. */
  12. ///////////////////////////////////////////////////////////////////////////////
  13. #ifndef _WINDOWS_
  14. # include <windows.h>
  15. #endif
  16. //
  17. // This class provides basic NT event logging capability. It provides only
  18. // a subset of the full capability provided by the NT event logging APIs.
  19. // I wanted a simple way to write messages to the event log. No reading
  20. // of event log entries is supported.
  21. //
  22. class CEventLog
  23. {
  24. public:
  25. //
  26. // Number conversion formats.
  27. //
  28. enum eFmt {
  29. eFmtDec, // Display as decimal.
  30. eFmtHex, // Display as hex
  31. eFmtSysErr // Display as win32 error text string.
  32. };
  33. CEventLog(void)
  34. : m_hLog(NULL)
  35. { DBGTRACE((DM_EVENTLOG, DL_MID, TEXT("CEventLog::CEventLog"))); }
  36. ~CEventLog(void);
  37. HRESULT Initialize(LPCTSTR pszEventSource);
  38. void Close(void);
  39. HRESULT ReportEvent(WORD wType,
  40. WORD wCategory,
  41. DWORD dwEventID,
  42. PSID lpUserSid = NULL,
  43. LPVOID pvRawData = NULL,
  44. DWORD cbRawData = 0);
  45. HRESULT ReportEvent(WORD wType,
  46. WORD wCategory,
  47. DWORD dwEventID,
  48. const CArray<CString>& rgstr,
  49. PSID lpUserSid = NULL,
  50. LPVOID pvRawData = NULL,
  51. DWORD cbRawData = 0);
  52. //
  53. // Push replacement data onto a stack to replace the
  54. // %1, %2 etc. parameters in the message strings.
  55. //
  56. void Push(HRESULT hr, eFmt = eFmtDec);
  57. void Push(LPCTSTR psz);
  58. private:
  59. HANDLE m_hLog;
  60. CArray<CString> m_rgstrText;
  61. static TCHAR m_szFmtDec[];
  62. static TCHAR m_szFmtHex[];
  63. //
  64. // Prevent copy.
  65. //
  66. CEventLog(const CEventLog& rhs);
  67. CEventLog& operator = (const CEventLog& rhs);
  68. };
  69. #endif // _INC_DSKQUOTA_EVENTLOG_H