1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

Add original TrueCrypt 7.1a sources

This commit is contained in:
Mounir IDRASSI
2013-06-22 16:16:13 +02:00
commit c606f0866c
252 changed files with 96916 additions and 0 deletions

88
src/Setup/ComSetup.cpp Normal file
View File

@@ -0,0 +1,88 @@
/*
Copyright (c) 2007-2010 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#define TC_MAIN_COM_VERSION_MAJOR 2
#define TC_MAIN_COM_VERSION_MINOR 4
#define TC_FORMAT_COM_VERSION_MAJOR 2
#define TC_FORMAT_COM_VERSION_MINOR 4
#include <atlbase.h>
#include <comdef.h>
#include <statreg.h>
#include <windows.h>
#include "ComSetup.h"
#include "Dlgcode.h"
#include "Resource.h"
#include "../Mount/MainCom_i.c"
#include "../Format/FormatCom_i.c"
extern "C" BOOL RegisterComServers (char *modulePath)
{
BOOL ret = TRUE;
wchar_t mainModule[1024], formatModule[1024];
CComPtr<ITypeLib> tl, tl2;
wsprintfW (mainModule, L"%hsTrueCrypt.exe", modulePath);
wsprintfW (formatModule, L"%hsTrueCrypt Format.exe", modulePath);
UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32);
UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32);
wchar_t setupModule[MAX_PATH];
GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0]));
CRegObject ro;
HRESULT r;
if (!SUCCEEDED (r = ro.FinalConstruct ())
|| !SUCCEEDED (r = ro.AddReplacement (L"MAIN_MODULE", mainModule))
|| !SUCCEEDED (r = ro.AddReplacement (L"FORMAT_MODULE", formatModule))
|| !SUCCEEDED (r = ro.ResourceRegister (setupModule, IDR_COMREG, L"REGISTRY"))
|| !SUCCEEDED (r = LoadTypeLib (mainModule, &tl))
|| !SUCCEEDED (r = RegisterTypeLib (tl, mainModule, 0))
|| !SUCCEEDED (r = LoadTypeLib (formatModule, &tl2))
|| !SUCCEEDED (r = RegisterTypeLib (tl2, formatModule, 0)))
{
MessageBox (MainDlg, _com_error (r).ErrorMessage(), TC_APP_NAME, MB_ICONERROR);
ret = FALSE;
}
ro.FinalRelease ();
return ret;
}
extern "C" BOOL UnregisterComServers (char *modulePath)
{
BOOL ret;
if (UnRegisterTypeLib (LIBID_TrueCryptMainCom, TC_MAIN_COM_VERSION_MAJOR, TC_MAIN_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK)
return FALSE;
if (UnRegisterTypeLib (LIBID_TrueCryptFormatCom, TC_FORMAT_COM_VERSION_MAJOR, TC_FORMAT_COM_VERSION_MINOR, 0, SYS_WIN32) != S_OK)
return FALSE;
wchar_t module[1024];
CRegObject ro;
ro.FinalConstruct ();
wsprintfW (module, L"%hsTrueCrypt.exe", modulePath);
ro.AddReplacement (L"MAIN_MODULE", module);
wsprintfW (module, L"%hsTrueCrypt Format.exe", modulePath);
ro.AddReplacement (L"FORMAT_MODULE", module);
wchar_t setupModule[MAX_PATH];
GetModuleFileNameW (NULL, setupModule, sizeof (setupModule) / sizeof (setupModule[0]));
ret = ro.ResourceUnregister (setupModule, IDR_COMREG, L"REGISTRY") == S_OK;
ro.FinalRelease ();
return ret;
}

18
src/Setup/ComSetup.h Normal file
View File

@@ -0,0 +1,18 @@
/*
Copyright (c) 2007 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#ifdef __cplusplus
extern "C" {
#endif
BOOL RegisterComServers (char *modulePath);
BOOL UnregisterComServers (char *modulePath);
#ifdef __cplusplus
}
#endif

92
src/Setup/ComSetup.rgs Normal file
View File

@@ -0,0 +1,92 @@
HKCR
{
ForceRemove TrueCrypt.1 = s 'TrueCrypt class'
{
CLSID = s '{CECBC0EE-78D9-41E6-BCF1-BC222BB224BA}'
}
ForceRemove TrueCrypt = s 'TrueCrypt class'
{
CLSID = s '{CECBC0EE-78D9-41E6-BCF1-BC222BB224BA}'
CurVer = s 'TrueCrypt.1'
}
NoRemove CLSID
{
ForceRemove {CECBC0EE-78D9-41E6-BCF1-BC222BB224BA} = s 'TrueCrypt class'
{
ProgID = s 'TrueCrypt.1'
VersionIndependentProgID = s 'TrueCrypt'
LocalServer32 = s '"%MAIN_MODULE%"'
TypeLib = s '{1770F56C-7881-4591-A179-79B8001C7D42}'
Elevation
{
val Enabled = d 1
val IconReference = s '@%MAIN_MODULE%,-501'
}
val AppId = s '{CECBC0EE-78D9-41E6-BCF1-BC222BB224BA}'
val LocalizedString = s '@%MAIN_MODULE%,-110'
}
}
NoRemove AppId
{
ForceRemove {CECBC0EE-78D9-41E6-BCF1-BC222BB224BA} = s 'TrueCrypt class'
{
val AccessPermission = b 010004803000000040000000000000001400000002001c000100000000001400070000000101000000000005040000000102000000000005200000002002000001020000000000052000000020020000
}
ForceRemove TrueCrypt.exe
{
val AppId = s '{CECBC0EE-78D9-41E6-BCF1-BC222BB224BA}'
}
}
ForceRemove TrueCryptFormat.1 = s 'TrueCryptFormat class'
{
CLSID = s '{777DCDFD-C330-480B-B582-B02B57580CC9}'
}
ForceRemove TrueCryptFormat = s 'TrueCryptFormat class'
{
CLSID = s '{777DCDFD-C330-480B-B582-B02B57580CC9}'
CurVer = s 'TrueCryptFormat.1'
}
NoRemove CLSID
{
ForceRemove {777DCDFD-C330-480B-B582-B02B57580CC9} = s 'TrueCryptFormat class'
{
ProgID = s 'TrueCryptFormat.1'
VersionIndependentProgID = s 'TrueCryptFormat'
LocalServer32 = s '"%FORMAT_MODULE%"'
TypeLib = s '{A7DF958C-0716-49E9-8C3E-53A775797576}'
Elevation
{
val Enabled = d 1
val IconReference = s '@%FORMAT_MODULE%,-501'
}
val AppId = s '{777DCDFD-C330-480B-B582-B02B57580CC9}'
val LocalizedString = s '@%FORMAT_MODULE%,-112'
}
}
NoRemove AppId
{
ForceRemove {777DCDFD-C330-480B-B582-B02B57580CC9} = s 'TrueCryptFormat class'
{
val AccessPermission = b 010004803000000040000000000000001400000002001c000100000000001400070000000101000000000005040000000102000000000005200000002002000001020000000000052000000020020000
}
ForceRemove 'TrueCrypt Format.exe'
{
val AppId = s '{777DCDFD-C330-480B-B582-B02B57580CC9}'
}
}
}

104
src/Setup/Dir.c Normal file
View File

@@ -0,0 +1,104 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of Encryption for the Masses 2.02a, which is
Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2008 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#include "Tcdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <direct.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "Dir.h"
/* create full directory tree. returns 0 for success, -1 if failure */
int
mkfulldir (char *oriPath, BOOL bCheckonly)
{
struct _stat st;
char *uniq_file;
char path [TC_MAX_PATH];
strcpy (path, oriPath);
if (strlen (path) == 3 && path[1] == ':')
goto is_root; /* keep final slash in root if present */
/* strip final forward or backslash if we have one! */
uniq_file = strrchr (path, '\\');
if (uniq_file && uniq_file[1] == '\0')
uniq_file[0] = '\0';
else
{
uniq_file = strrchr (path, '/');
if (uniq_file && uniq_file[1] == '\0')
uniq_file[0] = '\0';
}
is_root:
if (bCheckonly)
return _stat (path, &st);
if (_stat (path, &st))
return mkfulldir_internal (path);
else
return 0;
}
int
mkfulldir_internal (char *path)
{
char *token;
struct _stat st;
static char tokpath[_MAX_PATH];
static char trail[_MAX_PATH];
strcpy (tokpath, path);
trail[0] = '\0';
token = strtok (tokpath, "\\/");
if (tokpath[0] == '\\' && tokpath[1] == '\\')
{ /* unc */
trail[0] = tokpath[0];
trail[1] = tokpath[1];
trail[2] = '\0';
strcat (trail, token);
strcat (trail, "\\");
token = strtok (NULL, "\\/");
if (token)
{ /* get share name */
strcat (trail, token);
strcat (trail, "\\");
}
token = strtok (NULL, "\\/");
}
if (tokpath[1] == ':')
{ /* drive letter */
strcat (trail, tokpath);
strcat (trail, "\\");
token = strtok (NULL, "\\/");
}
while (token != NULL)
{
int x;
strcat (trail, token);
x = _mkdir (trail);
strcat (trail, "\\");
token = strtok (NULL, "\\/");
}
return _stat (path, &st);
}

21
src/Setup/Dir.h Normal file
View File

@@ -0,0 +1,21 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of Encryption for the Masses 2.02a, which is
Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2008 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#ifdef __cplusplus
extern "C" {
#endif
int mkfulldir ( char *path , BOOL bCheckonly );
int mkfulldir_internal ( char *path );
#ifdef __cplusplus
}
#endif

64
src/Setup/Resource.h Normal file
View File

@@ -0,0 +1,64 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Setup.rc
//
#define IDR_COMREG 10
#define IDD_INSTALL 101
#define IDD_INSTALL_OPTIONS_PAGE_DLG 102
#define IDD_UNINSTALL 103
#define IDI_SETUP 104
#define IDR_SETUP_RSRC_HEADER 105
#define IDD_EXTRACTION_OPTIONS_PAGE_DLG 106
#define IDB_SETUP_WIZARD 107
#define IDD_INTRO_PAGE_DLG 108
#define IDB_SETUP_WIZARD_BKG 109
#define IDD_INFO_PAGE_DLG 110
#define IDD_INSTL_DLG 111
#define IDD_WIZARD_MODE_PAGE_DLG 112
#define IDD_PROGRESS_PAGE_DLG 113
#define IDD_DONATIONS_PAGE_DLG 114
#define IDC_DESTINATION 1000
#define IDC_BOX_TITLE 1001
#define IDC_BROWSE 1002
#define IDC_BOX_INFO 1003
#define IDC_LICENSE 1004
#define IDC_BOX_HELP 1005
#define IDC_LICENSE_TEXT 1006
#define IDC_BOX_HELP2 1007
#define IDC_FILE_TYPE 1008
#define IDT_UNINSTALL_DIR 1009
#define IDC_PROG_GROUP 1010
#define IDC_SYSTEM_RESTORE 1011
#define IDC_DESKTOP_ICON 1012
#define IDC_ALL_USERS 1013
#define IDT_INSTALL_DESTINATION 1014
#define IDC_UNINSTALL 1015
#define IDC_PROGRESS_BAR 1016
#define IDC_LOG_WINDOW 1017
#define IDC_SETUP_WIZARD_BKG 1018
#define IDC_SETUP_WIZARD_GFX_AREA 1019
#define IDC_HR 1020
#define IDC_OPEN_CONTAINING_FOLDER 1021
#define IDC_AGREE 1022
#define IDC_HR_BOTTOM 1023
#define IDC_WIZARD_MODE_INSTALL 1024
#define IDC_WIZARD_MODE_EXTRACT_ONLY 1025
#define IDC_NEXT 1026
#define IDC_PREV 1027
#define IDT_EXTRACT_DESTINATION 1028
#define IDC_POS_BOX 1029
#define IDC_BITMAP_SETUP_WIZARD 1030
#define IDC_MAIN_CONTENT_CANVAS 1031
#define IDC_DONATE 1032
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 115
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1033
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

734
src/Setup/SelfExtract.c Normal file
View File

@@ -0,0 +1,734 @@
/*
Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#include "Tcdefs.h"
#include "Inflate.h"
#include "SelfExtract.h"
#include "Wizard.h"
#include "Setup.h"
#include "Crc.h"
#include "Endian.h"
#include "Dlgcode.h"
#include "Dir.h"
#include "Language.h"
#include "Resource.h"
#define OutputPackageFile "TrueCrypt Setup " VERSION_STRING ".exe"
#define MAG_START_MARKER "TCINSTRT"
#define MAG_END_MARKER_OBFUSCATED "T/C/I/N/S/C/R/C"
#define PIPE_BUFFER_LEN (4 * BYTES_PER_KB)
unsigned char MagEndMarker [sizeof (MAG_END_MARKER_OBFUSCATED)];
char DestExtractPath [TC_MAX_PATH];
DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
volatile char *PipeWriteBuf = NULL;
volatile HANDLE hChildStdinWrite = INVALID_HANDLE_VALUE;
unsigned char *DecompressedData = NULL;
void SelfExtractStartupInit (void)
{
DeobfuscateMagEndMarker ();
}
// 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)
{
int i;
for (i = 0; i < sizeof (MAG_END_MARKER_OBFUSCATED); i += 2)
MagEndMarker [i/2] = MAG_END_MARKER_OBFUSCATED [i];
MagEndMarker [i/2] = 0;
}
static void PkgError (char *msg)
{
MessageBox (NULL, msg, "TrueCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
}
static void PkgWarning (char *msg)
{
MessageBox (NULL, msg, "TrueCrypt", MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
static void PkgInfo (char *msg)
{
MessageBox (NULL, msg, "TrueCrypt", MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
// Returns 0 if decompression fails or, if successful, returns the size of the decompressed data
static int DecompressBuffer (char *out, char *in, int len)
{
return (DecompressDeflatedData (out, in, len)); // Inflate
}
static void __cdecl PipeWriteThread (void *len)
{
int sendBufSize = PIPE_BUFFER_LEN, bytesSent = 0;
int bytesToSend = *((int *) len), bytesSentTotal = 0;
if (PipeWriteBuf == NULL || (HANDLE) hChildStdinWrite == INVALID_HANDLE_VALUE)
{
PkgError ("Failed sending data to the STDIN pipe");
return;
}
while (bytesToSend > 0)
{
if (bytesToSend < PIPE_BUFFER_LEN)
sendBufSize = bytesToSend;
if (!WriteFile ((HANDLE) hChildStdinWrite, (char *) PipeWriteBuf + bytesSentTotal, sendBufSize, &bytesSent, NULL)
|| bytesSent == 0
|| bytesSent != sendBufSize)
{
PkgError ("Failed sending data to the STDIN pipe");
return;
}
bytesToSend -= bytesSent;
bytesSentTotal += bytesSent;
}
// Closing the pipe causes the child process to stop reading from it
if (!CloseHandle (hChildStdinWrite))
{
PkgError ("Cannot close pipe");
return;
}
}
// Returns 0 if compression fails or, if successful, the size of the compressed data
static int CompressBuffer (char *out, char *in, int len)
{
SECURITY_ATTRIBUTES securityAttrib;
DWORD bytesReceived = 0;
HANDLE hChildStdoutWrite = INVALID_HANDLE_VALUE;
HANDLE hChildStdoutRead = INVALID_HANDLE_VALUE;
HANDLE hChildStdinRead = INVALID_HANDLE_VALUE;
STARTUPINFO startupInfo;
PROCESS_INFORMATION procInfo;
char pipeBuffer [PIPE_BUFFER_LEN];
int res_len = 0;
BOOL bGzipHeaderRead = FALSE;
ZeroMemory (&startupInfo, sizeof (startupInfo));
ZeroMemory (&procInfo, sizeof (procInfo));
// Pipe handle inheritance
securityAttrib.bInheritHandle = TRUE;
securityAttrib.nLength = sizeof (securityAttrib);
securityAttrib.lpSecurityDescriptor = NULL;
if (!CreatePipe (&hChildStdoutRead, &hChildStdoutWrite, &securityAttrib, 0))
{
PkgError ("Cannot create STDOUT pipe.");
return 0;
}
SetHandleInformation (hChildStdoutRead, HANDLE_FLAG_INHERIT, 0);
if (!CreatePipe (&hChildStdinRead, &((HANDLE) hChildStdinWrite), &securityAttrib, 0))
{
PkgError ("Cannot create STDIN pipe.");
return 0;
}
SetHandleInformation (hChildStdinWrite, HANDLE_FLAG_INHERIT, 0);
// Create a child process that will compress the data
startupInfo.wShowWindow = SW_HIDE;
startupInfo.hStdInput = hChildStdinRead;
startupInfo.hStdOutput = hChildStdoutWrite;
startupInfo.cb = sizeof (startupInfo);
startupInfo.hStdError = hChildStdoutWrite;
startupInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
if (!CreateProcess (NULL, "gzip --best", NULL, NULL, TRUE, 0, NULL, NULL, &startupInfo, &procInfo))
{
PkgError ("Error: Cannot run gzip.\n\nBefore you can create a self-extracting TrueCrypt package, you need to have the open-source 'gzip' compression tool placed in any directory in the search path for executable files (for example, in 'C:\\Windows\\').\n\nNote: gzip can be freely downloaded e.g. from www.gzip.org");
return 0;
}
CloseHandle (procInfo.hProcess);
CloseHandle (procInfo.hThread);
// Start sending the uncompressed data to the pipe (STDIN)
PipeWriteBuf = in;
_beginthread (PipeWriteThread, PIPE_BUFFER_LEN * 2, (void *) &len);
if (!CloseHandle (hChildStdoutWrite))
{
PkgError ("Cannot close STDOUT write");
return 0;
}
bGzipHeaderRead = FALSE;
// Read the compressed data from the pipe (sent by the child process to STDOUT)
while (TRUE)
{
if (!ReadFile (hChildStdoutRead, pipeBuffer, bGzipHeaderRead ? PIPE_BUFFER_LEN : 10, &bytesReceived, NULL))
break;
if (bGzipHeaderRead)
{
memcpy (out + res_len, pipeBuffer, bytesReceived);
res_len += bytesReceived;
}
else
bGzipHeaderRead = TRUE; // Skip the 10-byte gzip header
}
return res_len - 8; // A gzip stream ends with a CRC-32 hash and a 32-bit size (those 8 bytes need to be chopped off)
}
// Clears all bytes that change when an exe file is digitally signed, except the data that are appended.
// If those bytes weren't cleared, CRC-32 checks would fail after signing.
static void WipeSignatureAreas (char *buffer)
{
// Clear bytes 0x130-0x1ff
memset (buffer + 0x130, 0, 0x200 - 0x130);
}
BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
{
int i, x;
unsigned char inputFile [TC_MAX_PATH];
unsigned char outputFile [TC_MAX_PATH];
unsigned char szTmpFilePath [TC_MAX_PATH];
unsigned char szTmp32bit [4] = {0};
unsigned char *szTmp32bitPtr = szTmp32bit;
unsigned char *buffer = NULL, *compressedBuffer = NULL;
unsigned char *bufIndex = NULL;
char tmpStr [2048];
int bufLen = 0, compressedDataLen = 0, uncompressedDataLen = 0;
x = strlen (szDestDir);
if (x < 2)
goto err;
if (szDestDir[x - 1] != '\\')
strcat (szDestDir, "\\");
GetModuleFileName (NULL, inputFile, sizeof (inputFile));
strcpy (outputFile, szDestDir);
strncat (outputFile, OutputPackageFile, sizeof (outputFile) - strlen (outputFile) - 1);
// Clone 'TrueCrypt Setup.exe' to create the base of the new self-extracting archive
if (!TCCopyFile (inputFile, outputFile))
{
handleWin32Error (hwndDlg);
PkgError ("Cannot copy 'TrueCrypt Setup.exe' to the package");
goto err;
}
// Determine the buffer size needed for all the files and meta data and check if all required files exist
bufLen = 0;
for (i = 0; i < sizeof (szCompressedFiles) / sizeof (szCompressedFiles[0]); i++)
{
_snprintf (szTmpFilePath, sizeof(szTmpFilePath), "%s%s", szDestDir, szCompressedFiles[i]);
if (!FileExists (szTmpFilePath))
{
char tmpstr [1000];
_snprintf (tmpstr, sizeof(tmpstr), "File not found:\n\n'%s'", szTmpFilePath);
remove (outputFile);
PkgError (tmpstr);
goto err;
}
bufLen += (int) GetFileSize64 (szTmpFilePath);
bufLen += 2; // 16-bit filename length
bufLen += strlen(szCompressedFiles[i]); // Filename
bufLen += 4; // CRC-32
bufLen += 4; // 32-bit file length
}
buffer = malloc (bufLen + 524288); // + 512K reserve
if (buffer == NULL)
{
PkgError ("Cannot allocate memory for uncompressed data");
remove (outputFile);
goto err;
}
// Write the start marker
if (!SaveBufferToFile (MAG_START_MARKER, outputFile, strlen (MAG_START_MARKER), TRUE))
{
PkgError ("Cannot write the start marker");
remove (outputFile);
goto err;
}
bufIndex = buffer;
// Copy all required files and their meta data to the buffer
for (i = 0; i < sizeof (szCompressedFiles) / sizeof (szCompressedFiles[0]); i++)
{
DWORD tmpFileSize;
unsigned char *tmpBuffer;
_snprintf (szTmpFilePath, sizeof(szTmpFilePath), "%s%s", szDestDir, szCompressedFiles[i]);
tmpBuffer = LoadFile (szTmpFilePath, &tmpFileSize);
if (tmpBuffer == NULL)
{
char tmpstr [1000];
free (tmpBuffer);
_snprintf (tmpstr, sizeof(tmpstr), "Cannot load file \n'%s'", szTmpFilePath);
remove (outputFile);
PkgError (tmpstr);
goto err;
}
// Copy the filename length to the main buffer
mputWord (bufIndex, (WORD) strlen(szCompressedFiles[i]));
// Copy the filename to the main buffer
memcpy (bufIndex, szCompressedFiles[i], strlen(szCompressedFiles[i]));
bufIndex += strlen(szCompressedFiles[i]);
// Compute CRC-32 hash of the uncompressed file and copy it to the main buffer
mputLong (bufIndex, GetCrc32 (tmpBuffer, tmpFileSize));
// Copy the file length to the main buffer
mputLong (bufIndex, (unsigned __int32) tmpFileSize);
// Copy the file contents to the main buffer
memcpy (bufIndex, tmpBuffer, tmpFileSize);
bufIndex += tmpFileSize;
free (tmpBuffer);
}
// Calculate the total size of the uncompressed data
uncompressedDataLen = (int) (bufIndex - buffer);
// Write total size of the uncompressed data
szTmp32bitPtr = szTmp32bit;
mputLong (szTmp32bitPtr, (unsigned __int32) uncompressedDataLen);
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE))
{
remove (outputFile);
PkgError ("Cannot write the total size of the uncompressed data");
goto err;
}
// Compress all the files and meta data in the buffer to create a solid archive
compressedBuffer = malloc (uncompressedDataLen + 524288); // + 512K reserve
if (compressedBuffer == NULL)
{
remove (outputFile);
PkgError ("Cannot allocate memory for compressed data");
goto err;
}
compressedDataLen = CompressBuffer (compressedBuffer, buffer, uncompressedDataLen);
if (compressedDataLen <= 0)
{
remove (outputFile);
PkgError ("Failed to compress the data");
goto err;
}
free (buffer);
buffer = NULL;
// Write the total size of the compressed data
szTmp32bitPtr = szTmp32bit;
mputLong (szTmp32bitPtr, (unsigned __int32) compressedDataLen);
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE))
{
remove (outputFile);
PkgError ("Cannot write the total size of the compressed data");
goto err;
}
// Write the compressed data
if (!SaveBufferToFile (compressedBuffer, outputFile, compressedDataLen, TRUE))
{
remove (outputFile);
PkgError ("Cannot write compressed data to the package");
goto err;
}
// Write the end marker
if (!SaveBufferToFile (MagEndMarker, outputFile, strlen (MagEndMarker), TRUE))
{
remove (outputFile);
PkgError ("Cannot write the end marker");
goto err;
}
free (compressedBuffer);
compressedBuffer = NULL;
// Compute and write CRC-32 hash of the entire package
{
DWORD tmpFileSize;
char *tmpBuffer;
tmpBuffer = LoadFile (outputFile, &tmpFileSize);
if (tmpBuffer == NULL)
{
handleWin32Error (hwndDlg);
remove (outputFile);
PkgError ("Cannot load the package to compute CRC");
goto err;
}
// Zero all bytes that change when the exe is digitally signed (except appended blocks).
WipeSignatureAreas (tmpBuffer);
szTmp32bitPtr = szTmp32bit;
mputLong (szTmp32bitPtr, GetCrc32 (tmpBuffer, tmpFileSize));
free (tmpBuffer);
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE))
{
remove (outputFile);
PkgError ("Cannot write the total size of the compressed data");
goto err;
}
}
sprintf (tmpStr, "Self-extracting package successfully created (%s)", outputFile);
PkgInfo (tmpStr);
return TRUE;
err:
if (buffer)
free (buffer);
if (compressedBuffer)
free (compressedBuffer);
return FALSE;
}
// Verifies the CRC-32 of the whole self-extracting package (except the digital signature areas, if present)
BOOL VerifyPackageIntegrity (void)
{
int fileDataEndPos = 0;
int fileDataStartPos = 0;
unsigned __int32 crc = 0;
unsigned char *tmpBuffer;
int tmpFileSize;
char path [TC_MAX_PATH];
GetModuleFileName (NULL, path, sizeof (path));
fileDataEndPos = (int) FindStringInFile (path, MagEndMarker, strlen (MagEndMarker));
if (fileDataEndPos < 0)
{
Error ("DIST_PACKAGE_CORRUPTED");
return FALSE;
}
fileDataEndPos--;
fileDataStartPos = (int) FindStringInFile (path, MAG_START_MARKER, strlen (MAG_START_MARKER));
if (fileDataStartPos < 0)
{
Error ("DIST_PACKAGE_CORRUPTED");
return FALSE;
}
fileDataStartPos += strlen (MAG_START_MARKER);
if (!LoadInt32 (path, &crc, fileDataEndPos + strlen (MagEndMarker) + 1))
{
Error ("CANT_VERIFY_PACKAGE_INTEGRITY");
return FALSE;
}
// Compute the CRC-32 hash of the whole file (except the digital signature area, if present)
tmpBuffer = LoadFile (path, &tmpFileSize);
if (tmpBuffer == NULL)
{
Error ("CANT_VERIFY_PACKAGE_INTEGRITY");
return FALSE;
}
// Zero all bytes that change when an exe is digitally signed (except appended blocks).
WipeSignatureAreas (tmpBuffer);
if (crc != GetCrc32 (tmpBuffer, fileDataEndPos + 1 + strlen (MagEndMarker)))
{
free (tmpBuffer);
Error ("DIST_PACKAGE_CORRUPTED");
return FALSE;
}
free (tmpBuffer);
return TRUE;
}
// Determines whether we are a self-extracting package
BOOL IsSelfExtractingPackage (void)
{
char path [TC_MAX_PATH];
GetModuleFileName (NULL, path, sizeof (path));
return (FindStringInFile (path, MagEndMarker, strlen (MagEndMarker)) != -1);
}
static void FreeAllFileBuffers (void)
{
int fileNo;
if (DecompressedData != NULL)
{
free (DecompressedData);
DecompressedData = NULL;
}
for (fileNo = 0; fileNo < NBR_COMPRESSED_FILES; fileNo++)
{
Decompressed_Files[fileNo].fileName = NULL;
Decompressed_Files[fileNo].fileContent = NULL;
Decompressed_Files[fileNo].fileNameLength = 0;
Decompressed_Files[fileNo].fileLength = 0;
Decompressed_Files[fileNo].crc = 0;
}
}
// Assumes that VerifyPackageIntegrity() has been used. Returns TRUE, if successful (otherwise FALSE).
// 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 (char *path)
{
int filePos = 0, fileNo = 0;
int fileDataEndPos = 0;
int fileDataStartPos = 0;
int uncompressedLen = 0;
int compressedLen = 0;
unsigned char *compressedData = NULL;
unsigned char *bufPos = NULL, *bufEndPos = NULL;
FreeAllFileBuffers();
fileDataEndPos = (int) FindStringInFile (path, MagEndMarker, strlen (MagEndMarker));
if (fileDataEndPos < 0)
{
Error ("CANNOT_READ_FROM_PACKAGE");
return FALSE;
}
fileDataEndPos--;
fileDataStartPos = (int) FindStringInFile (path, MAG_START_MARKER, strlen (MAG_START_MARKER));
if (fileDataStartPos < 0)
{
Error ("CANNOT_READ_FROM_PACKAGE");
return FALSE;
}
fileDataStartPos += strlen (MAG_START_MARKER);
filePos = fileDataStartPos;
// Read the stored total size of the uncompressed data
if (!LoadInt32 (path, &uncompressedLen, filePos))
{
Error ("CANNOT_READ_FROM_PACKAGE");
return FALSE;
}
filePos += 4;
// Read the stored total size of the compressed data
if (!LoadInt32 (path, &compressedLen, filePos))
{
Error ("CANNOT_READ_FROM_PACKAGE");
return FALSE;
}
filePos += 4;
if (compressedLen != fileDataEndPos - fileDataStartPos - 8 + 1)
{
Error ("DIST_PACKAGE_CORRUPTED");
}
DecompressedData = malloc (uncompressedLen + 524288); // + 512K reserve
if (DecompressedData == NULL)
{
Error ("ERR_MEM_ALLOC");
return FALSE;
}
bufPos = DecompressedData;
bufEndPos = bufPos + uncompressedLen - 1;
compressedData = LoadFileBlock (path, filePos, compressedLen);
if (compressedData == NULL)
{
free (DecompressedData);
DecompressedData = NULL;
Error ("CANNOT_READ_FROM_PACKAGE");
return FALSE;
}
// Decompress the data
if (DecompressBuffer (DecompressedData, compressedData, compressedLen) != uncompressedLen)
{
Error ("DIST_PACKAGE_CORRUPTED");
goto sem_end;
}
while (bufPos <= bufEndPos && fileNo < NBR_COMPRESSED_FILES)
{
// Filename length
Decompressed_Files[fileNo].fileNameLength = mgetWord (bufPos);
// Filename
Decompressed_Files[fileNo].fileName = bufPos;
bufPos += Decompressed_Files[fileNo].fileNameLength;
// CRC-32 of the file
Decompressed_Files[fileNo].crc = mgetLong (bufPos);
// File length
Decompressed_Files[fileNo].fileLength = mgetLong (bufPos);
// File content
Decompressed_Files[fileNo].fileContent = bufPos;
bufPos += Decompressed_Files[fileNo].fileLength;
// Verify CRC-32 of the file (to verify that it didn't get corrupted while creating the solid archive).
if (Decompressed_Files[fileNo].crc
!= GetCrc32 (Decompressed_Files[fileNo].fileContent, Decompressed_Files[fileNo].fileLength))
{
Error ("DIST_PACKAGE_CORRUPTED");
goto sem_end;
}
fileNo++;
}
if (fileNo < NBR_COMPRESSED_FILES)
{
Error ("DIST_PACKAGE_CORRUPTED");
goto sem_end;
}
free (compressedData);
return TRUE;
sem_end:
FreeAllFileBuffers();
free (compressedData);
return FALSE;
}
void __cdecl ExtractAllFilesThread (void *hwndDlg)
{
int fileNo;
BOOL bSuccess = FALSE;
char packageFile [TC_MAX_PATH];
InvalidateRect (GetDlgItem (GetParent (hwndDlg), IDD_INSTL_DLG), NULL, TRUE);
ClearLogWindow (hwndDlg);
GetModuleFileName (NULL, packageFile, sizeof (packageFile));
if (!(bSuccess = SelfExtractInMemory (packageFile)))
goto eaf_end;
if (mkfulldir (DestExtractPath, TRUE) != 0)
{
if (mkfulldir (DestExtractPath, FALSE) != 0)
{
wchar_t szTmp[TC_MAX_PATH];
handleWin32Error (hwndDlg);
wsprintfW (szTmp, GetString ("CANT_CREATE_FOLDER"), DestExtractPath);
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONHAND);
bSuccess = FALSE;
goto eaf_end;
}
}
for (fileNo = 0; fileNo < NBR_COMPRESSED_FILES; fileNo++)
{
char fileName [TC_MAX_PATH] = {0};
char filePath [TC_MAX_PATH] = {0};
// Filename
strncpy (fileName, Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength);
fileName [Decompressed_Files[fileNo].fileNameLength] = 0;
strcpy (filePath, DestExtractPath);
strcat (filePath, fileName);
StatusMessageParam (hwndDlg, "EXTRACTING_VERB", filePath);
// Write the file
if (!SaveBufferToFile (
Decompressed_Files[fileNo].fileContent,
filePath,
Decompressed_Files[fileNo].fileLength,
FALSE))
{
wchar_t szTmp[512];
_snwprintf (szTmp, sizeof (szTmp) / 2, GetString ("CANNOT_WRITE_FILE_X"), filePath);
MessageBoxW (hwndDlg, szTmp, lpszTitle, MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
bSuccess = FALSE;
goto eaf_end;
}
UpdateProgressBarProc ((int) (100 * ((float) fileNo / NBR_COMPRESSED_FILES)));
}
eaf_end:
FreeAllFileBuffers();
if (bSuccess)
PostMessage (MainDlg, TC_APPMSG_EXTRACTION_SUCCESS, 0, 0);
else
PostMessage (MainDlg, TC_APPMSG_EXTRACTION_FAILURE, 0, 0);
}

39
src/Setup/SelfExtract.h Normal file
View File

@@ -0,0 +1,39 @@
/*
Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.
Governed by the TrueCrypt License 3.0 the full text of which is contained in
the file License.txt included in TrueCrypt binary and source code distribution
packages.
*/
#include "Setup.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
// WARNING: file name is NOT null-terminated (use fileNameLength).
unsigned char *fileName;
int fileNameLength;
uint32 crc;
__int32 fileLength;
unsigned char *fileContent;
} DECOMPRESSED_FILE;
extern DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
void SelfExtractStartupInit (void);
BOOL SelfExtractInMemory (char *path);
void __cdecl ExtractAllFilesThread (void *hwndDlg);
BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir);
BOOL VerifyPackageIntegrity (void);
BOOL IsSelfExtractingPackage (void);
static void DeobfuscateMagEndMarker (void);
extern char DestExtractPath [TC_MAX_PATH];
#ifdef __cplusplus
}
#endif

2160
src/Setup/Setup.c Normal file

File diff suppressed because it is too large Load Diff

100
src/Setup/Setup.h Normal file
View File

@@ -0,0 +1,100 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of Encryption for the Masses 2.02a, which is
Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2009 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#ifndef SETUP_H
#define SETUP_H
#ifdef __cplusplus
extern "C" {
#endif
// Specifies what files to install, where (determined by the prefix), and in what order
static char *szFiles[]=
{
"ATrueCrypt User Guide.pdf",
"ALicense.txt",
"ATrueCrypt.exe",
"ATrueCrypt Format.exe",
"Atruecrypt.sys",
"Atruecrypt-x64.sys",
"Dtruecrypt.sys",
"ATrueCrypt Setup.exe"
};
// Specifies what files are included in self-extracting packages (no other files will be packaged or extracted).
static char *szCompressedFiles[]=
{
"TrueCrypt User Guide.pdf",
"License.txt",
"TrueCrypt.exe",
"TrueCrypt Format.exe",
"truecrypt.sys",
"truecrypt-x64.sys"
};
#define FILENAME_64BIT_DRIVER "truecrypt-x64.sys"
#define NBR_COMPRESSED_FILES (sizeof(szCompressedFiles) / sizeof(szCompressedFiles[0]))
void localcleanup (void);
BOOL StatDeleteFile ( char *lpszFile );
BOOL StatRemoveDirectory ( char *lpszDir );
HRESULT CreateLink ( char *lpszPathObj , char *lpszArguments , char *lpszPathLink );
void GetProgramPath ( HWND hwndDlg , char *path );
void StatusMessage (HWND hwndDlg, char *stringId);
void StatusMessageParam (HWND hwndDlg, char *stringId, char *param);
void ClearLogWindow (HWND hwndDlg);
void StatusMessage ( HWND hwndDlg , char *stringId );
void StatusMessageParam ( HWND hwndDlg , char *stringId , char *param );
void RegMessage ( HWND hwndDlg , char *txt );
void RegRemoveMessage (HWND hwndDlg, char *txt);
void CopyMessage ( HWND hwndDlg , char *txt );
void RemoveMessage ( HWND hwndDlg , char *txt );
void IconMessage ( HWND hwndDlg , char *txt );
static int CALLBACK BrowseCallbackProc ( HWND hwnd , UINT uMsg , LPARAM lp , LPARAM pData );
void LoadLicense ( HWND hwndDlg );
void DetermineUpgradeDowngradeStatus (BOOL bCloseDriverHandle, LONG *driverVersionPtr);
BOOL DoFilesInstall ( HWND hwndDlg , char *szDestDir );
BOOL DoRegInstall ( HWND hwndDlg , char *szDestDir , BOOL bInstallType );
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated);
BOOL DoServiceUninstall ( HWND hwndDlg , char *lpszService );
BOOL DoDriverUnload ( HWND hwndDlg );
BOOL DoShortcutsInstall ( HWND hwndDlg , char *szDestDir , BOOL bProgGroup, BOOL bDesktopIcon );
BOOL DoShortcutsUninstall (HWND hwndDlg, char *szDestDir);
void OutcomePrompt ( HWND hwndDlg , BOOL bOK );
void DoUninstall ( void *hwndDlg );
void DoInstall ( void *hwndDlg );
void SetInstallationPath (HWND hwndDlg);
BOOL UpgradeBootLoader (HWND hwndDlg);
BOOL CALLBACK InstallDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
extern BOOL bDevm;
extern BOOL Rollback;
extern BOOL bUpgrade;
extern BOOL bPossiblyFirstTimeInstall;
extern BOOL bRepairMode;
extern BOOL bSystemRestore;
extern BOOL bDisableSwapFiles;
extern BOOL bForAllUsers;
extern BOOL bRegisterFileExt;
extern BOOL bAddToStartMenu;
extern BOOL bDesktopIcon;
extern BOOL bDesktopIconStatusDetermined;
extern BOOL SystemEncryptionUpdate;
extern BOOL bRestartRequired;
extern HMODULE volatile SystemRestoreDll;
extern char InstallationPath[TC_MAX_PATH];
extern char SetupFilesDir[TC_MAX_PATH];
#ifdef __cplusplus
}
#endif
#endif // #ifndef SETUP_H

BIN
src/Setup/Setup.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

21
src/Setup/Setup.manifest Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>

327
src/Setup/Setup.rc Normal file
View File

@@ -0,0 +1,327 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "..\\common\\resource.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 7,1,1,0
PRODUCTVERSION 7,1,1,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "TrueCrypt Foundation"
VALUE "FileDescription", "TrueCrypt Setup"
VALUE "FileVersion", "7.1a"
VALUE "LegalTrademarks", "TrueCrypt"
VALUE "OriginalFilename", "TrueCrypt Setup.exe"
VALUE "ProductName", "TrueCrypt"
VALUE "ProductVersion", "7.1a"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// HEADER
//
IDR_SETUP_RSRC_HEADER HEADER "resource.h"
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_COMREG REGISTRY "ComSetup.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_UNINSTALL DIALOGEX 0, 0, 349, 234
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Uninstall TrueCrypt"
CLASS "CustomDlg"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Click Uninstall to remove TrueCrypt from this system.",IDT_UNINSTALL_DIR,8,8,334,8
LISTBOX IDC_LOG_WINDOW,7,21,335,179,LBS_NOINTEGRALHEIGHT | LBS_NOSEL | WS_VSCROLL
DEFPUSHBUTTON "&Uninstall",IDC_UNINSTALL,236,213,50,14
PUSHBUTTON "Cancel",IDCANCEL,292,213,50,14
CONTROL "Create System &Restore point",IDC_SYSTEM_RESTORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,215,194,10
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,2,206,347,1,WS_EX_STATICEDGE
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,1,1,348,1,WS_EX_STATICEDGE
END
IDD_INSTALL_OPTIONS_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
EDITTEXT IDC_DESTINATION,11,41,260,13,ES_AUTOHSCROLL
PUSHBUTTON "Bro&wse...",IDC_BROWSE,278,40,59,14
CONTROL "Install &for all users",IDC_ALL_USERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,77,168,11
CONTROL "Associate the .tc file &extension with TrueCrypt",IDC_FILE_TYPE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,113,232,11
CONTROL "Add TrueCrypt to &Start menu",IDC_PROG_GROUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,89,168,11
CONTROL "Create System &Restore point",IDC_SYSTEM_RESTORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,125,194,11
CONTROL "Add TrueCrypt icon to &desktop",IDC_DESKTOP_ICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,101,168,11
LTEXT "Please select or type the location where you want to install the TrueCrypt program files. If the specified folder does not exist, it will be automatically created.",IDT_INSTALL_DESTINATION,11,14,319,25
END
IDD_INFO_PAGE_DLG DIALOGEX 0, 0, 217, 156
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "",IDC_BOX_HELP,0,10,217,146
END
IDD_INTRO_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_LICENSE_TEXT,"RichEdit20A",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_TABSTOP,0,23,345,108
CONTROL "",IDC_AGREE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,137,126,10
LTEXT "",IDC_BOX_HELP,0,0,346,22
END
IDD_INSTL_DLG DIALOGEX 0, 0, 374, 231
STYLE DS_SETFONT | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "TrueCrypt Setup Wizard"
CLASS "CustomDlg"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
PUSHBUTTON "&Help",IDHELP,150,211,50,14
PUSHBUTTON "",IDC_PREV,209,211,50,14
DEFPUSHBUTTON "",IDC_NEXT,259,211,50,14
PUSHBUTTON "Cancel",IDCANCEL,317,211,50,14
LTEXT "",IDC_BOX_TITLE,11,5,324,12,0,WS_EX_TRANSPARENT
CONTROL 107,IDC_BITMAP_SETUP_WIZARD,"Static",SS_BITMAP | SS_NOTIFY,139,3,228,30
CONTROL 109,IDC_SETUP_WIZARD_BKG,"Static",SS_BITMAP,0,0,11,10
CONTROL "",IDC_SETUP_WIZARD_GFX_AREA,"Static",SS_GRAYRECT | NOT WS_VISIBLE,0,0,378,36,WS_EX_TRANSPARENT | WS_EX_STATICEDGE
CONTROL "",IDC_HR_BOTTOM,"Static",SS_ETCHEDHORZ,67,204,306,1,WS_EX_STATICEDGE
CONTROL "",IDC_HR,"Static",SS_ETCHEDHORZ,0,35,399,1,WS_EX_STATICEDGE
LTEXT "TrueCrypt Installer",IDC_STATIC,4,200,62,8,WS_DISABLED
LTEXT "",IDC_BOX_INFO,18,18,317,13,0,WS_EX_TRANSPARENT
LTEXT "",IDC_MAIN_CONTENT_CANVAS,0,36,374,164
LTEXT "",IDC_POS_BOX,14,42,346,155,0,WS_EX_TRANSPARENT
END
IDD_EXTRACTION_OPTIONS_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
PUSHBUTTON "Bro&wse...",IDC_BROWSE,277,32,62,14
EDITTEXT IDC_DESTINATION,6,33,264,12,ES_AUTOHSCROLL
LTEXT "Please select or type the location where you want to place the extracted files:",IDT_EXTRACT_DESTINATION,6,15,333,17
CONTROL "&Open the destination location when finished",IDC_OPEN_CONTAINING_FOLDER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,91,318,16
LTEXT "",IDC_BOX_HELP,6,56,333,32
END
IDD_WIZARD_MODE_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "&Install",IDC_WIZARD_MODE_INSTALL,"Button",BS_AUTORADIOBUTTON,6,14,232,10
CONTROL "&Extract",IDC_WIZARD_MODE_EXTRACT_ONLY,"Button",BS_AUTORADIOBUTTON,6,60,232,10
LTEXT "",IDC_BOX_HELP,42,77,286,64
LTEXT "",IDC_BOX_HELP2,42,30,286,29
END
IDD_PROGRESS_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LISTBOX IDC_LOG_WINDOW,0,1,345,131,LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL
CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",PBS_SMOOTH | WS_BORDER,0,139,345,12
END
IDD_DONATIONS_PAGE_DLG DIALOGEX 0, 0, 346, 152
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
EXSTYLE WS_EX_TRANSPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
PUSHBUTTON "Donate now...",IDC_DONATE,124,94,96,14
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SETUP ICON "Setup.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""..\\\\common\\\\resource.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#include ""..\\\\common\\\\common.rc""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_UNINSTALL, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 342
TOPMARGIN, 7
BOTTOMMARGIN, 229
END
IDD_INSTALL_OPTIONS_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 147
END
IDD_INFO_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 210
TOPMARGIN, 7
BOTTOMMARGIN, 149
END
IDD_INTRO_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 145
END
IDD_INSTL_DLG, DIALOG
BEGIN
RIGHTMARGIN, 367
TOPMARGIN, 1
BOTTOMMARGIN, 229
HORZGUIDE, 196
END
IDD_EXTRACTION_OPTIONS_PAGE_DLG, DIALOG
BEGIN
RIGHTMARGIN, 343
BOTTOMMARGIN, 147
END
IDD_WIZARD_MODE_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 145
END
IDD_PROGRESS_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 145
END
IDD_DONATIONS_PAGE_DLG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 339
TOPMARGIN, 7
BOTTOMMARGIN, 147
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_SETUP_WIZARD BITMAP "TrueCrypt_setup.bmp"
IDB_SETUP_WIZARD_BKG BITMAP "TrueCrypt_setup_background.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "..\\common\\common.rc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

482
src/Setup/Setup.vcproj Normal file
View File

@@ -0,0 +1,482 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Setup"
ProjectGUID="{DF5F654D-BD44-4E31-B92E-B68074DC37A8}"
RootNamespace="Setup"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Common;..\Crypto;..\;$(PKCS11_INC)"
PreprocessorDefinitions="SETUP;WIN32;DEBUG;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
WarningLevel="4"
DebugInformationFormat="4"
DisableSpecificWarnings="4057;4100;4127;4201;4505;4701;4706"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:LIBCMTD"
AdditionalDependencies="libcmtd.lib comctl32.lib setupapi.lib"
OutputFile="$(OutDir)/TrueCryptSetup.exe"
LinkIncremental="2"
GenerateManifest="false"
UACExecutionLevel="2"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/Setup.pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="Setup.manifest"
EmbedManifest="true"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="md &quot;..\Debug\Setup Files&quot; 2&gt;NUL:&#x0D;&#x0A;copy Debug\TrueCryptSetup.exe &quot;..\Debug\Setup Files\TrueCrypt Setup.exe&quot; &gt;NUL:&#x0D;&#x0A;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/w34189"
Optimization="2"
AdditionalIncludeDirectories="..\Common;..\Crypto;..\;$(PKCS11_INC)"
PreprocessorDefinitions="SETUP;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"
RuntimeLibrary="0"
BufferSecurityCheck="true"
UsePrecompiledHeader="0"
AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)/"
WarningLevel="4"
DebugInformationFormat="0"
DisableSpecificWarnings="4057;4100;4127;4201;4505;4701;4706"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/IGNORE:4089"
AdditionalDependencies="comctl32.lib setupapi.lib"
OutputFile="$(OutDir)/TrueCryptSetup.exe"
LinkIncremental="1"
GenerateManifest="false"
UACExecutionLevel="2"
GenerateDebugInformation="false"
GenerateMapFile="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="Setup.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy Release\TrueCryptSetup.exe &quot;..\Release\Setup Files\TrueCrypt Setup.exe&quot;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ComSetup.cpp"
>
</File>
<File
RelativePath=".\ComSetup.rgs"
>
</File>
<File
RelativePath=".\Dir.c"
>
</File>
<File
RelativePath=".\SelfExtract.c"
>
</File>
<File
RelativePath=".\Setup.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Wizard.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\Xml.c"
>
</File>
<Filter
Name="Common"
>
<File
RelativePath="..\Common\BootEncryption.cpp"
>
</File>
<File
RelativePath="..\Common\Crc.c"
>
</File>
<File
RelativePath="..\Common\Dictionary.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\Dlgcode.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\Endian.c"
>
</File>
<File
RelativePath="..\Common\Inflate.c"
>
</File>
<File
RelativePath="..\Common\Language.c"
>
</File>
<File
RelativePath="..\Common\Registry.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\Common\Apidrvr.h"
>
</File>
<File
RelativePath="..\Common\Combo.h"
>
</File>
<File
RelativePath=".\ComSetup.h"
>
</File>
<File
RelativePath="..\Common\Crc.h"
>
</File>
<File
RelativePath=".\Dir.h"
>
</File>
<File
RelativePath="..\Common\Dlgcode.h"
>
</File>
<File
RelativePath="..\Common\Exception.h"
>
</File>
<File
RelativePath="..\Common\Inflate.h"
>
</File>
<File
RelativePath="..\Common\Language.h"
>
</File>
<File
RelativePath="..\Common\Registry.h"
>
</File>
<File
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath="..\Common\Resource.h"
>
</File>
<File
RelativePath=".\SelfExtract.h"
>
</File>
<File
RelativePath=".\Setup.h"
>
</File>
<File
RelativePath="..\Common\Tcdefs.h"
>
</File>
<File
RelativePath=".\Wizard.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\Setup.ico"
>
</File>
<File
RelativePath=".\Setup.manifest"
>
</File>
<File
RelativePath=".\Setup.rc"
>
</File>
<File
RelativePath="..\Common\TrueCrypt.ico"
>
</File>
<File
RelativePath=".\TrueCrypt_setup.bmp"
>
</File>
<File
RelativePath=".\TrueCrypt_setup_background.bmp"
>
</File>
<File
RelativePath="..\Common\TrueCrypt_Volume.ico"
>
</File>
<Filter
Name="Common"
>
<File
RelativePath="..\Common\Common.rc"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCResourceCompilerTool"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\Common\Language.xml"
>
</File>
<File
RelativePath="..\Resources\Texts\License.rtf"
>
</File>
<File
RelativePath="..\Common\Textual_logo_288dpi.bmp"
>
</File>
<File
RelativePath="..\Common\Textual_logo_96dpi.bmp"
>
</File>
<File
RelativePath="..\Common\Textual_logo_background.bmp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

1203
src/Setup/Wizard.c Normal file

File diff suppressed because it is too large Load Diff

29
src/Setup/Wizard.h Normal file
View File

@@ -0,0 +1,29 @@
/*
Legal Notice: Some portions of the source code contained in this file were
derived from the source code of Encryption for the Masses 2.02a, which is
Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
Agreement for Encryption for the Masses'. Modifications and additions to
the original source code (contained in this file) and all other portions
of this file are Copyright (c) 2003-2008 TrueCrypt Developers Association
and are governed by the TrueCrypt License 3.0 the full text of which is
contained in the file License.txt included in TrueCrypt binary and source
code distribution packages. */
#ifdef __cplusplus
extern "C" {
#endif
void InitProgressBar (void);
BOOL UpdateProgressBarProc (int nPercent);
void RefreshUIGFX (void);
void localcleanupwiz (void);
BOOL CALLBACK PageDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
BOOL CALLBACK MainDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
extern BOOL bPromptTutorial;
extern BOOL bPromptReleaseNotes;
#ifdef __cplusplus
}
#endif