|
|
@@ -2123,14 +2123,15 @@ ErrorCodeEnum ResourceWatcherFSM::DetectVTMInstalledBySetup(BOOL& fYes)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-bool ResourceWatcherFSM::RegRdVtmVersion(CSimpleStringA& VTMpath, CSimpleStringA& vtmVersion)
|
|
|
+bool ResourceWatcherFSM::RegRdVtmVersion(CSimpleStringA& VTMpath, CSimpleStringA& vtmVersion, CSimpleStringA& verPath)
|
|
|
{
|
|
|
bool bRet = false;
|
|
|
HKEY key;
|
|
|
CSimpleStringA regPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\vtm.exe";
|
|
|
+ CSimpleStringA regParaPath = "path";
|
|
|
CSimpleStringA regParaVersion = "version";
|
|
|
LONG lResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath, 0, KEY_ALL_ACCESS, &key);
|
|
|
- char arrVTMpath[MAX_PATH] = { 0 }, arrVTMversion[MAX_PATH] = { 0 };
|
|
|
+ char arrVTMpath[MAX_PATH] = { 0 }, arrVTMversion[MAX_PATH] = { 0 }, arrVTMverPath[MAX_PATH] = { 0 };
|
|
|
if (ERROR_SUCCESS == lResult)
|
|
|
{
|
|
|
DWORD dwValue = MAX_PATH * sizeof(CHAR);
|
|
|
@@ -2145,9 +2146,22 @@ bool ResourceWatcherFSM::RegRdVtmVersion(CSimpleStringA& VTMpath, CSimpleStringA
|
|
|
return bRet;
|
|
|
}
|
|
|
|
|
|
+ dwValue = MAX_PATH * sizeof(CHAR);
|
|
|
+ bool res2 = GetRegValue(key, regParaPath, arrVTMverPath, &dwValue);
|
|
|
+ if (res2) {
|
|
|
+ bRet = true;
|
|
|
+ verPath = arrVTMverPath;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ bRet = false;
|
|
|
+ RegCloseKey(key);
|
|
|
+ return bRet;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
dwValue = MAX_PATH * sizeof(CHAR);
|
|
|
- bool res2 = GetRegValue(key, regParaVersion, arrVTMversion, &dwValue);
|
|
|
- if (res2) {
|
|
|
+ bool res3 = GetRegValue(key, regParaVersion, arrVTMversion, &dwValue);
|
|
|
+ if (res3) {
|
|
|
bRet = true;
|
|
|
vtmVersion = arrVTMversion;
|
|
|
}
|
|
|
@@ -2278,11 +2292,11 @@ static void GetUserDesktopDire(CSimpleStringA& outDir)
|
|
|
bool ResourceWatcherFSM::RegOperation4LnkFile()
|
|
|
{
|
|
|
bool bRet = true;
|
|
|
- CSimpleStringA csVersion, VtmRegPath, VtmRegVersion;
|
|
|
+ CSimpleStringA csVersion(true), VtmRegPath(true), VtmRegVersion(true), VtmRegVerPath(true);
|
|
|
bool bGetActive = GetVtmVersionFromActiveTxt(csVersion);
|
|
|
- bool bRegRead = RegRdVtmVersion(VtmRegPath, VtmRegVersion);
|
|
|
+ bool bRegRead = RegRdVtmVersion(VtmRegPath, VtmRegVersion, VtmRegVerPath);
|
|
|
|
|
|
- CSimpleStringA rootVerPath, exePath;
|
|
|
+ CSimpleStringA rootVerPath(true), exePath(true);
|
|
|
ErrorCodeEnum rc = GetEntityBase()->GetFunction()->GetPath("RootVer", rootVerPath);
|
|
|
exePath = rootVerPath + "\\VTM.exe";
|
|
|
|
|
|
@@ -2292,7 +2306,9 @@ bool ResourceWatcherFSM::RegOperation4LnkFile()
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Copy VTM.exe to version root fail.");
|
|
|
bRet = false;
|
|
|
}
|
|
|
- if (bRet && (!bRegRead || VtmRegVersion.IsNullOrEmpty() || 0 != VtmRegVersion.Compare(csVersion, true))) {
|
|
|
+ CSimpleStringA fullregVersionPath = VtmRegVerPath + "\\" + VtmRegVersion;
|
|
|
+ CSimpleStringA curVersionPath = rootVerPath + "\\" + csVersion;
|
|
|
+ if(bRet && !rootVerPath.IsNullOrEmpty() && !csVersion.IsNullOrEmpty() && (!bRegRead || 0 != curVersionPath.Compare(fullregVersionPath, true))) {
|
|
|
if (!RegWtVtmPath(exePath, rootVerPath))
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("RegWtVtmPath failed.");
|
|
|
@@ -2302,7 +2318,6 @@ bool ResourceWatcherFSM::RegOperation4LnkFile()
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("RegWtVtmVersion failed.");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
CSimpleStringA s(true);
|
|
|
GetUserDesktopDire(s);
|
|
|
s += "\\可视柜台.lnk";
|