Jelajahi Sumber

!10824 最新测试版本合并
Merge pull request !10824 from 80374374/ST2

Gifur 2 bulan lalu
induk
melakukan
591c7b1ab5
30 mengubah file dengan 694 tambahan dan 1922 penghapusan
  1. 3 23
      CMakeLists.txt
  2. 30 0
      DevAdapter/zcopy/CMakeLists.txt
  3. 1 1
      Framework/spbase/sp_cfg.cpp
  4. 1 1
      Module/include/CommEntityUtil.hpp
  5. 0 76
      Module/mod_ResourceWatcher/ResourceWatcher.xml
  6. 134 352
      Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp
  7. 37 6
      Module/mod_ResourceWatcher/ResourceWatcherFSM.h
  8. 0 7
      Module/mod_ResourceWatcher/ResourceWatcher_UserCode.h
  9. 0 196
      Module/mod_ResourceWatcher/ResourceWatcher_client_g.h
  10. 0 129
      Module/mod_ResourceWatcher/ResourceWatcher_def_g.h
  11. 0 108
      Module/mod_ResourceWatcher/ResourceWatcher_server_g.h
  12. 0 703
      Module/mod_ResourceWatcher/mod_ResourceWatcher.cpp
  13. 35 133
      Module/mod_ResourceWatcher/mod_ResourceWatcher.h
  14. 6 6
      Module/mod_accessauth/AccessAuthFSM.cpp
  15. 1 1
      Module/mod_accessauth/mod_AccessAuth.cpp
  16. 8 33
      Module/mod_healthmanager/HealthManagerFSM.cpp
  17. 0 1
      Module/mod_healthmanager/HealthManagerFSM.h
  18. 4 4
      Module/mod_healthmanager/mod_healthmanager.cpp
  19. 53 53
      Module/mod_pinpad/PinPadFSM.cpp
  20. 2 2
      Module/mod_pinpad/PinPadFSM.h
  21. 1 1
      Module/mod_pinpad/PinPad_UserErrorCode.h
  22. 196 60
      Module/mod_vtmloader/VtmLoaderFSM.cpp
  23. 28 2
      Module/mod_vtmloader/VtmLoaderFSM.h
  24. 9 1
      Module/mod_vtmloader/VtmLoader_UserCode.h
  25. 50 0
      Module/mod_vtmloader/VtmLoader_client_g.h
  26. 33 0
      Module/mod_vtmloader/VtmLoader_def_g.h
  27. 27 0
      Module/mod_vtmloader/VtmLoader_server_g.h
  28. 4 13
      Module/mod_vtmloader/mod_vtmloader.cpp
  29. 8 10
      Module/mod_vtmloader/mod_vtmloader.h
  30. 23 0
      Module/mod_vtmloader/vtmloader.xml

+ 3 - 23
CMakeLists.txt

@@ -500,6 +500,8 @@ set(RVC_VENDOR_PATH  "${PACK_INSTALL_PREFIX_CUR_VER}/dep")
 set(RVC_SHARED_PATH   "${PACK_INSTALL_PREFIX_CUR_VER}/share")
 set(RVC_RESOURCE_PATH   "${PACK_INSTALL_PREFIX_CUR_VER}/res")
 set(RVC_EXTEND_PATH   "${PACK_INSTALL_PREFIX_CUR_VER}/ext")
+set(RVC_INSTALL_NEWDEP "${PACK_INSTALL_RUN_DIR}/dep")
+set(RVC_INSTALL_NEWDEP_VERSION_FILE "${RVC_INSTALL_NEWDEP}/depver.txt")
 #win
 set(RVC_CHROMIUM_PATH "${RVC_RUNTIME_PATH}/Chromium")
 set(CMAKE_INSTALL_INCLUDEDIR ${RVC_INCLUDE_PATH})
@@ -705,26 +707,6 @@ if(NOT ONLY_BUILD_DEVADAPTER)
 	file(GLOB RVC_RESOURCE_FILES LIST_DIRECTORIES FALSE "${CMAKE_SOURCE_DIR}/addin/assets/*")
 	install(FILES ${RVC_RESOURCE_FILES} DESTINATION ${RVC_RUNTIME_PATH} COMPONENT resources)
 
-	#if(CONAN_RES_DIRS_SOGOUIME)
-	#	message(STATUS "include sogou input installation.")
-	#	install(DIRECTORY "${CONAN_RES_DIRS_SOGOUIME}" DESTINATION "${PACK_INSTALL_DATA_DIR}" COMPONENT resources)
-	#endif(CONAN_RES_DIRS_SOGOUIME)
-
-	#if(CONAN_RES_DIRS_HYQIHEITTF)
-	#	message(STATUS "include font installation.")
-	#	install(DIRECTORY "${CONAN_RES_DIRS_HYQIHEITTF}" DESTINATION "${PACK_INSTALL_DATA_DIR}" COMPONENT resources)
-	#endif(CONAN_RES_DIRS_HYQIHEITTF)
-
-	#if(CONAN_RES_DIRS_UOSBROWSER)
-	#	message(STATUS "include uosbrowser installation.")
-	#	install(DIRECTORY "${CONAN_RES_DIRS_UOSBROWSER}" DESTINATION "${PACK_INSTALL_DATA_DIR}" COMPONENT resources)
-	#endif(CONAN_RES_DIRS_UOSBROWSER)
-
-	#if(CONAN_RES_DIRS_VENDORFILE)
-	#	message(STATUS "include vendor file installation.")
-	#	install(DIRECTORY "${CONAN_RES_DIRS_VENDORFILE}" DESTINATION "${PACK_INSTALL_MISCS_DIR}" COMPONENT resources)
-	#endif(CONAN_RES_DIRS_VENDORFILE)
-
 endif(NOT ONLY_BUILD_DEVADAPTER)
 
 
@@ -900,7 +882,7 @@ if(WITH_LABEL_RECORD AND DEVOPS_ON AND NOT DEVOPS_ON_CMAKE_PRD)
 		set(LABEL_UPLOAD_URL_PREFIX "http://55.11.56.122/rvc/LR04.02_RVCTerminalPlus_UAT")
 	endif(DEVOPS_ON_CMAKE_ST)
 	set(LABEL_UPLOAD_URL "${LABEL_UPLOAD_URL_PREFIX}/RVCTerminalPlus-$ENV{PIPELINE_BRANCH}.zip")
-	set(LABEL_UPLOAD_URL_NAME "http://avsuser.paasst.cmbchina.cn/avsui/other-bean/insert-tmp-version-info")
+	set(LABEL_UPLOAD_URL_NAME "http://avsuser.paasuat.cmbchina.cn/avsui/other-bean/insert-tmp-version-info")
 	if(MSVC)
 		set(LABEL_UPLOAD_PLATFORM "win")
 	else()
@@ -914,8 +896,6 @@ if(WITH_LABEL_RECORD AND DEVOPS_ON AND NOT DEVOPS_ON_CMAKE_PRD)
 	install(CODE "MESSAGE(\"----finished uploading label info ${LABEL_UPLOAD_URL}----\")" COMPONENT symbols)
 endif(WITH_LABEL_RECORD AND DEVOPS_ON AND NOT DEVOPS_ON_CMAKE_PRD)
 
-
-
 #appoint the component to install , except header file here.
  #set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
 set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE TRUE)

+ 30 - 0
DevAdapter/zcopy/CMakeLists.txt

@@ -0,0 +1,30 @@
+if(NOT DEVOPS_ON)
+#功能:本地开发环境安装时支持拷贝应用下的dep内容到解耦下的当前dep版本目录(通过读取depver.txt)
+#单独创建文件夹的原因:需要在所有文件install后再拷贝,CMake没有PostInstall的阶段步骤设置,只能通过这种方式找到契机
+	install(CODE "
+		message(STATUS \"安装完成,开始拷贝适配器目录\")
+		set(DEP_VERSION_CONTENT \"0.0.0.1\")
+		if(EXISTS \"\${CMAKE_INSTALL_PREFIX}/${RVC_INSTALL_NEWDEP_VERSION_FILE}\")
+			file(READ \"\${CMAKE_INSTALL_PREFIX}/${RVC_INSTALL_NEWDEP_VERSION_FILE}\" DEP_VERSION_CONTENT)
+		else()
+			message(STATUS \"make dep version file\")
+			file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${RVC_INSTALL_NEWDEP}\")
+			file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${RVC_INSTALL_NEWDEP_VERSION_FILE}\" \${DEP_VERSION_CONTENT})
+		endif()
+		message(STATUS \"dep version: \${DEP_VERSION_CONTENT}\")
+		set(DEP_VERSION_DIR \"\${CMAKE_INSTALL_PREFIX}/${RVC_INSTALL_NEWDEP}/\${DEP_VERSION_CONTENT}\")
+		if(NOT EXISTS \"\${DEP_VERSION_DIR}\")
+			message(STATUS \"make dep version directory: \${DEP_VERSION_DIR}\")
+			file(MAKE_DIRECTORY \"\${DEP_VERSION_DIR}\")
+		endif()
+		set(SOURCE_DEP_DIR \${CMAKE_INSTALL_PREFIX}/${RVC_VENDOR_PATH})
+		set(TARGET_DEP_DIR \${DEP_VERSION_DIR})
+		file(MAKE_DIRECTORY \${TARGET_DEP_DIR})
+		file(GLOB_RECURSE FILES_TO_COPY \${SOURCE_DEP_DIR}/*)
+		foreach(FILE \${FILES_TO_COPY})
+			message(STATUS \"copy dep file: \${FILE}\")
+			file(COPY \${FILE} DESTINATION \${TARGET_DEP_DIR})
+		endforeach()" 
+	 COMPONENT devadapters)
+
+endif(NOT DEVOPS_ON)

+ 1 - 1
Framework/spbase/sp_cfg.cpp

@@ -655,7 +655,7 @@ int sp_TryUpdateToken(char *oldToken, char *newToken)
 		return ErrorCodeEnum::Error_NotConfig;
 	}
 
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("TryUpdateToken by %s, %s", terminalNoInRoot.c_str(), terminalVer);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TryUpdateToken by %s, %s", terminalNoInRoot.c_str(), terminalVer);
 	auto tokenRet = refreshToken(terminalNoInRoot, terminalVer, channelId, tokenScret, commonUrl);
 
 	if (tokenRet.first)

+ 1 - 1
Module/include/CommEntityUtil.hpp

@@ -268,7 +268,7 @@ static BOOL IsFirsRunAppAfterSystemBoot(CEntityBase* pEntity, DWORD theReportUse
 		CSmallDateTime dateTime;
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("systemRunInfo time: %s", (LPCTSTR)runInfo.tmStart.ToTimeString());
 		ec = pEntity->GetFunction()->GetRebootInfo(/*runInfo.tmStart*/dateTime, bootInfo);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("bootInfor time: %s", (LPCTSTR)bootInfo.tmStart.ToTimeString());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("bootInfor time: %s", (LPCTSTR)bootInfo.tmStart.ToTimeString());
 		CSmallDateTime systemBootTime;
 		const BOOL bRet = System::GetSystemBootTime(systemBootTime);
 		if (bRet && systemBootTime > bootInfo.tmStart) {

+ 0 - 76
Module/mod_ResourceWatcher/ResourceWatcher.xml

@@ -161,32 +161,6 @@
 				<param name="terminalVer" type="string" />
 			</res>
 		</twoway>
-
-    <twoway  name="GetThirdPartyInstallState" overlap="true" method_id="10">
-      <req>
-        <!---1: 表示获取搜狗输入法的安装信息,3,自定义检测程序安装情况-->
-        <param name="mode" type="int" />
-        <param name="reserved1" type="int" />
-        <param name="reserved2" type="int" />
-        <!--新增两个字段,该接口确认为内部使用,TODO: SpGen更新-->
-        <param name="reserverd3" type="string"/>
-        <param name="reserverd4" type="string"/>
-      </req>
-      <res>
-        <!--1:已安装,0:未安装-->
-        <param name="status" type="int" />
-		<!-- 安装版本信息 -->
-        <param name="version" type="string"/>
-		<!-- 安装路径 -->
-        <param name="path" type="string"/>
-		<!-- 对于搜狗输入法,储存安装时间 -->
-        <param name="reserverd1" type="string"/>
-        <param name="reserverd2" type="string"/>
-        <param name="reserverd3" type="int"/>
-        <param name="reserverd4" type="int"/>
-		<param name="terminalVer" type="string" />
-      </res>
-    </twoway>
     <twoway  name="InstallThirdPartyProgram" overlap="true" method_id="11">
       <req>
         <!---1: 搜狗输入法-->
@@ -203,56 +177,6 @@
 		<param name="terminalVer" type="string" />
       </res>
     </twoway>
-    <twoway  name="UninstallThirdPartyProgram" overlap="true" method_id="14">
-      <req>
-        <!---1: 搜狗输入法-->
-        <param name="type" type="int" />
-        <param name="reserved1" type="int" />
-        <param name="reserved2" type="int" />
-      </req>
-      <res>
-        <param name="result" type="int" />
-        <param name="msg" type="string"/>
-        <param name="reserverd1" type="string"/>
-        <param name="reserverd2" type="string"/>
-		<param name="terminalVer" type="string" />
-      </res>
-    </twoway>
-
-		<!--第三方软件手工启动接口-->
-		<twoway  name="RestartThirdPartyProgram" overlap="true" method_id="15">>
-			<req>
-				<!---1: 搜狗输入法-->
-				<param name="type" type="int" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />
-			</req>
-			<res>
-				<param name="result" type="int" />
-				<param name="msg" type="string"/>
-				<param name="reserverd1" type="string"/>
-				<param name="reserverd2" type="string"/>
-				<param name="terminalVer" type="string" />
-			</res>
-		</twoway>
-
-		<!--第三方软件进程检测接口-->
-		<twoway  name="ProcessDetectThirdPartyProgram" overlap="true" method_id="16">
-			<req>
-				<!---1: 搜狗输入法-->
-				<param name="type" type="int" />
-				<param name="reserved1" type="int" />
-				<param name="reserved2" type="int" />
-			</req>
-			<res>
-				<param name="result" type="int" />
-				<param name="msg" type="string"/>
-				<param name="reserverd1" type="string"/>
-				<param name="reserverd2" type="string"/>
-				<param name="terminalVer" type="string" />
-			</res>
-		</twoway>
-
 		<!--文件清理接口-->
 		<twoway  name="FilesClean" overlap="true" method_id="17">
 			<req>

+ 134 - 352
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -7,7 +7,6 @@
 #include <algorithm>
 #include "fileutil.h"
 #include <ctime>
-#include "CommEntityUtil.hpp"
 #include "SpUtility.h"
 #include "RestfulFunc.h"
 #include <stdio.h>
@@ -91,6 +90,14 @@ const char* CMB_LINK_FILE_NAME = "招商银行可视柜台.lnk";
 #endif
 const char* STRATUP_FILENAME_FROM_SCRIPTS = "spexplorerauto.lnk";
 
+bool cmp(const pair<int, double>& a, const pair<int, double>& b) {
+    return a.second > b.second;
+}
+
+bool cmpPid(const pair<int, CSimpleStringA>& a, const pair<int, CSimpleStringA>& b) {
+    return a.first < b.first;
+}
+
 #if defined(RVC_OS_WIN)
 //https://blog.csdn.net/aflyeaglenku/article/details/51742820
 typedef struct _dmi_header
@@ -256,9 +263,9 @@ bool ResourceWatcherFSM::GetSysActiveStatus(CSimpleStringA& outInfo)
 //首页状态变化时触发的功能
 void ResourceWatcherFSM::TriggerAtStatusChanged(bool bMStatus)
 {
-    if (firstMpage)//首次进入首页
+    if (neverMainPage)//首次进入首页
     {
-        firstMpage = false;
+        neverMainPage = false;
 
         CSmartPointer<IConfigInfo> spRunConfig;
         CSmartPointer<IConfigInfo> spCtSettingConfig;
@@ -311,9 +318,21 @@ void ResourceWatcherFSM::TriggerAtStatusChanged(bool bMStatus)
     }
 }
 
+void ResourceWatcherFSM::TriggerProccessUpload()
+{
+    CSmartPointer<IConfigInfo> spCtSettingConfig;
+    GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
+    int CloseUploadSysProcFlag = 0; //关闭进程信息上送标志
+    spCtSettingConfig->ReadConfigValueInt(m_pEntity->GetEntityName(), "CloseUploadSysProcFlag", CloseUploadSysProcFlag);
+    if (CloseUploadSysProcFlag != 1) {
+        UploadSysProcInfoTask* uploadProcInfo = new UploadSysProcInfoTask(this);
+        GetEntityBase()->GetFunction()->PostThreadPoolTask(uploadProcInfo);
+    }
+}
+
 ErrorCodeEnum ResourceWatcherFSM::OnInit()
 {
-    firstMpage = true;		//是否首次进入首页
+    neverMainPage = true;		//是否未进入过首页
 
     ErrorCodeEnum erroCode = Error_Succeed;
     DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Complied at: %s %s", __DATE__, __TIME__);
@@ -324,9 +343,8 @@ ErrorCodeEnum ResourceWatcherFSM::OnInit()
     erroCode = GetEntityBase()->GetFunction()->GetSystemStaticInfo(m_RvcSysinfo);
     m_bFirstRunAfterBoot = DetectIsFirstRunAtBoot();
     if (m_bFirstRunAfterBoot) {
-        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("First time to run after system boot.");
+        DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("First time to run after system boot.");
     }
-
     spCtSettingConfig->ReadConfigValueInt(m_pEntity->GetEntityName(), "DisplayCnt", m_iNonSignedDisplay);
     if (m_iNonSignedDisplay <= 0)
         m_iNonSignedDisplay = 10;
@@ -341,6 +359,7 @@ ErrorCodeEnum ResourceWatcherFSM::OnInit()
         m_skipDesktopDetect = TRUE;
     }
     spRunConfig->ReadConfigValueInt("WarnRecord", "disk", m_diskLastWarnHour);
+
     return Error_Succeed;
 }
 
@@ -2006,94 +2025,6 @@ void ResourceWatcherFSM::DetectVersionHasChangedAndWarn()
     }
 }
 
-void ResourceWatcherFSM::DetectDestopFileAndWarn(bool bClear, CSimpleStringA& strFileSaveList)
-{
-	CSimpleStringA filelist(true);
-	int dirCount(0), fileCount(0);
-	CSimpleStringA desktopFullPath(true);
-	CSimpleStringA desktopPublicPath(true);
-    GetUserDesktopDirectory(desktopFullPath);
-    GetCommDesktopDirectory(desktopPublicPath);
-    if (desktopFullPath.IsNullOrEmpty() || desktopPublicPath.IsNullOrEmpty()) {
-        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get desktop directory path failed: pub:%d,user:%d", desktopPublicPath.GetLength(), desktopFullPath.GetLength());
-    }
-    else {
-		CAutoArray<CSimpleStringA> desktopPaths;
-		desktopPaths.Init(2);
-		desktopPaths[0] = desktopFullPath;
-		desktopPaths[1] = desktopPublicPath;
-		for (int k = 0; k < desktopPaths.GetCount(); ++k) {
-			CSimpleStringA& curPath = desktopPaths[k];
-			auto arr = fileutil_get_sub_files(curPath);
-			if (arr != NULL) {
-				for (int i = 0; i < arr->nelts; ++i) {
-					char* file = ARRAY_IDX(arr, i, char*);
-					char* filename = strrchr(file, '\\');
-					if (filename != NULL) { filename += 1; }
-					else { filename = file; }
-					bool toRecord = true;
-					if (bClear) {
-						std::string strLowFileName = SP::Utility::ToLower(std::string(filename));
-						if (strFileSaveList.IsNullOrEmpty() || strFileSaveList.IndexOf(strLowFileName.c_str()) == -1) {
-							DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("delete desktop file:%s", filename);
-							RemoveFileA(file);
-							if (!ExistsFileA(file)) {
-								toRecord = false;
-							}
-						}
-						else {
-							DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("skip to delete: %s", filename);
-						}
-					}
-					if (toRecord) {
-						fileCount++;
-						if (!filelist.IsNullOrEmpty()) {
-							filelist += "|";
-						}
-						filelist += filename;
-					}
-				}
-				if (arr->nelts > 0) {
-					filelist += ";";
-				}
-				toolkit_array_free2(arr);
-			}
-
-			arr = fileutil_get_sub_dirs(curPath);
-			if (arr != NULL) {
-				for (int i = 0; i < arr->nelts; ++i) {
-					char* dir = ARRAY_IDX(arr, i, char*);
-					char* dirname = strrchr(dir, '\\');
-					if (dirname != NULL) { dirname += 1; }
-					else { dirname = dir; }
-					bool toRecord = true;
-					if (bClear) {
-						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("remove desktop dir:%s", dirname);
-						RemoveDirRecursiveA(dir);
-						if (!ExistsDirA(dir)) {
-							toRecord = false;
-						}
-					}
-					if (toRecord) {
-						dirCount++;
-						if (!filelist.IsNullOrEmpty() && i != 0) {
-							filelist += "|";
-						}
-						filelist += dirname;
-					}
-				}
-				if (arr->nelts > 0) {
-					filelist += ";";
-				}
-				toolkit_array_free2(arr);
-			}
-		}
-		LogWarn(Severity_Low, Error_Debug, LOG_INFO_DESKTOP_FILESTATUS
-			, CSimpleStringA::Format("{\"subject\":\"desktop_file\",\"clear_flag\":\"%d\",\"desktop\":\"%s\",\"file_count\":%d,\"dir_count\":%d,\"content\":\"%s\"}"
-				, bClear ? 1 : 0, desktopFullPath.GetData(), fileCount, dirCount, filelist.GetLength() < 950 ? filelist.GetData() : (filelist.SubString(0, 950) + "....").GetData()));
-    }
-}
-
 bool ResourceWatcherFSM::SetDesktopSysIcon2Registry(const std::string& key, bool toDisplay)
 {
     bool result(true);
@@ -2225,144 +2156,6 @@ void ResourceWatcherFSM::MakeSureWin8IntoDesktopPageAtLogon()
     }
 }
 
-void ResourceWatcherFSM::DetectAutoStartFileAndWarn()
-{
-    std::vector<std::string> userlist;
-	std::vector<std::string> publist;
-    std::string r1, r2;
-    GetAutoStartFile(r1, userlist, r2, publist);
-    std::string strUserList = "";
-    std::string strPubList = "";
-
-	std::string strUserAutoList = "";
-	std::string strPubAutoList = "";
-    int userAutoCnt = 0, pubAutoCnt = 0;
-    int userAutoPureCnt = 0, pubAutoPureCnt = 0;
-    int catchLegitCnt = 0;
-    std::vector<std::string> autolist;
-    autolist.push_back(CMB_LINK_FILE_NAME);
-	autolist.push_back(STRATUP_FILENAME_FROM_SCRIPTS);
-
-    for (auto it = userlist.cbegin(); it != userlist.cend(); ++it) {
-        if (!strUserList.empty()) { strUserList += "|"; }
-        strUserList += it->c_str();
-
-        for (auto kt = keyUserlist.cbegin(); kt != keyUserlist.cend(); ++kt) {
-            if (it->compare(*kt) == 0) {
-				if (!strUserAutoList.empty()) { strUserAutoList += "|"; }
-                strUserAutoList += it->c_str();
-                userAutoCnt++;
-                userAutoPureCnt++;
-                break;
-            }
-        }
-		for (auto kt = autolist.cbegin(); kt != autolist.cend(); ++kt) {
-			if (it->compare(*kt) == 0) {
-				if (!strUserAutoList.empty()) { strUserAutoList += "|"; }
-				strUserAutoList += it->c_str();
-				userAutoCnt++;
-                catchLegitCnt++;
-                break;
-			}
-		}
-    }
-	for (auto it = publist.cbegin(); it != publist.cend(); ++it) {
-		if (!strPubList.empty()) { strPubList += "|"; }
-        strPubList += it->c_str();
-
-		for (auto kt = keyPublist.cbegin(); kt != keyPublist.cend(); ++kt) {
-			if (it->compare(*kt) == 0) {
-				if (!strPubAutoList.empty()) { strPubAutoList += "|"; }
-                strPubAutoList += it->c_str();
-                pubAutoCnt++;
-                pubAutoPureCnt++;
-                break;
-			}
-		}
-		for (auto kt = autolist.cbegin(); kt != autolist.cend(); ++kt) {
-			if (it->compare(*kt) == 0) {
-				if (!strPubAutoList.empty()) { strPubAutoList += "|"; }
-				strPubAutoList += it->c_str();
-				pubAutoCnt++;
-                catchLegitCnt++;
-				break;
-			}
-		}
-	}
-	LogWarn(Severity_Low, Error_Debug, LOG_INFO_AUTOSTART_FILESTATUS
-		, CSimpleStringA::Format("{\"subject\":\"autostart_file\", \"file_count\":%d, \"user\":\"%s\",\"public\":\"%s\"}"
-            , userlist.size() + publist.size(), strUserList.c_str(), strPubList.c_str()));
-
-    if (pubAutoCnt + userAutoCnt > 1) {
-		LogWarn(Severity_Low, Error_Debug, LOG_INFO_AUTOSTART_INTEREST_FILESTATUS
-			, CSimpleStringA::Format("{\"subject\":\"duplicate_vtm_autostart_file\", \"user_count\":%d, \"pub_count\":%d, \"user\":\"%s\",\"public\":\"%s\", \"legal_count\":%d, \"delete_flag\":%d}"
-				, userAutoCnt, pubAutoCnt, strUserAutoList.c_str(), strPubAutoList.c_str(), catchLegitCnt, flag4DeleteKeyAutoStartFile));
-    }
-
-    if (catchLegitCnt > 0 && flag4DeleteKeyAutoStartFile && (pubAutoPureCnt > 0 || userAutoPureCnt > 0)) {
-        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to delete duplicate auto start file.");
-        DeleteDuplicateAutoStartFile();
-    }
-    //////////////////////////////////////////////////////////////////////////
-
-    struct fileStruc {
-        std::string username;
-        std::vector<std::string> filenames;
-        //JSONCONVERT2OBJECT_MEMEBER_REGISTER(username, filenames)
-    };
-
-    struct fileVec
-    {
-        std::vector<fileStruc> startupfiles;
-        //JSONCONVERT2OBJECT_MEMEBER_REGISTER(startupfiles)
-    } curStartupFileInfo, keyStartFileInfo;
-
-	CSimpleStringA desktopParentPath = "C:\\Users";
-	auto arr = fileutil_get_sub_dirs(desktopParentPath);
-	if (arr != NULL) {
-		for (int i = 0; i < arr->nelts; ++i) {
-			char* dir = ARRAY_IDX(arr, i, char*);
-			char* dirname = strrchr(dir, '\\');
-			if (dirname != NULL) { dirname += 1; }
-			else { dirname = dir; }
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("dir name:%s", dirname);
-            fileStruc curset;
-			fileStruc keyset;
-            curset.username = keyset.username = dirname;
-            ToListCurrentUserStartupFile(dir, curset.filenames, keyset.filenames);
-            curStartupFileInfo.startupfiles.push_back(curset);
-            keyStartFileInfo.startupfiles.push_back(keyset);
-		}
-		toolkit_array_free2(arr);
-	}
-    std::string curset_str(""), keyset_str("");
-    for (auto it = curStartupFileInfo.startupfiles.begin(); it != curStartupFileInfo.startupfiles.end(); ++it) {
-        if (!curset_str.empty()) curset_str += ";";
-        curset_str += it->username;
-        curset_str += ":";
-        std::string content("");
-        for (auto ik = it->filenames.begin(); ik != it->filenames.end(); ik++) {
-            if (!content.empty()) content += "|";
-            content += ik->c_str();
-        }
-        curset_str += content;
-    }
-
-	for (auto it = keyStartFileInfo.startupfiles.begin(); it != keyStartFileInfo.startupfiles.end(); ++it) {
-		if (!keyset_str.empty()) keyset_str += ";";
-        keyset_str += it->username;
-        keyset_str += ":";
-		std::string content("");
-		for (auto ik = it->filenames.begin(); ik != it->filenames.end(); ik++) {
-			if (!content.empty()) content += "|";
-			content += ik->c_str();
-		}
-        keyset_str += content;
-	}
-    //LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_DEBUG_STARTUPFILES, curset_str.c_str());
-	LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_DEBUG_KEY_STARTUPFILES, keyset_str.c_str());
-}
-
 bool ResourceWatcherFSM::RegRdVtmVersion(CSimpleStringA& VTMpath, CSimpleStringA& vtmVersion, CSimpleStringA& verPath)
 {
     bool bRet = false;
@@ -2651,34 +2444,6 @@ void ResourceWatcherFSM::VerifySignature(const CSimpleStringA& filePath)
     FindClose(hFind);
 }
 
-void ResourceWatcherFSM::DetectAndClearDesktopFile()
-{
-#if defined(RVC_OS_WIN)
-	CSmartPointer<IConfigInfo> spCtSettingConfig;
-	GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
-
-	int clearDesktopFlag(0);
-	CSimpleStringA strFileWhiteSheet(true);
-	spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "ClearDesktopSwitch", clearDesktopFlag);
-	if (!!clearDesktopFlag) {
-		spCtSettingConfig->ReadConfigValue(GetEntityBase()->GetEntityName(), "DesktopWhiteSheet", strFileWhiteSheet);
-		if (!strFileWhiteSheet.IsNullOrEmpty()) {
-			std::string strLowFileName = SP::Utility::ToLower(std::string(strFileWhiteSheet.GetData()));
-			strFileWhiteSheet = strLowFileName.c_str();
-		}
-	}
-	DetectDestopFileAndWarn(!!clearDesktopFlag, strFileWhiteSheet);
-    /** 如果白名单中有{SysIcon}则不清理桌面系统图标  [Gifur@2024830]*/
-    if (!!clearDesktopFlag && (strFileWhiteSheet.IsNullOrEmpty() || strFileWhiteSheet.IndexOf("{sysicon}") == -1)) {
-		SetDesktopSysIcon2Registry("{20D04FE0-3AEA-1069-A2D8-08002B30309D}", false); //此电脑 图标
-		SetDesktopSysIcon2Registry("{645FF040-5081-101B-9F08-00AA002F954E}", false); //回收站 图标
-		SetDesktopSysIcon2Registry("{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", false); //网络 图标
-		SetDesktopSysIcon2Registry("{5399E694-6CE5-4D6C-8FCE-1D8870FDCBA0}", false); //控制面板 图标
-		SetDesktopSysIcon2Registry("{59031a47-3f72-44a7-89c5-5595fe6b30ee}", false); //用户的文件 图标
-    }
-#endif //RVC_OS_WIN
-}
-
 CSimpleStringA ResourceWatcherFSM::GetFileName(const CSimpleStringA& filePath)
 {
     CSimpleStringA tmp = filePath;
@@ -3340,16 +3105,6 @@ long long CompareFileTime2(const FILETIME& preTime, const FILETIME& nowTime)
     return Filetime2Int64(nowTime) - Filetime2Int64(preTime);
 }
 
-unordered_map<int, long long> oldProcessTime;
-unordered_map<int, long long> newProcessTime;
-unordered_map<int, CSimpleStringA> processName;
-unordered_map<int, double> processCpu;
-string sysProcName = "[System Process]|System|Registry|smss.exe|csrss.exe|services.exe|wininit.exe";
-
-bool cmp(const pair<int, double>& a, const pair<int, double>& b) {
-    return a.second > b.second;
-}
-
 void ResourceWatcherFSM::GetSystemCPUStatus()
 {
     oldProcessTime.clear();
@@ -3697,11 +3452,19 @@ void ResourceWatcherFSM::GetSystemMemoryStatus()
 
 void ResourceWatcherFSM::DetectWallpaperAndWarn()
 {
+	//////////////////////////////////////////////////////////////////////////
+	CSmartPointer<IConfigInfo> spCtSettingConfig;
+	GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
+	int value(0);
+	spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "MakeSureCMBWallPaper", value);
+	if (!value) {
+		return;
+    }
+    bool wallpapaerSetCMD = true;
 	DWORD dwFlag = KEY_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS;
 	if (Is32R64Platform() != 0) {
 		dwFlag |= KEY_WOW64_64KEY;
 	}
-	bool wallpapaerSetCMD = false;
     bool wellDone = false;
 	CSimpleStringA regeditValue(true);
 	HKEY hKey;
@@ -3713,8 +3476,8 @@ void ResourceWatcherFSM::DetectWallpaperAndWarn()
 		memset(szValue, '\0', MAX_PATH + 1);
 		lResult = RegQueryValueEx(hKey, "Wallpaper", NULL, &dwType, (LPBYTE)szValue, &dwSize);
 		if (lResult == ERROR_SUCCESS) {
-			CSimpleStringA strMsg = CSimpleStringA::Format("{\"subject\":\"wallpaper_path\",\"value\":\"%s\"}", szValue);
-			LogWarn(Severity_Low, Error_Debug, LOG_INFO_DESKTOP_WALLPAPER_PATH, strMsg);
+			//CSimpleStringA strMsg = CSimpleStringA::Format("{\"subject\":\"wallpaper_path\",\"value\":\"%s\"}", szValue);
+			//LogWarn(Severity_Low, Error_Debug, LOG_INFO_DESKTOP_WALLPAPER_PATH, strMsg);
             regeditValue = szValue;
             wellDone = true;
 		}
@@ -3728,14 +3491,7 @@ void ResourceWatcherFSM::DetectWallpaperAndWarn()
 		LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_DESKTOP_WALLPAPER_PATH_FETCHFAILE, strMsg);
 	}
     RegCloseKey(hKey);
-    //////////////////////////////////////////////////////////////////////////
-	CSmartPointer<IConfigInfo> spCtSettingConfig;
-	GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
-	int value(0);
-    spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "MakeSureCMBWallPaper", value);
-	if (!!value) {
-        wallpapaerSetCMD = true;
-	}
+
 
 	CSimpleStringA RVCWallpaperName("WallPaper1920.png");
     if (wellDone && !regeditValue.IsNullOrEmpty() && regeditValue.IndexOf(RVCWallpaperName) != -1 && ExistsFileA(regeditValue)) {
@@ -3835,25 +3591,12 @@ void ResourceWatcherFSM::InitCustomAutoStartFileSheet()
 			}
 		}
 	}
-	int value(0);
-    spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "DeleteCustomAutoStartFile", value);
-	if (!!value) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get DeleteCustomAutoStartFile execute flag from CenterSettings");
-		flag4DeleteKeyAutoStartFile = !!value;
-	}
-  //  if (flag4DeleteKeyAutoStartFile) {
-		//strFileInterestSheet.Clear();
-		//spCtSettingConfig->ReadConfigValue(GetEntityBase()->GetEntityName(), "DeleteAutoStartFileSheet", strFileInterestSheet);
-		//if (!strFileInterestSheet.IsNullOrEmpty()) {
-		//	auto fileNames = strFileInterestSheet.Split('|');
-		//	if (fileNames.GetCount() > 0) {
-		//		for (int i = 0; i < fileNames.GetCount(); ++i) {
-		//			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DeleteAutoStartFileSheet[%s]", fileNames[i].GetData());
-  //                  delKeylist.push_back(fileNames[i].GetData());
-		//		}
-		//	}
-		//}
-  //  }
+	//int value(0);
+ //   spCtSettingConfig->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "DeleteCustomAutoStartFile", value);
+	//if (!!value) {
+	//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Get DeleteCustomAutoStartFile execute flag from CenterSettings");
+	//	flag4DeleteKeyAutoStartFile = !!value;
+	//}
 }
 
 void ResourceWatcherFSM::InitUserInfo()
@@ -4367,7 +4110,7 @@ void ResourceWatcherFSM::AlarmSystemBasicInfo()
             strResult += CSimpleStringA::Format("\"Serial Number\":\"%s\"", info.strSerialNumber.GetData());
         }
         strResult += "}";
-        LogWarn(Severity_Low, Error_Debug, LOG_INFO_DEVICE_SMBIOS_GET, strResult);
+        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutManufacturer")(strResult.GetData());
     }
 }
 
@@ -4416,7 +4159,7 @@ void ResourceWatcherFSM::DetectSoftwareInstallStatus()
 		{
 			strSoftwaresNames[i] = value;
 		}
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Detect SoftDetect from CentralSetting, %d: [%s],[%s],[%s]"
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Detect SoftDetect from CentralSetting, %d: [%s],[%s],[%s]"
 			, i, item.GetData(), strSoftwaresNames[i].GetData(), strSoftwaresVers[i].GetData());
 		nNameCounts++;
 	}
@@ -4427,14 +4170,11 @@ void ResourceWatcherFSM::DetectSoftwareInstallStatus()
         vector<SetupSoftInfo> stupInfo;
         DWORD dwInitFlag(0);
         FetchSoftewareInstall(stupInfo, dwInitFlag);
-        DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("1software size:%d", stupInfo.size());
         if (dwInitFlag == 1) {
 			FetchSoftewareInstall(stupInfo, dwInitFlag);
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("2software size:%d", stupInfo.size());
         }
         dwInitFlag = 2;
 		FetchSoftewareInstall(stupInfo, dwInitFlag);
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("3software size:%d", stupInfo.size());
         for (int i = 0; i < nNameCounts; ++i) {
             bool found(false);
 			for (int j = 0; j < stupInfo.size(); j++) {
@@ -4566,7 +4306,7 @@ void ResourceWatcherFSM::UploadSysVersionInfo(UINT& ver)
         srcData.insert(std::make_pair("cpu-type", sucContent));
     } while (false);
     auto ret = generateJsonStr(srcData);
-    LogWarn(Severity_Low, Error_Hardware, LOG_RESOURCEWATCHER_SYSTEMINFO, ret.second.c_str());
+    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SystemBaseInfo")(ret.second.c_str());
 }
 
 void ResourceWatcherFSM::UploadSysActivationStatus()
@@ -4621,7 +4361,7 @@ void ResourceWatcherFSM::UploadSysActivationStatus()
 	else {
 		warnMsg = CSimpleStringA::Format("{\"subject\":\"system_activation\", \"fetch_status\":\"failed\"}");
 	}
-	LogWarn(Severity_Low, Error_Debug, LOG_INFO_SYSTEM_ACTIVATION_INFO, value);
+    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SystemActivationStatus")(value);
 }
 
 string ResourceWatcherFSM::MemoryProcessStatus()
@@ -4755,10 +4495,6 @@ const char* ResourceWatcherFSM::GetItems(const char* buffer, unsigned int item)
     return p;
 }
 
-bool cmp(const pair<DWORD, DOUBLE>& a, const pair<DWORD, DOUBLE>& b) {
-    return a.second > b.second;
-}
-
 /* -----------------------
    根据先后两个时间的CPU信息,
    计算CPU的总占用量和各个进程的占用量
@@ -4767,12 +4503,15 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
 {
     //int cpu_num = sysconf(_SC_NPROCESSORS_CONF);      //CPU核数
 
+    oldProcessTime.clear();
+    newProcessTime.clear();
+    processName.clear();
+    processCpu.clear();
+
     CPUInfo* cpuOld = new CPUInfo;
     CPUInfo* cpuNew = new CPUInfo;
 
     const char* tPath = "/proc";
-    map<DWORD, string> nameProcess;  // <pid, 进程名>
-    map<DWORD, DOUBLE> usageProcess; // <pid, CPU占用率>
 
     long oldTotalTime = GetCPURunTime(cpuOld);  //旧CPU运行总时间
     if (oldTotalTime == -1)
@@ -4780,7 +4519,6 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
         return;
     }
 
-    map<DWORD, long> oldProcCPUTime;  // <pid, 旧时刻进程的CPU占用时间>
     struct dirent* oldDirp;
     DIR* oldDp = opendir(tPath);
     if (oldDp != NULL) {
@@ -4807,8 +4545,8 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
                 return;
             }
 
-            oldProcCPUTime[pid] = oldTime;
-            nameProcess[pid] = oldProcCPU->pname;
+            oldProcessTime[pid] = oldTime;
+            processName[pid] = oldProcCPU->pname;
 
             delete oldProcCPU;
         }
@@ -4823,7 +4561,6 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
         return;
     }
 
-    map<DWORD, long> newProcCPUTime; // <pid, 新时刻进程的CPU占用时间>
     struct dirent* newDirp;
     DIR* newDp = opendir(tPath);
     if (newDp != NULL) {
@@ -4851,52 +4588,26 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
                 return;
             }
 
-            newProcCPUTime[pid] = newTime;
+            newProcessTime[pid] = newTime;
 
             string tName = newProcCPU->pname;
             tName.erase(tName.begin());
             tName.erase(tName.begin() + (tName.length() - 1));
 
-            nameProcess[pid] = tName;
+            processName[pid] = tName.c_str();
 
             delete newProcCPU;
         }
         closedir(newDp);
     }
 
-    map<DWORD, long>::iterator it;
-    for (it = newProcCPUTime.begin(); it != newProcCPUTime.end(); ++it)
+    unordered_map<int, long long>::iterator it;
+    for (it = newProcessTime.begin(); it != newProcessTime.end(); ++it)
     {
         DWORD tPid = it->first;
         //进程的占用率 = 单位时间间隔里进程的CPU时间片占用 / 单位时间间隔里CPU的整体时间片
-        DOUBLE tRatio = 100.0 * (newProcCPUTime[tPid] - oldProcCPUTime[tPid]) / (newTotalTime - oldTotalTime);
-        usageProcess[tPid] = tRatio;
-    }
-
-    CSystemRunInfo runInfo = { 0 };
-    GetEntityBase()->GetFunction()->GetSystemRunInfo(runInfo);
-
-    for (int i = 0; i < runInfo.strRunningEntityNames.GetCount(); i++) //实体进程的名称默认全为sphost,需转换为对应实体名
-    {
-        string entityName = runInfo.strRunningEntityNames[i].GetData();
-        CEntityRunInfo entityInfo = { 0 };
-        GetEntityBase()->GetFunction()->GetEntityRunInfo(entityName.c_str(), entityInfo);
-        nameProcess[entityInfo.dwProcessID] = entityName;
-    }
-
-    vector<pair<DWORD, DOUBLE>> vec(usageProcess.begin(), usageProcess.end());
-    sort(vec.begin(), vec.end(), cmp); //根据CPU使用率从大到小进行排序
-
-    int cpuTop = 10;
-    int len = MIN(cpuTop, vec.size()); //确认要展示的进程数量
-    string procWarn = "";
-    for (int i = 0; i < len; ++i) //构建进程的CPU使用告警信息
-    {
-        char* tUsage = new char[20];
-        sprintf(tUsage, "%.2lf", vec[i].second);
-        procWarn = procWarn + ",\"" + nameProcess[vec[i].first] + "\":\"" + string(tUsage) + "%\"";
-
-        delete tUsage;
+        double tRatio = 100.0 * (newProcessTime[tPid] - oldProcessTime[tPid]) / (newTotalTime - oldTotalTime);
+        processCpu[tPid] = tRatio;
     }
 
     unsigned long oldInfo, newInfo;
@@ -4925,12 +4636,39 @@ void ResourceWatcherFSM::GetSystemCPUStatus()
         cpuWarnTime = cpuWarnTime % cpuWarnThreshold;
         if (cpuWarnTime == 0) //每达到一次阈值告警一次
         {
+            CSystemRunInfo runInfo = { 0 };
+            GetEntityBase()->GetFunction()->GetSystemRunInfo(runInfo);
+
+            for (int i = 0; i < runInfo.strRunningEntityNames.GetCount(); i++) //实体进程的名称默认全为sphost,需转换为对应实体名
+            {
+                CSimpleStringA entityName = runInfo.strRunningEntityNames[i].GetData();
+                CEntityRunInfo entityInfo = { 0 };
+                GetEntityBase()->GetFunction()->GetEntityRunInfo(entityName.GetData(), entityInfo);
+                processName[entityInfo.dwProcessID] = entityName;
+            }
+
+            vector<pair<int, double>> vec(processCpu.begin(), processCpu.end());
+            sort(vec.begin(), vec.end(), cmp); //根据CPU使用率从大到小进行排序
+
+            int cpuTop = 10;
+            int len = MIN(cpuTop, vec.size()); //确认要展示的进程数量
+            CSimpleStringA procWarn = "";
+            for (int i = 0; i < len; ++i) //构建进程的CPU使用告警信息
+            {
+                char* tUsage = new char[20];
+                sprintf(tUsage, "%.2lf", vec[i].second);
+                procWarn = procWarn + ",\"" + processName[vec[i].first] + "\":\"" + tUsage + "%\"";
+
+                delete tUsage;
+            }
+
             stringstream tss;
             tss << std::setiosflags(std::ios::fixed) << std::setprecision(2) << cUsedRate * 100;
 
-            string warn = "{\"type\":\"cpu\", \"total_used\":\"" + tss.str() + "%\"" + procWarn + "}";
-            LogWarn(Severity_Middle, Error_Resource, LOG_EVT_RESOURCE_CPU_TOO_HIGH, CSimpleStringA::Format("%s", warn.c_str()));
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A03").setAPI("CpuUsedCheck")(warn.c_str());
+            CSimpleStringA warn = "";
+            warn = warn + "{\"type\":\"cpu\", \"total_used\":\"" + tss.str().c_str() + "%\"" + procWarn + "}";
+            LogWarn(Severity_Middle, Error_Resource, LOG_EVT_RESOURCE_CPU_TOO_HIGH, CSimpleStringA::Format("%s", warn.GetData()));
+            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5A03").setAPI("CpuUsedCheck")(warn.GetData());
         }
         cpuWarnTime++;
     }
@@ -5152,3 +4890,47 @@ void ResourceWatcherFSM::ConfirmWindowEffectHasBeenOpen()
 }
 #endif // RVC_OS_LINUX
 
+void ResourceWatcherFSM::GetSystemProccess()
+{
+    if(processName.empty())
+    {
+        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get Sys Process error, it's empty!");
+        return;
+    }
+
+    int len = 0;
+    CSimpleStringA curProcStr = "";
+    CSimpleStringA endStr = ",";
+    CSimpleStringA totalProcStr = "{";
+
+    vector<pair<int, CSimpleStringA>> vec(processName.begin(), processName.end());
+    sort(vec.begin(), vec.end(), cmpPid);
+
+    for (int i = 0; i < vec.size(); i++)
+    {
+        curProcStr = CSimpleStringA("\"") + to_string(vec[i].first).c_str() + "\":\"" + vec[i].second + "\"";
+        len = totalProcStr.GetLength() + curProcStr.GetLength();
+        if (len > 1000 || i == (vec.size()-1))
+        {
+            endStr = "}";
+            if (i == (vec.size() - 1)) //最后一个
+            {
+                totalProcStr = totalProcStr + curProcStr + endStr;
+                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetSystemProccess")(totalProcStr.GetData());
+                break;
+            }
+            else //长度超限
+            {
+                totalProcStr[totalProcStr.GetLength() - 1] = '}';
+                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetSystemProccess")(totalProcStr.GetData());
+                totalProcStr = CSimpleStringA("{") + curProcStr + ","; //超过长度则从当前进程开始重新搭建日志
+            }
+        }
+        else
+        {
+            endStr = ",";
+            totalProcStr = totalProcStr + curProcStr + endStr;
+        }
+        
+    }
+}

+ 37 - 6
Module/mod_ResourceWatcher/ResourceWatcherFSM.h

@@ -2,6 +2,7 @@
 
 #include "stdafx.h"
 #include "SpFSM.h"
+#include "CommEntityUtil.hpp"
 
 #define JUS_A_TEST 0
 #include "FileInfo.h"
@@ -236,6 +237,7 @@ public:
 
 	//进入首页时触发的功能在此
 	void TriggerAtStatusChanged(bool bMStatus);
+	void TriggerProccessUpload();
 
 	void AfterInit();
 
@@ -275,14 +277,21 @@ private:
 	vector<CSimpleStringA>m_nonSignedFiles;
 	int m_iNonSignedTotal;
 	bool m_bNeedForceDiskCheck;
+
+	string sysProcName = "[System Process]|System|Registry|smss.exe|csrss.exe|services.exe|wininit.exe";
 #endif // RVC_OS_WIN
+	unordered_map<int, long long> oldProcessTime;  // <pid, 旧时刻进程的CPU占用时间>
+	unordered_map<int, long long> newProcessTime;	// <pid, 新时刻进程的CPU占用时间>
+	unordered_map<int, CSimpleStringA> processName;  // <pid, 进程名>
+	unordered_map<int, double> processCpu;	// <pid, CPU占用率>
+
 
     int m_iVerify;
     int m_iNonSignedDisplay;
 	int m_cpuHighPercent, m_memHighPercent, m_diskHighPercent;
 
     BOOL checkActiveBefore;
-	BOOL firstMpage;
+	BOOL neverMainPage;
 	BOOL forceFileOpt;
 
 	std::vector<std::string> keyUserlist;
@@ -292,6 +301,8 @@ private:
 
 	CSimpleStringA m_strLoginedUserName;
 
+	map<string, string> SysProcInfo; //用于记录系统进程
+
 public:
 	void CheckDiskFileSpace();
 
@@ -307,6 +318,8 @@ public:
 		SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req,
 		ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx);
 
+	bool GetNeverMainPageFlag() { return neverMainPage; } //是否未进过首页
+	void GetSystemProccess();
 	void GetSystemCPUStatus();
 	void GetSystemMemoryStatus();
 	void GetSystemDiskStatus();
@@ -379,10 +392,8 @@ public:
 	//2:startmenu lnk from user customization
 	BOOL IsHasSetAutoStartupByFolder(CSimpleStringA& strPath, int& setType);
 	void DetectVersionHasChangedAndWarn();
-	void DetectDestopFileAndWarn(bool bClear, CSimpleStringA& strFileSaveList);
 	bool SetDesktopSysIcon2Registry(const std::string& key, bool toDisplay);
 	void MakeSureWin8IntoDesktopPageAtLogon();
-	void DetectAutoStartFileAndWarn();
 
 	void DetectVersionHasChangedAndWarnCover()
 	{
@@ -392,7 +403,6 @@ public:
 		}
 	}
 	void VerifySignature();
-	void DetectAndClearDesktopFile();
 	void VerifySignature(const CSimpleStringA& filePath);
 	CSimpleStringA GetFileName(const CSimpleStringA& filePath);
 	bool RetrieveDigitalSignatureInfo(const char* pFilePath);
@@ -482,9 +492,7 @@ struct AggerateAutoStatTask : public ITaskSp
 		m_pFSM->DetectWallpaperAndWarn();
 		m_pFSM->DetectAutoStartupCover();
 		m_pFSM->RegOperation4LnkFile();
-		m_pFSM->DetectAndClearDesktopFile();
 		m_pFSM->MakeSureWin8IntoDesktopPageAtLogon();
-		m_pFSM->DetectAutoStartFileAndWarn();
 	}
 };
 
@@ -522,4 +530,27 @@ struct CheckDiskFileSpaceTask : public ITaskSp
 	{
 		m_pFSM->CheckDiskFileSpace();
 	}
+};
+
+//获取系统进程并上送, TerminalStage的值为 A, C, M, S触发
+struct UploadSysProcInfoTask : public ITaskSp
+{
+	ResourceWatcherFSM* m_pFSM;
+	UploadSysProcInfoTask(ResourceWatcherFSM* pFSM) : m_pFSM(pFSM) {}
+	void Process()
+	{
+		CSimpleStringA t_terminalState;
+		DWORD elapsed = 0;
+		DWORD dwStart = SP::Module::Comm::RVCGetTickCount();
+		DWORD dwEnd = SP::Module::Comm::RVCGetTickCount();
+		DWORD checkTimeOut = 5 * 60000; //五分钟超时
+		while (elapsed < checkTimeOut && m_pFSM->GetNeverMainPageFlag()) //到达终态,5分钟未进首页 or 成功进入首页跳出循环
+		{
+			Sleep(60000); //1分钟检测一次进首页状态
+			dwEnd = SP::Module::Comm::RVCGetTickCount();
+			elapsed = dwEnd - dwStart;
+		}
+		m_pFSM->GetSystemCPUStatus();
+		m_pFSM->GetSystemProccess();
+	}
 };

+ 0 - 7
Module/mod_ResourceWatcher/ResourceWatcher_UserCode.h

@@ -3,7 +3,6 @@
 
 #pragma once
 
-#define LOG_RESOURCEWATCHER_SYSTEMINFO 0x50A00004
 #define LOG_RESOURCEWATCHER_COMPOSITING_CHANGE_ON 0x50A00005
 #define LOG_RESOURCEWATCHER_COMPOSITING_CHANGE_OFF 0x50A00006
 #define LOG_RESOURCEWATCHER_CLIPBOARD_REMOVE_FAILED 0x50A0000A
@@ -29,8 +28,6 @@
 
 #define LOG_INFO_MONITOR_SETTINGS	0x50A00035
 #define LOG_INFO_MONITOR_SETTINGS_GET	0x50A00036
-#define LOG_INFO_DEVICE_SMBIOS_GET	0x50A00037
-#define LOG_INFO_SYSTEM_ACTIVATION_INFO	0x50A00038
 
 #define LOG_WARN_VER_DELETE	0x50A00040
 #define LOG_WARN_AUTO_STARTUP_FROM_REGIST 0x50A00041 //注册VBS自启动
@@ -56,16 +53,12 @@
 #define LOG_WARN_PROCESS_STATUS 0x50A00052
 #define LOG_WARN_FILE_DELETE_SUC 0x50A00053
 #define LOG_WARN_ACTIVE_FILE_CHANGE	0x50A00054
-#define LOG_INFO_DESKTOP_FILESTATUS	0x50A00055
 #define LOG_WARN_FILE_DELETE_FAILED	0x50A00057
-#define LOG_INFO_AUTOSTART_FILESTATUS	0x50A00058
-#define LOG_INFO_AUTOSTART_INTEREST_FILESTATUS	0x50A00059
 #define LOG_INFO_LOCAL_VERSION	0x50A0005A //本地终端版本信息
 
 #define LOG_RESOURCEWATCHER_OSD_RECOVER_ENABLE 0x50A00060
 #define LOG_RESOURCEWATCHER_OSD_REMOVE_SUCC 0x50A00061
 #define LOG_RESOURCEWATCHER_DEBUG_STARTUPFILES 0x50A00062
-#define LOG_RESOURCEWATCHER_DEBUG_KEY_STARTUPFILES 0x50A00063
 
 
 #define LOG_EVT_RESOURCE_CPU_ERROR	0x50A00102                //CPU使用率过于异常 > 98%(mod_ResourceWatcher)

+ 0 - 196
Module/mod_ResourceWatcher/ResourceWatcher_client_g.h

@@ -303,55 +303,6 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum GetThirdPartyInstallState(ResourceWatcherService_GetThirdPartyInstallState_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(ResourceWatcherService_Method_GetThirdPartyInstallState, ResourceWatcherService_MethodSignature_GetThirdPartyInstallState, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum GetThirdPartyInstallState(ResourceWatcherService_GetThirdPartyInstallState_Req &Req, ResourceWatcherService_GetThirdPartyInstallState_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetThirdPartyInstallState(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetThirdPartyInstallState(ResourceWatcherService_GetThirdPartyInstallState_Req &Req, ResourceWatcherService_GetThirdPartyInstallState_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetThirdPartyInstallState(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum GetThirdPartyInstallState(ResourceWatcherService_GetThirdPartyInstallState_Req &Req, ResourceWatcherService_GetThirdPartyInstallState_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = GetThirdPartyInstallState(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
 	ErrorCodeEnum InstallThirdPartyProgram(ResourceWatcherService_InstallThirdPartyProgram_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
@@ -401,153 +352,6 @@ public:
 		return Error;
 	}
 
-	ErrorCodeEnum UninstallThirdPartyProgram(ResourceWatcherService_UninstallThirdPartyProgram_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(ResourceWatcherService_Method_UninstallThirdPartyProgram, ResourceWatcherService_MethodSignature_UninstallThirdPartyProgram, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum UninstallThirdPartyProgram(ResourceWatcherService_UninstallThirdPartyProgram_Req &Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = UninstallThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum UninstallThirdPartyProgram(ResourceWatcherService_UninstallThirdPartyProgram_Req &Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = UninstallThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum UninstallThirdPartyProgram(ResourceWatcherService_UninstallThirdPartyProgram_Req &Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = UninstallThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum RestartThirdPartyProgram(ResourceWatcherService_RestartThirdPartyProgram_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(ResourceWatcherService_Method_RestartThirdPartyProgram, ResourceWatcherService_MethodSignature_RestartThirdPartyProgram, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum RestartThirdPartyProgram(ResourceWatcherService_RestartThirdPartyProgram_Req &Req, ResourceWatcherService_RestartThirdPartyProgram_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = RestartThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum RestartThirdPartyProgram(ResourceWatcherService_RestartThirdPartyProgram_Req &Req, ResourceWatcherService_RestartThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = RestartThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum RestartThirdPartyProgram(ResourceWatcherService_RestartThirdPartyProgram_Req &Req, ResourceWatcherService_RestartThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = RestartThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum ProcessDetectThirdPartyProgram(ResourceWatcherService_ProcessDetectThirdPartyProgram_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(ResourceWatcherService_Method_ProcessDetectThirdPartyProgram, ResourceWatcherService_MethodSignature_ProcessDetectThirdPartyProgram, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum ProcessDetectThirdPartyProgram(ResourceWatcherService_ProcessDetectThirdPartyProgram_Req &Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ProcessDetectThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ProcessDetectThirdPartyProgram(ResourceWatcherService_ProcessDetectThirdPartyProgram_Req &Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ProcessDetectThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum ProcessDetectThirdPartyProgram(ResourceWatcherService_ProcessDetectThirdPartyProgram_Req &Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = ProcessDetectThirdPartyProgram(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
 	ErrorCodeEnum FilesClean(ResourceWatcherService_FilesClean_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
 	{
 		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();

+ 0 - 129
Module/mod_ResourceWatcher/ResourceWatcher_def_g.h

@@ -17,11 +17,7 @@ namespace ResourceWatcher {
 #define ResourceWatcherService_Method_CheckNetType 5
 #define ResourceWatcherService_Method_GetBizLinks 6
 #define ResourceWatcherService_Method_BizLinkDetect 7
-#define ResourceWatcherService_Method_GetThirdPartyInstallState 10
 #define ResourceWatcherService_Method_InstallThirdPartyProgram 11
-#define ResourceWatcherService_Method_UninstallThirdPartyProgram 14
-#define ResourceWatcherService_Method_RestartThirdPartyProgram 15
-#define ResourceWatcherService_Method_ProcessDetectThirdPartyProgram 16
 #define ResourceWatcherService_Method_FilesClean 17
 #define ResourceWatcherService_Method_FetchSystemSnapshot 20
 #define ResourceWatcherService_Method_CheckIsFileExists 21
@@ -31,11 +27,7 @@ namespace ResourceWatcher {
 #define ResourceWatcherService_MethodSignature_CheckNetType 1341887614
 #define ResourceWatcherService_MethodSignature_GetBizLinks 651862197
 #define ResourceWatcherService_MethodSignature_BizLinkDetect 1476437131
-#define ResourceWatcherService_MethodSignature_GetThirdPartyInstallState -15861483
 #define ResourceWatcherService_MethodSignature_InstallThirdPartyProgram -1049249852
-#define ResourceWatcherService_MethodSignature_UninstallThirdPartyProgram -2137706699
-#define ResourceWatcherService_MethodSignature_RestartThirdPartyProgram -534704262
-#define ResourceWatcherService_MethodSignature_ProcessDetectThirdPartyProgram -1692430185
 #define ResourceWatcherService_MethodSignature_FilesClean 624348486
 #define ResourceWatcherService_MethodSignature_FetchSystemSnapshot -1005346345
 #define ResourceWatcherService_MethodSignature_CheckIsFileExists -339255831
@@ -45,11 +37,7 @@ namespace ResourceWatcher {
 #define ResourceWatcherService_LogCode_CheckNetType "QLR040250A05"
 #define ResourceWatcherService_LogCode_GetBizLinks "QLR040250A06"
 #define ResourceWatcherService_LogCode_BizLinkDetect "QLR040250A07"
-#define ResourceWatcherService_LogCode_GetThirdPartyInstallState "QLR040250A10"
 #define ResourceWatcherService_LogCode_InstallThirdPartyProgram "QLR040250A11"
-#define ResourceWatcherService_LogCode_UninstallThirdPartyProgram "QLR040250A14"
-#define ResourceWatcherService_LogCode_RestartThirdPartyProgram "QLR040250A15"
-#define ResourceWatcherService_LogCode_ProcessDetectThirdPartyProgram "QLR040250A16"
 #define ResourceWatcherService_LogCode_FilesClean "QLR040250A17"
 #define ResourceWatcherService_LogCode_FetchSystemSnapshot "QLR040250A20"
 #define ResourceWatcherService_LogCode_CheckIsFileExists "QLR040250A21"
@@ -212,39 +200,6 @@ struct ResourceWatcherService_BizLinkDetect_Ans
 
 };
 
-struct ResourceWatcherService_GetThirdPartyInstallState_Req
-{
-	int mode;
-	int reserved1;
-	int reserved2;
-	CSimpleStringA reserverd3;
-	CSimpleStringA reserverd4;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & mode & reserved1 & reserved2 & reserverd3 & reserverd4;
-	}
-
-};
-
-struct ResourceWatcherService_GetThirdPartyInstallState_Ans
-{
-	int status;
-	CSimpleStringA version;
-	CSimpleStringA path;
-	CSimpleStringA reserverd1;
-	CSimpleStringA reserverd2;
-	int reserverd3;
-	int reserverd4;
-	CSimpleStringA terminalVer;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & status & version & path & reserverd1 & reserverd2 & reserverd3 & reserverd4 & terminalVer;
-	}
-
-};
-
 struct ResourceWatcherService_InstallThirdPartyProgram_Req
 {
 	int type;
@@ -274,90 +229,6 @@ struct ResourceWatcherService_InstallThirdPartyProgram_Ans
 
 };
 
-struct ResourceWatcherService_UninstallThirdPartyProgram_Req
-{
-	int type;
-	int reserved1;
-	int reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & type & reserved1 & reserved2;
-	}
-
-};
-
-struct ResourceWatcherService_UninstallThirdPartyProgram_Ans
-{
-	int result;
-	CSimpleStringA msg;
-	CSimpleStringA reserverd1;
-	CSimpleStringA reserverd2;
-	CSimpleStringA terminalVer;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & msg & reserverd1 & reserverd2 & terminalVer;
-	}
-
-};
-
-struct ResourceWatcherService_RestartThirdPartyProgram_Req
-{
-	int type;
-	int reserved1;
-	int reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & type & reserved1 & reserved2;
-	}
-
-};
-
-struct ResourceWatcherService_RestartThirdPartyProgram_Ans
-{
-	int result;
-	CSimpleStringA msg;
-	CSimpleStringA reserverd1;
-	CSimpleStringA reserverd2;
-	CSimpleStringA terminalVer;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & msg & reserverd1 & reserverd2 & terminalVer;
-	}
-
-};
-
-struct ResourceWatcherService_ProcessDetectThirdPartyProgram_Req
-{
-	int type;
-	int reserved1;
-	int reserved2;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & type & reserved1 & reserved2;
-	}
-
-};
-
-struct ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans
-{
-	int result;
-	CSimpleStringA msg;
-	CSimpleStringA reserverd1;
-	CSimpleStringA reserverd2;
-	CSimpleStringA terminalVer;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & result & msg & reserverd1 & reserverd2 & terminalVer;
-	}
-
-};
-
 struct ResourceWatcherService_FilesClean_Req
 {
 	int type;

+ 0 - 108
Module/mod_ResourceWatcher/ResourceWatcher_server_g.h

@@ -65,13 +65,6 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ResourceWatcherService_Method_GetThirdPartyInstallState:
-			if (dwSignature == ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case ResourceWatcherService_Method_InstallThirdPartyProgram:
 			if (dwSignature == ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
 				bOverlap = true;
@@ -79,27 +72,6 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ResourceWatcherService_Method_UninstallThirdPartyProgram:
-			if (dwSignature == ResourceWatcherService_MethodSignature_UninstallThirdPartyProgram) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case ResourceWatcherService_Method_RestartThirdPartyProgram:
-			if (dwSignature == ResourceWatcherService_MethodSignature_RestartThirdPartyProgram) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case ResourceWatcherService_Method_ProcessDetectThirdPartyProgram:
-			if (dwSignature == ResourceWatcherService_MethodSignature_ProcessDetectThirdPartyProgram) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case ResourceWatcherService_Method_FilesClean:
 			if (dwSignature == ResourceWatcherService_MethodSignature_FilesClean) {
 				bOverlap = true;
@@ -157,31 +129,11 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ResourceWatcherService_Method_GetThirdPartyInstallState:
-			if (dwSignature != ResourceWatcherService_MethodSignature_GetThirdPartyInstallState) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case ResourceWatcherService_Method_InstallThirdPartyProgram:
 			if (dwSignature != ResourceWatcherService_MethodSignature_InstallThirdPartyProgram) {
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
-		case ResourceWatcherService_Method_UninstallThirdPartyProgram:
-			if (dwSignature != ResourceWatcherService_MethodSignature_UninstallThirdPartyProgram) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case ResourceWatcherService_Method_RestartThirdPartyProgram:
-			if (dwSignature != ResourceWatcherService_MethodSignature_RestartThirdPartyProgram) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case ResourceWatcherService_Method_ProcessDetectThirdPartyProgram:
-			if (dwSignature != ResourceWatcherService_MethodSignature_ProcessDetectThirdPartyProgram) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
 		case ResourceWatcherService_Method_FilesClean:
 			if (dwSignature != ResourceWatcherService_MethodSignature_FilesClean) {
 				Error = Error_MethodSignatureFailed;
@@ -229,31 +181,11 @@ public:
 	/// override by user
 	}
 
-	virtual void Handle_GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
 	virtual void Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx)
 	{
 	/// override by user
 	}
 
-	virtual void Handle_UninstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_RestartThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req, ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_ProcessDetectThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
 	virtual void Handle_FilesClean(SpReqAnsContext<ResourceWatcherService_FilesClean_Req, ResourceWatcherService_FilesClean_Ans>::Pointer ctx)
 	{
 	/// override by user
@@ -335,16 +267,6 @@ public:
 						Handle_BizLinkDetect(ctx);
 					}
 					break;
-				case ResourceWatcherService_Method_GetThirdPartyInstallState:
-					{
-						SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,ResourceWatcherService_GetThirdPartyInstallState_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_GetThirdPartyInstallState(ctx);
-					}
-					break;
 				case ResourceWatcherService_Method_InstallThirdPartyProgram:
 					{
 						SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx;
@@ -355,36 +277,6 @@ public:
 						Handle_InstallThirdPartyProgram(ctx);
 					}
 					break;
-				case ResourceWatcherService_Method_UninstallThirdPartyProgram:
-					{
-						SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req,ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req,ResourceWatcherService_UninstallThirdPartyProgram_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_UninstallThirdPartyProgram(ctx);
-					}
-					break;
-				case ResourceWatcherService_Method_RestartThirdPartyProgram:
-					{
-						SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req,ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req,ResourceWatcherService_RestartThirdPartyProgram_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_RestartThirdPartyProgram(ctx);
-					}
-					break;
-				case ResourceWatcherService_Method_ProcessDetectThirdPartyProgram:
-					{
-						SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req,ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req,ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_ProcessDetectThirdPartyProgram(ctx);
-					}
-					break;
 				case ResourceWatcherService_Method_FilesClean:
 					{
 						SpReqAnsContext<ResourceWatcherService_FilesClean_Req,ResourceWatcherService_FilesClean_Ans>::Pointer ctx;

+ 0 - 703
Module/mod_ResourceWatcher/mod_ResourceWatcher.cpp

@@ -74,13 +74,6 @@ void ResourceWatcherServiceSession::Handle_GetBizLinks(SpReqAnsContext<ResourceW
     m_pEntity->GetBizLinks(ctx);
 }
 
-void ResourceWatcherServiceSession::Handle_GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(ResourceWatcherService_LogCode_GetThirdPartyInstallState).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->GetThirdPartyInstallState(ctx);
-}
-
 void ResourceWatcherServiceSession::Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx)
 {
     DbgToBeidou(ctx->link, __FUNCTION__)();
@@ -88,27 +81,6 @@ void ResourceWatcherServiceSession::Handle_InstallThirdPartyProgram(SpReqAnsCont
     m_pEntity->InstallThirdPartyProgram(ctx);
 }
 
-void ResourceWatcherServiceSession::Handle_UninstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(ResourceWatcherService_LogCode_UninstallThirdPartyProgram).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->UninstallThirdPartyProgram(ctx);
-}
-
-void ResourceWatcherServiceSession::Handle_RestartThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req, ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(ResourceWatcherService_LogCode_RestartThirdPartyProgram).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->RestartThirdPartyProgram(ctx);
-}
-
-void ResourceWatcherServiceSession::Handle_ProcessDetectThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx)
-{
-    DbgToBeidou(ctx->link, __FUNCTION__)();
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(ResourceWatcherService_LogCode_ProcessDetectThirdPartyProgram).setAPI(__FUNCTION__)(__FUNCTION__);
-    m_pEntity->ProcessDetectThirdPartyProgram(ctx);
-}
-
 void ResourceWatcherServiceSession::Handle_FilesClean(SpReqAnsContext<ResourceWatcherService_FilesClean_Req, ResourceWatcherService_FilesClean_Ans>::Pointer ctx)
 {
     DbgToBeidou(ctx->link, __FUNCTION__)();
@@ -240,7 +212,6 @@ std::string TryToGetSogouVersionEx()
             DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("cat sogou version return empty!");
         }
         else {
-            DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cat sogou version returned: %s", succStr.c_str());
             return succStr;
         }
     }
@@ -594,334 +565,6 @@ void ResourceWatcherEntity::InstallThirdPartyProgram(SpReqAnsContext<ResourceWat
     return;
 }
 
-void ResourceWatcherEntity::UninstallSogou(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx)
-{
-    ErrorCodeEnum result(Error_Succeed);
-    ErrorCodeEnum tmpResult(Error_Succeed);
-    CSimpleStringA tmpMsg(true);
-
-    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to uninstall sogou input...");
-
-#if defined(RVC_OS_LINUX)
-    CSimpleStringA strUninstallScriptFile(true);
-    SogouInstallInfo info;
-    do {
-        ErrorCodeEnum ecGet = GetSogouInstallInfo(info);
-        if (info.program.IsTSFVersion()) {
-            CSimpleStringA shellScriptPath;
-            GetFunction()->GetPath("Base", shellScriptPath);
-            shellScriptPath += SPLIT_SLASH_STR;
-            shellScriptPath += "res" SPLIT_SLASH_STR "RunScript" SPLIT_SLASH_STR;
-            strUninstallScriptFile = shellScriptPath + "uninstall_tfs_sogouimebs.sh";
-            if (!ExistsFileA(strUninstallScriptFile)) {
-                tmpMsg = CSimpleStringA::Format("%s 文件不存在!", strUninstallScriptFile.GetData());
-                tmpResult = Error_InvalidState;
-                break;
-            }
-            char app[MAX_PATH] = { '\0' };
-            sprintf(app, "bash %s", strUninstallScriptFile.GetData());
-            tmpResult = RunShellScript(app);
-            if (tmpResult != 0) {
-                tmpMsg = CSimpleStringA::Format("执行 '%s' 失败", app);
-            }
-            else {
-                Sleep(300);
-            }
-        }
-        else {
-            CSimpleStringA strInstallPkgPath;
-            tmpResult = GetSogouPkgDirPath(strInstallPkgPath);
-            if (tmpResult == Error_Succeed) {
-                tmpResult = SetFileExecutePriviledge(strInstallPkgPath);
-                if (tmpResult != Error_Succeed) {
-                    tmpMsg = CSimpleStringA::Format("%s 修改文件夹权限失败", strInstallPkgPath.GetData());
-                    tmpResult = Error_NoPrivilege;
-                    break;
-                }
-                const CSimpleStringA strShutdownScriptFile = strInstallPkgPath + SPLIT_SLASH_STR + "shutdown_service.sh";
-                strUninstallScriptFile = strInstallPkgPath + SPLIT_SLASH_STR + "uninstall_sogouime.sh";
-                if (!ExistsFileA(strShutdownScriptFile)) {
-                    tmpMsg = CSimpleStringA::Format("%s 文件不存在!", strShutdownScriptFile.GetData());
-                    tmpResult = Error_InvalidState;
-                    break;
-                }
-                if (!ExistsFileA(strUninstallScriptFile)) {
-                    tmpMsg = CSimpleStringA::Format("%s 文件不存在!", strUninstallScriptFile.GetData());
-                    tmpResult = Error_InvalidState;
-                    break;
-                }
-                char app[MAX_PATH] = { '\0' };
-                sprintf(app, "bash %s", strShutdownScriptFile.GetData());
-                tmpResult = RunShellScript(app);
-                if (tmpResult != 0) {
-                    tmpMsg = CSimpleStringA::Format("执行 '%s' 失败", app);
-                }
-                else {
-                    Sleep(300);
-                    sprintf(app, "bash %s", strUninstallScriptFile.GetData());
-                    tmpResult = RunShellScript(app);
-                    if (tmpResult != 0) {
-                        tmpMsg = CSimpleStringA::Format("执行 '%s' 失败", app);
-                    }
-                    else {
-                        Sleep(100);
-                    }
-                }
-            }
-            else {
-                tmpMsg = CSimpleStringA::Format(" 指定位置 [Ad] 找不到输入法安装包");
-                tmpResult = Error_InvalidState;
-                break;
-            }
-        }
-
-    } while (false);
-#else
-    SogouInstallInfo info;
-    GetSogouInstallInfo(info);
-    CSimpleStringA uninPath = info.program.strInstallDir + "\\" + info.program.strVersion + "\\Uninstall.exe";
-    int startFlag = WinExec(uninPath.GetData(), SW_SHOWNORMAL);
-    if (startFlag > 31) {
-        tmpMsg = CSimpleStringA::Format("已执行搜狗卸载程序!路径:%s。", uninPath.GetData());
-    }
-    else {
-        tmpMsg = CSimpleStringA::Format("执行搜狗卸载程序异常!路径:%s。", uninPath.GetData());
-        tmpResult = Error_Unexpect;
-    }
-#endif //RVC_OS_LINUX
-
-    ctx->Ans.result = tmpResult;
-    ctx->Ans.msg = tmpMsg;
-    ctx->Answer(result);
-}
-
-void ResourceWatcherEntity::UninstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx)
-{
-    ErrorCodeEnum result(Error_Succeed);
-    ErrorCodeEnum tmpResult(Error_Succeed);
-    CSimpleStringA tmpMsg(true);
-
-    LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHE_UNINSTALL_THIRDPARTYPROGRAM,
-        CSimpleStringA::Format("UninstallThirdPartyProgram: ctx-req context: %d, %d, %d", ctx->Req.type, ctx->Req.reserved1, ctx->Req.reserved2));
-
-    if (ctx->Req.type == 1) {
-        //卸载搜狗输入法
-#if defined(RVC_OS_LINUX)
-        UninstallSogouTask* sogouUninstall = new UninstallSogouTask(this);
-        sogouUninstall->ctx = ctx;
-        GetFunction()->PostThreadPoolTask(sogouUninstall);
-        return;
-#else
-        UninstallSogou(ctx);
-#endif //RVC_OS_LINUX
-
-    }
-    else {
-        tmpMsg = CSimpleStringA::Format("接口调用参数错误");
-        result = Error_NotSupport;
-    }
-    ctx->Ans.result = tmpResult;
-    ctx->Ans.msg = tmpMsg;
-    ctx->Answer(result);
-    return;
-}
-
-void ResourceWatcherEntity::RestartThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req, ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx)
-{
-    ErrorCodeEnum result(Error_Succeed);
-    ErrorCodeEnum tmpResult(Error_Succeed);
-    CSimpleStringA tmpMsg(true);
-
-    LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHE_RESTART_THIRDPARTYPROGRAM,
-        CSimpleStringA::Format("RestartThirdPartyProgram: ctx-req context: %d, %d, %d", ctx->Req.type, ctx->Req.reserved1, ctx->Req.reserved2));
-
-    if (ctx->Req.type == 1)
-    {
-        SogouInstallInfo info;
-        GetSogouInstallInfo(info);
-
-        if (!info.program.IsTSFVersion())
-        {
-            //重启搜狗输入法
-#if defined(RVC_OS_WIN)
-            CSimpleStringA csBinPath;
-            ErrorCodeEnum eErrPath = GetFunction()->GetPath("Bin", csBinPath);
-            CSimpleStringA startPath = csBinPath + "\\spScript\\SogouServStarter.bat";
-
-            if (eErrPath != Error_Succeed) {
-                tmpResult = Error_NotExist;
-                tmpMsg = "获取重启脚本路径失败。";
-            }
-            else if (!ExistsFileA(startPath)) {
-                tmpResult = Error_NotExist;
-                tmpMsg = CSimpleStringA::Format("搜狗重启脚本不存在。");
-            }
-            else {
-                CAutoArray<CSimpleStringA> pName(2);
-                pName[0] = "SogouImeMon.exe";
-                pName[1] = "SogouImeWebSrv.exe";
-
-                if (!KillProcessFromName(pName[0]) || !KillProcessFromName(pName[1])) {
-                    tmpMsg = CSimpleStringA::Format("杀死当前搜狗进程失败。");
-                    tmpResult = Error_Unexpect;
-                }
-                else {
-                    STARTUPINFO si = { sizeof(si) };
-                    PROCESS_INFORMATION pi;
-                    si.dwFlags = STARTF_USESHOWWINDOW;
-                    si.wShowWindow = TRUE;
-                    char* cmdline = const_cast<LPSTR>(startPath.GetData());
-                    BOOL bRet = ::CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
-                    WaitForSingleObject(pi.hProcess, INFINITE);
-                    std::string res = DoCheckCertainProcessStatus(pName);
-                    if (res.size() > 0) {
-                        tmpMsg = CSimpleStringA::Format("已成功重启搜狗输入法进程!路径:%s。", startPath.GetData());
-                    }
-                    else {
-                        tmpMsg = CSimpleStringA::Format("重启搜狗进程失败!路径:%s。", startPath.GetData());
-                        tmpResult = Error_Unexpect;
-                    }
-                }
-            }
-#else
-            static int old_process_id[2] = { -1, -1 };
-            char* relate_processes[2] = { "sogouImeWebSrv", "sogouImeService" };
-
-            int count = 3;
-            alive_process_info processes[3];
-            memset(processes, 0, sizeof(processes));
-
-            osutil_detect_unique_app(relate_processes, array_size(relate_processes), &count, processes);
-
-            CAutoArray<CSimpleStringA> msgs(array_size(relate_processes));
-            int cnt(0);
-
-            for (int i = 0; i < array_size(relate_processes); ++i) {
-                int k = -1;
-                for (int j = 0; j < count; ++j) {
-                    if (strcmp(processes[j].name, relate_processes[i]) == 0) {
-                        k = j;
-                        break;
-                    }
-                }
-                if (k != -1) {
-                    cnt++;
-                    old_process_id[k] = processes[k].pid;
-                    std::string sucContent, failedContent;
-                    CSimpleStringA strCmd = CSimpleStringA::Format("kill -9 %d", old_process_id[k]);
-                    bool ret = SP::Module::Util::ShellExecute(strCmd.GetData(), sucContent, failedContent);
-                    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("{%s}:{%s}{%s}", strCmd.GetData(), sucContent.c_str(), failedContent.c_str());
-                }
-            }
-
-            int cnt2(0);
-            if (cnt > 0) {
-                ///**TODO(Gifur@7/5/2022): 待优化处理 */
-                Sleep(2000);
-                int newCount = 3;
-                int notSame = 0;
-                vector<CSimpleStringA> tKillmsg;
-                alive_process_info newProcesses[3];
-                memset(newProcesses, 0, sizeof(newProcesses));
-                osutil_detect_unique_app(relate_processes, array_size(relate_processes), &newCount, newProcesses);
-                for (int i = 0; i < array_size(relate_processes); ++i) {
-                    int k = -1;
-                    for (int j = 0; j < count; ++j) {
-                        if (strcmp(newProcesses[j].name, relate_processes[i]) == 0 && newProcesses[j].pid > 0) {
-                            k = j;
-                            break;
-                        }
-                    }
-                    if (k != -1) {
-                        cnt2++;
-                        if (newProcesses[k].pid != old_process_id[k]) {
-                            notSame++;
-                        }
-                        else {
-                            tmpResult = Error_Unexpect;
-                            CSimpleStringA tmsg = CSimpleStringA::Format("{杀死当前搜狗进程[%s]失败,pid[%d]。}",
-                                newProcesses[k].name, newProcesses[k].pid);
-                            tKillmsg.push_back(tmsg);
-                        }
-                    }
-                }
-
-                if (cnt2 == 0) {
-                    tmpMsg = "已杀死搜狗进程。但重启搜狗进程失败,请确认守护进程正常运行。";
-                    tmpResult = Error_Unexpect;
-                }
-                else {
-                    if (tKillmsg.size() != 0) {
-                        for (int i = 0; i < tKillmsg.size(); ++i) {
-                            tmpMsg += tKillmsg[i];
-                        }
-                    }
-                    else {
-                        tmpMsg = "已成功重启搜狗输入法进程。";
-                    }
-                }
-            }
-            else {
-                tmpMsg = "当前系统无搜狗进程,请确认已安装搜狗输入法,并重启计算机以尝试启动搜狗输入法!";
-                tmpResult = Error_Unexpect;
-            }
-#endif //RVC_OS_WIN
-        }
-        else
-        {
-            tmpResult = Error_NotSupport;
-            tmpMsg = CSimpleStringA::Format("新搜狗版本,不支持重启功能");
-        }
-    }
-    else
-    {
-        tmpResult = Error_Param;
-        tmpMsg = CSimpleStringA::Format("接口调用参数错误。");
-    }
-
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM) ("用户桌面重启:%s. result:%d.", tmpMsg.GetData(), tmpResult);
-    LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHE_RESTART_THIRDPARTYPROGRAM,
-        CSimpleStringA::Format("用户桌面重启:%s. result:%d.", tmpMsg.GetData(), tmpResult));
-    ctx->Ans.result = tmpResult;
-    ctx->Ans.msg = tmpMsg;
-
-    ctx->Answer(result);
-    return;
-}
-
-void ResourceWatcherEntity::ProcessDetectThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx)
-{
-    ErrorCodeEnum result(Error_Succeed);
-    ErrorCodeEnum tmpResult(Error_Succeed);
-
-    CSimpleStringA tmpMsg(true);
-    std::string res("");
-
-    if (ctx->Req.type == 1) {//检测搜狗输入法进程
-        CAutoArray<CSimpleStringA> pName(2);
-#if defined(RVC_OS_WIN)
-        pName[0] = "SogouImeMon.exe";
-        pName[1] = "SogouImeWebSrv.exe";
-#else
-        pName[0] = "sogouImeWebSrv";
-        pName[1] = "sogouImeService";
-#endif //RVC_OS_WIN
-        res = DoCheckCertainProcessStatus(pName);
-        if (res.length() == 0) {
-            tmpResult = Error_Failed;
-            tmpMsg = "当前系统无搜狗进程";
-        }
-        else {
-            tmpMsg = CSimpleStringA::Format("%s", res.c_str());
-        }
-    }
-
-    ctx->Ans.result = tmpResult;
-    ctx->Ans.msg = tmpMsg;
-    ctx->Answer(result);
-    return;
-}
-
 ErrorCodeEnum ResourceWatcherEntity::ReportSogouInstallState()
 {
     CSmartPointer<IEntityFunction> spFunction = GetFunction();
@@ -1228,222 +871,6 @@ BOOL ResourceWatcherEntity::KillProcessFromName(const CSimpleStringA& strProcess
 
 #endif //RVC_OS_LINUX
 
-void ResourceWatcherEntity::DoCheckSogouProcessStatus()
-{
-#if defined(RVC_OS_WIN)
-    if (lastUpgradeInstallTime != 0 && lastUpgradeSwitchTime != 0 && lastUpgradeInstallTime < lastUpgradeSwitchTime) //完整记录了上一次升级的时间
-    {
-        if (sogouChangeTime.size() != 0) {
-            for (int i = 0; i < sogouChangeWarn.size(); i++) {
-                if (newestSogouInstall) //搜狗升级
-                {
-                    //正常不用告警
-                   /* LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, (sogouChangeWarn[i] + "搜狗升级切换1").GetData());
-                    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z102")("搜狗升级切换1");*/
-                }
-                else //非搜狗升级导致的退出
-                {
-                    LogWarn(Severity_Middle, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, (sogouChangeWarn[i] + "异常切换1").GetData());
-                    DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z103").setResultCode("RTA5A08")("搜狗异常切换1");
-                }
-            }
-
-            sogouChangeTime.clear();
-            sogouChangeWarn.clear();
-
-            lastUpgradeInstallTime = 0;
-            lastUpgradeSwitchTime = 0;
-            newestSogouInstall = false;
-
-            return;
-        }
-    }
-
-    bool fCheck = false;
-    CAutoArray<CSimpleStringA> pName(2);
-    pName[0] = "SogouImeMon.exe";
-    pName[1] = "SogouImeWebSrv.exe";
-    int pSize = pName.GetCount();
-
-    static int old_process_id[2] = { -1, -1 };
-    static int firstCheck[2] = { -1, -1 };
-    CAutoArray<CSimpleStringA> msgs;
-    for (int i = 0; i < pSize; ++i) {
-        /*old_process_id.push_back(-1);*/
-        CSimpleStringA temp("");
-        msgs.Append(&temp, 0, 1);
-    }
-    int cnt(0);
-
-    PROCESSENTRY32 pe32;
-    pe32.dwSize = sizeof(pe32);
-    //获得系统进程快照的句柄  
-    HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-    if (hProcessSnap == INVALID_HANDLE_VALUE) {
-        DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("CreateToolhelp32Snapshot error.");
-        return;
-    }
-    for (int i = 0; i < pSize; ++i) {
-        int position = -1;
-        BOOL bProcess = Process32First(hProcessSnap, &pe32);
-        while (bProcess) {
-            if (strcmp(pe32.szExeFile, pName[i].GetData()) == 0) {
-                position = 1;
-                break;
-            }
-            bProcess = Process32Next(hProcessSnap, &pe32);
-        }
-
-        if (position != -1 && old_process_id[i] == -1) {
-            if (firstCheck[i] == -1) {
-                DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Sougou first check!");
-                msgs[cnt++] = CSimpleStringA::Format("{\"name\":\"%s\", \"pid\":%d}"
-                    , pName[i].GetData(), pe32.th32ProcessID);
-                firstCheck[i] = 1;
-                fCheck = true;
-                sogouProcessRun = 1;
-            }
-            old_process_id[i] = pe32.th32ProcessID;
-        }
-        else if (position != -1 && (pe32.th32ProcessID != old_process_id[i])) {
-            msgs[cnt++] = CSimpleStringA::Format("{\"name\":\"%s\", \"prev\":%d, \"pid\":%d}"
-                , pName[i].GetData(), old_process_id[i], pe32.th32ProcessID);
-            old_process_id[i] = pe32.th32ProcessID;
-
-        }
-        else if (position == -1 && old_process_id[i] > 0) {
-            msgs[cnt++] = CSimpleStringA::Format("{\"name\":\"%s\", \"prev\":%d, \"pid\":%d}"
-                , pName[i].GetData(), old_process_id[i], 0);
-            old_process_id[i] = 0;
-        }
-    }
-
-    std::string uploadInfo("");
-    if (cnt > 0) {
-        if (cnt > 1) {
-            uploadInfo = "{";
-        }
-        for (int i = 0; i < cnt; ++i) {
-            if (i != 0) {
-                uploadInfo += ",";
-            }
-            uploadInfo += msgs[i].GetData();
-        }
-        if (cnt > 1) {
-            uploadInfo += "}";
-        }
-
-        if (fCheck) //首次检测
-        {
-            LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_FIRSTCHECK, uploadInfo.c_str()); //第一次检测
-            lastUpgradeInstallTime = 0;
-            lastUpgradeSwitchTime = 0;
-            newestSogouInstall = false;
-            DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z101")("搜狗首次检测");
-        }
-        else if (newestSogouInstall) {
-            //LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, (uploadInfo + "搜狗升级切换2").c_str()); //升级安装导致的进程切换视为正常退出
-            lastUpgradeInstallTime = 0;
-            lastUpgradeSwitchTime = 0;
-            newestSogouInstall = false;
-            //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z102")("搜狗升级切换2");
-        }
-        else if (time(0) <= lastSogouChangeEndTime) //lastSogouChangeEndTime为状态'I'结束后的60秒
-        {
-            //LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, (uploadInfo + "搜狗升级切换3").c_str()); //升级安装导致的进程切换视为正常退出
-            lastUpgradeInstallTime = 0;
-            lastUpgradeSwitchTime = 0;
-            newestSogouInstall = false;
-            //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z102")("搜狗升级切换3");
-        }
-        else {
-            if (lastUpgradeInstallTime == 0 && lastUpgradeSwitchTime == 0)//非升级时段
-            {
-                LogWarn(Severity_Middle, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, (uploadInfo + "异常切换3").c_str()); //其他情况下的进程切换视为异常退出
-                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040250A01Z103").setResultCode("RTA5A08")("搜狗异常切换3");
-            }
-            else //升级时段,'I'安装中,但是还没有'S'切换时,出现了搜狗进程切换
-            {
-                sogouChangeWarn.push_back(CSimpleStringA(uploadInfo.c_str()));
-                sogouChangeTime.push_back(time(0));
-            }
-        }
-    }
-    else {
-        SogouInstallInfo info;
-        GetSogouInstallInfo(info);
-
-        if (!info.program.IsTSFVersion()) //如果是旧版本搜狗,则检测是否启动
-        {
-            if (sogouProcessRun == 0)//进程未运行
-            {
-                LogWarn(Severity_Middle, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, "搜狗进程未启动!");
-                DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode("QLR040250A01Z101").setResultCode("RTA5A01")("搜狗未启动!");
-                sogouProcessRun = -1; //进程未启动告警一次即可
-            }
-        }
-    }
-    CloseHandle(hProcessSnap);
-
-#else
-    static int old_process_id[2] = { -1, -1 };
-    char* relate_processes[2] = { "sogouImeWebSrv", "sogouImeService" };
-
-    int count = 3;
-    alive_process_info processes[3];
-    memset(processes, 0, sizeof(processes));
-
-    osutil_detect_unique_app(relate_processes, array_size(relate_processes), &count, processes);
-
-    CAutoArray<CSimpleStringA> msgs(array_size(relate_processes));
-    int cnt(0);
-
-    for (int i = 0; i < array_size(relate_processes); ++i) {
-        int k = -1;
-        for (int j = 0; j < count; ++j) {
-            if (strcmp(processes[j].name, relate_processes[i]) == 0) {
-                k = j;
-                break;
-            }
-        }
-
-        if (k != -1 && old_process_id[i] == -1) {
-            old_process_id[i] = processes[k].pid;
-
-        }
-        else if (k != -1 && (processes[k].pid != old_process_id[i])) {
-            msgs[cnt++] = CSimpleStringA::Format("{\"name\":\"%s\", \"prev\":%d, \"pid\":%d}"
-                , relate_processes[i], old_process_id[i], processes[k].pid);
-            old_process_id[i] = processes[k].pid;
-
-        }
-        else if (k == -1 && old_process_id[i] != 0) {
-            msgs[cnt++] = CSimpleStringA::Format("{\"name\":\"%s\", \"prev\":%d, \"pid\":%d}"
-                , relate_processes[i], old_process_id[i], 0);
-            old_process_id[i] = 0;
-        }
-    }
-
-    if (cnt > 0) {
-        std::string uploadInfo("");
-        if (cnt > 1) {
-            uploadInfo = "{";
-        }
-        for (int i = 0; i < cnt; ++i) {
-            if (i != 0) {
-                uploadInfo += ",";
-            }
-            uploadInfo += msgs[i].GetData();
-        }
-        if (cnt > 1) {
-            uploadInfo += "}";
-        }
-
-        LogWarn(Severity_Low, Error_Debug, LOG_RESOURCEWATCHER_SOGOU_PROCESS_STATUS_CHANGE, uploadInfo.c_str());
-    }
-#endif //RVC_OS_WIN
-}
-
 #if defined(RVC_OS_LINUX)
 ErrorCodeEnum ResourceWatcherEntity::GetSogouPkgDirPath(CSimpleStringA& strPkgPath)
 {
@@ -1905,115 +1332,6 @@ ErrorCodeEnum ResourceWatcherEntity::DeleteUnzipDir()
     return Error_Succeed;
 }
 
-void ResourceWatcherEntity::GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx)
-{
-    ErrorCodeEnum result(Error_Succeed);
-    if (ctx->Req.mode == 1) {//查看搜狗输入法安装状态
-        SogouInstallInfo info;
-        GetSogouInstallInfo(info);
-        ctx->Ans.status = info.IsInstalledSuccess() ? 1 : 0;
-        ctx->Ans.path = info.program.strInstallDir;
-        ctx->Ans.version = info.program.strVersion;
-        ctx->Ans.reserverd1 = info.state.GetInstallTime().ToTimeString();
-        ctx->Ans.reserverd2 = "";
-        ctx->Ans.reserverd3 = info.program.IsTSFVersion() ? 1 : 0;
-        ctx->Ans.reserverd4 = 0;
-    }
-    else if (ctx->Req.mode == 2) { //检测字体的安装状态
-#if defined(_MSC_VER)
-        result = Error_NotImpl;
-#else
-        CSimpleStringA strFontDir("/usr/share/fonts/truetype");
-        CSimpleStringA strRVCTTFsDir(strFontDir + SPLIT_SLASH_STR + "RVCTTFs");
-        if (!ExistsDirA(strRVCTTFsDir)) {
-            ctx->Ans.status = 0;
-            ctx->Ans.reserverd1 = CSimpleStringA::Format("%s 文件夹不存在", (LPCTSTR)strRVCTTFsDir);
-        }
-        else {
-            CSimpleStringA ttf1 = strRVCTTFsDir + SPLIT_SLASH_STR + "HYQiHei-55S.ttf";
-            CSimpleStringA ttf2 = strRVCTTFsDir + SPLIT_SLASH_STR + "HYQiHei-65S.ttf";
-            CSimpleStringA ttfdir = strRVCTTFsDir + SPLIT_SLASH_STR + "fonts.dir";
-            CSimpleStringA ttfscale = strRVCTTFsDir + SPLIT_SLASH_STR + "fonts.scale";
-            CSimpleStringA ttfuuid = strRVCTTFsDir + SPLIT_SLASH_STR + ".uuid";
-
-            int existCheck = 0;
-            if (!ExistsFileA(ttf1)) {
-                existCheck |= 1;
-            }
-            if (!ExistsFileA(ttf2)) {
-                existCheck |= 2;
-            }
-            if (!ExistsFileA(ttfdir)) {
-                existCheck |= 4;
-            }
-            if (!ExistsFileA(ttfscale)) {
-                existCheck |= 8;
-            }
-            if (!ExistsFileA(ttfuuid)) {
-                existCheck |= 16;
-            }
-            if (existCheck != 0) {
-                ctx->Ans.status = 0;
-                ctx->Ans.reserverd1 = CSimpleStringA::Format("安装文件不存在:0x%X", existCheck);
-            }
-            else {
-                ctx->Ans.status = 1;
-                ctx->Ans.reserverd1 = "";
-                ctx->Ans.path = strRVCTTFsDir;
-                ctx->Ans.version = "";
-            }
-        }
-#endif //_MSC_VER
-    }
-    else if (ctx->Req.mode == 3) { //自定义安装
-#if defined(RVC_OS_WIN)
-        result = Error_NotSupport;
-#else
-        if (ctx->Req.reserverd3.IsNullOrEmpty()) {
-            DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("the req rerverd3 is empty.");
-            result = Error_Param;
-        }
-        else {
-            DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to check %s 's install status...", ctx->Req.reserverd3.GetData());
-            CSimpleStringA strSoftwareName(ctx->Req.reserverd3);
-            CSimpleStringA strSoftwareVersion(ctx->Req.reserverd4);
-            CSimpleStringA runItem = CSimpleStringA::Format("dpkg -l | grep %s | awk '{print $3}'", strSoftwareName.GetData());
-            std::string additional("");
-            std::string succStr, errStr;
-            std::string runStr(runItem.GetData());
-            if (SP::Module::Util::ShellExecute(runStr, succStr, errStr)) {
-                if (succStr.empty()) {
-                    DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s is not installed", strSoftwareName.GetData());
-                    ctx->Ans.status = 0;
-                }
-                else {
-                    succStr = SP::Utility::ToTrim(succStr);
-                    if (strSoftwareVersion.IsNullOrEmpty() || strSoftwareVersion.Compare(succStr.c_str()) == 0) {
-                        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s is installed, version: %s", strSoftwareName.GetData(), succStr.c_str());
-                        ctx->Ans.status = 1;
-                    }
-                    else {
-                        ctx->Ans.status = 2;
-                        DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s is installed, but the version<%s> is not the dream one<%s>"
-                            , strSoftwareName.GetData(), succStr.c_str(), strSoftwareVersion.GetData());
-                        ctx->Ans.reserverd1 = succStr.c_str();
-                    }
-                }
-            }
-            else {
-                DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Execute <%s> failed.", runItem.GetData());
-                result = Error_Process;
-            }
-        }
-#endif //RVC_OS_WIN
-    }
-    else {
-        result = Error_NotSupport;
-    }
-    ctx->Answer(result);
-    return;
-}
-
 CSimpleStringA ResourceWatcherEntity::GetFilePathWithDir(CSimpleStringA dir, CSimpleStringA fileName)
 {
     CSimpleStringA tmpPath(""), filePath("");
@@ -2584,27 +1902,6 @@ void ResourceWatcherEntity::FilesClean(SpReqAnsContext<ResourceWatcherService_Fi
     ctx->Answer(result);
 }
 
-void ResourceWatcherEntity::OnUpgradeStateEvent(const char* pszEntityName, DWORD dwMessageId, DWORD dwMessageSignature, UpgradeManager::UpgradeStateEvent& evt)
-{
-    DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("OnUpgradeStateEvent, cInstallState:%c, strNewVersion:%s.", evt.cInstallState, evt.strNewVersion.GetData());
-    CSimpleStringA packName = evt.strPackName;
-
-    if (evt.cInstallState == 'I') {
-        lastUpgradeInstallTime = time(0);
-        DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("lastUpgradeInstallTime = %lld.", lastUpgradeInstallTime);
-    }
-
-    if (evt.cInstallState == 'S' || evt.cInstallState == 'C') {
-        lastUpgradeSwitchTime = time(0);
-        DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("lastUpgradeSwitchTime = %lld.", lastUpgradeSwitchTime);
-        if (evt.strNewVersion.GetLength() == 0) {
-            newestSogouInstall = true;
-            lastSogouChangeEndTime = lastUpgradeSwitchTime + 60;
-        }
-        DoCheckSogouProcessStatus();
-    }
-}
-
 void ResourceWatcherEntity::FetchSystemSnapshot(
     SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req, ResourceWatcherService_FetchSystemSnapshot_Ans>::Pointer ctx)
 {

+ 35 - 133
Module/mod_ResourceWatcher/mod_ResourceWatcher.h

@@ -8,12 +8,6 @@
 
 class ResourceWatcherEntity;
 
-#define ENT_TIMERID_CHECK_SOGOU_INPUT_INSTALLED_STATE 1
-#define ENT_TIMERINTERVAL_CHECK_SOGOU_INPUT_INSTALLED_STATE 60 * 1000
-
-#define ENT_TIMERID_CHECK_SOGOU_INPUT_PROCESS_STATUS_CHANGE 3
-#define ENT_TIMERINTERVAL_CHECK_SOGOU_INPUT_PROCESS_STATUS_CHANGE 30 * 1000
-
 #define ENT_TIMERID_PROCESS_CHECK 66
 #define ENT_TIMERINTERVAL_PROCESS_CHECK 60 * 60 * 1000  //进程检测间隔默认一小时
 
@@ -42,16 +36,8 @@ public:
 
 	virtual void Handle_GetBizLinks(SpReqAnsContext<ResourceWatcherService_GetBizLinks_Req, ResourceWatcherService_GetBizLinks_Ans>::Pointer ctx);
 
-	virtual void Handle_GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req, ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx);
-
 	virtual void Handle_InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req, ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx);
 
-	virtual void Handle_UninstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req, ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx);
-
-	virtual void Handle_RestartThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req, ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx);
-
-	virtual void Handle_ProcessDetectThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req, ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx);
-
 	virtual void Handle_FilesClean(SpReqAnsContext<ResourceWatcherService_FilesClean_Req, ResourceWatcherService_FilesClean_Ans>::Pointer ctx);
 
 	virtual void Handle_FetchSystemSnapshot(SpReqAnsContext<ResourceWatcherService_FetchSystemSnapshot_Req, ResourceWatcherService_FetchSystemSnapshot_Ans>::Pointer ctx);
@@ -62,7 +48,7 @@ private:
 	ResourceWatcherEntity* m_pEntity;
 };
 
-class ResourceWatcherEntity : public CEntityBase, public IBroadcastListener, public ITimerListener, public ISysVarListener
+class ResourceWatcherEntity : public CEntityBase, public ITimerListener, public ISysVarListener
 {
 public:
 	ResourceWatcherEntity(){}
@@ -82,26 +68,7 @@ public:
 
 		ErrorCodeEnum errorCode = Error_Succeed;
 
-		errorCode = m_fsm.Init(this);
-
-		if (errorCode == Error_Succeed) {
-
-            CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
-			newestSogouInstall = false;
-			lastUpgradeInstallTime = 0; //上次升级安装时间
-			lastUpgradeSwitchTime = 0;  //上次升级切换时间
-			lastSogouChangeEndTime = 0;    //上一次切换结束判定的时间
-			sogouProcessRun = 0;      //搜狗进程是否启动
-
-			errorCode = spEntityFunction->SubscribeBroadcast("UpgradeManager", NULL, this, m_uuidUpgradeStateEventListener);
-			if (errorCode != Error_Succeed)
-			{
-				LOG_TRACE("Subscribe UpgradeManager evt failed 0x%x", errorCode);
-				pTransactionContext->SendAnswer(errorCode);
-				return;
-			}
-		}
-		
+		errorCode = m_fsm.Init(this);		
 		pTransactionContext->SendAnswer(errorCode);
 	}
 
@@ -109,9 +76,9 @@ public:
 	{
 		m_fsm.AfterInit();
 
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to check Sogou input install state...");
 		CSmartPointer<IEntityFunction> spEntityFunction = GetFunction();
-		spEntityFunction->SetTimer(ENT_TIMERID_CHECK_SOGOU_INPUT_INSTALLED_STATE,
-			this, ENT_TIMERINTERVAL_CHECK_SOGOU_INPUT_INSTALLED_STATE);
+		ReportSogouInstallState(); //实体启动时检测搜狗输入法安装状态
 
 		CSimpleStringA uiState;
 		spEntityFunction->GetSysVar("UIState", uiState);
@@ -120,6 +87,25 @@ public:
 		}
 		spEntityFunction->RegistSysVarEvent("UIState", this);
 
+		CSimpleStringA terminalStage;
+		spEntityFunction->GetSysVar("TerminalStage", terminalStage);
+		if (
+			0 == CSimpleStringA("C").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("S").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("M").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("A").Compare(terminalStage, true)
+			)
+		{
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Terminal has been lastStage(%s) before ResourceWatcher start.", terminalStage);
+			m_fsm.TriggerProccessUpload();
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Terminal is starting, regist the teminalStage Event.");
+			spEntityFunction->RegistSysVarEvent("terminalStage", this);
+		}
+		
+
 		CSmartPointer<IConfigInfo> spCtSettingConfig;
 		GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
 
@@ -233,21 +219,9 @@ public:
 		ctx->Answer(Error_NotSupport);
 	}
 
-	void GetThirdPartyInstallState(SpReqAnsContext<ResourceWatcherService_GetThirdPartyInstallState_Req,
-		ResourceWatcherService_GetThirdPartyInstallState_Ans>::Pointer ctx);
-
 	void InstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,
 		ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx);
 
-	void UninstallThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req,
-		ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx);
-
-	void RestartThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_RestartThirdPartyProgram_Req,
-		ResourceWatcherService_RestartThirdPartyProgram_Ans>::Pointer ctx);
-
-	void ProcessDetectThirdPartyProgram(SpReqAnsContext<ResourceWatcherService_ProcessDetectThirdPartyProgram_Req,
-		ResourceWatcherService_ProcessDetectThirdPartyProgram_Ans>::Pointer ctx);
-
 	void FilesClean(SpReqAnsContext<ResourceWatcherService_FilesClean_Req,
 		ResourceWatcherService_FilesClean_Ans>::Pointer ctx);
 
@@ -256,89 +230,40 @@ public:
 	void InstallSogou(SpReqAnsContext<ResourceWatcherService_InstallThirdPartyProgram_Req,
 		ResourceWatcherService_InstallThirdPartyProgram_Ans>::Pointer ctx);
 
-	void UninstallSogou(SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req,
-		ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx);
-
 	void CheckIsFileExists(SpReqAnsContext<ResourceWatcherService_CheckIsFileExists_Req, 
 		ResourceWatcherService_CheckIsFileExists_Ans>::Pointer ctx);
-
 	int CheckMediaResource(int iFileType, const char* pFileName);
-
-#if defined(_MSC_VER)
-	SP_BEGIN_MSG_DISPATCH_MAP(ResourceWatcherEntity)
-		SP_BEGIN_ENTITY_MSG("UpgradeManager")
-		SP_MSG_HANDLE_NS(UpgradeManager, UpgradeStateEvent, OnUpgradeStateEvent)
-		SP_END_ENTITY_MSG()
-		SP_END_MSG_DISPATCH_MAP()
-#else
-	virtual void OnBroadcastEvent(CUUID SubID, const char* pszEntityName, DWORD dwMessageId, DWORD dwMessageSignature, CAutoBuffer Buffer) \
-	{
-		if (!pszEntityName) {
-			LOG_TRACE("pszEntityName cannot empty!");
-		}
-		else if (_stricmp("UpgradeManager", pszEntityName) == 0) {
-			switch (dwMessageId) {
-			case eMsg_UpgradeStateEvent:
-				if (eMsgSig_UpgradeStateEvent == dwMessageSignature) {
-					UpgradeManager::UpgradeStateEvent t;
-					ErrorCodeEnum Error = SpBuffer2Object(Buffer, t);
-					if (Error == Error_Succeed)
-						OnUpgradeStateEvent(pszEntityName, dwMessageId, dwMessageSignature, t);
-				}
-				else {
-					LOG_TRACE("%s signature mismatched!", "UpgradeStateEvent");
-				}
-				break;
-			default:
-				LOG_TRACE("msg id %d ignored!", dwMessageId);
-				break;
-			}
-		}
-		else {
-			LOG_TRACE("ignore pszEntityName");
-		}
-	}
-#endif //_MSC_VER
 	void OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName)
 	{
 		if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0)) {
 			m_fsm.TriggerAtStatusChanged(_strnicmp(pszValue, "M", strlen("M")) == 0);
 		}
+		else if ((_strnicmp(pszKey, "TerminalStage", strlen("TerminalStage")) == 0)) {
+			if (0 == CSimpleStringA("C").Compare(pszValue, true)
+				|| 0 == CSimpleStringA("S").Compare(pszValue, true)
+				|| 0 == CSimpleStringA("M").Compare(pszValue, true)
+				|| 0 == CSimpleStringA("A").Compare(pszValue, true)
+				)
+			{
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Status changed, teminalStage = %s.", pszValue);
+				m_fsm.TriggerProccessUpload();
+			}
+		}
 	}
 private:
 
-	void OnUpgradeStateEvent(const char* pszEntityName, DWORD dwMessageId, DWORD dwMessageSignature, UpgradeManager::UpgradeStateEvent& evt);
-
 	//report sogou input software install state and installed information
 	ErrorCodeEnum ReportSogouInstallState();
 
 	void OnTimeout(DWORD dwTimerID)
 	{
-		if (dwTimerID == ENT_TIMERID_CHECK_SOGOU_INPUT_INSTALLED_STATE) {
-
-			CSimpleStringA strState;
-			auto err = GetFunction()->GetSysVar("UIState", strState);
-
-			if (err == Error_Succeed && strState == "M") {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to check Sogou input install state...");
-				if (Error_Succeed == ReportSogouInstallState()) {//如果安装了搜狗输入法,就去除检测搜狗输入法安装的定时器,并设置进程检测的定时器。
-					GetFunction()->KillTimer(ENT_TIMERID_CHECK_SOGOU_INPUT_INSTALLED_STATE);
-					GetFunction()->SetTimer(ENT_TIMERID_CHECK_SOGOU_INPUT_PROCESS_STATUS_CHANGE,
-						this, ENT_TIMERINTERVAL_CHECK_SOGOU_INPUT_PROCESS_STATUS_CHANGE);
-				}
-			}
-		}
-		else if (dwTimerID == ENT_TIMERID_CHECK_SOGOU_INPUT_PROCESS_STATUS_CHANGE) {
-			DoCheckSogouProcessStatus();
-		}
-		else if (dwTimerID == ENT_TIMERID_PROCESS_CHECK) {
+		if (dwTimerID == ENT_TIMERID_PROCESS_CHECK) {
 			CheckProcessStatus();
 		}
 		else {
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Unkonwn timer id: %u", dwTimerID);
 		}
 	}
-	void DoCheckSogouProcessStatus();
 	std::string DoCheckCertainProcessStatus(const CAutoArray<CSimpleStringA>& pName);
 	void SecProcCheck(); //检测终端安全软件应用
 
@@ -364,16 +289,6 @@ private:
 
 private:
 	ResourceWatcherFSM m_fsm;
-	CUUID m_uuidUpgradeStateEventListener;
-	BOOL newestSogouInstall; //最近一次安装的标志
-
-	time_t lastUpgradeInstallTime; //上次升级安装时间
-	time_t lastUpgradeSwitchTime;  //上次升级切换时间
-	time_t lastSogouChangeEndTime;    //上一次进程切换时间
-	int sogouProcessRun;
-
-	vector<CSimpleStringA> sogouChangeWarn;
-	vector<time_t> sogouChangeTime;
 };
 
 struct InstallSogouTask : public ITaskSp
@@ -387,17 +302,4 @@ struct InstallSogouTask : public ITaskSp
 	{
 		m_pEntity->InstallSogou(ctx);
 	}
-};
-
-struct UninstallSogouTask : public ITaskSp
-{
-	SpReqAnsContext<ResourceWatcherService_UninstallThirdPartyProgram_Req,
-		ResourceWatcherService_UninstallThirdPartyProgram_Ans>::Pointer ctx;
-
-	ResourceWatcherEntity* m_pEntity;
-	UninstallSogouTask(ResourceWatcherEntity* entity) :m_pEntity(entity) {}
-	void Process()
-	{
-		m_pEntity->UninstallSogou(ctx);
-	}
 };

+ 6 - 6
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -418,12 +418,12 @@ struct GetTokenTask : ITaskSp
 				CSimpleStringA tmsg = CSimpleStringA::Format("{\"errcode\": \"%s\", \"message\": %s}",
 					responseStatus.errorCode.c_str(), getTokenAns.warnMessage.c_str());
 				m_entity->SetAuthErrMsg(tmsg.GetData());
-				m_fsm->GetEntityBase()->GetFunction()->SetSysVar("AuthErrMsg", tmsg.GetData(), true);
+				m_fsm->GetEntityBase()->GetFunction()->SetSysVar("AuthErrMsg", tmsg.GetData());
 			}
 			else
 			{
 				m_entity->SetAuthErrMsg("");
-				m_fsm->GetEntityBase()->GetFunction()->SetSysVar("AuthErrMsg", "", true);
+				m_fsm->GetEntityBase()->GetFunction()->SetSysVar("AuthErrMsg", "");
 			}
 
 			DWORD rc = m_fsm->HandleGetToken((BYTE*)getTokenAns.sharedKey.enToken.c_str(), (BYTE*)getTokenAns.sharedKey.sharedSK.c_str(),
@@ -527,7 +527,7 @@ void CAccessAuthFSM::doWarnMsg(int errReason, std::string errMsg, bool bNeedEven
 	{
 		auto pEntity = (CAccessAuthEntity*)m_pEntity;
 		pEntity->SetAuthErrMsg(fullErrMsg.c_str());
-		const ErrorCodeEnum ec = m_pEntity->GetFunction()->SetSysVar("AuthErrMsg", fullErrMsg.c_str(), true);
+		const ErrorCodeEnum ec = m_pEntity->GetFunction()->SetSysVar("AuthErrMsg", fullErrMsg.c_str());
 		if (ec != Error_Succeed) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Update SysVar failed: 0x%X", ec);
 		}
@@ -535,7 +535,7 @@ void CAccessAuthFSM::doWarnMsg(int errReason, std::string errMsg, bool bNeedEven
 		if (errReason == ERR_ACCESSAUTH_SERVICE_FAILED)
 		{
 			pEntity->SetAuthErrMsg(errMsg.c_str());
-			m_pEntity->GetFunction()->SetSysVar("AuthErrMsg", errMsg.c_str(), true);
+			m_pEntity->GetFunction()->SetSysVar("AuthErrMsg", errMsg.c_str());
 			LogEvent(Severity_Middle, ERR_ACCESSAUTH_SERVICE_FAILED, errMsg.c_str());
 		}
 		else
@@ -802,7 +802,7 @@ DWORD CAccessAuthFSM::HandleGetToken(BYTE* enToken1, BYTE* sharedKey, BYTE* enTo
 	{
 		rc = Error_Bug;
 		pEntity->SetAuthErrMsg("返回令牌校验不通过");
-		pEntity->GetFunction()->SetSysVar("AuthErrMsg", "返回令牌校验不通过", true);
+		pEntity->GetFunction()->SetSysVar("AuthErrMsg", "返回令牌校验不通过");
 		char* sm3Ret = Str2Hex((char*)sm3, 32);
 		delete sm3Ret;
 		doWarnMsg(ERR_ACCESSAUTH_TOKEN_HASH, "返回令牌校验不通过", true);
@@ -821,7 +821,7 @@ DWORD CAccessAuthFSM::HandleGetToken(BYTE* enToken1, BYTE* sharedKey, BYTE* enTo
 		if (rc != Error_Succeed) 
 		{
 			pEntity->SetAuthErrMsg("保存令牌失败");
-			pEntity->GetFunction()->SetSysVar("AuthErrMsg", "保存令牌失败", true);
+			pEntity->GetFunction()->SetSysVar("AuthErrMsg", "保存令牌失败");
 			doWarnMsg(ERR_ACCESSAUTH_SAVE_TOKEN, "保存令牌失败", true);
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA5208")(GetOutPutStr("%s%08X", "SaveTokenAndSharedSK", rc).c_str());
 		}

+ 1 - 1
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -448,7 +448,7 @@ int CAccessAuthEntity::GetPinPadCapability()
 
 void CAccessAuthEntity::printPasswdError(const string& strErrMsg){
 	SetAuthErrMsg(strErrMsg.c_str());
-	GetFunction()->SetSysVar("AuthErrMsg", strErrMsg.c_str(), true);
+	GetFunction()->SetSysVar("AuthErrMsg", strErrMsg.c_str());
 	m_FSM.doWarnMsg( ERROR_ACCESSAUTH_OPENCRYPTCONTEXT, strErrMsg.c_str(),true, strErrMsg);
 	DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA520C")(strErrMsg.c_str());
 }

+ 8 - 33
Module/mod_healthmanager/HealthManagerFSM.cpp

@@ -50,9 +50,7 @@ enum EntityOP
 ErrorCodeEnum CHealthManagerFSM::Initial()
 {
 	m_netList.Init(0);
-#if defined(RVC_OS_WIN)
-	SaveOsVersion();
-#endif
+
 	CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
 	CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
 	CSmartPointer<IAsynWaitSp> spWait;
@@ -144,7 +142,7 @@ unsigned int CHealthManagerFSM::s4_on_event(FSMEvent* pEvt)
 			CSimpleStringA csTermStage;
 			ErrorCodeEnum eErrCode;
 			eErrCode = GetEntityBase()->GetFunction()->GetSysVar("TerminalStage",csTermStage);
-			DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("after accessauth to get termstage %s",(LPCTSTR)csTermStage);
+			DbgWithLink(LOG_LEVEL_DEBUG,LOG_TYPE_SYSTEM)("after accessauth to get termstage %s",(LPCTSTR)csTermStage);
 			//oilyang@20220614 添加密钥更新逻辑
 			if (csTermStage[0] == 'A')
 			{
@@ -330,7 +328,7 @@ int CHealthManagerFSM::AccessAuthDoWork()
 	ErrorCodeEnum eErrCode = GetEntityBase()->GetFunction()->GetSysVar("TerminalStage", csTermStage);
 	if (eErrCode == Error_Succeed)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("before accessauth get TerminalStage %s", csTermStage.GetData());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("before accessauth get TerminalStage %s", csTermStage.GetData());
 		CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
 		CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
 		CEntityRunInfo acInfo;
@@ -348,7 +346,7 @@ int CHealthManagerFSM::AccessAuthDoWork()
 			}
 			break;
 			case EntityState_Idle:
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AccessAuth state idle.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("AccessAuth state idle.");
 				break;
 			default:
 				break;
@@ -632,29 +630,6 @@ void CHealthManagerFSM::PostProcessAfterUpgrade()
 		}
 	}
 }
-void CHealthManagerFSM::SaveOsVersion()
-{
-#if defined(RVC_OS_WIN)
-	CSimpleStringA runInfoPath;
-	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("runinfo", runInfoPath);
-	if (eErr != Error_Succeed) {
-		DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("GetPath runinfo error=%d.", eErr);
-		return;
-	}
-	runInfoPath += "\\runcfg\\osverion";
-	ifstream is;
-	is.open(runInfoPath.GetData(), ios::binary);
-	if (!is.is_open())
-	{
-		DWORD dwErr = GetLastError();
-		DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("open runcfg\\osverion file failed. [%d]", dwErr);
-		CSimpleStringA csCmd;
-		csCmd = CSimpleStringA::Format("cmd /c ver >%s", runInfoPath);
-		WinExec((LPCSTR)csCmd, SW_HIDE);
-	}
-#endif
-	return;
-}
 CSimpleStringA CHealthManagerFSM::GetOsVersion()
 {
 #if defined(RVC_OS_WIN)
@@ -971,14 +946,14 @@ void CHealthManagerFSM::WKUpdatePeriod()
 			m_pACClient = new AccessAuthService_ClientBase(this->GetEntityBase());
 			eErrCode = m_pACClient->Connect();
 			if (eErrCode != Error_Succeed) {
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("accessauth connected failed.");
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("accessauth connected failed:%d", eErrCode);
 				m_pACClient->SafeDelete();
 				m_pACClient = NULL;
 				m_bInAccessAuthDoWork = false;
 				return;
 			}
 			else {
-				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("accessauth connected.");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("accessauth connected.");
 			}
 		}
 
@@ -1072,14 +1047,14 @@ bool CHealthManagerFSM::CheckProcessExistByName(CSimpleStringA procName)
 			do {
 				if (_stricmp(&pe.szExeFile[0], procName.GetData()) == 0)
 				{
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("find %s on this machine.", procName.GetData());
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("find %s on this machine.", procName.GetData());
 					return true;
 				}
 			} while (Process32Next(hSnapshot, &pe));
 		}
 		CloseHandle(hSnapshot);
 	}
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("can't find %s on this machine.", procName.GetData());
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("can't find %s on this machine.", procName.GetData());
 	return false;
 #else
 	return false;

+ 0 - 1
Module/mod_healthmanager/HealthManagerFSM.h

@@ -204,7 +204,6 @@ private:
 	virtual ErrorCodeEnum AsyncContinueEntity(const char *entity_name, void *pData);
 	virtual ErrorCodeEnum AsyncTerminateEntity(const char *entity_name, void *pData);
 	virtual void OnAnswer(CSmartPointer<IAsynWaitSp> pAsynWaitSp);
-	void SaveOsVersion();
 	CSimpleStringA GetOsVersion();
 	int sumday(int year,int month,int day);//¼ÆËãÌìÊý
 	bool CheckProcessExistByName(CSimpleStringA procName);

+ 4 - 4
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -471,7 +471,7 @@ int CHealthManagerEntity::CheckGuardianIsRun(bool bStart)
 		CloseHandle(hSnapshot);
 	}
 	Sleep(1000);
-	DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("cannot find guardian.");
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cannot find guardian.");
 	if (!m_bNeedGuardian)//no need guardian
 	{
 		if (!m_bSayIdle)
@@ -517,7 +517,7 @@ int CHealthManagerEntity::CheckGuardianIsRun(bool bStart)
 		}
 	}
 	else
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("cannot find guardian.");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cannot find guardian.");
 
 	if (!m_bNeedGuardian)//no need guardian
 	{
@@ -767,7 +767,7 @@ bool CHealthManagerEntity::DoRestart()
 	spConfigRun->ReadConfigValue("Run", "VersionEx", m_versionEx);
 	//判断上个版本号值是否为空
 	if(m_versionEx.IsNullOrEmpty()){
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get VersionEx is null");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get VersionEx is null");
 	}
 	spCerConfig->ReadConfigValueInt(GetEntityName(), "MaxTimeWaitMainPageMS", m_maxWaitMainpageTime);
 	if (m_maxWaitMainpageTime < 5000)
@@ -1466,7 +1466,7 @@ void CHealthManagerEntity::OnEntityStateHook(const char* pszEntityName, const ch
 		{
 		case EntityState_Lost:
 		{
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s trigger by %s: from %s to %s", pszEntityName, pszTriggerEntity, SpStrEntityState(eLastState), SpStrEntityState(eState));
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s trigger by %s: from %s to %s", pszEntityName, pszTriggerEntity, SpStrEntityState(eLastState), SpStrEntityState(eState));
 			CSimpleStringA tmpWarnMsg = CSimpleStringA::Format("%s lost. trig entity:%s,lastState:%s", pszEntityName, pszTriggerEntity, SpStrEntityState(eLastState));
 			CEntityStaticInfo esi = { 0 };
 			ErrorCodeEnum ec = GetFunction()->GetEntityStaticInfo(pszEntityName, esi);

+ 53 - 53
Module/mod_pinpad/PinPadFSM.cpp

@@ -17,7 +17,7 @@
 
 using namespace std;
 
-const int PINPAD_INIT_TRIES = 3;
+const int PINPAD_INIT_TRIES = 1;
 const int PINPAD_ANY_INPUT_TIMEOUT = 100;
 const int MAX_PINPAD_INPUT_TIMEOUT = 60000;
 const int MAX_INPUT_TIMER_TIMEOUT = 600000;
@@ -41,21 +41,9 @@ ErrorCodeEnum CPinPadFSM::OnExit()
 	LOG_FUNCTION();
 	m_bEntityExit = true;
 	m_hInputConVar.Broadcast();
-	ErrorCodeEnum eErr = Error_Succeed;
 	if (m_hDevHelper != nullptr)
-	{
-		m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
-		ErrorCodeEnum errClosePinPad = m_hDevHelper->StopInput();
-		m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
-		if (errClosePinPad != Error_Succeed)
-		{
-			DWORD dwUserCode = SetErrorAndLog(errClosePinPad, MEC_DEVAPI_EPP_StopInput, "DevAdapter::StopInput", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime);
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
-				.setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwUserCode))("OnExit:close pinpad(%d).", SpStrError(errClosePinPad));
-		}
 		m_hDevHelper.TearDown();
-	}
-	return eErr;
+	return Error_Succeed;
 }
 void CPinPadFSM::s0_on_entry()
 {
@@ -430,20 +418,7 @@ int CPinPadFSM::Initial()
 	else
 		SetErrorAndLog(eErrDev, MEC_DEVAPI_EPP_GetDevCategory, "DevAdapter::GetDevCategory", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime);
 
-	CSimpleStringA xTmpStr = CSimpleStringA::Format("(hw support):%d,load key :%d,SMSN:%s", m_encryptkey, m_bSMLoaded, m_keySNSM.GetData());
-	ULLINT tmpAllCost = SP::Module::Comm::RVCGetTickCount() - m_ullEntityStart;
-	std::map<std::string, std::string> devConnInfo;
-	devConnInfo["AllCost"] = CSimpleStringA::Format("%d", tmpAllCost);
-	devConnInfo["AdpFileLoadCost"] = CSimpleStringA::Format("%d",m_ullAdpFileLoadCost);
-	devConnInfo["DevConnectCost"] = CSimpleStringA::Format("%d", tmpAllCost - m_ullAdpFileLoadCost);
-	std::pair<bool, std::string> strResult;
-	strResult = generateJsonStr(devConnInfo);
-
-	LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_DevConnect_CostTime, CSimpleStringA::Format("%s", strResult.second.c_str()));
-	LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_PinPad_InfoAboutKey_Onboot, xTmpStr.GetData());
-	LogEvent(Severity_Middle, LOG_EVT_PINPAD_OPEN_SUC, "Open pinpad suc.");
-
-	CSimpleStringA csRunInfo, csSNBakFile;
+	CSimpleStringA csRunInfo, csSNBakFile, csBakSN("");
 	if ((eErr = GetEntityBase()->GetFunction()->GetPath("RunInfo", csRunInfo)) == Error_Succeed)
 	{
 		csSNBakFile = csRunInfo + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "snbak.dat";
@@ -452,7 +427,7 @@ int CPinPadFSM::Initial()
 		ZeroMemory(buffer, 16);
 		if (infile.is_open())
 			infile.read(buffer, 16);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("bak.sn:%s", buffer);
+		csBakSN = buffer;
 		if (strlen(buffer) > 0 && m_keySNSM.Compare(buffer) != 0)
 		{
 			LogWarn(Severity_High, Error_Unexpect, PinPad_UserErrorCode_PinPad_SN_NOTMATCH, CSimpleStringA::Format("m_keySN:%s,snbak:%s", m_keySNSM.GetData(), buffer));
@@ -466,6 +441,21 @@ int CPinPadFSM::Initial()
 		infile.close();
 	}
 
+	ULLINT tmpAllCost = SP::Module::Comm::RVCGetTickCount() - m_ullEntityStart;
+	std::map<std::string, std::string> devConnInfo;
+	devConnInfo["AllCost"] = CSimpleStringA::Format("%d", tmpAllCost);
+	devConnInfo["AdpFileLoadCost"] = CSimpleStringA::Format("%d",m_ullAdpFileLoadCost);
+	devConnInfo["DevConnectCost"] = CSimpleStringA::Format("%llu", tmpAllCost - m_ullAdpFileLoadCost);
+	devConnInfo["SMSupport"] = CSimpleStringA::Format("%d", m_encryptkey);
+	devConnInfo["KeyLoaded"] = CSimpleStringA::Format("%d", m_bSMLoaded);
+	devConnInfo["KeySN"] = CSimpleStringA::Format("%s", m_keySNSM.GetData()); 
+	devConnInfo["BakSN"] = CSimpleStringA::Format("%s", csBakSN.GetData());
+	std::pair<bool, std::string> strResult;
+	strResult = generateJsonStr(devConnInfo);
+
+	LogWarn(Severity_Low, Error_Unexpect, PinPad_UserErrorCode_DevConnect_CostTime, CSimpleStringA::Format("%s", strResult.second.c_str()));
+	LogEvent(Severity_Middle, LOG_EVT_PINPAD_OPEN_SUC, "Open pinpad suc.");
+
 	return 0;
 }
 unsigned int __stdcall DoWork(void *pData)
@@ -685,6 +675,7 @@ ErrorCodeEnum CPinPadFSM::GetEncryptText(SpReqAnsContext<PinPadService_GetInputS
 		ctxSM->Answer(Error_DevCommFailed, dwUserCode);
 		return Error_DevCommFailed;
 	}
+	m_bStartPinInputOK = true;
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StartPinInput").setCostTime(m_ullEndTime - m_ullBeginTime)();
 	DbgToBeidou(ctxSM->link, "GetEncryptText")();
 	char* buf = new char[len + 1];
@@ -940,20 +931,23 @@ int CPinPadFSM::GetInput(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadSer
 	ULLINT ullGetInputBegin = SP::Module::Comm::RVCGetTickCount();
 	ErrorCodeEnum eErrCode = GetEncryptText(m_inputSMCtx);
 
-	m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
-	ErrorCodeEnum errClosePinPad = m_hDevHelper->StopInput();
-	m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
-	if (errClosePinPad != Error_Succeed)
+	if (m_bStartPinInputOK)
 	{
-		DWORD dwUserCode = SetErrorAndLog(errClosePinPad, MEC_DEVAPI_EPP_StopInput, "DevAdapter::StopInput", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetInputSM);
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
-			.setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwUserCode))("OnExit:close pinpad(%d).", SpStrError(errClosePinPad));
+		m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
+		ErrorCodeEnum errClosePinPad = m_hDevHelper->StopInput();
+		m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
+		if (errClosePinPad != Error_Succeed)
+		{
+			DWORD dwUserCode = SetErrorAndLog(errClosePinPad, MEC_DEVAPI_EPP_StopInput, "DevAdapter::StopInput", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetInputSM);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
+				.setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwUserCode))("OnExit:close pinpad(%d).", SpStrError(errClosePinPad));
+		}
+		else
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
+			("StopInput cost:%llu(ms), req acc.len:%d,confirm:%d,len:%d. ans:ck.len:%d", m_ullEndTime - m_ullBeginTime, m_inputSMCtx->Req.account.GetLength(), m_inputSMCtx->Req.confirm
+				, m_inputSMCtx->Req.length, m_inputSMCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputSMCtx->Ans.checkcode.GetLength());
+		m_bStartPinInputOK = false;
 	}
-	else
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
-		("StopInput cost:%d(ms), req acc.len:%d,confirm:%d,len:%d. ans:ck.len:%d", m_ullEndTime - m_ullBeginTime, m_inputSMCtx->Req.account.GetLength(), m_inputSMCtx->Req.confirm
-			, m_inputSMCtx->Req.length, m_inputSMCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputSMCtx->Ans.checkcode.GetLength());
-
 	DbgToBeidou(m_inputSMCtx->link, "GetInput")();
 	m_bPinInput = false;
 	LogEvent(Severity_Middle, LOG_EVT_PINPAD_GREEN_OFF, "PinPad light off.");
@@ -1208,6 +1202,7 @@ ErrorCodeEnum CPinPadFSM::GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCod
 			if (eErr != Error_Succeed)
 			{
 				SetErrorAndLog(eErr, MEC_DEVAPI_EPP_SetParam, "DevAdapter::SetParam", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetCheckCode);
+				ctx->Answer(Error_DevCommFailed);
 				return Error_DevCommFailed;
 			}
 			m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
@@ -1220,6 +1215,7 @@ ErrorCodeEnum CPinPadFSM::GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCod
 		{
 			SetErrorAndLog(eErr, MEC_DEVAPI_EPP_ActiveWorkingKey, "DevAdapter::ActiveWorkingKey", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetCheckCode);
 			ctx->Ans.checkcode[i] = "";
+			ctx->Answer(Error_DevCommFailed);
 			return Error_DevCommFailed;
 		}
 		else
@@ -1235,6 +1231,7 @@ ErrorCodeEnum CPinPadFSM::GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCod
 			if (eErr != Error_Succeed)
 			{
 				SetErrorAndLog(eErr, MEC_DEVAPI_EPP_EncryptData, "DevAdapter::EncryptData", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetCheckCode);
+				ctx->Answer(Error_DevCommFailed);
 				return Error_DevCommFailed;
 			}
 			ctx->Ans.checkcode[i] = (const char*)dstInfo.data;
@@ -1390,6 +1387,7 @@ ErrorCodeEnum CPinPadFSM::GetEncryptTextJS(SpReqAnsContext<PinPadService_GetInpu
 		ctxJS->Answer(Error_DevCommFailed, dwUserCode);
 		return Error_DevCommFailed;
 	}
+	m_bStartPinInputOK = true;
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StartPinInput").setCostTime(m_ullEndTime - m_ullBeginTime)();
 	DbgToBeidou(ctxJS->link, "GetEncryptTextJS")();
 	char* buf = new char[CurrentPasswordLen + 1];
@@ -1587,20 +1585,22 @@ int CPinPadFSM::GetInputJS(SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadS
 	ULLINT ullGetInputBegin = SP::Module::Comm::RVCGetTickCount();
 	ErrorCodeEnum eErrCode = GetEncryptTextJS(m_inputJSCtx);
 
-	m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
-	ErrorCodeEnum errClosePinPad = m_hDevHelper->StopInput();
-	m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
-	if (errClosePinPad != Error_Succeed)
+	if (m_bStartPinInputOK)
 	{
-		DWORD dwUserCode = SetErrorAndLog(errClosePinPad, MEC_DEVAPI_EPP_StopInput, "DevAdapter::StopInput", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetInputSM);
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
-			.setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwUserCode))("OnExit:close pinpad(%d).", SpStrError(errClosePinPad));
+		m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
+		ErrorCodeEnum errClosePinPad = m_hDevHelper->StopInput();
+		m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
+		if (errClosePinPad != Error_Succeed)
+		{
+			DWORD dwUserCode = SetErrorAndLog(errClosePinPad, MEC_DEVAPI_EPP_StopInput, "DevAdapter::StopInput", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, PinPadService_LogCode_GetInputSM);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
+				.setResultCode(GetEntityBase()->GetFunction()->UserCodeToRTACode(dwUserCode))("OnExit:close pinpad(%d).", SpStrError(errClosePinPad));
+		}
+		else
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
+			("StopInput cost:%llu(ms), req acc.len:%d,ans.ck.len:%d", m_ullEndTime - m_ullBeginTime, m_inputJSCtx->Req.account.GetLength(), m_inputJSCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputJSCtx->Ans.checkcode.GetLength());
+		m_bStartPinInputOK = false;
 	}
-	else
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::StopInput").setCostTime(m_ullEndTime - m_ullBeginTime)
-		("StopInput cost:%d(ms), req acc.len:%d,ans.ck.len:%d", m_ullEndTime - m_ullBeginTime, m_inputJSCtx->Req.account.GetLength(), m_inputJSCtx->Ans.checkcode.IsNullOrEmpty() ? 0 : m_inputJSCtx->Ans.checkcode.GetLength()
-			);
-		
 	DbgToBeidou(m_inputJSCtx->link, "GetInputJS")();
 	m_bPinInputJS = false;
 	LogEvent(Severity_Middle, LOG_EVT_PINPAD_GREEN_OFF, "PinPad light off.");

+ 2 - 2
Module/mod_pinpad/PinPadFSM.h

@@ -169,7 +169,7 @@ public:
 		END_FSM_RULE()
 
 		CPinPadFSM() : m_bFrontCancel(false),
-		m_bWaitingMore(false), m_bExit(false), m_bPlainPin(true),
+		m_bWaitingMore(false), m_bExit(false), m_bPlainPin(true), m_bStartPinInputOK(false),
 		m_bEntityExit(false), m_bPinInput(false), m_bLoadKey(false), m_bEncrypt(false)
 		, m_dwDevCommFailCount(0), m_dwPinPadRunCount(0), m_encryptkey(1)
 		, m_bSM(false), m_bSMLoaded(false), m_szModel(""), m_szType("")
@@ -284,7 +284,7 @@ private:
 	SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer m_inputSMCtx;
 	SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadService_GetInputJS_Ans>::Pointer m_inputJSCtx;
 	char m_szAccount[MAX_ACCOUNT_LEN];
-	bool m_bFrontCancel,m_bWaitingMore,m_bExit,m_bPlainPin,m_bEntityExit
+	bool m_bFrontCancel,m_bWaitingMore,m_bExit,m_bPlainPin,m_bEntityExit, m_bStartPinInputOK
 		,m_bPinInput,m_bLoadKey,m_bEncrypt,m_bSM,m_bSMLoaded, m_bPinInputJS, m_bUseBackupSN/*if use backup sn*/, m_bSetParamOnce/*call SetParam Only once*/;
 	ULLINT m_ullBeginTime, m_ullEndTime, m_ullAdpFileLoadCost, m_ullEntityStart;
 	CSimpleStringA m_deviceNo, m_devCheckData,m_keySNSM,m_szModel,m_szType,m_szVendor;

+ 1 - 1
Module/mod_pinpad/PinPad_UserErrorCode.h

@@ -27,7 +27,7 @@ enum PinPad_UserErrorCode {
 	PinPad_UserErrorCode_PinPad_LoadKey_SMSN = 0x20600216,
 	PinPad_UserErrorCode_PinPad_LoadKey_Clear_SMSN = 0x20600217,
 	PinPad_UserErrorCode_NotInGetInput = 0x20600218,
-	PinPad_UserErrorCode_PinPad_InfoAboutKey_Onboot = 0x20600219,
+	//PinPad_UserErrorCode_PinPad_InfoAboutKey_Onboot = 0x20600219,
 	PinPad_UserErrorCode_PinPad_CheckCode_Changed = 0x2060021A,
 	PinPad_UserErrorCode_PinPad_GetEncryptText_Get12Account_Error = 0x2060021B,
 	PinPad_UserErrorCode_PinPad_DevOpenFailed = 0x2060021C,

+ 196 - 60
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -1,9 +1,11 @@
 #include "stdafx.h"
 #include <algorithm>
+#include <fstream>
 #include <winpr/file.h>
 #include "fileutil.h"
+#include "iniutil.h"
+#include "RVCEventCode.h"
 #include "VtmLoaderFSM.h"
-#include "VtmLoader_UserCode.h"
 #include "EventCode.h"
 
 
@@ -194,11 +196,17 @@ DWORD checkUrlActive(LPVOID param)
 			&t_upload_BussinessSys_Suc, &t_upload_BussinessUser_Suc, &t_upload_beidou_Suc,
 			&t_upload_TerminalSys_Err, &t_upload_TerminalUser_Err, &t_upload_BussinessSys_Err, &t_upload_BussinessUser_Err, &t_upload_beidou_Err,
 			&t_discard_full, &t_discard_RTI1002, &curLogNum);
-		LogWarn(SeverityLevelEnum::Severity_Low, Error_Trace, WARN_SendEndpoint_LOG_INFO,
+		/*LogWarn(SeverityLevelEnum::Severity_Low, Error_Trace, WARN_SendEndpoint_LOG_INFO,
 			CSimpleString::Format("checkUrlActive::GetSendLogInfo, TS_Suc:%d, TU_Suc:%d, BS_Suc:%d, BU_Suc:%d, beidou_Suc:%d, TS_Err:%d, TU_Err:%d, BS_Err:%d, BU_Err:%d, beidou_Err:%d, discard_forFull:%d, discard_forRTI1002:%d, curNum:%d"
 				, t_upload_TerminalSys_Suc, t_upload_TerminalUser_Suc, t_upload_BussinessSys_Suc, t_upload_BussinessUser_Suc, t_upload_beidou_Suc,
 				t_upload_TerminalSys_Err, t_upload_TerminalUser_Err, t_upload_BussinessSys_Err, t_upload_BussinessUser_Err, t_upload_beidou_Err
 			, t_discard_full, t_discard_RTI1002, curLogNum).GetData());
+			*/
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s",
+			CSimpleString::Format("checkUrlActive::GetSendLogInfo, TS_Suc:%d, TU_Suc:%d, BS_Suc:%d, BU_Suc:%d, beidou_Suc:%d, TS_Err:%d, TU_Err:%d, BS_Err:%d, BU_Err:%d, beidou_Err:%d, discard_forFull:%d, discard_forRTI1002:%d, curNum:%d"
+				, t_upload_TerminalSys_Suc, t_upload_TerminalUser_Suc, t_upload_BussinessSys_Suc, t_upload_BussinessUser_Suc, t_upload_beidou_Suc,
+				t_upload_TerminalSys_Err, t_upload_TerminalUser_Err, t_upload_BussinessSys_Err, t_upload_BussinessUser_Err, t_upload_beidou_Err
+				, t_discard_full, t_discard_RTI1002, curLogNum).GetData());
 		Sleep(entityInfo->m_uploadLogInfo_waitSec * 1000);
 	}
 	return 0;
@@ -286,6 +294,7 @@ void CVtmLoaderFSM::s0_on_entry()
 		NetWorkCheckAndGetSettingTask* task = new NetWorkCheckAndGetSettingTask(this);
 		GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
 	}
+	GetOsVersion();
 }
 
 void CVtmLoaderFSM::s0_on_exit()
@@ -327,6 +336,15 @@ unsigned int CVtmLoaderFSM::s0_on_event(FSMEvent* pEvt)
 			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
 		}
 		break;
+	case USER_EVT_QUERY_LOCAL_INFO:
+		pEvt->SetHandled();
+		{
+			QueryLocalInfoEvent* qlie = dynamic_cast<QueryLocalInfoEvent*>(pEvt);
+			QueryLocalInfoTask* pTask = new QueryLocalInfoTask(this);
+			pTask->ctx = qlie->ctx;
+			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
+		}
+		break;
 	default:
 		break;
 	}
@@ -841,6 +859,15 @@ unsigned int CVtmLoaderFSM::s4_on_event(FSMEvent* pEvt)
 			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
 		}
 		break;
+	case USER_EVT_QUERY_LOCAL_INFO:
+		pEvt->SetHandled();
+		{
+			QueryLocalInfoEvent* qlie = dynamic_cast<QueryLocalInfoEvent*>(pEvt);
+			QueryLocalInfoTask* pTask = new QueryLocalInfoTask(this);
+			pTask->ctx = qlie->ctx;
+			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
+		}
+		break;
 	default:
 		break;
 	}
@@ -880,6 +907,15 @@ unsigned int CVtmLoaderFSM::s5_on_event(FSMEvent* pEvt)
 			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
 		}
 		break;
+	case USER_EVT_QUERY_LOCAL_INFO:
+		pEvt->SetHandled();
+		{
+			QueryLocalInfoEvent* qlie = dynamic_cast<QueryLocalInfoEvent*>(pEvt);
+			QueryLocalInfoTask* pTask = new QueryLocalInfoTask(this);
+			pTask->ctx = qlie->ctx;
+			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
+		}
+		break;
 	default:
 		break;
 	}
@@ -1098,6 +1134,12 @@ int CVtmLoaderFSM::EntityLoad()
 	else
 		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("GetSystemRunInfo failed:%d");
 
+	//oilyang@20250715 before load entitys, to set sysvar "AuthErrMsg" to ""
+	//oiltmp@20250715 several months later,we can delete this
+	ErrorCodeEnum eErrCode = Error_Unexpect;
+	if ((eErrCode = GetEntityBase()->GetFunction()->SetSysVar("AuthErrMsg", "",true)) != Error_Succeed)
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_SYSVAR_SET_FAILED)("Set sysvar \"AuthErrMsg\" failed:%d", eErrCode);
+
 	LogWarn(Severity_Low, Error_Succeed, VtmLoader_BootInfoPrint, "开始加载实体");
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("StartLoadEntity")("开始加载实体");
 
@@ -1202,8 +1244,10 @@ int CVtmLoaderFSM::EntityLoad()
 
 	//oilyang if install VTM ,just wait for msg to start entity
 	CSimpleStringA csTermStage("");
-	ErrorCodeEnum eErrCode = GetEntityBase()->GetFunction()->GetSysVar("TerminalStage", csTermStage);
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TerminalStage %s.", csTermStage.GetData());
+	if ((eErrCode = GetEntityBase()->GetFunction()->GetSysVar("TerminalStage", csTermStage)) != Error_Succeed)
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_SYSVAR_GET_FAILED)("Get sysvar \"TerminalStage\" failed:%d", eErrCode);
+	else
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TerminalStage %s.", csTermStage.GetData());
 	if (csTermStage.Compare("N") == 0)//"N" for installing
 	{
 		//start UpgradeManager
@@ -1763,12 +1807,6 @@ bool CVtmLoaderFSM::GetConfig()
 	ITimerListener* pListener = new TimerOutHelper<CVtmLoaderFSM>(this, &CVtmLoaderFSM::OnCentersettingUpdateTimeout, pTmpData);
 	GetEntityBase()->GetFunction()->SetTimer(TIMER_CENTERSETTING_UPDATE_CHECK, pListener, CENTERSETTING_UPDATE_CHECK_TIME);
 
-	eErr = SubscribeEntitysEvents();
-	if (eErr != Error_Succeed)
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("subscribe event fail, 0x%x", eErr);
-	else
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("subscribe event succeed");
-
 	CSmartPointer<IConfigInfo> pConfig;
 	CSimpleString t_endpoint, t_topicSys, t_topicUser, t_topicBeidou, t_bussSys, t_bussUser, t_VTMWeb;
 
@@ -1829,20 +1867,7 @@ bool CVtmLoaderFSM::GetConfig()
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR040210F13")("Get config succeed.");
 	return true;
 }
-ErrorCodeEnum CVtmLoaderFSM::SubscribeEntitysEvents()
-{
-	//want to do what?
-	auto rc = Error_Succeed;
-	/*GifutTest20250314 begin*/
-	CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
-	rc = pFunc->RegistTerminalStateChangeEvent(dynamic_cast<ITerminalStateChangedListener*>(this->GetEntityBase()));
-	if (rc != Error_Succeed)
-	{
-		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("RegistTerminalStateChangeEvent failed: %s", SpStrError(rc));
-	}
-	/*GifutTest20250314 end*/
-	return rc;
-}
+
 int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
 {
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to HttpConnCheck");
@@ -1879,11 +1904,10 @@ int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
 			CAutoArray<NetworkAdapterItem> netList;
 			if (SP::Module::Net::GetINETMacAddresses(netList) == Error_Succeed)
 			{
-				string tmpDns;
-				GetDns(tmpDns);
+				CSimpleStringA tmpDns = GetDns();
 				for (int i = 0; i < netList.GetCount(); i++) {
 					LogWarn(Severity_Low, Error_Unexpect, VtmLoader_BootInfoPrint, CSimpleStringA::Format("(%d)interface:%s; ip:%s; mac:%s; %s", i, netList[i].description.c_str()
-						, netList[i].ip.c_str(), netList[i].mac.c_str(), tmpDns.c_str()).GetData());
+						, netList[i].ip.c_str(), netList[i].mac.c_str(), tmpDns.GetData()).GetData());
 				}
 			}
 		}
@@ -1903,37 +1927,63 @@ int CVtmLoaderFSM::HttpConnCheck(CSimpleStringA csHttAddr, HttpAddrType eType)
 
 	return -1;
 }
-void CVtmLoaderFSM::GetDns(string& dns)
+CSimpleStringA CVtmLoaderFSM::GetDns()
 {
-	dns = "";
-#if defined(RVC_OS_LINUX)
-
-	FILE* stream;
-	char* line = NULL;
-	size_t len = 0;
-	ssize_t read;
-
-	stream = popen("cat /etc/resolv.conf", "r");
-	string tmpStr;
-	while ((read = getline(&line, &len, stream)) != -1)
-	{
-		tmpStr = line;
-		int pos = tmpStr.find("nameserver");
-		if (pos != string::npos)
-		{
-			tmpStr = tmpStr.replace(pos, strlen("nameserver"), "dns");
-			dns += tmpStr + ";";
-		}
+	CSimpleStringA runInfoPath, csDNSKeyword, csTmpDns("");
+	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("runinfo", runInfoPath);
+	if (eErr != Error_Succeed) {
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("GetPath runinfo error=%d.", eErr);
+		return "";
 	}
-	int rnPos = dns.find("\n");
-	while (rnPos != string::npos)
+	runInfoPath = runInfoPath + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "dns";
+
+#if defined(RVC_OS_WIN)
+	CSimpleStringA csCmd;
+	csCmd = CSimpleStringA::Format("cmd /c ipconfig /all >%s", runInfoPath.GetData());
+	WinExec((LPCSTR)csCmd, SW_HIDE);
+	csDNSKeyword = "DNS 服务器";
+#else
+	std::string sucContent, failedContent;
+	CSimpleStringA strCmd;
+	strCmd = CSimpleStringA::Format("cat /etc/resolv.conf | grep \"nameserver\" >%s", runInfoPath.GetData());
+	bool ret = SP::Module::Util::ShellExecute(strCmd.GetData(), sucContent, failedContent);
+	csDNSKeyword = "nameserver";
+#endif //RVC_OS_WIN
+	ifstream is;
+	is.open(runInfoPath.GetData(), ios::binary);
+	if (!is.is_open())
 	{
-		dns.replace(rnPos, 1, " ");
-		rnPos = dns.find("\n");
+		DWORD dwErr = GetLastError();
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("open %s file failed. [%d]", runInfoPath.GetData(), dwErr);
+		return "";
 	}
+
+	string line;
+	while (!is.eof()) {
+		getline(is, line);
+		//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("line:%s", line.c_str());
+		size_t start = line.find(csDNSKeyword.GetData());
+		if (start != string::npos)
+		{
+#if defined(RVC_OS_WIN)
+			int dnsStart = line.find(": ");
+			if (dnsStart != string::npos)
+			{
+				string xDns = SP::Utility::ToTrim(line.substr(dnsStart + 1, line.length() - dnsStart - 1));
+				csTmpDns += xDns.c_str();
+				csTmpDns += ";";
+			}
 #else
+			string xDns = SP::Utility::ToTrim(line.substr(start + csDNSKeyword.GetLength() + 1, line.length() - start - csDNSKeyword.GetLength() - 1));
+			csTmpDns += xDns.c_str();
+			csTmpDns += ";";
 #endif
-	return;
+		}
+		else
+			continue;
+	}
+	
+	return csTmpDns;
 }
 void CVtmLoaderFSM::ToCheckIfInstalling()
 {
@@ -1970,14 +2020,6 @@ void CVtmLoaderFSM::CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDevi
 	ErrorCodeEnum eErrCode = Error_Unexpect;
 	CSimpleStringA csEntityName = ctx->Req.entityName;
 
-	//oiltmp@20240415 to be delete after x months
-	if (ctx->Req.entityName.Compare("CardIssuer") == 0)
-	{
-		if (m_sysInfo.strMachineType.Compare("RVC.CardStore") == 0 || m_sysInfo.strMachineType.Compare("RVC.CardPrinter") == 0)
-			csEntityName = "CardIssuerStore";
-		else
-			csEntityName = "CardIssuerStand";
-	}
 	
 	if ((eErrCode = m_pEntity->GetFunction()->GetEntityStaticInfo(csEntityName.GetData(), staticInfo)) != Error_Succeed)
 	{
@@ -2017,6 +2059,7 @@ void CVtmLoaderFSM::SaveTerminalNo(SpReqAnsContext<VtmLoaderService_SaveTerminal
 		ctx->Answer(Error_Param);
 		return;
 	}
+	LogWarn(Severity_Low, Error_Trace, VtmLoader_SetTerminalNo, CSimpleStringA::Format("SaveTerminalNo:[%s]", ctx->Req.terminalNo.GetData()));
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(VtmLoaderService_LogCode_SaveTerminalNo)("write terminalNo[%s] to root.ini", ctx->Req.terminalNo.GetData());
 	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPrivilegeFunction()->WriteTerminalNoToRootIni(ctx->Req.terminalNo);
 	ctx->Answer(eErr);
@@ -3074,4 +3117,97 @@ void CVtmLoaderFSM::OnCentersettingUpdateTimeout(void* pData)
 {
 	GetCenterCfgThread();
 	GetEntityBase()->GetFunction()->ResetTimer(TIMER_CENTERSETTING_UPDATE_CHECK, CENTERSETTING_UPDATE_CHECK_TIME);
+}
+
+CSimpleStringA CVtmLoaderFSM::GetOsVersion()
+{
+#if defined(RVC_OS_WIN)
+	CSimpleStringA runInfoPath;
+	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("runinfo", runInfoPath);
+	if (eErr != Error_Succeed) {
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_GETPATH_FAILED)("GetPath runinfo error=%d.", eErr);
+		return "";
+	}
+	runInfoPath += "\\runcfg\\osverion";
+	CSimpleStringA csCmd;
+	csCmd = CSimpleStringA::Format("cmd /c ver >%s", runInfoPath);
+	WinExec((LPCSTR)csCmd, SW_HIDE);
+
+	ifstream is;
+	is.open(runInfoPath.GetData(), ios::binary);
+	if (is.is_open())
+	{
+		string line;
+		while (!is.eof()) {
+			getline(is, line);
+			int start = line.find("版本");
+			if (start != string::npos)
+			{
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ver:[%s]", line.c_str());
+				return CSimpleStringA(line.c_str());
+			}
+			else
+				continue;
+		}
+	}
+	else
+	{
+		DWORD dwErr = GetLastError();
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("open runcfg\\osverion file failed. [%d]", dwErr);
+	}
+	return "";
+#else
+	std::map<std::string, std::string> osInfo;
+	const char filePath[] = "/etc/os-version";
+	char tmp[33];
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "SystemName", "unknown", tmp, 32, filePath);
+	osInfo["SystemName"] = tmp;
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "ProductType", "unknown", tmp, 32, filePath);
+	osInfo["ProductType"] = tmp;
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "MajorVersion", "unknown", tmp, 32, filePath);
+	osInfo["MajorVersion"] = tmp;
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "MinorVersion", "unknown", tmp, 32, filePath);
+	osInfo["MinorVersion"] = tmp;
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "OsBuild", "unknown", tmp, 32, filePath);
+	osInfo["OsBuild"] = tmp;
+	return generateJsonStr(osInfo).second.c_str();
+#endif
+}
+void CVtmLoaderFSM::QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx)
+{
+#ifdef RVC_OS_WIN
+	ctx->Ans.VtmAppType = "Windows";
+#else
+	ctx->Ans.VtmAppType = "UOS";
+#endif
+	CSimpleStringA csRunPath("");
+	GetEntityBase()->GetFunction()->GetPath("Run", csRunPath);
+	ctx->Ans.AppPath = csRunPath;
+
+	CAutoArray<NetworkAdapterItem> netList;
+	if (SP::Module::Net::GetINETMacAddresses(netList) == Error_Succeed)
+	{
+		CSimpleStringA csMac(""), csIP("");
+		for (int i = 0; i < netList.GetCount(); i++) {
+			if (!csMac.IsNullOrEmpty()) {
+				csMac += ";";
+			}
+			csMac += netList[i].mac.c_str();
+			if (!csIP.IsNullOrEmpty()) {
+				csIP += ";";
+			}
+			csIP += netList[i].ip.c_str();
+		}
+		ctx->Ans.IPs = csIP;
+		ctx->Ans.MACs = csMac;
+	}
+	ctx->Ans.DNSs = GetDns();
+	ctx->Ans.OSVersion = GetOsVersion();
+
+	ctx->Answer(Error_Succeed);
 }

+ 28 - 2
Module/mod_vtmloader/VtmLoaderFSM.h

@@ -5,6 +5,7 @@
 #include "SpUtility.h"
 #include "CommEntityUtil.hpp"
 #include "VtmLoader_server_g.h"
+#include "VtmLoader_UserCode.h"
 using namespace VtmLoader;
 
 //集中配置更新  
@@ -21,6 +22,7 @@ enum EvtType
 	USER_EVT_CHECK_DEVICE_ENTITY,
 	USER_EVT_SAVE_TERMINALNO,
 	USER_EVT_DEALWITH_OLD_EVENT,
+	USER_EVT_QUERY_LOCAL_INFO,
 };
 
 enum LoadStage
@@ -158,6 +160,7 @@ public:
 			ctx->Answer(Error_Param);
 			return;
 		}
+		LogWarn(Severity_Low, Error_Trace, VtmLoader_SetTerminalNo, CSimpleStringA::Format("SetTerminalNo:[%s]", ctx->Req.terminalNo.GetData()));
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(VtmLoaderService_LogCode_SetTerminalNo)("set terminalNo to [%s]", ctx->Req.terminalNo.GetData());
 		m_terminalNoFromWeb = ctx->Req.terminalNo;
 		ctx->Answer(Error_Succeed);
@@ -167,6 +170,7 @@ public:
 	void CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx);
 	void SaveTerminalNo(SpReqAnsContext<VtmLoaderService_SaveTerminalNo_Req, VtmLoaderService_SaveTerminalNo_Ans>::Pointer ctx);
 	void DealWithOldEvent(SpReqAnsContext<VtmLoaderService_DealWithOldEvent_Req, VtmLoaderService_DealWithOldEvent_Ans>::Pointer ctx);
+	void QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx);
 	bool CheckConfigInfoInTestRoom();
 	void SetVideoEntityOK() { m_bMediaControllerOK = true; }
 	bool CheckIfNeedCopyDepFiles();
@@ -199,10 +203,10 @@ private:
 	ErrorCodeEnum AsyncStartEntity(const char* entity_name, const char* cmdline, void* pData);
 	void OnAnswer(CSmartPointer<IAsynWaitSp> pAsynWaitSp);
 	bool IsRootINIExist(CSimpleStringA& path);
-	ErrorCodeEnum SubscribeEntitysEvents();
-	void GetDns(string& dns);
+	CSimpleStringA GetDns();
 	void ToCheckIfInstalling();
 	void DoSpecialJobInTestRoom();
+	CSimpleStringA GetOsVersion();
 
 private:
 	CSystemStaticInfo m_sysInfo;
@@ -268,6 +272,18 @@ public:
 			ctx->Answer(Error_InvalidState);
 	}
 };
+class QueryLocalInfoEvent : public FSMEvent
+{
+public:
+	QueryLocalInfoEvent() : FSMEvent(USER_EVT_QUERY_LOCAL_INFO) {}
+	~QueryLocalInfoEvent() {}
+	SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx;
+	virtual void OnUnhandled()
+	{
+		if (ctx != NULL)
+			ctx->Answer(Error_InvalidState);
+	}
+};
 
 struct NetWorkCheckAndGetSettingTask : public ITaskSp
 {
@@ -343,4 +359,14 @@ struct CopyDepFilesToNewDepPathTask : public ITaskSp
 	{
 		fsm->CopyDepFilesToNewDepPath();
 	}
+};
+struct QueryLocalInfoTask : public ITaskSp
+{
+	CVtmLoaderFSM* fsm;
+	SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx;
+	QueryLocalInfoTask(CVtmLoaderFSM* f) : fsm(f) {}
+	void Process()
+	{
+		fsm->QueryLocalInfo(ctx);
+	}
 };

+ 9 - 1
Module/mod_vtmloader/VtmLoader_UserCode.h

@@ -1,3 +1,7 @@
+#ifndef _VTMLOADER_USER_ERROR_CODE_H
+#define _VTMLOADER_USER_ERROR_CODE_H
+#pragma once
+
 const int VtmLoader_UserCode_NetCard_OK = 0x10f00201;
 const int VtmLoader_UserCode_NetCard_UnAvaible = 0x10f00202;
 const int WARN_SendEndpoint_URL_ERR = 0x10f00203;
@@ -30,4 +34,8 @@ const int VtmLoader_DepDirCopyFailed = 0x10f0021d;
 const int VtmLoader_DepDirCopySuc = 0x10f0021e;
 const int VtmLoader_InfoAboutBootCost = 0x10f0021f;
 const int VtmLoader_CenterSettingConnectFailed = 0x10f00220;
-const int VtmLoader_CenterSettingUpdateSucceed = 0x10f00221;
+const int VtmLoader_CenterSettingUpdateSucceed = 0x10f00221;
+const int VtmLoader_SetTerminalNo = 0x10f00222;
+const int VtmLoader_SaveTerminalNo = 0x10f00223;
+
+#endif //_VTMLOADER_USER_ERROR_CODE_H

+ 50 - 0
Module/mod_vtmloader/VtmLoader_client_g.h

@@ -32,6 +32,7 @@ public:
 	}
 	void OnClose(ErrorCodeEnum)
 	{
+		Dbg("session closed.");
 		bSessionClosed = true;
 	}
 	bool QuerySessionClosed()
@@ -303,6 +304,55 @@ public:
 		return Error;
 	}
 
+	ErrorCodeEnum QueryLocalInfo(VtmLoaderService_QueryLocalInfo_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
+	{
+		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
+		CAutoBuffer Buf = SpObject2Buffer(Req);
+		if (m_context.checkEmpty())
+		{
+			m_context.AutoGenerate();
+			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
+			m_context = m_context.upgradeLink();
+		}
+		auto ret = pFunc->AsyncRequest(VtmLoaderService_Method_QueryLocalInfo, VtmLoaderService_MethodSignature_QueryLocalInfo, Buf, spAsyncWait, m_context, dwTimeout);
+		m_context.clear();
+		return ret;
+	}
+	ErrorCodeEnum QueryLocalInfo(VtmLoaderService_QueryLocalInfo_Req &Req, VtmLoaderService_QueryLocalInfo_Ans &Ans, DWORD dwTimeout)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = QueryLocalInfo(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum QueryLocalInfo(VtmLoaderService_QueryLocalInfo_Req &Req, VtmLoaderService_QueryLocalInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = QueryLocalInfo(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+	ErrorCodeEnum QueryLocalInfo(VtmLoaderService_QueryLocalInfo_Req &Req, VtmLoaderService_QueryLocalInfo_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
+	{
+		CSmartPointer<IAsynWaitSp> spAsyncWait;
+		ErrorCodeEnum Error = QueryLocalInfo(Req, spAsyncWait, dwTimeout);
+		if (Error == Error_Succeed) {
+			bool bEnd = false;
+			CSimpleString str;
+			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
+			LOG_ASSERT(Error || bEnd);
+		}
+		return Error;
+	}
+
 
 	bool SafeDelete()
 	{

+ 33 - 0
Module/mod_vtmloader/VtmLoader_def_g.h

@@ -17,18 +17,21 @@ namespace VtmLoader {
 #define VtmLoaderService_Method_CheckDeviceEntity 3
 #define VtmLoaderService_Method_SaveTerminalNo 4
 #define VtmLoaderService_Method_DealWithOldEvent 5
+#define VtmLoaderService_Method_QueryLocalInfo 6
 
 #define VtmLoaderService_MethodSignature_SetTerminalNo 616197282
 #define VtmLoaderService_MethodSignature_NoticeAppReady -656753321
 #define VtmLoaderService_MethodSignature_CheckDeviceEntity 217616252
 #define VtmLoaderService_MethodSignature_SaveTerminalNo -1817061577
 #define VtmLoaderService_MethodSignature_DealWithOldEvent -1552130738
+#define VtmLoaderService_MethodSignature_QueryLocalInfo 1307554776
 
 #define VtmLoaderService_LogCode_SetTerminalNo "QLR040210F01"
 #define VtmLoaderService_LogCode_NoticeAppReady "QLR040210F02"
 #define VtmLoaderService_LogCode_CheckDeviceEntity "QLR040210F03"
 #define VtmLoaderService_LogCode_SaveTerminalNo "QLR040210F04"
 #define VtmLoaderService_LogCode_DealWithOldEvent "QLR040210F05"
+#define VtmLoaderService_LogCode_QueryLocalInfo "QLR040210F06"
 
 struct VtmLoaderService_SetTerminalNo_Req
 {
@@ -155,6 +158,36 @@ struct VtmLoaderService_DealWithOldEvent_Ans
 
 };
 
+struct VtmLoaderService_QueryLocalInfo_Req
+{
+	CSimpleStringA reqReserved1;
+	CSimpleStringA reqReserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & reqReserved1 & reqReserved2;
+	}
+
+};
+
+struct VtmLoaderService_QueryLocalInfo_Ans
+{
+	CSimpleStringA IPs;
+	CSimpleStringA MACs;
+	CSimpleStringA DNSs;
+	CSimpleStringA OSVersion;
+	CSimpleStringA VtmAppType;
+	CSimpleStringA AppPath;
+	CSimpleStringA ansReserved1;
+	CSimpleStringA ansReserved2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & IPs & MACs & DNSs & OSVersion & VtmAppType & AppPath & ansReserved1 & ansReserved2;
+	}
+
+};
+
 
 ///////////////////////////
 

+ 27 - 0
Module/mod_vtmloader/VtmLoader_server_g.h

@@ -65,6 +65,13 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case VtmLoaderService_Method_QueryLocalInfo:
+			if (dwSignature == VtmLoaderService_MethodSignature_QueryLocalInfo) {
+				bOverlap = true;
+			} else {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -101,6 +108,11 @@ public:
 				Error = Error_MethodSignatureFailed;
 			}
 			break;
+		case VtmLoaderService_Method_QueryLocalInfo:
+			if (dwSignature != VtmLoaderService_MethodSignature_QueryLocalInfo) {
+				Error = Error_MethodSignatureFailed;
+			}
+			break;
 		default:
 			Error = Error_MethodNotFound;
 			break;
@@ -133,6 +145,11 @@ public:
 	/// override by user
 	}
 
+	virtual void Handle_QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx)
+	{
+	/// override by user
+	}
+
 	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		CAutoBuffer Buf;
@@ -199,6 +216,16 @@ public:
 						Handle_DealWithOldEvent(ctx);
 					}
 					break;
+				case VtmLoaderService_Method_QueryLocalInfo:
+					{
+						SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req,VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx;
+						ctx.Attach(new SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req,VtmLoaderService_QueryLocalInfo_Ans>(pTransactionContext));
+						SpBuffer2Object(Buf, ctx->Req);
+						pTransactionContext->GetLinkContext(ctx->link);
+						EntityResource::setLink(ctx->link);
+						Handle_QueryLocalInfo(ctx);
+					}
+					break;
 				default:
 					assert(0);
 					break;

+ 4 - 13
Module/mod_vtmloader/mod_vtmloader.cpp

@@ -29,6 +29,10 @@ void VtmLoaderServerSession::Handle_DealWithOldEvent(SpReqAnsContext<VtmLoaderSe
 {
 	m_pEntity->DealWithOldEvent(ctx);
 }
+void VtmLoaderServerSession::Handle_QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx)
+{
+	m_pEntity->QueryLocalInfo(ctx);
+}
 
 
 void CVtmLoaderEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext) 
@@ -50,7 +54,6 @@ void CVtmLoaderEntity::OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer
 { 
 	//m_task.Close();
 	m_FSM.PostExitEvent();
-	UnsubscribeEntitysEvents();
 	pTransactionContext->SendAnswer(Error_Succeed); 
 }	
 
@@ -140,18 +143,6 @@ void CVtmLoaderEntity::EntityLostProc(CSimpleStringA entityName)
 	else
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("on lost start %d", eErrCode);
 }
-	ErrorCodeEnum CVtmLoaderEntity::UnsubscribeEntitysEvents()
-{
-	auto pFunc = GetFunction();
-		
-	if ((__int64)m_SubLogID2 != 0)
-		pFunc->UnsubscribeLog(m_SubLogID2);
-
-	if ((__int64)m_SubLogID3 != 0)
-		pFunc->UnsubscribeLog(m_SubLogID3);
-
-	return Error_Succeed;
-}
 
 	void CVtmLoaderEntity::DealWithOldEvent(SpReqAnsContext<VtmLoaderService_DealWithOldEvent_Req, VtmLoaderService_DealWithOldEvent_Ans>::Pointer ctx)
 	{

+ 8 - 10
Module/mod_vtmloader/mod_vtmloader.h

@@ -17,6 +17,7 @@ public:
 	virtual void Handle_CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx);
 	virtual void Handle_SaveTerminalNo(SpReqAnsContext<VtmLoaderService_SaveTerminalNo_Req, VtmLoaderService_SaveTerminalNo_Ans>::Pointer ctx);
 	virtual void Handle_DealWithOldEvent(SpReqAnsContext<VtmLoaderService_DealWithOldEvent_Req, VtmLoaderService_DealWithOldEvent_Ans>::Pointer ctx);
+	virtual void Handle_QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx);
 private:
 	CVtmLoaderEntity* m_pEntity;
 };
@@ -56,10 +57,9 @@ public:
 		const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, 
 		const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext &pLinkInfo);
 
-	ErrorCodeEnum UnsubscribeEntitysEvents();
 	CSimpleStringA GetCurMaintainer(){ return m_strUserID;}
 
-	void SetTerminalNo(SpReqAnsContext<VtmLoaderService_SetTerminalNo_Req, VtmLoaderService_SetTerminalNo_Ans>::Pointer ctx) { m_FSM.SetTerminalNo(ctx); }
+	void SetTerminalNo(SpReqAnsContext<VtmLoaderService_SetTerminalNo_Req, VtmLoaderService_SetTerminalNo_Ans>::Pointer ctx) {	m_FSM.SetTerminalNo(ctx); 	}
 	//void NoticeAppReady(SpReqAnsContext<VtmLoaderService_NoticeAppReady_Req, VtmLoaderService_NoticeAppReady_Ans>::Pointer ctx);
 	void CheckDeviceEntity(SpReqAnsContext<VtmLoaderService_CheckDeviceEntity_Req, VtmLoaderService_CheckDeviceEntity_Ans>::Pointer ctx)
 	{
@@ -80,6 +80,12 @@ public:
 	}
 
 	void DealWithOldEvent(SpReqAnsContext<VtmLoaderService_DealWithOldEvent_Req, VtmLoaderService_DealWithOldEvent_Ans>::Pointer ctx);
+	void QueryLocalInfo(SpReqAnsContext<VtmLoaderService_QueryLocalInfo_Req, VtmLoaderService_QueryLocalInfo_Ans>::Pointer ctx)
+	{
+		QueryLocalInfoEvent* pEvt = new QueryLocalInfoEvent();
+		pEvt->ctx = ctx;
+		m_FSM.PostEventFIFO(pEvt);
+	}
 	
 	virtual void OnEntityStateHook(const char* pszEntityName, const char* pszTriggerEntity, EntityStateEnum eState, EntityStateEnum eLastState);
 	virtual void OnUserStateHook(const char* pszEntityName, DWORD dwState, DWORD dwLastState) { return; }
@@ -88,14 +94,6 @@ public:
 	void EntityLostProc(CSimpleStringA entityName);
 	void SetVideoEntityOK() { m_FSM.SetVideoEntityOK(); }
 
-	/*GifutTest20250314 begin*/
-	//void OnStateChanged(AppBootStateEnum oldState, AppBootStateEnum curState, const char* triggerEntity)
-	//{
-	//	LOG_FUNCTION();
-	//	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("state changed from %s to %s by %s", SpStrAppBootState(oldState), SpStrAppBootState(curState), triggerEntity);
-	//}
-	/*GifutTest20250314 end*/
-
 protected:
 	//GUITask m_task;
 	CVtmLoaderFSM m_FSM;

+ 23 - 0
Module/mod_vtmloader/vtmloader.xml

@@ -67,5 +67,28 @@
 		<param name="isSuccess" type="bool"/>
 	  </res>	  
     </twoway>
+    <!--查询终端本地环境信息-->
+    <twoway name="QueryLocalInfo" overlap="true" method_id="6">
+      <req>
+        <param name="reqReserved1" type="string"/>
+        <param name="reqReserved2" type="string"/>
+      </req>
+      <res>
+        <!--ip地址,如有多个则以';'分隔-->
+        <param name="IPs" type="string"/>
+        <!--mac地址,如有多个则以';'分隔-->
+        <param name="MACs" type="string"/>
+        <!--dns地址,如有多个则以';'分隔-->
+        <param name="DNSs" type="string"/>
+        <!--操作系统相关信息-->
+        <param name="OSVersion" type="string"/>
+        <!--终端应用的版本类型-->
+        <param name="VtmAppType" type="string"/>
+        <!--终端应用运行目录-->
+        <param name="AppPath" type="string"/>
+        <param name="ansReserved1" type="string"/>
+        <param name="ansReserved2" type="string"/>
+      </res>
+    </twoway>
   </class>
 </entity>