Leaked source code of windows server 2003
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.

172 lines
8.4 KiB

  1. #ifndef __GLOBALS_H__
  2. #define __GLOBALS_H__
  3. /*---------------------------------------------------------------------------
  4. File: ...
  5. Comments: ...
  6. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  7. Proprietary and confidential to Mission Critical Software, Inc.
  8. REVISION LOG ENTRY
  9. Revision By: Christy Boles
  10. Revised on 03/04/99 17:13:56
  11. ---------------------------------------------------------------------------
  12. */
  13. #include "ServList.hpp"
  14. #include "Monitor.h"
  15. #include "TSync.hpp"
  16. class GlobalData
  17. {
  18. long m_LinesRead; // number of lines of the dispatch log that have been processed
  19. WCHAR m_LogFile[MAX_PATH]; // full path of dispatch log
  20. WCHAR m_ReadableLogFile[MAX_PATH]; // full path of human-readable log file
  21. WCHAR m_ResultDir[MAX_PATH];// full path of results directory
  22. WCHAR m_ResultShare[MAX_PATH]; // sharename for results share
  23. WCHAR m_DatabasePath[MAX_PATH]; // full path of Access database to write resulting stats to
  24. WCHAR m_CacheFile[MAX_PATH]; // filename of FST cache file generated by dispatcher
  25. int m_IntervalSeconds; // number of seconds for monitoring threads to wait between passes
  26. BOOL m_Done; // monitoring threads should check this to see if they should stop
  27. BOOL m_bForcedToStopMonitoring; // monitoring is forced to stop while agents are still running
  28. BOOL m_ImportStats; // indicates whether the monitor should write stats to a database
  29. BOOL m_bFirstPassDone; // indicates whether we have made a first pass through the log file yet
  30. BOOL m_bTotalRead; // indicates whether we have read the total number of agents
  31. HWND m_ListWnd; // handle to the server list window
  32. HWND m_SummaryWnd; // handle to the summary window
  33. HWND m_DetailWnd; // handle to the single-server detail window
  34. ComputerStats m_ComputerStats; // stats on number of computers in progress
  35. DetailStats m_DetailStats; // stats on total objects processed (by completed agents)
  36. TServerList m_ServerList; // list containing the servers where the agent is being dispatched
  37. TCriticalSection m_cs;
  38. BOOL m_LogDone; // indicates whether the dispatcher has finished writing to the log file
  39. public:
  40. GlobalData()
  41. {
  42. Initialize();
  43. }
  44. void Initialize()
  45. {
  46. m_cs.Enter();
  47. m_LinesRead = 0;
  48. m_LogFile[0] = 0;
  49. m_ReadableLogFile[0] = 0;
  50. m_ResultDir[0] = 0;
  51. m_ResultShare[0] = 0;
  52. m_DatabasePath[0] = 0;
  53. m_CacheFile[0] = 0;
  54. m_IntervalSeconds = 5;
  55. m_Done = FALSE;
  56. m_bForcedToStopMonitoring = FALSE;
  57. m_ImportStats = FALSE;
  58. m_bFirstPassDone = FALSE;
  59. m_bTotalRead = FALSE;
  60. m_ListWnd = NULL;
  61. m_SummaryWnd = NULL;
  62. m_DetailWnd = NULL;
  63. memset(&m_ComputerStats,0,sizeof m_ComputerStats);
  64. memset(&m_DetailStats,0,sizeof m_DetailStats);
  65. m_ServerList.Clear();
  66. m_LogDone = FALSE;
  67. m_cs.Leave();
  68. }
  69. void GetLinesRead(long * lines) { m_cs.Enter(); (*lines) = m_LinesRead; m_cs.Leave(); }
  70. void SetLinesRead(long lines) { m_cs.Enter(); m_LinesRead = lines; m_cs.Leave(); }
  71. void GetLogPath(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_LogFile); m_cs.Leave(); }
  72. void SetLogPath(WCHAR const * path) { m_cs.Enter(); safecopy(m_LogFile,path); m_cs.Leave(); }
  73. void GetReadableLogFile(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_ReadableLogFile); m_cs.Leave(); }
  74. void SetReadableLogFile(WCHAR const * path) { m_cs.Enter(); safecopy(m_ReadableLogFile,path); m_cs.Leave(); }
  75. void GetResultDir(WCHAR * dir) { m_cs.Enter(); UStrCpy(dir,m_ResultDir); m_cs.Leave() ; }
  76. void SetResultDir(WCHAR const * dir) { m_cs.Enter(); safecopy(m_ResultDir,dir); m_cs.Leave(); }
  77. void GetResultShare(WCHAR * share) { m_cs.Enter(); UStrCpy(share,m_ResultShare); m_cs.Leave() ; }
  78. void SetResultShare(WCHAR const * share) { m_cs.Enter(); safecopy(m_ResultShare,share); m_cs.Leave(); }
  79. void GetWaitInterval(long * interval) { m_cs.Enter(); (*interval) = m_IntervalSeconds; m_cs.Leave(); }
  80. void SetWaitInterval(long interval) { m_cs.Enter(); m_IntervalSeconds = interval; m_cs.Leave(); }
  81. void GetDone(BOOL * bDone) { m_cs.Enter(); (*bDone) = m_Done; m_cs.Leave(); }
  82. void SetDone(BOOL bDone) { m_cs.Enter(); m_Done = bDone; m_cs.Leave(); }
  83. void GetForcedToStopMonitoring(BOOL* bForcedToStop) { m_cs.Enter(); (*bForcedToStop) = m_bForcedToStopMonitoring; m_cs.Leave(); }
  84. void SetForcedToStopMonitoring(BOOL bForcedToStop) { m_cs.Enter(); m_bForcedToStopMonitoring = bForcedToStop; m_cs.Leave(); }
  85. void GetLogDone(BOOL * bDone) { m_cs.Enter(); (*bDone) = m_LogDone; m_cs.Leave(); }
  86. void SetLogDone(BOOL bDone) { m_cs.Enter(); m_LogDone = bDone; m_cs.Leave(); }
  87. void GetListWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_ListWnd; m_cs.Leave(); }
  88. void SetListWindow(HWND hWnd) { m_cs.Enter(); m_ListWnd = hWnd; m_cs.Leave(); }
  89. void GetSummaryWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_SummaryWnd; m_cs.Leave(); }
  90. void SetSummaryWindow(HWND hWnd) { m_cs.Enter(); m_SummaryWnd = hWnd; m_cs.Leave(); }
  91. void GetDetailWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_DetailWnd; m_cs.Leave(); }
  92. void SetDetailWindow(HWND hWnd) { m_cs.Enter(); m_DetailWnd = hWnd; m_cs.Leave(); }
  93. void GetComputerStats(ComputerStats * pStats) { m_cs.Enter(); memcpy(pStats,&m_ComputerStats, sizeof m_ComputerStats); m_cs.Leave(); }
  94. void SetComputerStats(ComputerStats const * pStats) { m_cs.Enter(); memcpy(&m_ComputerStats,pStats,sizeof m_ComputerStats); m_cs.Leave(); }
  95. void GetDetailStats(DetailStats * pStats) { m_cs.Enter(); memcpy(pStats,&m_DetailStats,sizeof m_DetailStats); m_cs.Leave(); }
  96. void GetImportStats(BOOL * pVal) { m_cs.Enter(); (*pVal) = m_ImportStats; m_cs.Leave(); }
  97. void SetImportStats(BOOL v) { m_cs.Enter(); m_ImportStats = v; m_cs.Leave(); }
  98. void GetDatabaseName(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_DatabasePath); m_cs.Leave(); }
  99. void SetDatabaseName(WCHAR const * path) { m_cs.Enter(); safecopy(m_DatabasePath,path); m_cs.Leave(); }
  100. void GetFirstPassDone(BOOL * pVal) { m_cs.Enter(); (*pVal) = m_bFirstPassDone; m_cs.Leave(); }
  101. void SetFirstPassDone(BOOL val) { m_cs.Enter(); m_bFirstPassDone = val; m_cs.Leave(); }
  102. void GetTotalRead(BOOL * pVal) { m_cs.Enter(); (*pVal) = m_bTotalRead; m_cs.Leave(); }
  103. void SetTotalRead(BOOL val) { m_cs.Enter(); m_bTotalRead = val; m_cs.Leave(); }
  104. void GetCacheFile(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_CacheFile); m_cs.Leave(); }
  105. void SetCacheFile(WCHAR const * path) { m_cs.Enter(); UStrCpy(m_CacheFile,path); m_cs.Leave(); }
  106. TServerList * GetUnsafeServerList(){ return &m_ServerList;}
  107. void Lock() { m_cs.Enter(); }
  108. void Unlock() { m_cs.Leave(); }
  109. void AddDetailStats(DetailStats * stats)
  110. {
  111. m_cs.Enter();
  112. m_DetailStats.directoriesChanged += stats->directoriesChanged;
  113. m_DetailStats.directoriesExamined += stats->directoriesExamined;
  114. m_DetailStats.directoriesUnchanged += stats->directoriesUnchanged;
  115. m_DetailStats.filesChanged += stats->filesChanged;
  116. m_DetailStats.filesExamined += stats->filesExamined;
  117. m_DetailStats.filesUnchanged += stats->filesUnchanged;
  118. m_DetailStats.sharesChanged += stats->sharesChanged;
  119. m_DetailStats.sharesExamined += stats->sharesExamined;
  120. m_DetailStats.sharesUnchanged += stats->sharesUnchanged;
  121. m_DetailStats.membersChanged += stats->membersChanged;
  122. m_DetailStats.membersExamined += stats->membersExamined;
  123. m_DetailStats.membersUnchanged += stats->membersUnchanged;
  124. m_DetailStats.rightsChanged += stats->rightsChanged;
  125. m_DetailStats.rightsExamined += stats->rightsExamined;
  126. m_DetailStats.rightsUnchanged += stats->rightsUnchanged;
  127. m_cs.Leave();
  128. }
  129. };
  130. extern GlobalData gData;
  131. void helpWrapper(HWND hwndDlg, int t);
  132. #endif //__GLOBALS_H__