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.

158 lines
6.9 KiB

  1. //***************************************************************************
  2. //
  3. // SYSTEM.H
  4. //
  5. // Module: HEALTHMON SERVER AGENT
  6. //
  7. // Purpose: This CSystem class only has one instance. Its main member
  8. // function is called each time the polling interval goes off. It then goes
  9. // through all of the CComponents, CDataPoints, and CThresholds.
  10. //
  11. // Copyright (c)1999 Microsoft Corporation, All Rights Reserved
  12. //
  13. //***************************************************************************
  14. #if !defined( __SYSTEM_H )
  15. #define __SYSTEM_H
  16. #include <wbemcli.h>
  17. #include <vector>
  18. #include "datagrp.h"
  19. #include "action.h"
  20. //typedef std::vector<CDataGroup*, std::allocator<CDataGroup*> > DGLIST;
  21. typedef std::vector<CAction*, std::allocator<CAction*> > ALIST;
  22. typedef std::vector<CBase*, std::allocator<CBase*> > BLIST;
  23. class CSystem : public CBase
  24. {
  25. public:
  26. CSystem();
  27. ~CSystem();
  28. DGLIST m_dataGroupList; // A system can only have DataGroups under it
  29. ALIST m_actionList; // A system can only have DataGroups under it
  30. long m_lAgentInterval;
  31. long m_lStartupDelayTime;
  32. DWORD m_lFiveMinTimerTime;
  33. long m_lNumInstancesAccepted;
  34. BOOL m_bEnabled;
  35. long m_lPrevState;
  36. DWORD m_startTick;
  37. long m_lNumberNormals;
  38. long m_lNumberWarnings;
  39. long m_lNumberCriticals;
  40. long m_lNumberChanges;
  41. LPTSTR m_szMessage;
  42. LPTSTR m_szResetMessage;
  43. BLIST m_masterList; // Flat list of all instances derived from CBase
  44. long m_lPrevChildCount;
  45. TCHAR m_szDTTime[512];
  46. TCHAR m_szTime[512];
  47. CTempConsumer* m_pTempSink;
  48. CTempConsumer* m_pEFTempSink;
  49. CTempConsumer* m_pECTempSink;
  50. CTempConsumer* m_pFTCBTempSink;
  51. CTempConsumer* m_pEFModTempSink;
  52. CTempConsumer* m_pECModTempSink;
  53. CTempConsumer* m_pFTCBModTempSink;
  54. PROCESS_INFORMATION m_processInfo;
  55. BOOL m_bValidLoad;
  56. int m_numActionChanges;
  57. BOOL InitWbemPointer(void);
  58. HRESULT InternalizeHMNamespace(void);
  59. HRESULT InternalizeSystem(void);
  60. HRESULT LoadInstanceFromMOF(IWbemClassObject*);
  61. HRESULT InternalizeDataGroups(void);
  62. HRESULT DredgePerfmon(void);
  63. HRESULT InternalizeActions(void);
  64. HRESULT InitActionErrorListener(void);
  65. HRESULT InitActionSIDListener(CTempConsumer* pTempSink, LPTSTR pszQUERY);
  66. BOOL OnAgentInterval(void);
  67. long GetAgentInterval(void);
  68. long GetStartupDelayTime(void);
  69. HRESULT HandleTempActionErrorEvent(IWbemClassObject* pObj);
  70. HRESULT HandleTempActionSIDEvent(IWbemClassObject* pObj);
  71. BOOL HandleTempActionEvent(LPTSTR, IWbemClassObject*);
  72. BOOL HandleTempEvent(CEventQueryDataCollector*, IWbemClassObject*);
  73. HRESULT SendHMSystemStatusInstances(IWbemObjectSink* pSink);
  74. HRESULT SendHMSystemStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  75. HRESULT SendHMDataGroupStatusInstances(IWbemObjectSink* pSink);
  76. HRESULT SendHMDataGroupStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  77. HRESULT SendHMDataCollectorStatusInstances(IWbemObjectSink* pSink);
  78. HRESULT SendHMDataCollectorStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  79. HRESULT SendHMDataCollectorPerInstanceStatusInstances(IWbemObjectSink* pSink);
  80. HRESULT SendHMDataCollectorPerInstanceStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  81. HRESULT SendHMDataCollectorStatisticsInstances(IWbemObjectSink* pSink);
  82. HRESULT SendHMDataCollectorStatisticsInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  83. HRESULT SendHMThresholdStatusInstances(IWbemObjectSink* pSink);
  84. HRESULT SendHMThresholdStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  85. // HRESULT SendHMThresholdStatusInstanceInstances(IWbemObjectSink* pSink);
  86. // HRESULT SendHMThresholdStatusInstanceInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  87. HRESULT SendHMActionStatusInstances(IWbemObjectSink* pSink);
  88. HRESULT SendHMActionStatusInstance(IWbemObjectSink* pSink, LPTSTR pszGUID);
  89. HRESULT GetHMSystemStatusInstance(IWbemClassObject** ppInstance, BOOL bEventBased);
  90. BOOL FireEvents(void);
  91. BOOL FireEvent(void);
  92. HRESULT ModSystem(IWbemClassObject* pObj);
  93. HRESULT ModDataGroup(IWbemClassObject* pObj);
  94. HRESULT ModDataCollector(IWbemClassObject* pObj);
  95. HRESULT ModThreshold(IWbemClassObject* pObj);
  96. HRESULT ModAction(IWbemClassObject* pObj);
  97. BOOL CreateActionAssociation(IWbemClassObject* pObj);
  98. BOOL ModActionAssociation(IWbemClassObject* pObj);
  99. HRESULT CreateSystemDataGroupAssociation(IWbemClassObject* pObj);
  100. // BOOL DeleteSystemDataGroupAssociation(IWbemClassObject* pObj);
  101. HRESULT CreateDataGroupDataGroupAssociation(IWbemClassObject* pObj);
  102. // BOOL DeleteDataGroupDataGroupAssociation(IWbemClassObject* pObj);
  103. HRESULT CreateDataGroupDataCollectorAssociation(IWbemClassObject* pObj);
  104. // BOOL DeleteDataGroupDataCollectorAssociation(IWbemClassObject* pObj);
  105. HRESULT CreateDataCollectorThresholdAssociation(IWbemClassObject* pObj);
  106. // BOOL DeleteDataCollectorThresholdAssociation(IWbemClassObject* pObj);
  107. BOOL ResetResetThresholdStates(void);
  108. BOOL GetChange(void);
  109. HRESULT FindAndDeleteByGUID(LPTSTR pszGUID);
  110. // HRESULT FindAndEnableByGUID(LPTSTR pszGUID, BOOL bEnable);
  111. HRESULT FindAndResetDEStateByGUID(LPTSTR pszGUID);
  112. HRESULT FindAndResetDEStatisticsByGUID(LPTSTR pszGUID);
  113. HRESULT FindAndEvaluateNowDEByGUID(LPTSTR pszGUID);
  114. BOOL Enable(BOOL bEnable);
  115. HRESULT CreateAction(IWbemClassObject* pObj);
  116. HRESULT FindAndCopyByGUID(LPTSTR pszGUID, SAFEARRAY** ppsa, LPTSTR *pszOriginalParentGUID);
  117. HRESULT FindAndPasteByGUID(LPTSTR pszGUID, SAFEARRAY* ppsa, LPTSTR pszOriginalSystem, LPTSTR pszOriginalParentGUID, BOOL bForceReplace);
  118. HRESULT FindAndCopyWithActionsByGUID(LPTSTR pszGUID, SAFEARRAY** ppsa, LPTSTR *pszOriginalParentGUID);
  119. HRESULT FindAndPasteWithActionsByGUID(LPTSTR pszGUID, SAFEARRAY* ppsa, LPTSTR pszOriginalSystem, LPTSTR pszOriginalParentGUID, BOOL bForceReplace);
  120. CBase *GetParentPointerFromPath(LPTSTR pszParentPath);
  121. CBase *FindImediateChildByName(LPTSTR pszChildName);
  122. CBase *FindPointerFromName(LPTSTR pszChildName);
  123. BOOL GetNextChildName(LPTSTR pszChildName, LPTSTR pszOutName);
  124. HRESULT DeleteConfigActionAssoc(LPTSTR pszConfigGUID, LPTSTR pszActionGUID);
  125. HRESULT DeleteAllConfigActionAssoc(LPTSTR pszConfigGUID);
  126. // HRESULT Move(LPTSTR pszTargetGUID, LPTSTR pszNewParentGUID);
  127. // BOOL ModifyAssocForMove(CBase *pNewParentBase);
  128. BOOL ReceiveNewChildForMove(CBase *pBase);
  129. BOOL DeleteChildFromList(LPTSTR pszGUID);
  130. BOOL FormatMessage(IWbemClassObject* pInstance);
  131. BOOL SendReminderActionIfStateIsSame(IWbemObjectSink* pActionEventSink, IWbemObjectSink* pActionTriggerEventSink, IWbemClassObject* pActionInstance, IWbemClassObject* pActionTriggerInstance, unsigned long ulTriggerStates);
  132. HRESULT AddPointerToMasterList(CBase *pBase);
  133. BOOL RemovePointerFromMasterList(CBase *pBase);
  134. CBase *FindPointerFromGUIDInMasterList(LPTSTR pszGUID);
  135. // new cut & paste code
  136. HRESULT AgentCopy(LPTSTR pszGUID, SAFEARRAY** ppsa, LPTSTR *pszOriginalParentGUID);
  137. HRESULT AgentPaste(LPTSTR pszTargetGUID,
  138. SAFEARRAY* psa,
  139. LPTSTR pszOriginalSystem,
  140. LPTSTR pszOriginalParentGUID,
  141. BOOL bForceReplace);
  142. HRESULT RemapActions(void);
  143. HRESULT CheckAllForBadLoad(void);
  144. HRESULT CheckForBadLoad(void);
  145. };
  146. #endif // __SYSTEM_H