mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 13:13:34 +01:00
Windows: simplify installer logic by copying only binaries for the current architecture.
This commit is contained in:
parent
0a737c8c87
commit
2dc39a7c7e
@ -69,7 +69,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/NODEFAULTLIB:LIBCMTD %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
|
||||
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
|
||||
<DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@ -107,7 +107,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
|
||||
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
|
||||
<DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
|
@ -34,8 +34,8 @@
|
||||
#else
|
||||
#define OutputPackageFile L"VeraCrypt Setup " _T(VERSION_STRING) L".exe"
|
||||
#endif
|
||||
#define MAG_START_MARKER "TCINSTRT"
|
||||
#define MAG_END_MARKER_OBFUSCATED "T/C/I/N/S/C/R/C"
|
||||
#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)
|
||||
|
||||
unsigned char MagEndMarker [sizeof (MAG_END_MARKER_OBFUSCATED)];
|
||||
@ -57,7 +57,7 @@ void SelfExtractStartupInit (void)
|
||||
// The end marker must be included in the self-extracting exe only once, not twice (used e.g.
|
||||
// by IsSelfExtractingPackage()) and that's why MAG_END_MARKER_OBFUSCATED is obfuscated and
|
||||
// needs to be deobfuscated using this function at startup.
|
||||
static void DeobfuscateMagEndMarker (void)
|
||||
void DeobfuscateMagEndMarker (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -385,16 +385,21 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir)
|
||||
|
||||
|
||||
// Verifies the CRC-32 of the whole self-extracting package (except the digital signature areas, if present)
|
||||
BOOL VerifyPackageIntegrity (void)
|
||||
BOOL VerifySelfPackageIntegrity ()
|
||||
{
|
||||
wchar_t path [TC_MAX_PATH];
|
||||
|
||||
GetModuleFileName (NULL, path, ARRAYSIZE (path));
|
||||
return VerifyPackageIntegrity (path);
|
||||
}
|
||||
|
||||
BOOL VerifyPackageIntegrity (const wchar_t *path)
|
||||
{
|
||||
int fileDataEndPos = 0;
|
||||
int fileDataStartPos = 0;
|
||||
unsigned __int32 crc = 0;
|
||||
unsigned char *tmpBuffer;
|
||||
int tmpFileSize;
|
||||
wchar_t path [TC_MAX_PATH];
|
||||
|
||||
GetModuleFileName (NULL, path, ARRAYSIZE (path));
|
||||
|
||||
#ifdef NDEBUG
|
||||
// verify Authenticode digital signature of the exe file
|
||||
@ -464,7 +469,7 @@ BOOL IsSelfExtractingPackage (void)
|
||||
}
|
||||
|
||||
|
||||
static void FreeAllFileBuffers (void)
|
||||
void FreeAllFileBuffers (void)
|
||||
{
|
||||
int fileNo;
|
||||
|
||||
@ -619,7 +624,7 @@ BOOL SelfExtractInMemory (wchar_t *path)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SETUP
|
||||
void __cdecl ExtractAllFilesThread (void *hwndDlg)
|
||||
{
|
||||
int fileNo;
|
||||
@ -704,4 +709,4 @@ void __cdecl ExtractAllFilesThread (void *hwndDlg)
|
||||
else
|
||||
PostMessage (MainDlg, TC_APPMSG_EXTRACTION_FAILURE, 0, 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -32,9 +32,11 @@ void SelfExtractStartupInit (void);
|
||||
BOOL SelfExtractInMemory (wchar_t *path);
|
||||
void __cdecl ExtractAllFilesThread (void *hwndDlg);
|
||||
BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir);
|
||||
BOOL VerifyPackageIntegrity (void);
|
||||
BOOL VerifyPackageIntegrity (const wchar_t *path);
|
||||
BOOL VerifySelfPackageIntegrity (void);
|
||||
BOOL IsSelfExtractingPackage (void);
|
||||
static void DeobfuscateMagEndMarker (void);
|
||||
void FreeAllFileBuffers (void);
|
||||
void DeobfuscateMagEndMarker (void);
|
||||
|
||||
extern wchar_t DestExtractPath [TC_MAX_PATH];
|
||||
|
||||
|
@ -685,18 +685,6 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
|
||||
continue; // Destination = target
|
||||
}
|
||||
|
||||
// skip files that don't apply to the current architecture
|
||||
if ( (Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCrypt-x64.exe") == 0))
|
||||
|| (Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCryptExpander-x64.exe") == 0))
|
||||
|| (Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCrypt Format-x64.exe") == 0))
|
||||
|| (!Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCrypt-x86.exe") == 0))
|
||||
|| (!Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCryptExpander-x86.exe") == 0))
|
||||
|| (!Is64BitOs () && (wcscmp (szFiles[i], L"AVeraCrypt Format-x86.exe") == 0))
|
||||
)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((*szFiles[i] == L'A') || (*szFiles[i] == L'X'))
|
||||
StringCbCopyW (szDir, sizeof(szDir), szDestDir);
|
||||
else if (*szFiles[i] == L'D')
|
||||
@ -765,36 +753,18 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCrypt-x64.exe", sizeof (L"VeraCrypt-x64.exe"));
|
||||
}
|
||||
|
||||
if (Is64BitOs ()
|
||||
&& wcscmp (szFiles[i], L"AVeraCrypt-x86.exe") == 0)
|
||||
{
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCrypt.exe", sizeof (L"VeraCrypt.exe"));
|
||||
}
|
||||
|
||||
if (Is64BitOs ()
|
||||
&& wcscmp (szFiles[i], L"AVeraCryptExpander.exe") == 0)
|
||||
{
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCryptExpander-x64.exe", sizeof (L"VeraCryptExpander-x64.exe"));
|
||||
}
|
||||
|
||||
if (Is64BitOs ()
|
||||
&& wcscmp (szFiles[i], L"AVeraCryptExpander-x86.exe") == 0)
|
||||
{
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCryptExpander.exe", sizeof (L"VeraCryptExpander.exe"));
|
||||
}
|
||||
|
||||
if (Is64BitOs ()
|
||||
&& wcscmp (szFiles[i], L"AVeraCrypt Format.exe") == 0)
|
||||
{
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCrypt Format-x64.exe", sizeof (L"VeraCrypt Format-x64.exe"));
|
||||
}
|
||||
|
||||
if (Is64BitOs ()
|
||||
&& wcscmp (szFiles[i], L"AVeraCrypt Format-x86.exe") == 0)
|
||||
{
|
||||
StringCbCopyNW (curFileName, sizeof(curFileName), L"VeraCrypt Format.exe", sizeof (L"VeraCrypt Format.exe"));
|
||||
}
|
||||
|
||||
if (!bDevm)
|
||||
{
|
||||
bResult = FALSE;
|
||||
@ -1052,6 +1022,12 @@ BOOL DoFilesInstall (HWND hwndDlg, wchar_t *szDestDir)
|
||||
FindClose (h);
|
||||
}
|
||||
|
||||
// remvove legacy files that are not needed anymore
|
||||
for (i = 0; i < sizeof (szLegacyFiles) / sizeof (szLegacyFiles[0]); i++)
|
||||
{
|
||||
StatDeleteFile (szLegacyFiles [i], TRUE);
|
||||
}
|
||||
|
||||
SetCurrentDirectory (SetupFilesDir);
|
||||
}
|
||||
|
||||
@ -2586,7 +2562,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz
|
||||
{
|
||||
if (IsSelfExtractingPackage())
|
||||
{
|
||||
if (!VerifyPackageIntegrity())
|
||||
if (!VerifySelfPackageIntegrity())
|
||||
{
|
||||
// Package corrupted
|
||||
exit (1);
|
||||
|
@ -27,14 +27,7 @@ static wchar_t *szFiles[]=
|
||||
L"AVeraCrypt.exe",
|
||||
L"AVeraCryptExpander.exe",
|
||||
L"AVeraCrypt Format.exe",
|
||||
L"AVeraCrypt-x86.exe",
|
||||
L"AVeraCryptExpander-x86.exe",
|
||||
L"AVeraCrypt Format-x86.exe",
|
||||
L"AVeraCrypt-x64.exe",
|
||||
L"AVeraCryptExpander-x64.exe",
|
||||
L"AVeraCrypt Format-x64.exe",
|
||||
L"Averacrypt.sys",
|
||||
L"Averacrypt-x64.sys",
|
||||
L"Dveracrypt.sys",
|
||||
L"AVeraCrypt Setup.exe",
|
||||
L"XLanguages.zip",
|
||||
@ -59,6 +52,18 @@ static wchar_t *szCompressedFiles[]=
|
||||
L"docs.zip"
|
||||
};
|
||||
|
||||
// Specifies what legacy files to remove during install
|
||||
static wchar_t *szLegacyFiles[]=
|
||||
{
|
||||
L"VeraCrypt-x86.exe",
|
||||
L"VeraCryptExpander-x86.exe",
|
||||
L"VeraCrypt Format-x86.exe",
|
||||
L"VeraCrypt-x64.exe",
|
||||
L"VeraCryptExpander-x64.exe",
|
||||
L"VeraCrypt Format-x64.exe",
|
||||
L"veracrypt-x64.sys",
|
||||
};
|
||||
|
||||
#define FILENAME_64BIT_DRIVER L"veracrypt-x64.sys"
|
||||
#define NBR_COMPRESSED_FILES (sizeof(szCompressedFiles) / sizeof(szCompressedFiles[0]))
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/NODEFAULTLIB:LIBCMTD %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcmtd.lib;atlsd.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
@ -107,7 +107,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" >NUL
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<DelayLoadDLLs>user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;mpr.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
|
Loading…
Reference in New Issue
Block a user