VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2022-02-09 22:37:22 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2022-02-10 01:20:25 +0100
commit302dc37fb9baa45c5864af533664c4139e209590 (patch)
treec0428a3f5de9267238f991751d491dac389fedca /src/Mount
parent2da115ffb4dd5e4d63394d48adbf19624db30ea2 (diff)
downloadVeraCrypt-302dc37fb9baa45c5864af533664c4139e209590.tar.gz
VeraCrypt-302dc37fb9baa45c5864af533664c4139e209590.zip
Windows: Make Travel Disk contains 32-bit and arm64 binaries when VeraCrypt installed using MSI
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c180
1 files changed, 91 insertions, 89 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 53be5177..5b964d4e 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -4790,15 +4790,101 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
else
{
int fileNo = 0;
+ BOOL bMsiX64Case = FALSE;
// get file from the Setup binary after checking its signature and its version
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt COMReg.exe", appDir); // MSI installation case
if (FileExists(srcPath))
{
- // we copy only our binaries since we don't have those of the other platforms
+ bMsiX64Case = TRUE;
+ }
+ else
+ StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Setup.exe", appDir); // EXE installation case
+
+ FreeAllFileBuffers ();
+
+ if (!VerifyPackageIntegrity (srcPath) || !SelfExtractInMemory (srcPath, TRUE) || (!bMsiX64Case && (Decompressed_Files_Count != NBR_COMPRESSED_FILES)))
+ {
+ MessageBoxW (hwndDlg, GetString ("DIST_PACKAGE_CORRUPTED"), lpszTitle, MB_ICONEXCLAMATION);
+ goto stop;
+ }
+
+ for (fileNo = 0; fileNo < Decompressed_Files_Count; fileNo++)
+ {
+ wchar_t fileName [TC_MAX_PATH] = {0};
+
+ // Filename
+ StringCchCopyNW (fileName, ARRAYSIZE(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength);
+ if (wcscmp (fileName, L"VeraCrypt.exe") == 0)
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
+ }
+ else if (wcscmp (fileName, L"VeraCrypt-x64.exe") == 0)
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir);
+ }
+ else if (wcscmp(fileName, L"VeraCrypt-arm64.exe") == 0)
+ {
+ StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-arm64.exe", dstDir);
+ }
+ else if (wcscmp (fileName, L"veracrypt.sys") == 0)
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir);
+ }
+ else if (wcscmp (fileName, L"veracrypt-x64.sys") == 0)
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
+ }
+ else if (wcscmp(fileName, L"veracrypt-arm64.sys") == 0)
+ {
+ StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-arm64.sys", dstDir);
+ }
+ else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format.exe") == 0))
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
+ }
+ else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format-x64.exe") == 0))
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir);
+ }
+ else if (copyWizard && (wcscmp(fileName, L"VeraCrypt Format-arm64.exe") == 0))
+ {
+ StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-arm64.exe", dstDir);
+ }
+ else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander.exe") == 0))
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir);
+ }
+ else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander-x64.exe") == 0))
+ {
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir);
+ }
+ else if (copyExpander && (wcscmp(fileName, L"VeraCryptExpander-arm64.exe") == 0))
+ {
+ StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-arm64.exe", dstDir);
+ }
+ else
+ continue;
+
+ if (!SaveBufferToFile (
+ (char *) Decompressed_Files[fileNo].fileContent,
+ dstPath,
+ Decompressed_Files[fileNo].fileLength,
+ FALSE, FALSE))
+ {
+ wchar_t szTmp[512];
+
+ StringCbPrintfW (szTmp, sizeof (szTmp), GetString ("CANNOT_WRITE_FILE_X"), dstPath);
+ MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
+ goto stop;
+ }
+ }
+
+ if (bMsiX64Case)
+ {
// Main app
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir);
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir);
if (!VerifyModuleSignature (srcPath))
{
Error ("DIST_PACKAGE_CORRUPTED", hwndDlg);
@@ -4814,7 +4900,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (copyWizard)
{
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir);
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir);
if (!VerifyModuleSignature (srcPath))
{
Error ("DIST_PACKAGE_CORRUPTED", hwndDlg);
@@ -4831,7 +4917,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (copyExpander)
{
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir);
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir);
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir);
if (!VerifyModuleSignature (srcPath))
{
Error ("DIST_PACKAGE_CORRUPTED", hwndDlg);
@@ -4846,7 +4932,7 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// Driver
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt.sys", appDir);
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir);
+ StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
if (!VerifyModuleSignature (srcPath))
{
Error ("DIST_PACKAGE_CORRUPTED", hwndDlg);
@@ -4858,90 +4944,6 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
goto stop;
}
}
- else
- {
- StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Setup.exe", appDir); // EXE installation case
-
- FreeAllFileBuffers ();
-
- if (!VerifyPackageIntegrity (srcPath) || !SelfExtractInMemory (srcPath))
- {
- MessageBoxW (hwndDlg, GetString ("DIST_PACKAGE_CORRUPTED"), lpszTitle, MB_ICONEXCLAMATION);
- goto stop;
- }
-
- for (fileNo = 0; fileNo < NBR_COMPRESSED_FILES; fileNo++)
- {
- wchar_t fileName [TC_MAX_PATH] = {0};
-
- // Filename
- StringCchCopyNW (fileName, ARRAYSIZE(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength);
-
- if (wcscmp (fileName, L"VeraCrypt.exe") == 0)
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
- }
- else if (wcscmp (fileName, L"VeraCrypt-x64.exe") == 0)
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir);
- }
- else if (wcscmp(fileName, L"VeraCrypt-arm64.exe") == 0)
- {
- StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-arm64.exe", dstDir);
- }
- else if (wcscmp (fileName, L"veracrypt.sys") == 0)
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir);
- }
- else if (wcscmp (fileName, L"veracrypt-x64.sys") == 0)
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
- }
- else if (wcscmp(fileName, L"veracrypt-arm64.sys") == 0)
- {
- StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-arm64.sys", dstDir);
- }
- else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format.exe") == 0))
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
- }
- else if (copyWizard && (wcscmp (fileName, L"VeraCrypt Format-x64.exe") == 0))
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir);
- }
- else if (copyWizard && (wcscmp(fileName, L"VeraCrypt Format-arm64.exe") == 0))
- {
- StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-arm64.exe", dstDir);
- }
- else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander.exe") == 0))
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir);
- }
- else if (copyExpander && (wcscmp (fileName, L"VeraCryptExpander-x64.exe") == 0))
- {
- StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir);
- }
- else if (copyExpander && (wcscmp(fileName, L"VeraCryptExpander-arm64.exe") == 0))
- {
- StringCbPrintfW(dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-arm64.exe", dstDir);
- }
- else
- continue;
-
- if (!SaveBufferToFile (
- (char *) Decompressed_Files[fileNo].fileContent,
- dstPath,
- Decompressed_Files[fileNo].fileLength,
- FALSE, FALSE))
- {
- wchar_t szTmp[512];
-
- StringCbPrintfW (szTmp, sizeof (szTmp), GetString ("CANNOT_WRITE_FILE_X"), dstPath);
- MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
- goto stop;
- }
- }
- }
}
if (strcmp (GetPreferredLangId (), "en") != 0)