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.

125 lines
2.7 KiB

  1. #ifndef _MEVENTLOG_HH
  2. #define _MEVENTLOG_HH
  3. // Copyright (c) Microsoft. All Rights Reserved
  4. //
  5. // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Microsoft.
  6. // The copyright notice above does not evidence any
  7. // actual or intendd publication of such source code.
  8. //
  9. // OneLiner : Interface for MEventLog
  10. // DevUnit : wlbstest
  11. // Author : Murtaza Hakim
  12. //
  13. // Description:
  14. // ------------
  15. // Gets event logs from a remote machine.
  16. // Include Files
  17. #include "MWmiObject.h"
  18. #include <vector>
  19. #include <map>
  20. #include <wbemidl.h>
  21. #include <comdef.h>
  22. using namespace std;
  23. class MEventLog
  24. {
  25. public:
  26. class Event
  27. {
  28. public:
  29. unsigned long RecordNumber;
  30. _bstr_t Logfile;
  31. unsigned long EventIdentifier;
  32. unsigned int EventCode;
  33. _bstr_t SourceName;
  34. _bstr_t Type;
  35. unsigned int Category;
  36. _bstr_t ComputerName;
  37. _bstr_t Message;
  38. };
  39. class UniqueEvent
  40. {
  41. public:
  42. unsigned long Count; // represents how many times event with this eventcode has happened.
  43. _bstr_t Logfile;
  44. unsigned int EventCode;
  45. _bstr_t SourceName;
  46. _bstr_t Type;
  47. unsigned int Category;
  48. _bstr_t ComputerName;
  49. _bstr_t Message;
  50. };
  51. enum MEventLog_Error
  52. {
  53. MEventLog_SUCCESS = 0,
  54. COM_FAILURE = 1,
  55. UNCONSTRUCTED = 2,
  56. };
  57. // constructor
  58. //
  59. MEventLog( _bstr_t machineIP );
  60. // constructor for local machine
  61. //
  62. MEventLog();
  63. // copy constructor
  64. //
  65. MEventLog( const MEventLog& obj);
  66. // assignment operator
  67. //
  68. MEventLog&
  69. operator=(const MEventLog& rhs );
  70. // destructor
  71. //
  72. ~MEventLog();
  73. // gets all event messages on remote machine.
  74. MEventLog_Error
  75. getEvents( vector< Event >* eventContainer );
  76. // gets all event messages on remote machine.
  77. MEventLog_Error
  78. getEvents( map< unsigned int, UniqueEvent >& systemEvents,
  79. map< unsigned int, UniqueEvent >& applicationEvents );
  80. // gets all event messages on remote machine.
  81. MEventLog_Error
  82. getEvents( map< _bstr_t, map< unsigned int, UniqueEvent > >& Events );
  83. // refresh connection
  84. MEventLog_Error
  85. refreshConnection();
  86. private:
  87. _bstr_t _mIP;
  88. MWmiObject machine;
  89. };
  90. //------------------------------------------------------
  91. // Ensure Type Safety
  92. //------------------------------------------------------
  93. typedef class MIPAddressAdmin MIPAddressAdmin;
  94. //------------------------------------------------------
  95. //
  96. #endif _MEVENTLOG_HH