ResourceWatcherFSM.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. #pragma once
  2. #include "stdafx.h"
  3. #include "SpFSM.h"
  4. #include "CommEntityUtil.hpp"
  5. #define JUS_A_TEST 0
  6. #include "FileInfo.h"
  7. #include <iostream>
  8. #include <iomanip>
  9. #include <fstream>
  10. #include <stdarg.h>
  11. #include <string>
  12. #include <vector>
  13. #include <assert.h>
  14. #include <time.h>
  15. #include <map>
  16. #include <vector>
  17. #include <unordered_map>
  18. #if defined(RVC_OS_LINUX)
  19. #include <sys/sysinfo.h>
  20. #include <time.h>
  21. #include <sys/types.h>
  22. #include <dirent.h>
  23. #include <sys/stat.h>
  24. #include "CommEntityUtil.hpp"
  25. #else
  26. #include <ws2tcpip.h>
  27. #include <tchar.h>
  28. #include <WinCrypt.h>
  29. #include <atlbase.h>
  30. #include <conio.h>
  31. #include "mbnapi.h"
  32. #include <comdef.h>
  33. #pragma comment(lib, "ws2_32.lib")
  34. #pragma comment(lib, "mbnapi_uuid.lib")
  35. #include "ResourceWatcher_UserCode.h"
  36. #include <time.h>
  37. #pragma comment(lib, "Gdi32.lib")
  38. #endif //RVC_OS_LINUX
  39. #include "FileSimpleComp.h"
  40. using namespace std;
  41. #define SYSVAR_FRAMEWORK_FIRST_BOOT "FirstLaunchSinceSysBoot" //框架开机后首次启动标识
  42. #define SYSVAR_FRAMEWORK_FIRST_BOOT_YES "Y"
  43. #define SYSVAR_FRAMEWORK_FIRST_BOOT_NO "N"
  44. //硬件信息搜集参数
  45. #define DEFAULT_HARDWARE_CHECK_TIME 60 * 1000 //CPU、内存扫描默认间隔,1分钟
  46. #define TIMER_HARDWARE_CHECK 2
  47. //硬盘扫描
  48. #define DEFAULT_DISK_CHECK_TIME 4 * 60 * 60 * 1000 //硬盘默认4小时扫描一次
  49. #define TIMER_DISK_CHECK 33
  50. //保留版本数目
  51. #define DEFAULT_VERSION_SAVED_COUNT 5
  52. #define MAX_VERSION_PATH 256
  53. //一天的秒数,用于计算文件时间
  54. const int SECONDS_OF_DAY = 60 * 60 * 24;
  55. const int VIDEO_DEFAULT_BACKDAYS = 30;
  56. enum EvtType
  57. {
  58. USER_EVT_RUN = EVT_USER + 1
  59. };
  60. #include "ResourceWatcher_server_g.h"
  61. #include "ResourceWatcher_msg_g.h"
  62. using namespace ResourceWatcher;
  63. #define MOD_VERSION "1.0.0.0"
  64. struct CInstallInfoEx : public CInstallInfo
  65. {
  66. CInstallInfoEx(const CInstallInfo& info)
  67. :CInstallInfo(info)
  68. {
  69. /* empty */
  70. }
  71. bool operator < (const CInstallInfoEx& rhs) const
  72. {
  73. CVersion l_version(this->InstallVersion);
  74. DWORD l_timeTick = (DWORD)this->tmSwithOverDate;
  75. CVersion r_version(rhs.InstallVersion);
  76. DWORD r_timeTick = (DWORD)rhs.tmSwithOverDate;
  77. if (l_version == r_version)
  78. return l_timeTick <= r_timeTick;
  79. return l_version > r_version;
  80. }
  81. };
  82. template<class T>
  83. class TimerOutHelper : public ITimerListener
  84. {
  85. public:
  86. typedef void (T::* FuncTimer)(void* pUserdata);
  87. TimerOutHelper(T* p, FuncTimer pTimerFunc, void* pData, bool bDeleteSelf = false)
  88. : m_pObject(p), m_pUserData(pData), m_pTimer(pTimerFunc), m_bDeleteSelf(bDeleteSelf)
  89. {
  90. }
  91. virtual void OnTimeout(DWORD dwTimerID)
  92. {
  93. (m_pObject->*m_pTimer)(m_pUserData);
  94. if (m_bDeleteSelf)
  95. delete this;
  96. }
  97. private:
  98. void* m_pUserData;
  99. T* m_pObject;
  100. FuncTimer m_pTimer;
  101. bool m_bDeleteSelf;
  102. };
  103. #ifdef RVC_OS_LINUX
  104. //chenjilin hardware change
  105. typedef struct CPUInfoStruct
  106. { // 记录 /proc/stat 中的CPU信息
  107. char name[20];
  108. unsigned int user;
  109. unsigned int nice;
  110. unsigned int system;
  111. unsigned int idle;
  112. unsigned int lowait;
  113. unsigned int irq;
  114. unsigned int softirq;
  115. }CPUInfo;
  116. typedef struct ProcCPUInfoStruct {
  117. unsigned int pid;
  118. char pname[1024];
  119. unsigned long utime; //user time
  120. unsigned long stime; //kernel time
  121. unsigned long cutime; //all user time
  122. unsigned long cstime; //all dead time
  123. }ProcCPUInfo;
  124. typedef struct MemInfoStruct // 记录 /proc/meminfo 中的内存信息
  125. {
  126. char infoName1[20];
  127. unsigned long memTotal;
  128. char infoName2[20];
  129. unsigned long memFree;
  130. char infoName3[20];
  131. unsigned long memAvail;
  132. }MemInfo;
  133. //change end
  134. #else
  135. struct EntityRunInfo
  136. {
  137. bool bGetLoadOpt;
  138. bool bRestarting;
  139. int eState;
  140. int eTest;
  141. int loadOpt;
  142. int memoryHighCount;
  143. int cpuRatio;
  144. FILETIME prevSysKernel, prevSysUser;
  145. FILETIME prevProcKernel, prevProcUser;
  146. };
  147. struct CPUInforStruct {
  148. bool bInitialed;
  149. int level;
  150. CSimpleStringA csBrand;
  151. };
  152. #endif // RVC_OS_LINUX
  153. struct SystemBasicInfo
  154. {
  155. CSimpleStringA strManufacturer;
  156. CSimpleStringA strProductName;
  157. CSimpleStringA strSerialNumber;
  158. SystemBasicInfo():strManufacturer(true), strProductName(true), strSerialNumber(true) {}
  159. };
  160. struct DeleteParam
  161. {
  162. DeleteParam():path(true),delDirFlag(false), saveBackDay(0), rtaCode(true), logCode(true) {}
  163. DeleteParam(LPCTSTR lpszPath):path(lpszPath), delDirFlag(false), saveBackDay(0), rtaCode(true), logCode(true) {}
  164. DeleteParam(const DeleteParam& rhs) :path(rhs.path), delDirFlag(rhs.delDirFlag), saveBackDay(rhs.saveBackDay), rtaCode(rhs.rtaCode), logCode(rhs.logCode) {}
  165. void SetRmDirFlag(bool val = true) {
  166. delDirFlag = val;
  167. if (delDirFlag) saveBackDay = 0;
  168. }
  169. //lpszPath:清理路径
  170. CSimpleStringA path;
  171. //控制是否将目录也一并删除,false 保留目录, true 删除目录
  172. bool delDirFlag;
  173. //保存多少天内的文件, 默认参数,默认值为0,即不保存。(delDir = true时,该参数强制为0)
  174. bool saveBackDay;
  175. CSimpleStringA rtaCode;
  176. CSimpleStringA logCode;
  177. };
  178. struct DeleteResult
  179. {
  180. DeleteResult() :sucCnt(0), failCnt(0) {}
  181. //删除成功个数
  182. DWORD sucCnt;
  183. //删除失败个数
  184. DWORD failCnt;
  185. };
  186. class ResourceWatcherFSM : public FSMImpl<ResourceWatcherFSM>
  187. {
  188. public:
  189. ResourceWatcherFSM(void);
  190. ~ResourceWatcherFSM(void);
  191. enum { s0, s1, s2, s3 };
  192. BEGIN_FSM_STATE(ResourceWatcherFSM)
  193. FSM_STATE_ENTRY(s0, "Idle", s0_on_entry, s0_on_exit, s0_on_event)
  194. FSM_STATE_ENTRY(s1, "Running", s1_on_entry, s1_on_exit, s1_on_event)
  195. END_FSM_STATE()
  196. BEGIN_FSM_RULE(ResourceWatcherFSM, s0)
  197. FSM_RULE_ENTRY(s0, s1, USER_EVT_RUN, 0)
  198. END_FSM_RULE()
  199. virtual ErrorCodeEnum OnInit();
  200. virtual ErrorCodeEnum OnExit();
  201. //进入首页时触发的功能在此
  202. void TriggerAtStatusChanged(bool bMStatus);
  203. void TriggerProccessUpload();
  204. void AfterInit();
  205. virtual void s0_on_entry();
  206. virtual void s0_on_exit();
  207. virtual unsigned int s0_on_event(FSMEvent* e);
  208. virtual void s1_on_entry();
  209. virtual void s1_on_exit();
  210. virtual unsigned int s1_on_event(FSMEvent* e);
  211. void SelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext);
  212. BOOL IsFirstRunAfterBoot() const
  213. {
  214. return m_bFirstRunAfterBoot;
  215. }
  216. #ifdef RVC_OS_LINUX
  217. bool GetMonitorInfo(CSimpleStringA& outInfo);
  218. bool GetSysActiveStatus(CSimpleStringA& outInfo);
  219. #else
  220. void SetForceDiskCheckFlag(bool flag)
  221. {
  222. m_bNeedForceDiskCheck = flag;
  223. }
  224. #endif // RVC_OS_LINUX
  225. void DetectSoftwareInstallStatus();
  226. private:
  227. int m_cpuTop; // CPU资源消耗最高的top进程个数
  228. CSystemStaticInfo m_RvcSysinfo;
  229. BOOL m_bFirstRunAfterBoot;
  230. int m_diskLastWarnHour;
  231. BOOL m_skipDesktopDetect;
  232. #ifdef RVC_OS_WIN
  233. vector<CSimpleStringA>m_nonSignedFiles;
  234. int m_iNonSignedTotal;
  235. bool m_bNeedForceDiskCheck;
  236. string sysProcName = "[System Process]|System|Registry|smss.exe|csrss.exe|services.exe|wininit.exe";
  237. #endif // RVC_OS_WIN
  238. unordered_map<int, long long> oldProcessTime; // <pid, 旧时刻进程的CPU占用时间>
  239. unordered_map<int, long long> newProcessTime; // <pid, 新时刻进程的CPU占用时间>
  240. unordered_map<int, CSimpleStringA> processName; // <pid, 进程名>
  241. unordered_map<int, double> processCpu; // <pid, CPU占用率>
  242. int m_iVerify;
  243. int m_iNonSignedDisplay;
  244. int m_cpuHighPercent, m_memHighPercent, m_diskHighPercent;
  245. BOOL checkActiveBefore;
  246. BOOL neverMainPage;
  247. BOOL forceFileOpt;
  248. std::vector<std::string> keyUserlist;
  249. std::vector<std::string> keyPublist;
  250. BOOL flag4DeleteKeyAutoStartFile;
  251. BOOL flag4DoAutoStartTaskIgnoreBoot;
  252. CSimpleStringA m_strLoginedUserName;
  253. map<string, string> SysProcInfo; //用于记录系统进程
  254. public:
  255. void CheckDiskFileSpace();
  256. ErrorCodeEnum BizLinkDetect(
  257. SpReqAnsContext<ResourceWatcherService_BizLinkDetect_Req,
  258. ResourceWatcherService_BizLinkDetect_Ans>::Pointer ctx);
  259. ErrorCodeEnum CheckNetType(
  260. SpReqAnsContext<ResourceWatcherService_CheckNetType_Req,
  261. ResourceWatcherService_CheckNetType_Ans>::Pointer ctx);
  262. ErrorCodeEnum GetBizLinks(
  263. SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,
  264. ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx);
  265. bool GetNeverMainPageFlag() { return neverMainPage; } //是否未进过首页
  266. void GetSystemProccess();
  267. void GetSystemCPUStatus();
  268. void GetSystemMemoryStatus();
  269. void GetSystemDiskStatus();
  270. void GetDiskStatusFrom(LPCTSTR path);
  271. void HardwareInfoTimer(void* pData);
  272. void DiskCheckTimer(void* pData);
  273. void LinkDetect(int detectType, const char* url, bool& status, unsigned int& delay, int warnFlag = 1);
  274. time_t GetPathTimeSeconds(const char* inPath);
  275. void AutoDeleteFiles();
  276. void CenterSettingDelete();
  277. BOOL DeleteVersionPackage();
  278. void DeleteVideoFiles();
  279. int ProcessFileDelete(const DeleteParam& delParam, DeleteResult& delResult);
  280. BOOL DetectIsFirstRunAtBoot();
  281. #ifdef RVC_OS_LINUX
  282. /** 返回操作系统当前的版本,比如1032,1010,1031*/
  283. UINT GetSystemDisplayVersion(CSimpleStringA& strVersion);
  284. void UploadSysVersionInfo(UINT& ver);
  285. void UploadSysActivationStatus();
  286. string MemoryProcessStatus();
  287. long GetCPURunTime(CPUInfo* cpu);
  288. long ReadProcCPURunTime(DWORD pid, ProcCPUInfo* pInfo);
  289. const char* GetItems(const char* buffer, unsigned int item);
  290. void ConfirmWindowEffectHasBeenOpen();
  291. void switchWindowsEffect(const char* cfgFilePath, bool enable);
  292. /** 1032操作系统版本出现剪贴板和操作中心,需要将剪贴板关掉避免手势唤起
  293. * 统信的人告知可以通过删除剪贴板程序实现……JUST DO IT!
  294. */
  295. void ConfirmDDEClipboardDisable();
  296. void RecoverDDEClipboardEnable();
  297. /** 自己摸索,统信说需要操作系统定制方能解决 [Gifur@202198]*/
  298. void ConfirmNotificationCenterDisable();
  299. #else
  300. int GetCpuUsageRatio(int pid);
  301. ULONGLONG GetDiskUsedByte();
  302. bool GetVTMExePath(CSimpleStringA& strValue, bool FailIfNotExist);
  303. bool CopyExeToRoot(const CSimpleStringA& csVersion, const CSimpleStringA& aimExePath);
  304. bool RegOperation4LnkFile();
  305. bool RegRdVtmVersion(CSimpleStringA& VTMpath, CSimpleStringA& vtmVersion, CSimpleStringA& verPath);
  306. bool RegWtVtmPath(const CSimpleStringA& vtmExtPath, const CSimpleStringA& rootPath);
  307. bool RegWtVtmVersion(const CSimpleStringA& vtmVer);
  308. //nType: 0 桌面,2 启动列表
  309. ErrorCodeEnum CreateLink(int nType, const CSimpleStringA& exePath);
  310. ErrorCodeEnum CreateLinkFile(const CSimpleStringA& szStartAppPath, const CSimpleStringA& szAddCmdLine,
  311. const CSimpleStringA& szDestLnkPath, const CSimpleStringA& szIconPath);
  312. bool GetVtmVersionFromActiveTxt(CSimpleStringA& csVersion);
  313. bool GetRegValueInt(HKEY hKey, LPCTSTR lpcszParam, DWORD& DwValue);
  314. bool GetRegValue(HKEY hKey, LPCTSTR lpcszParam, CSimpleStringA& strValue);
  315. void DetectAutoStartupCover();
  316. void UploadScreenInfo();
  317. //0:explorer.exe
  318. //1:vbs
  319. //2:vtm.exe
  320. //3:startmenu lnk from RVCTermimalApplicationSetup
  321. //4:startmenu lnk from install scripts
  322. //5:startmenu lnk from user customization
  323. //-1:failed
  324. int DetectAutoStartupType(CSimpleStringA& strValue);
  325. ErrorCodeEnum ChangeAutoStartupWithExe(bool resetVBS = false, bool resetExplorer = false);
  326. int InitialAutoStartupSetType();
  327. void DeleteDuplicateAutoStartFile(bool toDeleteLastLegity = false);
  328. //0:startmenu lnk from RVCTermimalApplicationSetup
  329. //1:startmenu lnk from install scripts
  330. //2:startmenu lnk from user customization
  331. BOOL IsHasSetAutoStartupByFolder(CSimpleStringA& strPath, int& setType);
  332. void DetectVersionHasChangedAndWarn();
  333. void DetectDestopFileAndWarn(bool bClear, CSimpleStringA& strFileSaveList);
  334. bool SetDesktopSysIcon2Registry(const std::string& key, bool toDisplay);
  335. void MakeSureWin8IntoDesktopPageAtLogon();
  336. void DetectAutoStartFileAndWarn();
  337. void DetectVersionHasChangedAndWarnCover()
  338. {
  339. if (!checkActiveBefore) {
  340. DetectVersionHasChangedAndWarn();
  341. checkActiveBefore = TRUE;
  342. }
  343. }
  344. void VerifySignature();
  345. void DetectAndClearDesktopFile();
  346. void VerifySignature(const CSimpleStringA& filePath);
  347. CSimpleStringA GetFileName(const CSimpleStringA& filePath);
  348. bool RetrieveDigitalSignatureInfo(const char* pFilePath);
  349. bool VerifyFirstCertificate(HCERTSTORE hStore, PCMSG_SIGNER_INFO pSignerInfo);
  350. bool VerifyOtherCertificate(PCMSG_SIGNER_INFO pSignerInfo);
  351. void DetectWallpaperAndWarn();
  352. void InitCustomAutoStartFileSheet();
  353. void InitUserInfo();
  354. void ToListCurrentUserStartupFile(const std::string& userDirPath, std::vector<std::string>& files, std::vector<std::string>& keyfiles);
  355. void GetCommDesktopDirectory(CSimpleStringA& outDir);
  356. void GetUserDesktopDirectory(CSimpleStringA& outDir);
  357. bool IsDesktopIconExist(CSimpleStringA& strPath);
  358. void GetCommStartupDirectory(CSimpleStringA& outDir);
  359. void GetUserStartupDirectory(CSimpleStringA& outDir);
  360. bool IsStartupIconExist(CSimpleStringA& strPath);
  361. void GetAutoStartFile(std::string& userDirPath, std::vector<std::string>& userDirFiles, std::string& pubDirPath, std::vector<std::string>& pubDirFiles);
  362. #endif // RVC_OS_LINUX
  363. void AlarmSystemBasicInfo();
  364. ErrorCodeEnum CatchSystemBasicInfo(SystemBasicInfo& info);
  365. /*
  366. -1:入参无效
  367. -2:GetPath失败
  368. >0:返回原字符串中$()后的字符位置,outDir返回解析后的内容
  369. */
  370. int ExpandDir(LPCTSTR macorStr, CSimpleStringA& outDir);
  371. };
  372. class RunEvent : public FSMEvent
  373. {
  374. public:
  375. RunEvent() : FSMEvent(USER_EVT_RUN) {}
  376. virtual ~RunEvent() {}
  377. };
  378. struct DetectSoftwareInstallStatusTask : public ITaskSp
  379. {
  380. ResourceWatcherFSM* m_pFSM;
  381. DetectSoftwareInstallStatusTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  382. void Process()
  383. {
  384. m_pFSM->DetectSoftwareInstallStatus();
  385. }
  386. };
  387. #ifdef RVC_OS_LINUX
  388. struct AggerateAutoStatTask : public ITaskSp
  389. {
  390. ResourceWatcherFSM* m_pFSM;
  391. AggerateAutoStatTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  392. void Process()
  393. {
  394. m_pFSM->UploadSysActivationStatus();
  395. }
  396. };
  397. #else
  398. struct CreateLinkTask :public ITaskSp
  399. {
  400. ResourceWatcherFSM* m_pFSM;
  401. CreateLinkTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  402. void Process()
  403. {
  404. m_pFSM->RegOperation4LnkFile();
  405. }
  406. };
  407. struct VerifyDigitSignTask : public ITaskSp
  408. {
  409. ResourceWatcherFSM* m_pFSM;
  410. VerifyDigitSignTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  411. void Process()
  412. {
  413. m_pFSM->VerifySignature();
  414. }
  415. };
  416. struct AggerateAutoStatTask : public ITaskSp
  417. {
  418. ResourceWatcherFSM* m_pFSM;
  419. AggerateAutoStatTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  420. void Process()
  421. {
  422. m_pFSM->UploadScreenInfo();
  423. m_pFSM->DetectWallpaperAndWarn();
  424. m_pFSM->DetectAutoStartupCover();
  425. m_pFSM->RegOperation4LnkFile();
  426. m_pFSM->DetectAndClearDesktopFile();
  427. m_pFSM->MakeSureWin8IntoDesktopPageAtLogon();
  428. m_pFSM->DetectAutoStartFileAndWarn();
  429. }
  430. };
  431. #endif // RVC_OS_LINUX
  432. //终端版本默认的自动清理策略
  433. struct DiskAndFilesTask : public ITaskSp
  434. {
  435. ResourceWatcherFSM* m_pFSM;
  436. int checkTime;
  437. bool flag = false;
  438. DiskAndFilesTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  439. void Process()
  440. {
  441. m_pFSM->AutoDeleteFiles();
  442. m_pFSM->CenterSettingDelete();
  443. if (flag)
  444. {
  445. m_pFSM->GetSystemDiskStatus(); //仅启动时检测一次硬盘状态即可
  446. void* pTmpData = NULL;
  447. ITimerListener* pListener = new TimerOutHelper<ResourceWatcherFSM>(m_pFSM, &ResourceWatcherFSM::DiskCheckTimer, pTmpData);
  448. m_pFSM->GetEntityBase()->GetFunction()->SetTimer(TIMER_DISK_CHECK, pListener, checkTime);
  449. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Set DISK CHECK Timer!");
  450. }
  451. }
  452. };
  453. struct CheckDiskFileSpaceTask : public ITaskSp
  454. {
  455. ResourceWatcherFSM* m_pFSM;
  456. CheckDiskFileSpaceTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  457. void Process()
  458. {
  459. m_pFSM->CheckDiskFileSpace();
  460. }
  461. };
  462. //获取系统进程并上送, TerminalStage的值为 A, C, M, S触发
  463. struct UploadSysProcInfoTask : public ITaskSp
  464. {
  465. ResourceWatcherFSM* m_pFSM;
  466. UploadSysProcInfoTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
  467. void Process()
  468. {
  469. CSimpleStringA t_terminalState;
  470. DWORD elapsed = 0;
  471. DWORD dwStart = SP::Module::Comm::RVCGetTickCount();
  472. DWORD dwEnd = SP::Module::Comm::RVCGetTickCount();
  473. DWORD checkTimeOut = 5 * 60000; //五分钟超时
  474. while (elapsed < checkTimeOut && m_pFSM->GetNeverMainPageFlag()) //到达终态,5分钟未进首页 or 成功进入首页跳出循环
  475. {
  476. Sleep(60000); //1分钟检测一次进首页状态
  477. dwEnd = SP::Module::Comm::RVCGetTickCount();
  478. elapsed = dwEnd - dwStart;
  479. }
  480. m_pFSM->GetSystemCPUStatus();
  481. m_pFSM->GetSystemProccess();
  482. }
  483. };