From 7d6cd0c92d30ebb2dd0ec24744d18524538457b9 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 13 Jul 2015 21:13:28 +0200 Subject: 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. --- src/Setup/Setup.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/Setup') diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index a5a30189..ce52fe3a 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -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); } } } -- cgit v1.2.3