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.

122 lines
2.6 KiB

  1. /*++
  2. Copyright (C) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. smrootnd.cpp
  5. Abstract:
  6. This object is used to represent the Performance Logs and Alerts root node
  7. --*/
  8. #include "Stdafx.h"
  9. #include "smrootnd.h"
  10. //
  11. // Constructor
  12. CSmRootNode::CSmRootNode()
  13. : m_bIsExpanded ( FALSE ),
  14. m_hRootNode ( NULL ),
  15. m_hParentNode ( NULL ),
  16. m_bIsExtension ( FALSE )
  17. {
  18. CString strTemp;
  19. ResourceStateManager rsm;
  20. // String allocation errors are thrown, to be
  21. // captured by rootnode alloc exception handler
  22. strTemp.LoadString ( IDS_MMC_DEFAULT_NAME );
  23. SetDisplayName ( strTemp );
  24. strTemp.LoadString ( IDS_ROOT_NODE_DESCRIPTION );
  25. SetDescription ( strTemp );
  26. strTemp.LoadString ( IDS_EXTENSION_COL_TYPE );
  27. SetType ( strTemp );
  28. return;
  29. }
  30. //
  31. // Destructor
  32. CSmRootNode::~CSmRootNode()
  33. {
  34. ASSERT (m_CounterLogService.m_QueryList.GetHeadPosition() == NULL);
  35. ASSERT (m_TraceLogService.m_QueryList.GetHeadPosition() == NULL);
  36. ASSERT (m_AlertService.m_QueryList.GetHeadPosition() == NULL);
  37. return;
  38. }
  39. void
  40. CSmRootNode::Destroy()
  41. {
  42. m_CounterLogService.Close();
  43. m_TraceLogService.Close();
  44. m_AlertService.Close();
  45. return;
  46. }
  47. BOOL
  48. CSmRootNode::IsLogService (
  49. MMC_COOKIE mmcCookie )
  50. {
  51. BOOL bReturn = FALSE;
  52. if (mmcCookie == (MMC_COOKIE)&m_CounterLogService) {
  53. bReturn = TRUE;
  54. } else if (mmcCookie == (MMC_COOKIE)&m_TraceLogService) {
  55. bReturn = TRUE;
  56. } else if (mmcCookie == (MMC_COOKIE)&m_AlertService) {
  57. bReturn = TRUE;
  58. }
  59. return bReturn;
  60. }
  61. BOOL
  62. CSmRootNode::IsAlertService (
  63. MMC_COOKIE mmcCookie )
  64. {
  65. BOOL bReturn = FALSE;
  66. if (mmcCookie == (MMC_COOKIE)&m_AlertService) {
  67. bReturn = TRUE;
  68. }
  69. return bReturn;
  70. }
  71. BOOL
  72. CSmRootNode::IsLogQuery (
  73. MMC_COOKIE mmcCookie )
  74. {
  75. PSLQUERY pPlQuery = NULL;
  76. POSITION Pos;
  77. // Handle multiple query types
  78. Pos = m_CounterLogService.m_QueryList.GetHeadPosition();
  79. while ( Pos != NULL) {
  80. pPlQuery = m_CounterLogService.m_QueryList.GetNext( Pos );
  81. if ((MMC_COOKIE)pPlQuery == mmcCookie) return TRUE;
  82. }
  83. Pos = m_TraceLogService.m_QueryList.GetHeadPosition();
  84. while ( Pos != NULL) {
  85. pPlQuery = m_TraceLogService.m_QueryList.GetNext( Pos );
  86. if ((MMC_COOKIE)pPlQuery == mmcCookie) return TRUE;
  87. }
  88. Pos = m_AlertService.m_QueryList.GetHeadPosition();
  89. while ( Pos != NULL) {
  90. pPlQuery = m_AlertService.m_QueryList.GetNext( Pos );
  91. if ((MMC_COOKIE)pPlQuery == mmcCookie) return TRUE;
  92. }
  93. return FALSE;
  94. }