1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 03:18:26 -06:00

Windows: on 64-bit Windows, more System favorite service from SysWoW64 to System32 since now all binaries are native 64-bit on 64-bit machines.

This commit is contained in:
Mounir IDRASSI
2015-07-13 21:13:28 +02:00
parent 103018b367
commit 7d6cd0c92d
6 changed files with 94 additions and 37 deletions

View File

@@ -769,12 +769,51 @@ BOOL DoFilesInstall (HWND hwndDlg, char *szDestDir)
if (bResult && strcmp (szFiles[i], "AVeraCrypt.exe") == 0)
{
string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe");
if (Is64BitOs ())
EnableWow64FsRedirection (FALSE);
string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe", false);
string serviceLegacyPath = GetServiceConfigPath (TC_APP_NAME ".exe", true);
if (FileExists (servicePath.c_str()))
{
CopyMessage (hwndDlg, (char *) servicePath.c_str());
bResult = CopyFile (szTmp, servicePath.c_str(), FALSE);
}
else if (Is64BitOs () && FileExists (serviceLegacyPath.c_str()))
{
string favoritesFile = GetServiceConfigPath (TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES, false);
string favoritesLegacyFile = GetServiceConfigPath (TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES, true);
// delete files from legacy path
RemoveMessage (hwndDlg, (char *) serviceLegacyPath.c_str());
DeleteFile (serviceLegacyPath.c_str());
CopyMessage (hwndDlg, (char *) servicePath.c_str());
bResult = CopyFile (szTmp, servicePath.c_str(), FALSE);
if (bResult && FileExists (favoritesLegacyFile.c_str()))
{
// copy the favorites XML file to the native system directory
bResult = CopyFile (favoritesLegacyFile.c_str(), favoritesFile.c_str(), FALSE);
if (bResult)
DeleteFile (favoritesLegacyFile.c_str());
BootEncryption BootEncObj (hwndDlg);
try
{
if (BootEncObj.GetStatus().DriveMounted)
{
BootEncObj.RegisterSystemFavoritesService (TRUE, TRUE);
}
}
catch (...) {}
}
}
if (Is64BitOs ())
EnableWow64FsRedirection (TRUE);
}
}
}