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.

135 lines
4.0 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. ELFSRC.HXX
  7. Event Log sourcing classes.
  8. FILE HISTORY:
  9. DavidHov 2/16/93 Created
  10. */
  11. #ifndef _ELFSRC_HXX_
  12. #define _ELFSRC_HXX_
  13. #define ELFSRC_MAX_STRINGS 10
  14. /*************************************************************************
  15. NAME: EVENT_LOG_SOURCE
  16. SYNOPSIS: Object used by an application to generate event log
  17. entries.
  18. This class encapsulates:
  19. Establishing an application as a valid event
  20. log source;
  21. Logging event in various forms;
  22. Removing an application as a valid event log source.
  23. (CURRENTLY UNIMPLEMENTED!)
  24. INTERFACE: Construct one instance for a given application.
  25. PARENT: BASE
  26. USES: None
  27. CAVEATS: BE SURE TO TERMINATE VARIABLE ARGUMENT LISTS WITH NULL.
  28. The Destroy() method is currently unimplemented.
  29. NOTES: This class wrappers the following Win32 APIs:
  30. RegisterEventSource
  31. DeregisterEventSource
  32. ReportEvent
  33. The first constructor form is used to create the
  34. necessary Registry keys and values for Event Log support.
  35. If they already exist, construction succeeds anyway.
  36. THIS IS THE RECOMMENDED APPROACH.
  37. The second constructor assumes that the information
  38. is already present in the Registry and WILL FAIL IF
  39. IT IS NOT.
  40. Note the use of variable lists of arguments, all of which
  41. are "const TCHAR *". These variable argument lists
  42. MUST BE TERMINATED with NULL or the "va_args" routines
  43. will almost certainly fault.
  44. HISTORY: DavidHov 03/01/93 Created
  45. **************************************************************************/
  46. DLL_CLASS EVENT_LOG_SOURCE : public BASE
  47. {
  48. public:
  49. // Constructor which creates required Registry entries
  50. // if not already present in Registry
  51. EVENT_LOG_SOURCE ( const TCHAR * pchSourceName,
  52. const TCHAR * pchDllName,
  53. DWORD dwTypesSupported,
  54. const TCHAR * pchServerName = NULL ) ;
  55. // Constructor which assumes source is already registered.
  56. EVENT_LOG_SOURCE ( const TCHAR * pchSourceName,
  57. const TCHAR * pchServerName = NULL ) ;
  58. ~ EVENT_LOG_SOURCE () ;
  59. // Log an event: a set of strings terminated by NULL.
  60. APIERR Log ( WORD wType,
  61. WORD wCategory,
  62. DWORD dwEventId,
  63. const TCHAR * pchStr1 = NULL,
  64. ...
  65. ) ;
  66. // Log an event: raw binary data, a SID and a set of strings
  67. // terminated by NULL. This is the full magilla.
  68. APIERR Log ( WORD wType,
  69. WORD wCategory,
  70. DWORD dwEventId,
  71. PVOID pvRawData,
  72. DWORD cbRawData,
  73. PSID pSid,
  74. const TCHAR * pchStr1,
  75. ...
  76. ) ;
  77. // Destroy the event log source information in the Registry
  78. // BUGBUG: UNIMPLEMENTED!
  79. APIERR Destroy () ;
  80. protected:
  81. HANDLE _hndl ; // The event log source handle
  82. // Create and open the event log source
  83. APIERR Create ( const TCHAR * pchSourceName,
  84. const TCHAR * pchDllName,
  85. DWORD dwTypesSupported,
  86. const TCHAR * pchServerName ) ;
  87. // Open the event log source
  88. APIERR Open ( const TCHAR * pchSourceName,
  89. const TCHAR * pchServerName ) ;
  90. // Close the source
  91. APIERR Close () ;
  92. };
  93. #endif // _ELFSRC_HXX_