VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Setup/Setup.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-09 21:29:33 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-09 23:13:53 (GMT)
commitb7eadfd310bc61e7a982dc8bce4eb32038a6fa09 (patch)
tree4de9e02ed3cf30e2c0af2b11ce333d356101628c /src/Setup/Setup.c
parenta7a8d57bcaaaf4e5982d2e51cd3086d34f45f780 (diff)
downloadVeraCrypt-b7eadfd310bc61e7a982dc8bce4eb32038a6fa09.zip
VeraCrypt-b7eadfd310bc61e7a982dc8bce4eb32038a6fa09.tar.gz
Windows: solve installer issue on Windows 10 caused by failure to overwrite VeraCrypt driver file.
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r--src/Setup/Setup.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index c52b311..5f1c930 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -86,10 +86,20 @@ void localcleanup (void)
CloseAppSetupMutex ();
}
-BOOL StatDeleteFile (char *lpszFile)
+BOOL StatDeleteFile (char *lpszFile, BOOL bCheckForOldFile)
{
struct __stat64 st;
+ if (bCheckForOldFile)
+ {
+ char szOldPath[MAX_PATH + 1];
+ StringCbCopyA (szOldPath, sizeof(szOldPath), lpszFile);
+ StringCbCatA (szOldPath, sizeof(szOldPath), VC_FILENAME_RENAMED_SUFFIX);
+
+ if (_stat64 (szOldPath, &st) == 0)
+ DeleteFile (szOldPath);
+ }
+
if (_stat64 (lpszFile, &st) == 0)
return DeleteFile (lpszFile);
else
@@ -725,7 +735,8 @@ BOOL DoFilesInstall (HWND hwndDlg, char *szDestDir)
(char *) Decompressed_Files[fileNo].fileContent,
szTmp,
Decompressed_Files[fileNo].fileLength,
- FALSE);
+ FALSE,
+ TRUE);
if (driver64)
{
@@ -769,7 +780,7 @@ BOOL DoFilesInstall (HWND hwndDlg, char *szDestDir)
}
else
{
- bResult = StatDeleteFile (szTmp);
+ bResult = StatDeleteFile (szTmp, TRUE);
}
err:
@@ -1022,27 +1033,27 @@ BOOL DoApplicationDataUninstall (HWND hwndDlg)
// Delete favorite volumes file
StringCbPrintfA (path2, sizeof(path2), "%s%s", path, TC_APPD_FILENAME_FAVORITE_VOLUMES);
RemoveMessage (hwndDlg, path2);
- StatDeleteFile (path2);
+ StatDeleteFile (path2, FALSE);
// Delete keyfile defaults
StringCbPrintfA (path2, sizeof(path2), "%s%s", path, TC_APPD_FILENAME_DEFAULT_KEYFILES);
RemoveMessage (hwndDlg, path2);
- StatDeleteFile (path2);
+ StatDeleteFile (path2, FALSE);
// Delete history file
StringCbPrintfA (path2, sizeof(path2), "%s%s", path, TC_APPD_FILENAME_HISTORY);
RemoveMessage (hwndDlg, path2);
- StatDeleteFile (path2);
+ StatDeleteFile (path2, FALSE);
// Delete configuration file
StringCbPrintfA (path2, sizeof(path2), "%s%s", path, TC_APPD_FILENAME_CONFIGURATION);
RemoveMessage (hwndDlg, path2);
- StatDeleteFile (path2);
+ StatDeleteFile (path2, FALSE);
// Delete system encryption configuration file
StringCbPrintfA (path2, sizeof(path2), "%s%s", path, TC_APPD_FILENAME_SYSTEM_ENCRYPTION);
RemoveMessage (hwndDlg, path2);
- StatDeleteFile (path2);
+ StatDeleteFile (path2, FALSE);
SHGetFolderPath (NULL, CSIDL_APPDATA, NULL, 0, path);
StringCbCatA (path, sizeof(path), "\\VeraCrypt");
@@ -1491,22 +1502,22 @@ BOOL DoShortcutsUninstall (HWND hwndDlg, char *szDestDir)
// Start menu entries
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt.lnk");
RemoveMessage (hwndDlg, szTmp2);
- if (StatDeleteFile (szTmp2) == FALSE)
+ if (StatDeleteFile (szTmp2, FALSE) == FALSE)
goto error;
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCryptExpander.lnk");
RemoveMessage (hwndDlg, szTmp2);
- if (StatDeleteFile (szTmp2) == FALSE)
+ if (StatDeleteFile (szTmp2, FALSE) == FALSE)
goto error;
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt Website.url");
RemoveMessage (hwndDlg, szTmp2);
- if (StatDeleteFile (szTmp2) == FALSE)
+ if (StatDeleteFile (szTmp2, FALSE) == FALSE)
goto error;
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\Uninstall VeraCrypt.lnk");
RemoveMessage (hwndDlg, szTmp2);
- if (StatDeleteFile (szTmp2) == FALSE)
+ if (StatDeleteFile (szTmp2, FALSE) == FALSE)
goto error;
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt User's Guide.lnk");
@@ -1527,7 +1538,7 @@ BOOL DoShortcutsUninstall (HWND hwndDlg, char *szDestDir)
StringCbPrintfA (szTmp2, sizeof(szTmp2), "%s%s", szLinkDir, "\\VeraCrypt.lnk");
RemoveMessage (hwndDlg, szTmp2);
- if (StatDeleteFile (szTmp2) == FALSE)
+ if (StatDeleteFile (szTmp2, FALSE) == FALSE)
goto error;
bOK = TRUE;