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.

161 lines
7.5 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_ImportStats; // indicates whether the monitor should write stats to a database
  28. BOOL m_bFirstPassDone; // indicates whether we have made a first pass through the log file yet
  29. HWND m_ListWnd; // handle to the server list window
  30. HWND m_SummaryWnd; // handle to the summary window
  31. HWND m_DetailWnd; // handle to the single-server detail window
  32. ComputerStats m_ComputerStats; // stats on number of computers in progress
  33. DetailStats m_DetailStats; // stats on total objects processed (by completed agents)
  34. TServerList m_ServerList; // list containing the servers where the agent is being dispatched
  35. TCriticalSection m_cs;
  36. BOOL m_LogDone; // indicates whether the dispatcher has finished writing to the log file
  37. public:
  38. GlobalData()
  39. {
  40. Initialize();
  41. }
  42. void Initialize()
  43. {
  44. m_cs.Enter();
  45. m_LinesRead = 0;
  46. m_LogFile[0] = 0;
  47. m_ReadableLogFile[0] = 0;
  48. m_ResultDir[0] = 0;
  49. m_ResultShare[0] = 0;
  50. m_DatabasePath[0] = 0;
  51. m_CacheFile[0] = 0;
  52. m_IntervalSeconds = 5;
  53. m_Done = FALSE;
  54. m_ImportStats = FALSE;
  55. m_bFirstPassDone = FALSE;
  56. m_ListWnd = NULL;
  57. m_SummaryWnd = NULL;
  58. m_DetailWnd = NULL;
  59. memset(&m_ComputerStats,0,sizeof m_ComputerStats);
  60. memset(&m_DetailStats,0,sizeof m_DetailStats);
  61. m_ServerList.Clear();
  62. m_LogDone = FALSE;
  63. m_cs.Leave();
  64. }
  65. void GetLinesRead(long * lines) { m_cs.Enter(); (*lines) = m_LinesRead; m_cs.Leave(); }
  66. void SetLinesRead(long lines) { m_cs.Enter(); m_LinesRead = lines; m_cs.Leave(); }
  67. void GetLogPath(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_LogFile); m_cs.Leave(); }
  68. void SetLogPath(WCHAR const * path) { m_cs.Enter(); safecopy(m_LogFile,path); m_cs.Leave(); }
  69. void GetReadableLogFile(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_ReadableLogFile); m_cs.Leave(); }
  70. void SetReadableLogFile(WCHAR const * path) { m_cs.Enter(); safecopy(m_ReadableLogFile,path); m_cs.Leave(); }
  71. void GetResultDir(WCHAR * dir) { m_cs.Enter(); UStrCpy(dir,m_ResultDir); m_cs.Leave() ; }
  72. void SetResultDir(WCHAR const * dir) { m_cs.Enter(); safecopy(m_ResultDir,dir); m_cs.Leave(); }
  73. void GetResultShare(WCHAR * share) { m_cs.Enter(); UStrCpy(share,m_ResultShare); m_cs.Leave() ; }
  74. void SetResultShare(WCHAR const * share) { m_cs.Enter(); safecopy(m_ResultShare,share); m_cs.Leave(); }
  75. void GetWaitInterval(long * interval) { m_cs.Enter(); (*interval) = m_IntervalSeconds; m_cs.Leave(); }
  76. void SetWaitInterval(long interval) { m_cs.Enter(); m_IntervalSeconds = interval; m_cs.Leave(); }
  77. void GetDone(BOOL * bDone) { m_cs.Enter(); (*bDone) = m_Done; m_cs.Leave(); }
  78. void SetDone(BOOL bDone) { m_cs.Enter(); m_Done = bDone; m_cs.Leave(); }
  79. void GetLogDone(BOOL * bDone) { m_cs.Enter(); (*bDone) = m_LogDone; m_cs.Leave(); }
  80. void SetLogDone(BOOL bDone) { m_cs.Enter(); m_LogDone = bDone; m_cs.Leave(); }
  81. void GetListWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_ListWnd; m_cs.Leave(); }
  82. void SetListWindow(HWND hWnd) { m_cs.Enter(); m_ListWnd = hWnd; m_cs.Leave(); }
  83. void GetSummaryWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_SummaryWnd; m_cs.Leave(); }
  84. void SetSummaryWindow(HWND hWnd) { m_cs.Enter(); m_SummaryWnd = hWnd; m_cs.Leave(); }
  85. void GetDetailWindow(HWND * hWnd) { m_cs.Enter(); (*hWnd) = m_DetailWnd; m_cs.Leave(); }
  86. void SetDetailWindow(HWND hWnd) { m_cs.Enter(); m_DetailWnd = hWnd; m_cs.Leave(); }
  87. void GetComputerStats(ComputerStats * pStats) { m_cs.Enter(); memcpy(pStats,&m_ComputerStats, sizeof m_ComputerStats); m_cs.Leave(); }
  88. void SetComputerStats(ComputerStats const * pStats) { m_cs.Enter(); memcpy(&m_ComputerStats,pStats,sizeof m_ComputerStats); m_cs.Leave(); }
  89. void GetDetailStats(DetailStats * pStats) { m_cs.Enter(); memcpy(pStats,&m_DetailStats,sizeof m_DetailStats); m_cs.Leave(); }
  90. void GetImportStats(BOOL * pVal) { m_cs.Enter(); (*pVal) = m_ImportStats; m_cs.Leave(); }
  91. void SetImportStats(BOOL v) { m_cs.Enter(); m_ImportStats = v; m_cs.Leave(); }
  92. void GetDatabaseName(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_DatabasePath); m_cs.Leave(); }
  93. void SetDatabaseName(WCHAR const * path) { m_cs.Enter(); safecopy(m_DatabasePath,path); m_cs.Leave(); }
  94. void GetFirstPassDone(BOOL * pVal) { m_cs.Enter(); (*pVal) = m_bFirstPassDone; m_cs.Leave(); }
  95. void SetFirstPassDone(BOOL val) { m_cs.Enter(); m_bFirstPassDone = val; m_cs.Leave(); }
  96. void GetCacheFile(WCHAR * path) { m_cs.Enter(); UStrCpy(path,m_CacheFile); m_cs.Leave(); }
  97. void SetCacheFile(WCHAR const * path) { m_cs.Enter(); UStrCpy(m_CacheFile,path); m_cs.Leave(); }
  98. TServerList * GetUnsafeServerList(){ return &m_ServerList;}
  99. void Lock() { m_cs.Enter(); }
  100. void Unlock() { m_cs.Leave(); }
  101. void AddDetailStats(DetailStats * stats)
  102. {
  103. m_cs.Enter();
  104. m_DetailStats.directoriesChanged += stats->directoriesChanged;
  105. m_DetailStats.directoriesExamined += stats->directoriesExamined;
  106. m_DetailStats.directoriesUnchanged += stats->directoriesUnchanged;
  107. m_DetailStats.filesChanged += stats->filesChanged;
  108. m_DetailStats.filesExamined += stats->filesExamined;
  109. m_DetailStats.filesUnchanged += stats->filesUnchanged;
  110. m_DetailStats.sharesChanged += stats->sharesChanged;
  111. m_DetailStats.sharesExamined += stats->sharesExamined;
  112. m_DetailStats.sharesUnchanged += stats->sharesUnchanged;
  113. m_DetailStats.membersChanged += stats->membersChanged;
  114. m_DetailStats.membersExamined += stats->membersExamined;
  115. m_DetailStats.membersUnchanged += stats->membersUnchanged;
  116. m_DetailStats.rightsChanged += stats->rightsChanged;
  117. m_DetailStats.rightsExamined += stats->rightsExamined;
  118. m_DetailStats.rightsUnchanged += stats->rightsUnchanged;
  119. m_cs.Leave();
  120. }
  121. };
  122. extern GlobalData gData;
  123. void helpWrapper(HWND hwndDlg, int t);
  124. #endif //__GLOBALS_H__