diff options
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r-- | src/Setup/Setup.c | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c index c52b311c..5f1c9300 100644 --- a/src/Setup/Setup.c +++ b/src/Setup/Setup.c @@ -85,12 +85,22 @@ 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
return TRUE;
@@ -724,9 +734,10 @@ BOOL DoFilesInstall (HWND hwndDlg, char *szDestDir) bResult = SaveBufferToFile (
(char *) Decompressed_Files[fileNo].fileContent,
szTmp,
Decompressed_Files[fileNo].fileLength,
- FALSE);
+ FALSE,
+ TRUE);
if (driver64)
{
if (!EnableWow64FsRedirection (TRUE))
@@ -768,9 +779,9 @@ BOOL DoFilesInstall (HWND hwndDlg, char *szDestDir) }
}
else
{
- bResult = StatDeleteFile (szTmp);
+ bResult = StatDeleteFile (szTmp, TRUE);
}
err:
if (bResult == FALSE)
@@ -1021,29 +1032,29 @@ 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");
RemoveMessage (hwndDlg, path);
@@ -1490,24 +1501,24 @@ 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");
DeleteFile (szTmp2);
@@ -1526,9 +1537,9 @@ 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;
|