VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Setup/Setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Setup/Setup.c')
-rw-r--r--src/Setup/Setup.c54
1 files changed, 39 insertions, 15 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 705ff5eb..bb7eef04 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -557,7 +557,7 @@ void StatusMessage (HWND hwndDlg, char *stringId)
SendDlgItemMessage (hwndDlg, IDC_LOG_WINDOW, LB_GETCOUNT, 0, 0) - 1, 0);
}
-void StatusMessageParam (HWND hwndDlg, char *stringId, wchar_t *param)
+void StatusMessageParam (HWND hwndDlg, char *stringId, const wchar_t *param)
{
wchar_t szTmp[1024];
@@ -576,23 +576,23 @@ void ClearLogWindow (HWND hwndDlg)
SendMessage (GetDlgItem (hwndDlg, IDC_LOG_WINDOW), LB_RESETCONTENT, 0, 0);
}
-void RegMessage (HWND hwndDlg, wchar_t *txt)
+void RegMessage (HWND hwndDlg, const wchar_t *txt)
{
StatusMessageParam (hwndDlg, "ADDING_REG", txt);
}
-void CopyMessage (HWND hwndDlg, wchar_t *txt)
+void _cdecl CopyMessage (HWND hwndDlg, const wchar_t *txt)
{
StatusMessageParam (hwndDlg, "INSTALLING", txt);
}
-void RemoveMessage (HWND hwndDlg, wchar_t *txt)
+void RemoveMessage (HWND hwndDlg, const wchar_t *txt)
{
if (!Rollback)
StatusMessageParam (hwndDlg, "REMOVING", txt);
}
-void IconMessage (HWND hwndDlg, wchar_t *txt)
+void IconMessage (HWND hwndDlg, const wchar_t *txt)
{
StatusMessageParam (hwndDlg, "ADDING_ICON", txt);
}
@@ -672,7 +672,7 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
for (i = 0; i < sizeof (szFiles) / sizeof (szFiles[0]); i++)
{
- BOOL bResult, driver64 = FALSE;
+ BOOL bResult, driver64 = FALSE, zipFile = FALSE;
wchar_t szDir[TC_MAX_PATH];
if (wcsstr (szFiles[i], L"VeraCrypt Setup") != 0)
@@ -696,7 +696,7 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
continue;
}
- if (*szFiles[i] == L'A')
+ if ((*szFiles[i] == L'A') || (*szFiles[i] == L'X'))
StringCbCopyW (szDir, sizeof(szDir), szDestDir);
else if (*szFiles[i] == L'D')
{
@@ -717,7 +717,17 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
if (*szFiles[i] == L'I')
continue;
+ if (*szFiles[i] == L'X')
+ zipFile = TRUE;
+
StringCbPrintfW (szTmp, sizeof(szTmp), L"%s%s", szDir, szFiles[i] + 1);
+ if (zipFile)
+ {
+ // build folder name by removing .zip extension
+ wchar_t* ptr = wcsrchr (szTmp, L'.');
+ if (ptr)
+ *ptr = 0;
+ }
if (bUninstall == FALSE)
CopyMessage (hwndDlg, szTmp);
@@ -805,13 +815,24 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
bResult = FALSE;
goto err;
}
-
- bResult = SaveBufferToFile (
- (char *) Decompressed_Files[fileNo].fileContent,
- szTmp,
- Decompressed_Files[fileNo].fileLength,
- FALSE,
- TRUE);
+ if (zipFile)
+ {
+ bResult = DecompressZipToDir (
+ Decompressed_Files[fileNo].fileContent,
+ Decompressed_Files[fileNo].fileLength,
+ szDir,
+ CopyMessage,
+ hwndDlg);
+ }
+ else
+ {
+ bResult = SaveBufferToFile (
+ (char *) Decompressed_Files[fileNo].fileContent,
+ szTmp,
+ Decompressed_Files[fileNo].fileLength,
+ FALSE,
+ TRUE);
+ }
if (driver64)
{
@@ -907,7 +928,10 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
{
if (driver64)
EnableWow64FsRedirection (FALSE);
- bResult = StatDeleteFile (szTmp, TRUE);
+ if (zipFile)
+ bResult = StatRemoveDirectory (szTmp);
+ else
+ bResult = StatDeleteFile (szTmp, TRUE);
if (driver64)
EnableWow64FsRedirection (TRUE);