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.

83 lines
2.9 KiB

  1. /*--------------------------------------------------------
  2. ntevents.h
  3. Defines a generic class that can register an NT
  4. event source and log NT events on that evens source.
  5. Copyright (c) 1996-1998 Microsoft Corporation
  6. All rights reserved.
  7. Authors:
  8. rsraghav R.S. Raghavan
  9. History:
  10. 03-10-95 rsraghav Created.
  11. -------------------------------------------------------*/
  12. #ifdef __cplusplus // file should be compiled only if it included by a c++ source
  13. #ifndef _NTEVENTS_H_
  14. #define _NTEVENTS_H_
  15. #if defined(DEBUG) && defined(INLINE)
  16. #undef THIS_FILE
  17. static char BASED_CODE NTEVENTS_H[] = "ntevents.h";
  18. #define THIS_FILE NTEVENTS_H
  19. #endif
  20. // #include "pwpmsg.h"
  21. //////////////////////////////////////////////////////////////////////
  22. // CNTEvent - generic class that allows to register an event source and log
  23. // NT events through that event source.
  24. class CNTEvent
  25. {
  26. public:
  27. CNTEvent(const char *pszEventSourceName);
  28. ~CNTEvent();
  29. BOOL FLogEvent(WORD wEventType, DWORD dwEventID, const char *pszParam1 = NULL,
  30. const char *pszParam2 = NULL, const char *pszParam3 = NULL,
  31. const char *pszParam4 = NULL, const char *pszParam5 = NULL,
  32. const char *pszParam6 = NULL, const char *pszParam7 = NULL,
  33. const char *pszParam8 = NULL, const char *pszParam9 = NULL);
  34. BOOL FLogError(DWORD dwEventID, const char *pszParam1 = NULL,
  35. const char *pszParam2 = NULL, const char *pszParam3 = NULL,
  36. const char *pszParam4 = NULL, const char *pszParam5 = NULL,
  37. const char *pszParam6 = NULL, const char *pszParam7 = NULL,
  38. const char *pszParam8 = NULL, const char *pszParam9 = NULL)
  39. {
  40. return FLogEvent(EVENTLOG_ERROR_TYPE, dwEventID, pszParam1, pszParam2, pszParam3,
  41. pszParam4, pszParam5, pszParam6, pszParam7, pszParam8, pszParam9);
  42. }
  43. BOOL FLogWarning(DWORD dwEventID, const char *pszParam1 = NULL,
  44. const char *pszParam2 = NULL, const char *pszParam3 = NULL,
  45. const char *pszParam4 = NULL, const char *pszParam5 = NULL,
  46. const char *pszParam6 = NULL, const char *pszParam7 = NULL,
  47. const char *pszParam8 = NULL, const char *pszParam9 = NULL)
  48. {
  49. return FLogEvent(EVENTLOG_WARNING_TYPE, dwEventID, pszParam1, pszParam2, pszParam3,
  50. pszParam4, pszParam5, pszParam6, pszParam7, pszParam8, pszParam9);
  51. }
  52. BOOL FLogInfo(DWORD dwEventID, const char *pszParam1 = NULL,
  53. const char *pszParam2 = NULL, const char *pszParam3 = NULL,
  54. const char *pszParam4 = NULL, const char *pszParam5 = NULL,
  55. const char *pszParam6 = NULL, const char *pszParam7 = NULL,
  56. const char *pszParam8 = NULL, const char *pszParam9 = NULL)
  57. {
  58. return FLogEvent(EVENTLOG_INFORMATION_TYPE, dwEventID, pszParam1, pszParam2, pszParam3,
  59. pszParam4, pszParam5, pszParam6, pszParam7, pszParam8, pszParam9);
  60. }
  61. private:
  62. HANDLE m_hEventSource; // handle to the event source
  63. };
  64. #endif // _NTEVENTS_H_
  65. #endif // __cplusplus