1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-12-28 17:49:45 -06:00

Windows: Full UNICODE rewrite and implement support for UNICODE passwords.

This commit is contained in:
Mounir IDRASSI
2015-11-25 01:41:37 +01:00
parent ec7d96fcb7
commit 90bd57fe40
61 changed files with 3240 additions and 3239 deletions

View File

@@ -27,14 +27,14 @@
#include "../Format/FormatCom_i.c"
extern "C" BOOL RegisterComServers (char *modulePath)
extern "C" BOOL RegisterComServers (wchar_t *modulePath)
{
BOOL ret = TRUE;
wchar_t mainModule[1024], formatModule[1024];
CComPtr<ITypeLib> tl, tl2;
wsprintfW (mainModule, L"%hsVeraCrypt.exe", modulePath);
wsprintfW (formatModule, L"%hsVeraCrypt Format.exe", modulePath);
wsprintfW (mainModule, L"%sVeraCrypt.exe", modulePath);
wsprintfW (formatModule, L"%sVeraCrypt 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);
@@ -58,7 +58,7 @@ extern "C" BOOL RegisterComServers (char *modulePath)
|| !SUCCEEDED (r = LoadTypeLib (formatModule, &tl2))
|| !SUCCEEDED (r = RegisterTypeLib (tl2, formatModule, 0)))
{
MessageBox (MainDlg, _com_error (r).ErrorMessage(), TC_APP_NAME, MB_ICONERROR);
MessageBox (MainDlg, _com_error (r).ErrorMessage(), _T(TC_APP_NAME), MB_ICONERROR);
ret = FALSE;
}
@@ -67,7 +67,7 @@ extern "C" BOOL RegisterComServers (char *modulePath)
}
extern "C" BOOL UnregisterComServers (char *modulePath)
extern "C" BOOL UnregisterComServers (wchar_t *modulePath)
{
BOOL ret;
@@ -85,10 +85,10 @@ extern "C" BOOL UnregisterComServers (char *modulePath)
CRegObject ro;
ro.FinalConstruct ();
wsprintfW (module, L"%hsVeraCrypt.exe", modulePath);
wsprintfW (module, L"%sVeraCrypt.exe", modulePath);
ro.AddReplacement (L"MAIN_MODULE", module);
wsprintfW (module, L"%hsVeraCrypt Format.exe", modulePath);
wsprintfW (module, L"%sVeraCrypt Format.exe", modulePath);
ro.AddReplacement (L"FORMAT_MODULE", module);
wchar_t setupModule[MAX_PATH];

View File

@@ -14,8 +14,8 @@
extern "C" {
#endif
BOOL RegisterComServers (char *modulePath);
BOOL UnregisterComServers (char *modulePath);
BOOL RegisterComServers (wchar_t *modulePath);
BOOL UnregisterComServers (wchar_t *modulePath);
#ifdef __cplusplus
}

View File

@@ -25,33 +25,33 @@
/* create full directory tree. returns 0 for success, -1 if failure */
int
mkfulldir (char *oriPath, BOOL bCheckonly)
mkfulldir (wchar_t *oriPath, BOOL bCheckonly)
{
struct _stat st;
char *uniq_file;
char path [TC_MAX_PATH];
wchar_t *uniq_file;
wchar_t path [TC_MAX_PATH];
StringCbCopyA (path, TC_MAX_PATH, oriPath);
StringCbCopyW (path, TC_MAX_PATH, oriPath);
if (strlen (path) == 3 && path[1] == ':')
if (wcslen (path) == 3 && path[1] == L':')
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';
uniq_file = wcsrchr (path, L'\\');
if (uniq_file && uniq_file[1] == L'\0')
uniq_file[0] = L'\0';
else
{
uniq_file = strrchr (path, '/');
if (uniq_file && uniq_file[1] == '\0')
uniq_file[0] = '\0';
uniq_file = wcsrchr (path, L'/');
if (uniq_file && uniq_file[1] == L'\0')
uniq_file[0] = L'\0';
}
is_root:
if (bCheckonly)
return _stat (path, &st);
return _wstat (path, &st);
if (_stat (path, &st))
if (_wstat (path, &st))
return mkfulldir_internal (path);
else
return 0;
@@ -59,52 +59,52 @@ mkfulldir (char *oriPath, BOOL bCheckonly)
int
mkfulldir_internal (char *path)
mkfulldir_internal (wchar_t *path)
{
char *token;
wchar_t *token;
struct _stat st;
static char tokpath[_MAX_PATH];
static char trail[_MAX_PATH];
static wchar_t tokpath[_MAX_PATH];
static wchar_t trail[_MAX_PATH];
StringCbCopyA (tokpath, _MAX_PATH, path);
trail[0] = '\0';
StringCbCopyW (tokpath, _MAX_PATH, path);
trail[0] = L'\0';
token = strtok (tokpath, "\\/");
token = wcstok (tokpath, L"\\/");
if (tokpath[0] == '\\' && tokpath[1] == '\\')
if (tokpath[0] == L'\\' && tokpath[1] == L'\\')
{ /* unc */
trail[0] = tokpath[0];
trail[1] = tokpath[1];
trail[2] = '\0';
trail[2] = L'\0';
if (token)
{
StringCbCatA (trail, _MAX_PATH, token);
StringCbCatA (trail, _MAX_PATH, "\\");
token = strtok (NULL, "\\/");
StringCbCatW (trail, _MAX_PATH, token);
StringCbCatW (trail, _MAX_PATH, L"\\");
token = wcstok (NULL, L"\\/");
if (token)
{ /* get share name */
StringCbCatA (trail, _MAX_PATH, token);
StringCbCatA (trail, _MAX_PATH, "\\");
StringCbCatW (trail, _MAX_PATH, token);
StringCbCatW (trail, _MAX_PATH, L"\\");
}
token = strtok (NULL, "\\/");
token = wcstok (NULL, L"\\/");
}
}
if (tokpath[1] == ':')
if (tokpath[1] == L':')
{ /* drive letter */
StringCbCatA (trail, _MAX_PATH, tokpath);
StringCbCatA (trail, _MAX_PATH, "\\");
token = strtok (NULL, "\\/");
StringCbCatW (trail, _MAX_PATH, tokpath);
StringCbCatW (trail, _MAX_PATH, L"\\");
token = wcstok (NULL, L"\\/");
}
while (token != NULL)
{
int x;
StringCbCatA (trail, _MAX_PATH, token);
x = _mkdir (trail);
StringCbCatA (trail, _MAX_PATH, "\\");
token = strtok (NULL, "\\/");
StringCbCatW (trail, _MAX_PATH, token);
x = _wmkdir (trail);
StringCbCatW (trail, _MAX_PATH, L"\\");
token = wcstok (NULL, L"\\/");
}
return _stat (path, &st);
return _wstat (path, &st);
}

View File

@@ -15,8 +15,8 @@
extern "C" {
#endif
int mkfulldir ( char *path , BOOL bCheckonly );
int mkfulldir_internal ( char *path );
int mkfulldir ( wchar_t *path , BOOL bCheckonly );
int mkfulldir_internal ( wchar_t *path );
#ifdef __cplusplus
}

View File

@@ -22,20 +22,21 @@
#include "Dir.h"
#include "Language.h"
#include "Resource.h"
#include <tchar.h>
#include <Strsafe.h>
#ifndef SRC_POS
#define SRC_POS (__FUNCTION__ ":" TC_TO_STRING(__LINE__))
#endif
#define OutputPackageFile "VeraCrypt Setup " VERSION_STRING ".exe"
#define OutputPackageFile L"VeraCrypt Setup " _T(VERSION_STRING) L".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];
wchar_t DestExtractPath [TC_MAX_PATH];
DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
volatile char *PipeWriteBuf = NULL;
@@ -64,21 +65,21 @@ static void DeobfuscateMagEndMarker (void)
}
static void PkgError (char *msg)
static void PkgError (wchar_t *msg)
{
MessageBox (NULL, msg, "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
MessageBox (NULL, msg, L"VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
}
static void PkgWarning (char *msg)
static void PkgWarning (wchar_t *msg)
{
MessageBox (NULL, msg, "VeraCrypt", MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
MessageBox (NULL, msg, L"VeraCrypt", MB_ICONWARNING | MB_SETFOREGROUND | MB_TOPMOST);
}
static void PkgInfo (char *msg)
static void PkgInfo (wchar_t *msg)
{
MessageBox (NULL, msg, "VeraCrypt", MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
MessageBox (NULL, msg, L"VeraCrypt", MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TOPMOST);
}
@@ -96,7 +97,7 @@ static void __cdecl PipeWriteThread (void *len)
if (PipeWriteBuf == NULL || (HANDLE) hChildStdinWrite == INVALID_HANDLE_VALUE)
{
PkgError ("Failed sending data to the STDIN pipe");
PkgError (L"Failed sending data to the STDIN pipe");
return;
}
@@ -109,7 +110,7 @@ static void __cdecl PipeWriteThread (void *len)
|| bytesSent == 0
|| bytesSent != sendBufSize)
{
PkgError ("Failed sending data to the STDIN pipe");
PkgError (L"Failed sending data to the STDIN pipe");
return;
}
@@ -121,7 +122,7 @@ static void __cdecl PipeWriteThread (void *len)
if (!CloseHandle (hChildStdinWrite))
{
PkgError ("Cannot close pipe");
PkgError (L"Cannot close pipe");
return;
}
}
@@ -140,6 +141,7 @@ static int CompressBuffer (char *out, char *in, int len)
char pipeBuffer [PIPE_BUFFER_LEN];
int res_len = 0;
BOOL bGzipHeaderRead = FALSE;
wchar_t szGzipCmd[64];
ZeroMemory (&startupInfo, sizeof (startupInfo));
ZeroMemory (&procInfo, sizeof (procInfo));
@@ -151,14 +153,14 @@ static int CompressBuffer (char *out, char *in, int len)
if (!CreatePipe (&hChildStdoutRead, &hChildStdoutWrite, &securityAttrib, 0))
{
PkgError ("Cannot create STDOUT pipe.");
PkgError (L"Cannot create STDOUT pipe.");
return 0;
}
SetHandleInformation (hChildStdoutRead, HANDLE_FLAG_INHERIT, 0);
if (!CreatePipe (&hChildStdinRead, &((HANDLE) hChildStdinWrite), &securityAttrib, 0))
{
PkgError ("Cannot create STDIN pipe.");
PkgError (L"Cannot create STDIN pipe.");
CloseHandle(hChildStdoutWrite);
CloseHandle(hChildStdoutRead);
return 0;
@@ -174,9 +176,10 @@ static int CompressBuffer (char *out, char *in, int len)
startupInfo.hStdError = hChildStdoutWrite;
startupInfo.dwFlags |= STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
if (!CreateProcess (NULL, "gzip --best", NULL, NULL, TRUE, 0, NULL, NULL, &startupInfo, &procInfo))
StringCbCopyW (szGzipCmd, sizeof (szGzipCmd), L"gzip --best");
if (!CreateProcess (NULL, szGzipCmd, NULL, NULL, TRUE, 0, NULL, NULL, &startupInfo, &procInfo))
{
PkgError ("Error: Cannot run gzip.\n\nBefore you can create a self-extracting VeraCrypt 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");
PkgError (L"Error: Cannot run gzip.\n\nBefore you can create a self-extracting VeraCrypt 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");
CloseHandle(hChildStdoutWrite);
CloseHandle(hChildStdoutRead);
CloseHandle(hChildStdinRead);
@@ -193,7 +196,7 @@ static int CompressBuffer (char *out, char *in, int len)
if (!CloseHandle (hChildStdoutWrite))
{
PkgError ("Cannot close STDOUT write");
PkgError (L"Cannot close STDOUT write");
CloseHandle(hChildStdoutRead);
CloseHandle(hChildStdinRead);
return 0;
@@ -231,37 +234,37 @@ static void WipeSignatureAreas (char *buffer)
}
BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir)
{
int i, x;
unsigned char inputFile [TC_MAX_PATH];
unsigned char outputFile [TC_MAX_PATH];
unsigned char szTmpFilePath [TC_MAX_PATH];
wchar_t inputFile [TC_MAX_PATH];
wchar_t outputFile [TC_MAX_PATH];
wchar_t 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];
wchar_t tmpStr [2048];
int bufLen = 0, compressedDataLen = 0, uncompressedDataLen = 0;
x = strlen (szDestDir);
x = wcslen (szDestDir);
if (x < 2)
goto err;
if (szDestDir[x - 1] != '\\')
StringCbCatA (szDestDir, MAX_PATH, "\\");
if (szDestDir[x - 1] != L'\\')
StringCbCatW (szDestDir, MAX_PATH, L"\\");
GetModuleFileName (NULL, inputFile, sizeof (inputFile));
GetModuleFileName (NULL, inputFile, ARRAYSIZE (inputFile));
StringCbCopyA (outputFile, sizeof(outputFile), szDestDir);
StringCbCatA (outputFile, sizeof(outputFile), OutputPackageFile);
StringCbCopyW (outputFile, sizeof(outputFile), szDestDir);
StringCbCatW (outputFile, sizeof(outputFile), OutputPackageFile);
// Clone 'VeraCrypt Setup.exe' to create the base of the new self-extracting archive
if (!TCCopyFile (inputFile, outputFile))
{
handleWin32Error (hwndDlg, SRC_POS);
PkgError ("Cannot copy 'VeraCrypt Setup.exe' to the package");
PkgError (L"Cannot copy 'VeraCrypt Setup.exe' to the package");
goto err;
}
@@ -271,15 +274,15 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
for (i = 0; i < sizeof (szCompressedFiles) / sizeof (szCompressedFiles[0]); i++)
{
StringCbPrintfA (szTmpFilePath, sizeof(szTmpFilePath), "%s%s", szDestDir, szCompressedFiles[i]);
StringCbPrintfW (szTmpFilePath, sizeof(szTmpFilePath), L"%s%s", szDestDir, szCompressedFiles[i]);
if (!FileExists (szTmpFilePath))
{
char tmpstr [1000];
wchar_t tmpstr [1000];
StringCbPrintfA (tmpstr, sizeof(tmpstr), "File not found:\n\n'%s'", szTmpFilePath);
if (remove (outputFile))
StringCbCatA (tmpstr, sizeof(tmpstr), "\nFailed also to delete package file");
StringCbPrintfW (tmpstr, sizeof(tmpstr), L"File not found:\n\n'%s'", szTmpFilePath);
if (_wremove (outputFile))
StringCbCatW (tmpstr, sizeof(tmpstr), L"\nFailed also to delete package file");
PkgError (tmpstr);
goto err;
}
@@ -287,7 +290,7 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
bufLen += (int) GetFileSize64 (szTmpFilePath);
bufLen += 2; // 16-bit filename length
bufLen += strlen(szCompressedFiles[i]); // Filename
bufLen += (wcslen(szCompressedFiles[i]) * sizeof (wchar_t)); // Filename
bufLen += 4; // CRC-32
bufLen += 4; // 32-bit file length
}
@@ -295,11 +298,11 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
buffer = malloc (bufLen + 524288); // + 512K reserve
if (buffer == NULL)
{
PkgError ("Cannot allocate memory for uncompressed data");
if (remove (outputFile))
PkgError ("Cannot allocate memory for uncompressed data.\nFailed also to delete package file");
PkgError (L"Cannot allocate memory for uncompressed data");
if (_wremove (outputFile))
PkgError (L"Cannot allocate memory for uncompressed data.\nFailed also to delete package file");
else
PkgError ("Cannot allocate memory for uncompressed data");
PkgError (L"Cannot allocate memory for uncompressed data");
goto err;
}
@@ -307,10 +310,10 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
// Write the start marker
if (!SaveBufferToFile (MAG_START_MARKER, outputFile, strlen (MAG_START_MARKER), TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write the start marker\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write the start marker\nFailed also to delete package file");
else
PkgError ("Cannot write the start marker");
PkgError (L"Cannot write the start marker");
goto err;
}
@@ -323,28 +326,27 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
DWORD tmpFileSize;
unsigned char *tmpBuffer;
StringCbPrintfA (szTmpFilePath, sizeof(szTmpFilePath), "%s%s", szDestDir, szCompressedFiles[i]);
StringCbPrintfW (szTmpFilePath, sizeof(szTmpFilePath), L"%s%s", szDestDir, szCompressedFiles[i]);
tmpBuffer = LoadFile (szTmpFilePath, &tmpFileSize);
if (tmpBuffer == NULL)
{
char tmpstr [1000];
wchar_t tmpstr [1000];
free (tmpBuffer);
StringCbPrintfA (tmpstr, sizeof(tmpstr), "Cannot load file \n'%s'", szTmpFilePath);
if (remove (outputFile))
StringCbCatA (tmpstr, sizeof(tmpstr), "\nFailed also to delete package file");
StringCbPrintfW (tmpstr, sizeof(tmpstr), L"Cannot load file \n'%s'", szTmpFilePath);
if (_wremove (outputFile))
StringCbCatW (tmpstr, sizeof(tmpstr), L"\nFailed also to delete package file");
PkgError (tmpstr);
goto err;
}
// Copy the filename length to the main buffer
mputWord (bufIndex, (WORD) strlen(szCompressedFiles[i]));
mputWord (bufIndex, (WORD) wcslen(szCompressedFiles[i]));
// Copy the filename to the main buffer
memcpy (bufIndex, szCompressedFiles[i], strlen(szCompressedFiles[i]));
bufIndex += strlen(szCompressedFiles[i]);
wmemcpy ((wchar_t*)bufIndex, szCompressedFiles[i], wcslen(szCompressedFiles[i]));
bufIndex += (wcslen(szCompressedFiles[i]) * sizeof (wchar_t));
// Compute CRC-32 hash of the uncompressed file and copy it to the main buffer
mputLong (bufIndex, GetCrc32 (tmpBuffer, tmpFileSize));
@@ -367,10 +369,10 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
mputLong (szTmp32bitPtr, (unsigned __int32) uncompressedDataLen);
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write the total size of the uncompressed data.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write the total size of the uncompressed data.\nFailed also to delete package file");
else
PkgError ("Cannot write the total size of the uncompressed data");
PkgError (L"Cannot write the total size of the uncompressed data");
goto err;
}
@@ -379,20 +381,20 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
compressedBuffer = malloc (uncompressedDataLen + 524288); // + 512K reserve
if (compressedBuffer == NULL)
{
if (remove (outputFile))
PkgError ("Cannot allocate memory for compressed data.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot allocate memory for compressed data.\nFailed also to delete package file");
else
PkgError ("Cannot allocate memory for compressed data");
PkgError (L"Cannot allocate memory for compressed data");
goto err;
}
compressedDataLen = CompressBuffer (compressedBuffer, buffer, uncompressedDataLen);
if (compressedDataLen <= 0)
{
if (remove (outputFile))
PkgError ("Failed to compress the data.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Failed to compress the data.\nFailed also to delete package file");
else
PkgError ("Failed to compress the data");
PkgError (L"Failed to compress the data");
goto err;
}
@@ -404,30 +406,30 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
mputLong (szTmp32bitPtr, (unsigned __int32) compressedDataLen);
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write the total size of the compressed data.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write the total size of the compressed data.\nFailed also to delete package file");
else
PkgError ("Cannot write the total size of the compressed data");
PkgError (L"Cannot write the total size of the compressed data");
goto err;
}
// Write the compressed data
if (!SaveBufferToFile (compressedBuffer, outputFile, compressedDataLen, TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write compressed data to the package.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write compressed data to the package.\nFailed also to delete package file");
else
PkgError ("Cannot write compressed data to the package");
PkgError (L"Cannot write compressed data to the package");
goto err;
}
// Write the end marker
if (!SaveBufferToFile (MagEndMarker, outputFile, strlen (MagEndMarker), TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write the end marker.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write the end marker.\nFailed also to delete package file");
else
PkgError ("Cannot write the end marker");
PkgError (L"Cannot write the end marker");
goto err;
}
@@ -444,10 +446,10 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
if (tmpBuffer == NULL)
{
handleWin32Error (hwndDlg, SRC_POS);
if (remove (outputFile))
PkgError ("Cannot load the package to compute CRC.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot load the package to compute CRC.\nFailed also to delete package file");
else
PkgError ("Cannot load the package to compute CRC");
PkgError (L"Cannot load the package to compute CRC");
goto err;
}
@@ -460,15 +462,15 @@ BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir)
if (!SaveBufferToFile (szTmp32bit, outputFile, sizeof (szTmp32bit), TRUE, FALSE))
{
if (remove (outputFile))
PkgError ("Cannot write the total size of the compressed data.\nFailed also to delete package file");
if (_wremove (outputFile))
PkgError (L"Cannot write the total size of the compressed data.\nFailed also to delete package file");
else
PkgError ("Cannot write the total size of the compressed data");
PkgError (L"Cannot write the total size of the compressed data");
goto err;
}
}
StringCbPrintfA (tmpStr, sizeof(tmpStr), "Self-extracting package successfully created (%s)", outputFile);
StringCbPrintfW (tmpStr, sizeof(tmpStr), L"Self-extracting package successfully created (%s)", outputFile);
PkgInfo (tmpStr);
return TRUE;
@@ -490,9 +492,9 @@ BOOL VerifyPackageIntegrity (void)
unsigned __int32 crc = 0;
unsigned char *tmpBuffer;
int tmpFileSize;
char path [TC_MAX_PATH];
wchar_t path [TC_MAX_PATH];
GetModuleFileName (NULL, path, sizeof (path));
GetModuleFileName (NULL, path, ARRAYSIZE (path));
fileDataEndPos = (int) FindStringInFile (path, MagEndMarker, strlen (MagEndMarker));
if (fileDataEndPos < 0)
@@ -545,9 +547,9 @@ BOOL VerifyPackageIntegrity (void)
// Determines whether we are a self-extracting package
BOOL IsSelfExtractingPackage (void)
{
char path [TC_MAX_PATH];
wchar_t path [TC_MAX_PATH];
GetModuleFileName (NULL, path, sizeof (path));
GetModuleFileName (NULL, path, ARRAYSIZE (path));
return (FindStringInFile (path, MagEndMarker, strlen (MagEndMarker)) != -1);
}
@@ -578,7 +580,7 @@ static 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 (char *path)
BOOL SelfExtractInMemory (wchar_t *path)
{
int filePos = 0, fileNo = 0;
int fileDataEndPos = 0;
@@ -667,8 +669,8 @@ BOOL SelfExtractInMemory (char *path)
Decompressed_Files[fileNo].fileNameLength = mgetWord (bufPos);
// Filename
Decompressed_Files[fileNo].fileName = bufPos;
bufPos += Decompressed_Files[fileNo].fileNameLength;
Decompressed_Files[fileNo].fileName = (wchar_t*) bufPos;
bufPos += (Decompressed_Files[fileNo].fileNameLength * sizeof (wchar_t));
// CRC-32 of the file
Decompressed_Files[fileNo].crc = mgetLong (bufPos);
@@ -711,13 +713,13 @@ void __cdecl ExtractAllFilesThread (void *hwndDlg)
{
int fileNo;
BOOL bSuccess = FALSE;
char packageFile [TC_MAX_PATH];
wchar_t packageFile [TC_MAX_PATH];
InvalidateRect (GetDlgItem (GetParent (hwndDlg), IDD_INSTL_DLG), NULL, TRUE);
ClearLogWindow (hwndDlg);
GetModuleFileName (NULL, packageFile, sizeof (packageFile));
GetModuleFileName (NULL, packageFile, ARRAYSIZE (packageFile));
if (!(bSuccess = SelfExtractInMemory (packageFile)))
goto eaf_end;
@@ -738,13 +740,13 @@ void __cdecl ExtractAllFilesThread (void *hwndDlg)
for (fileNo = 0; fileNo < NBR_COMPRESSED_FILES; fileNo++)
{
char fileName [TC_MAX_PATH] = {0};
char filePath [TC_MAX_PATH] = {0};
wchar_t fileName [TC_MAX_PATH] = {0};
wchar_t filePath [TC_MAX_PATH] = {0};
// Filename
StringCbCopyNA (fileName, sizeof(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength);
StringCbCopyA (filePath, sizeof(filePath), DestExtractPath);
StringCbCatA (filePath, sizeof(filePath), fileName);
StringCchCopyNW (fileName, ARRAYSIZE(fileName), Decompressed_Files[fileNo].fileName, Decompressed_Files[fileNo].fileNameLength);
StringCbCopyW (filePath, sizeof(filePath), DestExtractPath);
StringCbCatW (filePath, sizeof(filePath), fileName);
StatusMessageParam (hwndDlg, "EXTRACTING_VERB", filePath);

View File

@@ -19,7 +19,7 @@ extern "C" {
typedef struct
{
// WARNING: file name is NOT null-terminated (use fileNameLength).
unsigned char *fileName;
wchar_t *fileName;
int fileNameLength;
uint32 crc;
__int32 fileLength;
@@ -29,14 +29,14 @@ typedef struct
extern DECOMPRESSED_FILE Decompressed_Files [NBR_COMPRESSED_FILES];
void SelfExtractStartupInit (void);
BOOL SelfExtractInMemory (char *path);
BOOL SelfExtractInMemory (wchar_t *path);
void __cdecl ExtractAllFilesThread (void *hwndDlg);
BOOL MakeSelfExtractingPackage (HWND hwndDlg, char *szDestDir);
BOOL MakeSelfExtractingPackage (HWND hwndDlg, wchar_t *szDestDir);
BOOL VerifyPackageIntegrity (void);
BOOL IsSelfExtractingPackage (void);
static void DeobfuscateMagEndMarker (void);
extern char DestExtractPath [TC_MAX_PATH];
extern wchar_t DestExtractPath [TC_MAX_PATH];
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@@ -19,146 +19,144 @@ extern "C" {
#endif
// Specifies what files to install, where (determined by the prefix), and in what order
static char *szFiles[]=
static wchar_t *szFiles[]=
{
"AVeraCrypt User Guide.pdf",
"ALicense.txt",
"ALICENSE",
"ANOTICE",
"AVeraCrypt.exe",
"AVeraCryptExpander.exe",
"AVeraCrypt Format.exe",
"AVeraCrypt-x86.exe",
"AVeraCryptExpander-x86.exe",
"AVeraCrypt Format-x86.exe",
"AVeraCrypt-x64.exe",
"AVeraCryptExpander-x64.exe",
"AVeraCrypt Format-x64.exe",
"Averacrypt.sys",
"Averacrypt-x64.sys",
"Dveracrypt.sys",
"AVeraCrypt Setup.exe",
"ALanguage.ar.xml",
"ALanguage.be.xml",
"ALanguage.bg.xml",
"ALanguage.ca.xml",
"ALanguage.cs.xml",
"ALanguage.da.xml",
"ALanguage.de.xml",
"ALanguage.el.xml",
"ALanguage.es.xml",
"ALanguage.et.xml",
"ALanguage.eu.xml",
"ALanguage.fa.xml",
"ALanguage.fi.xml",
"ALanguage.fr.xml",
"ALanguage.hu.xml",
"ALanguage.id.xml",
"ALanguage.it.xml",
"ALanguage.ja.xml",
"ALanguage.ka.xml",
"ALanguage.ko.xml",
"ALanguage.lv.xml",
"ALanguage.my.xml",
"ALanguage.nl.xml",
"ALanguage.nn.xml",
"ALanguage.pl.xml",
"ALanguage.pt-br.xml",
"ALanguage.ru.xml",
"ALanguage.sk.xml",
"ALanguage.sl.xml",
"ALanguage.sv.xml",
"ALanguage.tr.xml",
"ALanguage.uk.xml",
"ALanguage.uz.xml",
"ALanguage.vi.xml",
"ALanguage.zh-cn.xml",
"ALanguage.zh-hk.xml",
"ALanguage.zh-tw.xml"
L"AVeraCrypt User Guide.pdf",
L"ALicense.txt",
L"ALICENSE",
L"ANOTICE",
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"ALanguage.ar.xml",
L"ALanguage.be.xml",
L"ALanguage.bg.xml",
L"ALanguage.ca.xml",
L"ALanguage.cs.xml",
L"ALanguage.da.xml",
L"ALanguage.de.xml",
L"ALanguage.el.xml",
L"ALanguage.es.xml",
L"ALanguage.et.xml",
L"ALanguage.eu.xml",
L"ALanguage.fa.xml",
L"ALanguage.fi.xml",
L"ALanguage.fr.xml",
L"ALanguage.hu.xml",
L"ALanguage.id.xml",
L"ALanguage.it.xml",
L"ALanguage.ja.xml",
L"ALanguage.ka.xml",
L"ALanguage.ko.xml",
L"ALanguage.lv.xml",
L"ALanguage.my.xml",
L"ALanguage.nl.xml",
L"ALanguage.nn.xml",
L"ALanguage.pl.xml",
L"ALanguage.pt-br.xml",
L"ALanguage.ru.xml",
L"ALanguage.sk.xml",
L"ALanguage.sl.xml",
L"ALanguage.sv.xml",
L"ALanguage.tr.xml",
L"ALanguage.uk.xml",
L"ALanguage.uz.xml",
L"ALanguage.vi.xml",
L"ALanguage.zh-cn.xml",
L"ALanguage.zh-hk.xml",
L"ALanguage.zh-tw.xml"
};
// Specifies what files are included in self-extracting packages (no other files will be packaged or extracted).
static char *szCompressedFiles[]=
static wchar_t *szCompressedFiles[]=
{
"VeraCrypt User Guide.pdf",
"License.txt",
"LICENSE",
"NOTICE",
"VeraCrypt.exe",
"VeraCryptExpander.exe",
"VeraCrypt Format.exe",
"VeraCrypt-x64.exe",
"VeraCryptExpander-x64.exe",
"VeraCrypt Format-x64.exe",
"veracrypt.sys",
"veracrypt-x64.sys",
"Language.ar.xml",
"Language.be.xml",
"Language.bg.xml",
"Language.ca.xml",
"Language.cs.xml",
"Language.da.xml",
"Language.de.xml",
"Language.el.xml",
"Language.es.xml",
"Language.et.xml",
"Language.eu.xml",
"Language.fa.xml",
"Language.fi.xml",
"Language.fr.xml",
"Language.hu.xml",
"Language.id.xml",
"Language.it.xml",
"Language.ja.xml",
"Language.ka.xml",
"Language.ko.xml",
"Language.lv.xml",
"Language.my.xml",
"Language.nl.xml",
"Language.nn.xml",
"Language.pl.xml",
"Language.pt-br.xml",
"Language.ru.xml",
"Language.sk.xml",
"Language.sl.xml",
"Language.sv.xml",
"Language.tr.xml",
"Language.uk.xml",
"Language.uz.xml",
"Language.vi.xml",
"Language.zh-cn.xml",
"Language.zh-hk.xml",
"Language.zh-tw.xml"
L"VeraCrypt User Guide.pdf",
L"License.txt",
L"LICENSE",
L"NOTICE",
L"VeraCrypt.exe",
L"VeraCryptExpander.exe",
L"VeraCrypt Format.exe",
L"VeraCrypt-x64.exe",
L"VeraCryptExpander-x64.exe",
L"VeraCrypt Format-x64.exe",
L"veracrypt.sys",
L"veracrypt-x64.sys",
L"Language.ar.xml",
L"Language.be.xml",
L"Language.bg.xml",
L"Language.ca.xml",
L"Language.cs.xml",
L"Language.da.xml",
L"Language.de.xml",
L"Language.el.xml",
L"Language.es.xml",
L"Language.et.xml",
L"Language.eu.xml",
L"Language.fa.xml",
L"Language.fi.xml",
L"Language.fr.xml",
L"Language.hu.xml",
L"Language.id.xml",
L"Language.it.xml",
L"Language.ja.xml",
L"Language.ka.xml",
L"Language.ko.xml",
L"Language.lv.xml",
L"Language.my.xml",
L"Language.nl.xml",
L"Language.nn.xml",
L"Language.pl.xml",
L"Language.pt-br.xml",
L"Language.ru.xml",
L"Language.sk.xml",
L"Language.sl.xml",
L"Language.sv.xml",
L"Language.tr.xml",
L"Language.uk.xml",
L"Language.uz.xml",
L"Language.vi.xml",
L"Language.zh-cn.xml",
L"Language.zh-hk.xml",
L"Language.zh-tw.xml"
};
#define FILENAME_64BIT_DRIVER "veracrypt-x64.sys"
#define FILENAME_64BIT_DRIVER L"veracrypt-x64.sys"
#define NBR_COMPRESSED_FILES (sizeof(szCompressedFiles) / sizeof(szCompressedFiles[0]))
void localcleanup (void);
BOOL StatDeleteFile ( char *lpszFile, BOOL bCheckForOldFile );
BOOL StatRemoveDirectory ( char *lpszDir );
HRESULT CreateLink ( char *lpszPathObj , char *lpszArguments , char *lpszPathLink );
void GetProgramPath ( HWND hwndDlg , char *path );
BOOL StatDeleteFile ( wchar_t *lpszFile, BOOL bCheckForOldFile );
BOOL StatRemoveDirectory ( wchar_t *lpszDir );
HRESULT CreateLink ( wchar_t *lpszPathObj , wchar_t *lpszArguments , wchar_t *lpszPathLink );
void GetProgramPath ( HWND hwndDlg , wchar_t *path );
void StatusMessage (HWND hwndDlg, char *stringId);
void StatusMessageParam (HWND hwndDlg, char *stringId, char *param);
void StatusMessageParam (HWND hwndDlg, char *stringId, wchar_t *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 );
void RegMessage ( HWND hwndDlg , wchar_t *txt );
void RegRemoveMessage (HWND hwndDlg, wchar_t *txt);
void CopyMessage ( HWND hwndDlg , wchar_t *txt );
void RemoveMessage ( HWND hwndDlg , wchar_t *txt );
void IconMessage ( HWND hwndDlg , wchar_t *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 DoFilesInstall ( HWND hwndDlg , wchar_t *szDestDir );
BOOL DoRegInstall ( HWND hwndDlg , wchar_t *szDestDir , BOOL bInstallType );
BOOL DoRegUninstall (HWND hwndDlg, BOOL bRemoveDeprecated);
BOOL DoServiceUninstall ( HWND hwndDlg , char *lpszService );
BOOL DoServiceUninstall ( HWND hwndDlg , wchar_t *lpszService );
BOOL DoDriverUnload ( HWND hwndDlg );
BOOL DoShortcutsInstall ( HWND hwndDlg , char *szDestDir , BOOL bProgGroup, BOOL bDesktopIcon );
BOOL DoShortcutsUninstall (HWND hwndDlg, char *szDestDir);
BOOL DoShortcutsInstall ( HWND hwndDlg , wchar_t *szDestDir , BOOL bProgGroup, BOOL bDesktopIcon );
BOOL DoShortcutsUninstall (HWND hwndDlg, wchar_t *szDestDir);
void OutcomePrompt ( HWND hwndDlg , BOOL bOK );
void DoUninstall ( void *hwndDlg );
void DoInstall ( void *hwndDlg );
@@ -182,8 +180,8 @@ 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];
extern wchar_t InstallationPath[TC_MAX_PATH];
extern wchar_t SetupFilesDir[TC_MAX_PATH];
#ifdef __cplusplus
}

View File

@@ -22,7 +22,7 @@
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -108,7 +108,7 @@
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -374,11 +374,11 @@
>
</File>
<File
RelativePath=".\Resource.h"
RelativePath="..\Common\Resource.h"
>
</File>
<File
RelativePath="..\Common\Resource.h"
RelativePath=".\Resource.h"
>
</File>
<File

View File

@@ -23,6 +23,7 @@
#include "Common/Resource.h"
#include "Resource.h"
#include "Setup.h"
#include <tchar.h>
#include <Strsafe.h>
using namespace std;
@@ -40,9 +41,9 @@ enum wizard_pages
HWND hCurPage = NULL; /* Handle to current wizard page */
int nCurPageNo = -1; /* The current wizard page */
char WizardDestInstallPath [TC_MAX_PATH];
char WizardDestExtractPath [TC_MAX_PATH];
char SelfFile [TC_MAX_PATH];
wchar_t WizardDestInstallPath [TC_MAX_PATH];
wchar_t WizardDestExtractPath [TC_MAX_PATH];
wchar_t SelfFile [TC_MAX_PATH];
HBITMAP hbmWizardBitmapRescaled = NULL;
@@ -92,12 +93,12 @@ void localcleanupwiz (void)
static void InitWizardDestInstallPath (void)
{
if (strlen (WizardDestInstallPath) < 2)
if (wcslen (WizardDestInstallPath) < 2)
{
StringCbCopyA (WizardDestInstallPath, sizeof(WizardDestInstallPath), InstallationPath);
if (WizardDestInstallPath [strlen (WizardDestInstallPath) - 1] != '\\')
StringCbCopyW (WizardDestInstallPath, sizeof(WizardDestInstallPath), InstallationPath);
if (WizardDestInstallPath [wcslen (WizardDestInstallPath) - 1] != L'\\')
{
StringCbCatA (WizardDestInstallPath, sizeof(WizardDestInstallPath), "\\");
StringCbCatW (WizardDestInstallPath, sizeof(WizardDestInstallPath), L"\\");
}
}
}
@@ -228,7 +229,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
licenseText = GetLegalNotices ();
if (licenseText != NULL)
{
SetWindowText (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), licenseText);
SetWindowTextA (GetDlgItem (hwndDlg, IDC_LICENSE_TEXT), licenseText);
free (licenseText);
}
else
@@ -308,10 +309,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case EXTRACTION_OPTIONS_PAGE:
if (strlen(WizardDestExtractPath) < 2)
if (wcslen(WizardDestExtractPath) < 2)
{
StringCbCopyA (WizardDestExtractPath, sizeof(WizardDestExtractPath), SetupFilesDir);
StringCbCatNA (WizardDestExtractPath, sizeof(WizardDestExtractPath), "VeraCrypt\\", sizeof (WizardDestExtractPath) - strlen (WizardDestExtractPath) - 1);
StringCbCopyW (WizardDestExtractPath, sizeof(WizardDestExtractPath), SetupFilesDir);
StringCbCatNW (WizardDestExtractPath, sizeof(WizardDestExtractPath), L"VeraCrypt\\", ARRAYSIZE (WizardDestExtractPath) - wcslen (WizardDestExtractPath) - 1);
}
SendMessage (GetDlgItem (hwndDlg, IDC_DESTINATION), EM_LIMITTEXT, TC_MAX_PATH - 1, 0);
@@ -353,10 +354,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDHELP), FALSE);
EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), FALSE);
if (WizardDestExtractPath [strlen(WizardDestExtractPath)-1] != '\\')
StringCbCatA (WizardDestExtractPath, sizeof(WizardDestExtractPath), "\\");
if (WizardDestExtractPath [wcslen(WizardDestExtractPath)-1] != L'\\')
StringCbCatW (WizardDestExtractPath, sizeof(WizardDestExtractPath), L"\\");
StringCbCopyA (DestExtractPath, sizeof(DestExtractPath), WizardDestExtractPath);
StringCbCopyW (DestExtractPath, sizeof(DestExtractPath), WizardDestExtractPath);
InitProgressBar ();
@@ -406,9 +407,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
EnableWindow (GetDlgItem (hwndDlg, IDC_BROWSE), FALSE);
EnableWindow (GetDlgItem (hwndDlg, IDC_ALL_USERS), FALSE);
char path[MAX_PATH];
wchar_t path[MAX_PATH];
SHGetSpecialFolderPath (hwndDlg, path, CSIDL_COMMON_PROGRAMS, 0);
bForAllUsers = (_access ((string (path) + "\\" TC_APP_NAME).c_str(), 0) == 0);
bForAllUsers = (_waccess ((wstring (path) + L"\\" _T(TC_APP_NAME)).c_str(), 0) == 0);
}
// System Restore
@@ -456,10 +457,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
InitProgressBar ();
if (WizardDestInstallPath [strlen(WizardDestInstallPath)-1] != '\\')
StringCbCatA (WizardDestInstallPath, sizeof(WizardDestInstallPath), "\\");
if (WizardDestInstallPath [wcslen(WizardDestInstallPath)-1] != L'\\')
StringCbCatW (WizardDestInstallPath, sizeof(WizardDestInstallPath), L"\\");
StringCbCopyA (InstallationPath, sizeof(InstallationPath), WizardDestInstallPath);
StringCbCopyW (InstallationPath, sizeof(InstallationPath), WizardDestInstallPath);
WaitCursor ();
@@ -627,9 +628,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDC_BROWSE:
if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestExtractPath))
{
if (WizardDestExtractPath [strlen(WizardDestExtractPath)-1] != '\\')
if (WizardDestExtractPath [wcslen(WizardDestExtractPath)-1] != L'\\')
{
StringCbCatA (WizardDestExtractPath, sizeof(WizardDestExtractPath), "\\");
StringCbCatW (WizardDestExtractPath, sizeof(WizardDestExtractPath), L"\\");
}
SetDlgItemText (hwndDlg, IDC_DESTINATION, WizardDestExtractPath);
}
@@ -648,9 +649,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDC_BROWSE:
if (BrowseDirectories (hwndDlg, "SELECT_DEST_DIR", WizardDestInstallPath))
{
if (WizardDestInstallPath [strlen(WizardDestInstallPath)-1] != '\\')
if (WizardDestInstallPath [wcslen(WizardDestInstallPath)-1] != L'\\')
{
StringCbCatA (WizardDestInstallPath, sizeof(WizardDestInstallPath), "\\");
StringCbCatW (WizardDestInstallPath, sizeof(WizardDestInstallPath), L"\\");
}
SetDlgItemText (hwndDlg, IDC_DESTINATION, WizardDestInstallPath);
}
@@ -803,7 +804,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
{
RECT rec;
GetModuleFileName (NULL, SelfFile, sizeof (SelfFile));
GetModuleFileName (NULL, SelfFile, ARRAYSIZE (SelfFile));
MainDlg = hwndDlg;
@@ -829,7 +830,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
SendMessage (GetDlgItem (hwndDlg, IDC_BOX_TITLE), WM_SETFONT, (WPARAM) hUserBoldFont, (LPARAM) TRUE);
SetWindowText (hwndDlg, "VeraCrypt Setup " VERSION_STRING);
SetWindowText (hwndDlg, L"VeraCrypt Setup " _T(VERSION_STRING));
DonColorSchemeId = GetDonVal (2, 9);
@@ -899,7 +900,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
HKEY hkey;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Updates\\Windows 2000\\SP5\\Update Rollup 1", 0, KEY_READ, &hkey) != ERROR_SUCCESS)
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Updates\\Windows 2000\\SP5\\Update Rollup 1", 0, KEY_READ, &hkey) != ERROR_SUCCESS)
{
ErrorDirect (L"VeraCrypt requires Update Rollup 1 for Windows 2000 SP4 to be installed.\n\nFor more information, see http://support.microsoft.com/kb/891861", hwndDlg);
AbortProcessSilent ();
@@ -928,14 +929,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (nCurPageNo == EXTRACTION_OPTIONS_PAGE)
{
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestExtractPath, sizeof (WizardDestExtractPath));
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestExtractPath, ARRAYSIZE (WizardDestExtractPath));
bStartExtraction = TRUE;
}
else if (nCurPageNo == INSTALL_OPTIONS_PAGE)
{
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestInstallPath, sizeof (WizardDestInstallPath));
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestInstallPath, ARRAYSIZE (WizardDestInstallPath));
bStartInstall = TRUE;
}
@@ -975,13 +976,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
else if (nCurPageNo == EXTRACTION_OPTIONS_PAGE)
{
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestExtractPath, sizeof (WizardDestExtractPath));
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestExtractPath, ARRAYSIZE (WizardDestExtractPath));
nCurPageNo = WIZARD_MODE_PAGE + 1;
}
else if (nCurPageNo == INSTALL_OPTIONS_PAGE)
{
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestInstallPath, sizeof (WizardDestInstallPath));
GetWindowText (GetDlgItem (hCurPage, IDC_DESTINATION), WizardDestInstallPath, ARRAYSIZE (WizardDestInstallPath));
}
LoadPage (hwndDlg, --nCurPageNo);
@@ -1156,7 +1157,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (bOpenContainingFolder && bExtractOnly && bExtractionSuccessful)
{
ShellExecute (NULL, "open", WizardDestExtractPath, NULL, NULL, SW_SHOWNORMAL);
ShellExecute (NULL, L"open", WizardDestExtractPath, NULL, NULL, SW_SHOWNORMAL);
}
else
{