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.

85 lines
2.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1994 - 1999.
  5. //
  6. // File: eventlog.hxx
  7. //
  8. // Contents: CEventLog class
  9. //
  10. // History: 07-Jun-94 DwightKr Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. class PStorage;
  15. #define wcsCiEventSource L"Ci"
  16. //+-------------------------------------------------------------------------
  17. //
  18. // Class: CEventItem
  19. //
  20. // Purpose: Encapsulates all information pertaining to a single event
  21. //
  22. // History: 07-Jun-94 DwightKr Created
  23. // 31-Dec-96 mohamedn Added support for raw data in CEventItem
  24. //
  25. //--------------------------------------------------------------------------
  26. class CEventItem
  27. {
  28. friend class CEventLog;
  29. public:
  30. CEventItem( WORD fType, WORD fCategory, DWORD eventId,
  31. WORD cArgs, DWORD dataSize=0 , const void* data=0 );
  32. ~CEventItem();
  33. void AddArg( const WCHAR * wcsString );
  34. void AddArg( const CHAR * pszString );
  35. void AddArg( const ULONG ulValue );
  36. void AddError( ULONG ulValue );
  37. private:
  38. WORD _fType;
  39. WORD _fCategory;
  40. DWORD _eventId;
  41. WORD _cArgsTotal;
  42. WORD _cArgsUsed;
  43. WCHAR ** _pwcsData;
  44. DWORD _dataSize;
  45. const void * _data;
  46. };
  47. //+-------------------------------------------------------------------------
  48. //
  49. // Class: CEventLog
  50. //
  51. // Purpose: Allows writing records to event log
  52. //
  53. // History: 07-Jun-94 DwightKr Created
  54. //
  55. //--------------------------------------------------------------------------
  56. class CEventLog
  57. {
  58. public:
  59. CEventLog( const WCHAR * wcsUNCServer , const WCHAR * wcsSource );
  60. ~CEventLog();
  61. void ReportEvent( CEventItem & event );
  62. private:
  63. HANDLE _hEventLog; // Handle to the open log
  64. };
  65. void ReportCorruptComponent( PStorage & storage, WCHAR const * pwszComponent );
  66. void ReportCorruptComponent( WCHAR const * pwszComponent );