VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Setup
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/Setup
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/Setup')
-rw-r--r--src/Setup/SelfExtract.c41
-rw-r--r--src/Setup/SelfExtract.h5
-rw-r--r--src/Setup/Setup.c4
3 files changed, 41 insertions, 9 deletions
diff --git a/src/Setup/SelfExtract.c b/src/Setup/SelfExtract.c
index 34fb0b25..acb2a625 100644
--- a/src/Setup/SelfExtract.c
+++ b/src/Setup/SelfExtract.c
@@ -32,8 +32,12 @@
#ifdef PORTABLE
#define OutputPackageFile L"VeraCrypt Portable " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX)L".exe"
#else
+#ifdef VC_COMREG
+#define OutputPackageFile L"VeraCrypt COMReg.exe"
+#else
#define OutputPackageFile L"VeraCrypt Setup " _T(VERSION_STRING) _T(VERSION_STRING_SUFFIX) L".exe"
#endif
+#endif
#define MAG_START_MARKER "VCINSTRT"
#define MAG_END_MARKER_OBFUSCATED "V/C/I/N/S/C/R/C"
#define PIPE_BUFFER_LEN (4 * BYTES_PER_KB)
@@ -41,6 +45,7 @@
unsigned char MagEndMarker [sizeof (MAG_END_MARKER_OBFUSCATED)];
wchar_t DestExtractPath [TC_MAX_PATH];
DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
+int Decompressed_Files_Count = 0;
volatile char *PipeWriteBuf = NULL;
volatile HANDLE hChildStdinWrite = INVALID_HANDLE_VALUE;
@@ -119,7 +124,7 @@ static void WipeSignatureAreas (char *buffer)
}
-BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir)
+BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir, BOOL bSkipX64)
{
int i, x;
wchar_t inputFile [TC_MAX_PATH];
@@ -163,6 +168,17 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir)
for (i = 0; i < sizeof (szCompressedFiles) / sizeof (szCompressedFiles[0]); i++)
{
+ if (bSkipX64 && wcsstr(szCompressedFiles[i], L"-x64"))
+ continue;
+
+#ifdef VC_COMREG
+ if ( wcsstr(szCompressedFiles[i], L".zip") || wcsstr(szCompressedFiles[i], L".inf")
+ || wcsstr(szCompressedFiles[i], L".cat") || wcsstr(szCompressedFiles[i], L".txt")
+ || wcsstr(szCompressedFiles[i], L"LICENSE") || wcsstr(szCompressedFiles[i], L"NOTICE")
+ )
+ continue;
+#endif
+
StringCbPrintfW (szTmpFilePath, sizeof(szTmpFilePath), L"%s%s", szDestDir, szCompressedFiles[i]);
if (!FileExists (szTmpFilePath))
@@ -215,6 +231,17 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir)
DWORD tmpFileSize;
unsigned char *tmpBuffer;
+ if (bSkipX64 && wcsstr(szCompressedFiles[i], L"-x64"))
+ continue;
+
+#ifdef VC_COMREG
+ if ( wcsstr(szCompressedFiles[i], L".zip") || wcsstr(szCompressedFiles[i], L".inf")
+ || wcsstr(szCompressedFiles[i], L".cat") || wcsstr(szCompressedFiles[i], L".txt")
+ || wcsstr(szCompressedFiles[i], L"LICENSE") || wcsstr(szCompressedFiles[i], L"NOTICE")
+ )
+ continue;
+#endif
+
StringCbPrintfW (szTmpFilePath, sizeof(szTmpFilePath), L"%s%s", szDestDir, szCompressedFiles[i]);
tmpBuffer = LoadFile (szTmpFilePath, &tmpFileSize);
@@ -485,6 +512,8 @@ void FreeAllFileBuffers (void)
Decompressed_Files[fileNo].fileLength = 0;
Decompressed_Files[fileNo].crc = 0;
}
+
+ Decompressed_Files_Count = 0;
}
@@ -492,7 +521,7 @@ void FreeAllFileBuffers (void)
// Creates a table of pointers to buffers containing the following objects for each file:
// filename size, filename (not null-terminated!), file size, file CRC-32, uncompressed file contents.
// For details, see the definition of the DECOMPRESSED_FILE structure.
-BOOL SelfExtractInMemory (wchar_t *path)
+BOOL SelfExtractInMemory (wchar_t *path, BOOL bSkipCountCheck)
{
int filePos = 0, fileNo = 0;
int fileDataEndPos = 0;
@@ -548,7 +577,7 @@ BOOL SelfExtractInMemory (wchar_t *path)
Error ("DIST_PACKAGE_CORRUPTED", NULL);
}
- decompressedDataLen = uncompressedLen + 524288; // + 512K reserve
+ decompressedDataLen = uncompressedLen;
DecompressedData = malloc (decompressedDataLen);
if (DecompressedData == NULL)
{
@@ -607,12 +636,14 @@ BOOL SelfExtractInMemory (wchar_t *path)
fileNo++;
}
- if (fileNo < NBR_COMPRESSED_FILES)
+ if (!bSkipCountCheck && (fileNo < NBR_COMPRESSED_FILES))
{
Error ("DIST_PACKAGE_CORRUPTED", NULL);
goto sem_end;
}
+ Decompressed_Files_Count = fileNo;
+
free (compressedData);
return TRUE;
@@ -635,7 +666,7 @@ void __cdecl ExtractAllFilesThread (void *hwndDlg)
GetModuleFileName (NULL, packageFile, ARRAYSIZE (packageFile));
- if (!(bSuccess = SelfExtractInMemory (packageFile)))
+ if (!(bSuccess = SelfExtractInMemory (packageFile, FALSE)))
goto eaf_end;
if (mkfulldir (DestExtractPath, TRUE) != 0)
diff --git a/src/Setup/SelfExtract.h b/src/Setup/SelfExtract.h
index ed4b6655..bcdb6fdb 100644
--- a/src/Setup/SelfExtract.h
+++ b/src/Setup/SelfExtract.h
@@ -27,11 +27,12 @@ typedef struct
} DECOMPRESSED_FILE;
extern DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
+extern int Decompressed_Files_Count;
void SelfExtractStartupInit (void);
-BOOL SelfExtractInMemory (wchar_t *path);
+BOOL SelfExtractInMemory (wchar_t *path, BOOL bSkipCountCheck);
void __cdecl ExtractAllFilesThread (void *hwndDlg);
-BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir);
+BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir, BOOL bSkipX64);
BOOL VerifyPackageIntegrity (const wchar_t *path);
BOOL VerifySelfPackageIntegrity (void);
BOOL IsSelfExtractingPackage (void);
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index 9f025ef0..fbc8a7d8 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -787,7 +787,7 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
GetModuleFileName (NULL, szTmp, ARRAYSIZE (szTmp));
- if (!SelfExtractInMemory (szTmp))
+ if (!SelfExtractInMemory (szTmp, FALSE))
return FALSE;
}
@@ -2779,7 +2779,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
{
/* Create self-extracting package */
- MakeSelfExtractingPackage (NULL, SetupFilesDir);
+ MakeSelfExtractingPackage (NULL, SetupFilesDir, FALSE);
}
else
{