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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 9433bd40..43c951f5 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -787,71 +787,72 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
GetModuleFileName (NULL, szTmp, ARRAYSIZE (szTmp));
if (!SelfExtractInMemory (szTmp, FALSE))
return FALSE;
}
x = wcslen (szDestDir);
if (x < 2)
return FALSE;
if (szDestDir[x - 1] != L'\\')
StringCbCatW (szDestDir, MAX_PATH, L"\\");
for (i = 0; i < sizeof (szFiles) / sizeof (szFiles[0]); i++)
{
BOOL bResult, driver64 = FALSE, zipFile = FALSE;
wchar_t szDir[TC_MAX_PATH];
if (wcsstr (szFiles[i], L"VeraCrypt Setup") != 0)
{
if (bUninstall)
continue; // Prevent 'access denied' error
if (bRepairMode)
continue; // Destination = target
}
if ((*szFiles[i] == L'A') || (*szFiles[i] == L'X'))
StringCbCopyW (szDir, sizeof(szDir), szDestDir);
else if (*szFiles[i] == L'D')
{
if (Is64BitOs ())
driver64 = TRUE;
- GetSystemDirectory (szDir, ARRAYSIZE (szDir));
+ if (!GetSystemDirectory (szDir, ARRAYSIZE (szDir)))
+ StringCbCopyW(szDir, sizeof(szDir), L"C:\\Windows\\System32");
x = wcslen (szDir);
if (szDir[x - 1] != L'\\')
StringCbCatW (szDir, sizeof(szDir), L"\\");
StringCbCatW (szDir, sizeof(szDir), L"Drivers\\");
}
else if (*szFiles[i] == L'W')
GetWindowsDirectory (szDir, ARRAYSIZE (szDir));
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);
else
RemoveMessage (hwndDlg, szTmp);
if (bUninstall == FALSE)
{
SetCurrentDirectory (SetupFilesDir);
if (wcsstr (szFiles[i], L"VeraCrypt Setup") != 0)