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.

84 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 ULONG ulValue );
  35. void AddError( ULONG ulValue );
  36. private:
  37. WORD _fType;
  38. WORD _fCategory;
  39. DWORD _eventId;
  40. WORD _cArgsTotal;
  41. WORD _cArgsUsed;
  42. WCHAR ** _pwcsData;
  43. DWORD _dataSize;
  44. const void * _data;
  45. };
  46. //+-------------------------------------------------------------------------
  47. //
  48. // Class: CEventLog
  49. //
  50. // Purpose: Allows writing records to event log
  51. //
  52. // History: 07-Jun-94 DwightKr Created
  53. //
  54. //--------------------------------------------------------------------------
  55. class CEventLog
  56. {
  57. public:
  58. CEventLog( const WCHAR * wcsUNCServer , const WCHAR * wcsSource );
  59. ~CEventLog();
  60. void ReportEvent( CEventItem & event );
  61. private:
  62. HANDLE _hEventLog; // Handle to the open log
  63. };
  64. void ReportCorruptComponent( PStorage & storage, WCHAR const * pwszComponent );
  65. void ReportCorruptComponent( WCHAR const * pwszComponent );