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.

106 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. eventlog.hxx
  5. Abstract:
  6. This file defines functions and types required for
  7. logging events to the event logger.
  8. Author:
  9. Murali R. Krishnan ( MuraliK ) 27-Sept-1994
  10. Revision History:
  11. MuraliK 21-Nov-1994 Ported to common dll
  12. --*/
  13. # ifndef _EVENTLOG_HXX_
  14. # define _EVENTLOG_HXX_
  15. #include <windows.h>
  16. # include "datetime.hxx" // for Win95 object
  17. /***********************************************************
  18. * Type Definitions
  19. ************************************************************/
  20. /*********************************************
  21. * class EVENT_LOG
  22. *
  23. * Declares a event log object.
  24. * This object provides an interface for logging messages
  25. * to the System EventLog file globally for given program.
  26. *
  27. ************************************************/
  28. class dllexp EVENT_LOG {
  29. private:
  30. DWORD m_ErrorCode; // error code for last operation
  31. HANDLE m_hEventSource; // handle for reporting events
  32. //
  33. // win95
  34. //
  35. HANDLE m_hLogFile;
  36. PASCLOG_DATETIME_CACHE m_pDateTimeCache;
  37. public:
  38. EVENT_LOG( IN LPCTSTR lpszSourceName); // name of source for event log
  39. ~EVENT_LOG( VOID);
  40. VOID
  41. LogEvent(
  42. IN DWORD idMessage, // id for log message
  43. IN WORD cSubStrings, // count of substrings
  44. IN const CHAR * apszSubStrings[], // substrings in the message
  45. IN DWORD errCode = 0); // error code if any
  46. BOOL Success( VOID) const
  47. { return ( m_ErrorCode == NO_ERROR); }
  48. DWORD GetErrorCode( VOID) const
  49. { return ( m_ErrorCode); }
  50. private:
  51. VOID
  52. LogEventPrivate(
  53. IN DWORD idMessage,
  54. IN WORD wEventType,
  55. IN WORD cSubStrings,
  56. IN const CHAR * apszSubStrings[],
  57. IN DWORD errCode);
  58. HANDLE
  59. RegisterEventSourceChicagoStyle(
  60. IN LPCSTR lpszSource,
  61. IN PHANDLE hFile
  62. );
  63. BOOL
  64. ReportEventChicagoStyle(
  65. IN HANDLE hEventSource,
  66. IN HANDLE hLogFile,
  67. IN DWORD idMessage,
  68. IN LPCSTR * apszSubStrings,
  69. IN DWORD dwErrorCode
  70. );
  71. };
  72. typedef EVENT_LOG * LPEVENT_LOG;
  73. # endif // _EVENTLOG_HXX_