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.

157 lines
4.4 KiB

  1. // HMRuleStatus.h: interface for the CHMRuleStatus class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_HMRULESTATUS_H__2C8B4D55_02FB_11D3_BDD8_0000F87A3912__INCLUDED_)
  5. #define AFX_HMRULESTATUS_H__2C8B4D55_02FB_11D3_BDD8_0000F87A3912__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "WbemClassObject.h"
  10. class CHMEvent : public CWbemClassObject
  11. {
  12. DECLARE_DYNCREATE(CHMEvent)
  13. // Construction/Destruction
  14. public:
  15. CHMEvent()
  16. {
  17. SYSTEMTIME st;
  18. m_pParent = NULL;
  19. m_ArrivalTime = CTime::GetCurrentTime();
  20. m_ArrivalTime.GetAsSystemTime(st);
  21. int iLen = GetTimeFormat(LOCALE_USER_DEFAULT,0L,&st,NULL,NULL,0);
  22. iLen = GetTimeFormat(LOCALE_USER_DEFAULT,0L,&st,NULL,m_sTime.GetBuffer(iLen+(sizeof(TCHAR)*1)),iLen);
  23. m_sTime.ReleaseBuffer();
  24. m_iNumberNormals = 0; // Number of Rules currently in normal state
  25. m_iNumberWarnings = 0; // Number of Rules currently in warning state
  26. m_iNumberCriticals = 0;// Number of Rules currently in critical state
  27. }
  28. ~CHMEvent() { m_pParent = NULL; }
  29. // Parent Members
  30. protected:
  31. CHMEvent* m_pParent;
  32. public:
  33. CHMEvent* GetParent() { return m_pParent; }
  34. void SetParent(CHMEvent* pParent) { m_pParent = pParent; }
  35. // Rolled Up RuleStatus
  36. public:
  37. virtual void RemoveStatusEvent(CHMEvent* pEvent) { ASSERT(pEvent); }
  38. CTypedPtrArray<CObArray,CHMEvent*> m_RolledUpRuleStatus;
  39. // Console Timestamp
  40. public:
  41. CTime m_ArrivalTime; // arrival time at console
  42. CString m_sTime;
  43. // Common Members
  44. public:
  45. int m_iNumberNormals; // Number of Rules currently in normal state
  46. int m_iNumberWarnings; // Number of Rules currently in warning state
  47. int m_iNumberCriticals;// Number of Rules currently in critical state
  48. CString m_sSystemName;
  49. };
  50. class CHMRuleStatusInstance : public CHMEvent
  51. {
  52. DECLARE_DYNCREATE(CHMRuleStatusInstance)
  53. // Construction/Destruction
  54. public:
  55. CHMRuleStatusInstance();
  56. CHMRuleStatusInstance(const CHMRuleStatusInstance& rsi);
  57. virtual ~CHMRuleStatusInstance();
  58. // Create
  59. public:
  60. HRESULT Create(const CString& sMachineName);
  61. HRESULT Create(IWbemClassObject* pObject);
  62. // Property Retreival Operations
  63. public:
  64. virtual HRESULT GetAllProperties();
  65. // Properties of the Microsoft_HMRuleStatusInstance
  66. public:
  67. CString m_sGuid;
  68. CString m_sMessage; // Comes directly from what was in the Microsoft_HMRule property
  69. CString m_sInstanceName; // Instance name is applicable (e.g. C: drive)
  70. int m_iState; // The state we are in.
  71. CString m_sCurrentValue; // Current value that caused the Rule crossing
  72. CString m_sStatusGuid;
  73. CString m_sDTime; // yyyymmddhhmmss.ssssssXUtc; X = GMT(+ or -), Utc = 3 dig. GMT minute
  74. int m_ID; // User viewable ID that shows up in the event so user can filter.
  75. // special property to track name of parent DataElement
  76. CString m_sDataElementName;
  77. CString m_sState;
  78. CString m_sDateTime;
  79. SYSTEMTIME m_st;
  80. };
  81. typedef CTypedPtrArray<CObArray,CHMRuleStatusInstance*> RuleStatusInstanceArray;
  82. class CHMRuleStatus : public CHMEvent
  83. {
  84. DECLARE_DYNCREATE(CHMRuleStatus)
  85. // Construction/Destruction
  86. public:
  87. CHMRuleStatus();
  88. CHMRuleStatus(const CHMRuleStatus& HMRuleStatus);
  89. virtual ~CHMRuleStatus();
  90. // Create
  91. public:
  92. HRESULT Create(const CString& sMachineName);
  93. HRESULT Create(IWbemClassObject* pObject);
  94. // Enumeration Operations
  95. public:
  96. HRESULT EnumerateObjects(ULONG& uReturned); // rentrant...continue to call until uReturned == 0
  97. // Property Retreival Operations
  98. public:
  99. virtual HRESULT GetAllProperties();
  100. // Microsoft_HMRuleStatus properties
  101. public:
  102. CString m_sRuleName; // Name of the system
  103. CString m_sGuid;
  104. int m_iState; // The state we are in - rollup from all Microsoft_HMDataGroups.
  105. int m_ID; // User viewable ID that shows up in the event so user can filter.
  106. CString m_sDTime; // yyyymmddhhmmss.ssssssXUtc; X = GMT(+ or -), Utc = 3 dig. GMT minute
  107. int m_iRuleCondition; // Condition that was used if the Rule crossing
  108. int m_iRuleDuration; // How long the value must have remained
  109. CString m_sCompareValue;
  110. COleSafeArray m_instances;
  111. RuleStatusInstanceArray m_Instances;
  112. // special property to track name of parent DataElement
  113. CString m_sDataElementName;
  114. CString m_sState;
  115. CString m_sDateTime;
  116. SYSTEMTIME m_st;
  117. // Status Rollup Operations
  118. public:
  119. void RemoveStatusEvent(CHMEvent* pEvent);
  120. };
  121. typedef CTypedPtrArray<CObArray,CHMRuleStatus*> RuleStatusArray;
  122. #endif // !defined(AFX_HMRULESTATUS_H__2C8B4D55_02FB_11D3_BDD8_0000F87A3912__INCLUDED_)