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.

201 lines
6.1 KiB

  1. #if !defined(AFX_HMOBJECT_H__D9BF4F9B_F673_11D2_BDC4_0000F87A3912__INCLUDED_)
  2. #define AFX_HMOBJECT_H__D9BF4F9B_F673_11D2_BDC4_0000F87A3912__INCLUDED_
  3. #if _MSC_VER > 1000
  4. #pragma once
  5. #endif // _MSC_VER > 1000
  6. // HMObject.h : header file
  7. //
  8. #include "HealthmonScopePane.h"
  9. #include "ScopePaneItem.h"
  10. #include "HMRuleStatus.h"
  11. #include "HMScopeItem.h"
  12. #include "HMEventResultsPaneItem.h"
  13. #include "SplitpaneResultsView.h"
  14. #include "WbemEventListener.h"
  15. #include "HMGraphView.h"
  16. #include "HMListView.h"
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CHMObject command target
  19. class CHMObject : public CCmdTarget
  20. {
  21. DECLARE_SERIAL(CHMObject)
  22. // Construction/Destruction
  23. public:
  24. CHMObject();
  25. virtual ~CHMObject();
  26. // Create/Destroy
  27. public:
  28. virtual void Destroy(bool bDeleteClassObject = false);
  29. // WMI Operations
  30. public:
  31. virtual HRESULT EnumerateChildren();
  32. virtual CString GetObjectPath();
  33. virtual CString GetStatusObjectPath();
  34. virtual CWbemClassObject* GetClassObject();
  35. virtual CWbemClassObject* GetParentClassObject();
  36. virtual CHMEvent* GetStatusClassObject();
  37. virtual void DeleteClassObject();
  38. void IncrementActiveSinkCount();
  39. void DecrementActiveSinkCount();
  40. virtual bool ImportMofFile(CArchive& ar);
  41. virtual bool ExportMofFile(CArchive& ar);
  42. protected:
  43. long m_lActiveSinkCount;
  44. // Clipboard Operations
  45. public:
  46. virtual bool Copy(CString& sParentGuid, COleSafeArray& Instances);
  47. virtual bool Paste(CHMObject* pObject, bool bCutOrMove);
  48. virtual bool QueryPaste(CHMObject* pObject);
  49. // Operations
  50. public:
  51. CString GetGuid();
  52. void SetGuid(const CString& sGuid);
  53. CString GetName();
  54. void SetName(const CString& sNewName);
  55. virtual bool Rename(const CString& sNewName);
  56. CString GetTypeName();
  57. virtual CString GetUITypeName();
  58. CString GetSystemName();
  59. void SetSystemName(const CString& sNewName);
  60. void ToggleStatusIcon(bool bOn = true);
  61. virtual bool Refresh();
  62. static int GetRefreshType() { return m_iRefreshType; }
  63. static int GetRefreshEventCount() { return m_iEventCount; }
  64. static void GetRefreshTimePeriod(int& iTimeValue, TimeUnit& Units) { iTimeValue = m_iTimeValue; Units = m_Units; }
  65. static void SetRefreshType(int iType) { m_iRefreshType = iType; }
  66. static void SetRefreshEventCount(int iEventCount) { m_iEventCount = iEventCount; }
  67. static void SetRefreshTimePeriod(int iTimeValue, TimeUnit Units) { m_iTimeValue = iTimeValue; m_Units = Units; }
  68. virtual bool ResetStatus();
  69. virtual bool ResetStatistics();
  70. virtual bool CheckNow();
  71. bool DeleteActionAssoc(const CString& sActionConfigGuid);
  72. int IsEnabled();
  73. void Enable();
  74. void Disable();
  75. CTime GetCreateDateTime();
  76. void GetCreateDateTime(CString& sDateTime);
  77. void SetCreateDateTime(const CTime& dtime);
  78. CTime GetModifiedDateTime();
  79. void GetModifiedDateTime(CString& sDateTime);
  80. void SetModifiedDateTime(const CTime& dtime);
  81. CString GetComment();
  82. void SetComment(const CString& sComment);
  83. void UpdateComment(const CString& sComment);
  84. void Serialize(CArchive& ar);
  85. protected:
  86. CString m_sGUID;
  87. CString m_sName;
  88. CString m_sTypeName;
  89. CString m_sSystemName;
  90. bool m_bStatusIconsOn;
  91. CTime m_CreateDateTime;
  92. CTime m_ModifiedDateTime;
  93. CString m_sComment;
  94. static int m_iRefreshType;
  95. static int m_iEventCount;
  96. static int m_iTimeValue;
  97. static TimeUnit m_Units;
  98. // Child Members
  99. public:
  100. int GetChildCount(CRuntimeClass* pClass = NULL);
  101. virtual int AddChild(CHMObject* pObject);
  102. virtual bool CreateChild(CHMObject* pObject, const CString& sWMIClassName, const CString& sWMIAssociatorClassName);
  103. CString GetUniqueChildName(UINT uiFmtID = IDS_STRING_UNTITLED);
  104. virtual CHMObject* GetChild(const CString& sName);
  105. CHMObject* GetChildByGuid(const CString& sGUID);
  106. CHMObject* GetDescendantByGuid(const CString& sGuid);
  107. CHMObject* GetChild(int iIndex);
  108. virtual void RemoveChild(CHMObject* pObject);
  109. void DestroyChild(int iIndex, bool bDeleteClassObject = false);
  110. virtual void DestroyChild(CHMObject* pObject, bool bDeleteClassObject = false);
  111. void DestroyAllChildren();
  112. protected:
  113. CTypedPtrArray<CObArray,CHMObject*> m_Children;
  114. long m_lNameSuffix;
  115. // Event Members
  116. public:
  117. virtual void AddContainer(const CString& sParentGuid, const CString& sGuid, CHMObject* pObject);
  118. void ClearEvents();
  119. // State Members
  120. public:
  121. virtual void UpdateStatus();
  122. int GetState() { return m_nState; }
  123. void SetState(int iState, bool bUpdateScopeItems = false, bool bApplyToChildren = false);
  124. virtual void TallyChildStates();
  125. long GetNormalCount() { return m_lNormalCount; }
  126. long GetWarningCount() { return m_lWarningCount; }
  127. long GetCriticalCount() { return m_lCriticalCount; }
  128. long GetUnknownCount() { return m_lUnknownCount; }
  129. protected:
  130. int m_nState;
  131. long m_lNormalCount;
  132. long m_lWarningCount;
  133. long m_lCriticalCount;
  134. long m_lUnknownCount;
  135. // Associated Scope Pane Member
  136. public:
  137. CScopePane* GetScopePane();
  138. void SetScopePane(CScopePane* pPane);
  139. protected:
  140. CScopePane* m_pPane;
  141. // Scope Item Members
  142. public:
  143. BOOL IsActionsItem();
  144. int GetScopeItemCount();
  145. CScopePaneItem* GetScopeItem(int iIndex);
  146. virtual int AddScopeItem(CScopePaneItem* pItem);
  147. virtual void RemoveScopeItem(int iIndex);
  148. void RemoveAllScopeItems();
  149. void DestroyAllScopeItems();
  150. virtual CScopePaneItem* CreateScopeItem() { ASSERT(FALSE); return NULL; }
  151. CScopePaneItem* IsSelected();
  152. protected:
  153. CTypedPtrArray<CObArray,CScopePaneItem*> m_ScopeItems;
  154. // Overrides
  155. // ClassWizard generated virtual function overrides
  156. //{{AFX_VIRTUAL(CHMObject)
  157. public:
  158. virtual void OnFinalRelease();
  159. //}}AFX_VIRTUAL
  160. // MFC Implementation
  161. protected:
  162. // Generated message map functions
  163. //{{AFX_MSG(CHMObject)
  164. // NOTE - the ClassWizard will add and remove member functions here.
  165. //}}AFX_MSG
  166. DECLARE_MESSAGE_MAP()
  167. // Generated OLE dispatch map functions
  168. //{{AFX_DISPATCH(CHMObject)
  169. // NOTE - the ClassWizard will add and remove member functions here.
  170. //}}AFX_DISPATCH
  171. DECLARE_DISPATCH_MAP()
  172. DECLARE_INTERFACE_MAP()
  173. };
  174. /////////////////////////////////////////////////////////////////////////////
  175. #include "HMObject.inl"
  176. //{{AFX_INSERT_LOCATION}}
  177. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  178. #endif // !defined(AFX_HMOBJECT_H__D9BF4F9B_F673_11D2_BDC4_0000F87A3912__INCLUDED_)