mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Full UNICODE rewrite and implement support for UNICODE passwords.
This commit is contained in:
@@ -311,11 +311,7 @@ typedef struct
|
||||
|
||||
#pragma pack (pop)
|
||||
|
||||
#ifdef TC_WINDOWS_DRIVER
|
||||
#define DRIVER_STR WIDE
|
||||
#else
|
||||
#define DRIVER_STR
|
||||
#endif
|
||||
|
||||
#define TC_UNIQUE_ID_PREFIX "VeraCryptVolume"
|
||||
#define TC_MOUNT_PREFIX L"\\Device\\VeraCryptVolume"
|
||||
|
||||
@@ -128,16 +128,9 @@ BOOL BaseCom::IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly)
|
||||
|
||||
DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
CW2A szFilePathA(filePath);
|
||||
if (!szFilePathA.m_psz)
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
auto_ptr <File> file (device ? new Device (string (szFilePathA.m_psz), !write) : new File (string (szFilePathA.m_psz), !write));
|
||||
auto_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
|
||||
file->CheckOpened (SRC_POS);
|
||||
file->SeekAt (offset);
|
||||
|
||||
@@ -246,7 +239,7 @@ DWORD BaseCom::SetDriverServiceStartType (DWORD startType)
|
||||
|
||||
DWORD BaseCom::WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value)
|
||||
{
|
||||
if (!::WriteLocalMachineRegistryDwordW (keyPath, valueName, value))
|
||||
if (!::WriteLocalMachineRegistryDword (keyPath, valueName, value))
|
||||
return GetLastError();
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
|
||||
@@ -76,17 +76,17 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
static void CopyFile (const string &sourceFile, const string &destinationFile)
|
||||
static void CopyFile (const wstring &sourceFile, const wstring &destinationFile)
|
||||
{
|
||||
Elevate();
|
||||
DWORD result;
|
||||
CComBSTR sourceFileBstr, destinationFileBstr;
|
||||
BSTR bstr = A2WBSTR(sourceFile.c_str());
|
||||
BSTR bstr = W2BSTR(sourceFile.c_str());
|
||||
if (bstr)
|
||||
{
|
||||
sourceFileBstr.Attach (bstr);
|
||||
|
||||
bstr = A2WBSTR(destinationFile.c_str());
|
||||
bstr = W2BSTR(destinationFile.c_str());
|
||||
if (bstr)
|
||||
{
|
||||
destinationFileBstr.Attach (bstr);
|
||||
@@ -109,12 +109,12 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
static void DeleteFile (const string &file)
|
||||
static void DeleteFile (const wstring &file)
|
||||
{
|
||||
Elevate();
|
||||
CComBSTR fileBstr;
|
||||
DWORD result;
|
||||
BSTR bstr = A2WBSTR(file.c_str());
|
||||
BSTR bstr = W2BSTR(file.c_str());
|
||||
if (bstr)
|
||||
{
|
||||
fileBstr.Attach (bstr);
|
||||
@@ -132,7 +132,7 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
static void ReadWriteFile (BOOL write, BOOL device, const string &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone)
|
||||
static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone)
|
||||
{
|
||||
Elevate();
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace VeraCrypt
|
||||
CComBSTR bufferBstr, fileBstr;
|
||||
if (bufferBstr.AppendBytes ((const char *) buffer, size) != S_OK)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
BSTR bstr = A2WBSTR(filePath.c_str());
|
||||
BSTR bstr = W2BSTR(filePath.c_str());
|
||||
if (bstr)
|
||||
{
|
||||
fileBstr.Attach (bstr);
|
||||
@@ -168,17 +168,17 @@ namespace VeraCrypt
|
||||
return ElevatedComInstance->IsPagingFileActive (checkNonWindowsPartitionsOnly);
|
||||
}
|
||||
|
||||
static void WriteLocalMachineRegistryDwordValue (char *keyPath, char *valueName, DWORD value)
|
||||
static void WriteLocalMachineRegistryDwordValue (wchar_t *keyPath, wchar_t *valueName, DWORD value)
|
||||
{
|
||||
Elevate();
|
||||
DWORD result;
|
||||
CComBSTR keyPathBstr, valueNameBstr;
|
||||
BSTR bstr = A2WBSTR(keyPath);
|
||||
BSTR bstr = W2BSTR(keyPath);
|
||||
if (bstr)
|
||||
{
|
||||
keyPathBstr.Attach (bstr);
|
||||
|
||||
bstr = A2WBSTR(valueName);
|
||||
bstr = W2BSTR(valueName);
|
||||
if (bstr)
|
||||
{
|
||||
valueNameBstr.Attach (bstr);
|
||||
@@ -289,7 +289,7 @@ namespace VeraCrypt
|
||||
public:
|
||||
static void AddReference () { }
|
||||
static void CallDriver (DWORD ioctl, void *input, DWORD inputSize, void *output, DWORD outputSize) { throw ParameterIncorrect (SRC_POS); }
|
||||
static void ReadWriteFile (BOOL write, BOOL device, const string &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone) { throw ParameterIncorrect (SRC_POS); }
|
||||
static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone) { throw ParameterIncorrect (SRC_POS); }
|
||||
static void RegisterFilterDriver (bool registerDriver, BootEncryption::FilterType filterType) { throw ParameterIncorrect (SRC_POS); }
|
||||
static void Release () { }
|
||||
static void SetDriverServiceStartType (DWORD startType) { throw ParameterIncorrect (SRC_POS); }
|
||||
@@ -298,7 +298,7 @@ namespace VeraCrypt
|
||||
#endif // SETUP
|
||||
|
||||
|
||||
File::File (string path, bool readOnly, bool create) : Elevated (false), FileOpen (false), LastError(0)
|
||||
File::File (wstring path, bool readOnly, bool create) : Elevated (false), FileOpen (false), LastError(0)
|
||||
{
|
||||
Handle = CreateFile (path.c_str(),
|
||||
readOnly ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
|
||||
@@ -417,18 +417,18 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
void Show (HWND parent, const string &str)
|
||||
void Show (HWND parent, const wstring &str)
|
||||
{
|
||||
MessageBox (parent, str.c_str(), NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
Device::Device (string path, bool readOnly)
|
||||
Device::Device (wstring path, bool readOnly)
|
||||
{
|
||||
FileOpen = false;
|
||||
Elevated = false;
|
||||
|
||||
Handle = CreateFile ((string ("\\\\.\\") + path).c_str(),
|
||||
Handle = CreateFile ((wstring (L"\\\\.\\") + path).c_str(),
|
||||
readOnly ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_RANDOM_ACCESS | FILE_FLAG_WRITE_THROUGH, NULL);
|
||||
@@ -616,7 +616,7 @@ namespace VeraCrypt
|
||||
DWORD BootEncryption::GetDriverServiceStartType ()
|
||||
{
|
||||
DWORD startType;
|
||||
throw_sys_if (!ReadLocalMachineRegistryDword ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", "Start", &startType));
|
||||
throw_sys_if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", L"Start", &startType));
|
||||
return startType;
|
||||
}
|
||||
|
||||
@@ -645,42 +645,42 @@ namespace VeraCrypt
|
||||
|
||||
finally_do_arg (SC_HANDLE, serviceManager, { CloseServiceHandle (finally_arg); });
|
||||
|
||||
SC_HANDLE service = OpenService (serviceManager, "veracrypt", SERVICE_CHANGE_CONFIG);
|
||||
SC_HANDLE service = OpenService (serviceManager, L"veracrypt", SERVICE_CHANGE_CONFIG);
|
||||
throw_sys_if (!service);
|
||||
|
||||
finally_do_arg (SC_HANDLE, service, { CloseServiceHandle (finally_arg); });
|
||||
|
||||
// Windows versions preceding Vista can be installed on FAT filesystem which does not
|
||||
// support long filenames during boot. Convert the driver path to short form if required.
|
||||
string driverPath;
|
||||
wstring driverPath;
|
||||
if (startOnBoot && !IsOSAtLeast (WIN_VISTA))
|
||||
{
|
||||
char pathBuf[MAX_PATH];
|
||||
char filesystem[128];
|
||||
wchar_t pathBuf[MAX_PATH];
|
||||
wchar_t filesystem[128];
|
||||
|
||||
string path (GetWindowsDirectory());
|
||||
path += "\\drivers\\veracrypt.sys";
|
||||
wstring path (GetWindowsDirectory());
|
||||
path += L"\\drivers\\veracrypt.sys";
|
||||
|
||||
if (GetVolumePathName (path.c_str(), pathBuf, sizeof (pathBuf))
|
||||
&& GetVolumeInformation (pathBuf, NULL, 0, NULL, NULL, NULL, filesystem, sizeof(filesystem))
|
||||
&& memcmp (filesystem, "FAT", 3) == 0)
|
||||
if (GetVolumePathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf))
|
||||
&& GetVolumeInformation (pathBuf, NULL, 0, NULL, NULL, NULL, filesystem, ARRAYSIZE(filesystem))
|
||||
&& wmemcmp (filesystem, L"FAT", 3) == 0)
|
||||
{
|
||||
throw_sys_if (GetShortPathName (path.c_str(), pathBuf, sizeof (pathBuf)) == 0);
|
||||
throw_sys_if (GetShortPathName (path.c_str(), pathBuf, ARRAYSIZE (pathBuf)) == 0);
|
||||
|
||||
// Convert absolute path to relative to the Windows directory
|
||||
driverPath = pathBuf;
|
||||
driverPath = driverPath.substr (driverPath.rfind ("\\", driverPath.rfind ("\\", driverPath.rfind ("\\") - 1) - 1) + 1);
|
||||
driverPath = driverPath.substr (driverPath.rfind (L"\\", driverPath.rfind (L"\\", driverPath.rfind (L"\\") - 1) - 1) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
throw_sys_if (!ChangeServiceConfig (service, SERVICE_NO_CHANGE, SERVICE_NO_CHANGE,
|
||||
startOnBoot ? SERVICE_ERROR_SEVERE : SERVICE_ERROR_NORMAL,
|
||||
driverPath.empty() ? NULL : driverPath.c_str(),
|
||||
startOnBoot ? "Filter" : NULL,
|
||||
startOnBoot ? L"Filter" : NULL,
|
||||
NULL, NULL, NULL, NULL, NULL));
|
||||
|
||||
// ChangeServiceConfig() rejects SERVICE_BOOT_START with ERROR_INVALID_PARAMETER
|
||||
throw_sys_if (!WriteLocalMachineRegistryDword ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", "Start", startType));
|
||||
throw_sys_if (!WriteLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", L"Start", startType));
|
||||
}
|
||||
|
||||
|
||||
@@ -692,7 +692,7 @@ namespace VeraCrypt
|
||||
GetSystemDriveConfiguration();
|
||||
|
||||
ProbeRealDriveSizeRequest request;
|
||||
StringCbPrintfW (request.DeviceName, sizeof (request.DeviceName), L"%hs", DriveConfig.DrivePartition.DevicePath.c_str());
|
||||
StringCbCopyW (request.DeviceName, sizeof (request.DeviceName), DriveConfig.DrivePartition.DevicePath.c_str());
|
||||
|
||||
CallDriver (TC_IOCTL_PROBE_REAL_DRIVE_SIZE, &request, sizeof (request), &request, sizeof (request));
|
||||
DriveConfig.DrivePartition.Info.PartitionLength = request.RealDriveSize;
|
||||
@@ -717,11 +717,11 @@ namespace VeraCrypt
|
||||
|
||||
for (int partNumber = 0; partNumber < 64; ++partNumber)
|
||||
{
|
||||
stringstream partPath;
|
||||
partPath << "\\Device\\Harddisk" << driveNumber << "\\Partition" << partNumber;
|
||||
wstringstream partPath;
|
||||
partPath << L"\\Device\\Harddisk" << driveNumber << L"\\Partition" << partNumber;
|
||||
|
||||
DISK_PARTITION_INFO_STRUCT diskPartInfo = {0};
|
||||
StringCbPrintfW (diskPartInfo.deviceName, sizeof (diskPartInfo.deviceName), L"%hs", partPath.str().c_str());
|
||||
StringCbCopyW (diskPartInfo.deviceName, sizeof (diskPartInfo.deviceName), partPath.str().c_str());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -748,19 +748,17 @@ namespace VeraCrypt
|
||||
part.IsGPT = diskPartInfo.IsGPT;
|
||||
|
||||
// Mount point
|
||||
wstringstream ws;
|
||||
ws << partPath.str().c_str();
|
||||
int driveNumber = GetDiskDeviceDriveLetter ((wchar_t *) ws.str().c_str());
|
||||
int driveNumber = GetDiskDeviceDriveLetter ((wchar_t *) partPath.str().c_str());
|
||||
|
||||
if (driveNumber >= 0)
|
||||
{
|
||||
part.MountPoint += (char) (driveNumber + 'A');
|
||||
part.MountPoint += ":";
|
||||
part.MountPoint += (wchar_t) (driveNumber + L'A');
|
||||
part.MountPoint += L":";
|
||||
}
|
||||
|
||||
// Volume ID
|
||||
wchar_t volumePath[TC_MAX_PATH];
|
||||
if (ResolveSymbolicLink ((wchar_t *) ws.str().c_str(), volumePath, sizeof(volumePath)))
|
||||
if (ResolveSymbolicLink ((wchar_t *) partPath.str().c_str(), volumePath, sizeof(volumePath)))
|
||||
{
|
||||
wchar_t volumeName[TC_MAX_PATH];
|
||||
HANDLE fh = FindFirstVolumeW (volumeName, array_capacity (volumeName));
|
||||
@@ -794,32 +792,32 @@ namespace VeraCrypt
|
||||
|
||||
DISK_GEOMETRY BootEncryption::GetDriveGeometry (int driveNumber)
|
||||
{
|
||||
stringstream devName;
|
||||
devName << "\\Device\\Harddisk" << driveNumber << "\\Partition0";
|
||||
wstringstream devName;
|
||||
devName << L"\\Device\\Harddisk" << driveNumber << L"\\Partition0";
|
||||
|
||||
DISK_GEOMETRY geometry;
|
||||
throw_sys_if (!::GetDriveGeometry ((char *) devName.str().c_str(), &geometry));
|
||||
throw_sys_if (!::GetDriveGeometry (devName.str().c_str(), &geometry));
|
||||
return geometry;
|
||||
}
|
||||
|
||||
|
||||
string BootEncryption::GetWindowsDirectory ()
|
||||
wstring BootEncryption::GetWindowsDirectory ()
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
throw_sys_if (GetSystemDirectory (buf, sizeof (buf)) == 0);
|
||||
wchar_t buf[MAX_PATH];
|
||||
throw_sys_if (GetSystemDirectory (buf, ARRAYSIZE (buf)) == 0);
|
||||
|
||||
return string (buf);
|
||||
return wstring (buf);
|
||||
}
|
||||
|
||||
|
||||
string BootEncryption::GetTempPath ()
|
||||
wstring BootEncryption::GetTempPath ()
|
||||
{
|
||||
char tempPath[MAX_PATH];
|
||||
DWORD tempLen = ::GetTempPath (sizeof (tempPath), tempPath);
|
||||
if (tempLen == 0 || tempLen > sizeof (tempPath))
|
||||
wchar_t tempPath[MAX_PATH];
|
||||
DWORD tempLen = ::GetTempPath (ARRAYSIZE (tempPath), tempPath);
|
||||
if (tempLen == 0 || tempLen > ARRAYSIZE (tempPath))
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
return string (tempPath);
|
||||
return wstring (tempPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -838,7 +836,7 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
// Note that this does not require admin rights (it just requires the driver to be running)
|
||||
bool BootEncryption::IsBootLoaderOnDrive (char *devicePath)
|
||||
bool BootEncryption::IsBootLoaderOnDrive (wchar_t *devicePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -846,8 +844,7 @@ namespace VeraCrypt
|
||||
memset (&openTestStruct, 0, sizeof (openTestStruct));
|
||||
DWORD dwResult;
|
||||
|
||||
StringCbCopyA ((char *) &openTestStruct.wszFileName[0], sizeof(openTestStruct.wszFileName),devicePath);
|
||||
ToUNICODE ((char *) &openTestStruct.wszFileName[0], sizeof(openTestStruct.wszFileName));
|
||||
StringCbCopyW (&openTestStruct.wszFileName[0], sizeof(openTestStruct.wszFileName),devicePath);
|
||||
|
||||
openTestStruct.bDetectTCBootLoader = TRUE;
|
||||
|
||||
@@ -949,7 +946,7 @@ namespace VeraCrypt
|
||||
bool BootEncryption::SystemDriveIsDynamic ()
|
||||
{
|
||||
GetSystemDriveConfigurationRequest request;
|
||||
StringCbPrintfW (request.DevicePath, sizeof (request.DevicePath), L"%hs", GetSystemDriveConfiguration().DeviceKernelPath.c_str());
|
||||
StringCbCopyW (request.DevicePath, sizeof (request.DevicePath), GetSystemDriveConfiguration().DeviceKernelPath.c_str());
|
||||
|
||||
CallDriver (TC_IOCTL_GET_SYSTEM_DRIVE_CONFIG, &request, sizeof (request), &request, sizeof (request));
|
||||
return request.DriveIsDynamic ? true : false;
|
||||
@@ -963,7 +960,7 @@ namespace VeraCrypt
|
||||
|
||||
SystemDriveConfiguration config;
|
||||
|
||||
string winDir = GetWindowsDirectory();
|
||||
wstring winDir = GetWindowsDirectory();
|
||||
|
||||
// Scan all drives
|
||||
for (int driveNumber = 0; driveNumber < 32; ++driveNumber)
|
||||
@@ -977,7 +974,7 @@ namespace VeraCrypt
|
||||
foreach (const Partition &part, partitions)
|
||||
{
|
||||
if (!part.MountPoint.empty()
|
||||
&& (_access ((part.MountPoint + "\\bootmgr").c_str(), 0) == 0 || _access ((part.MountPoint + "\\ntldr").c_str(), 0) == 0))
|
||||
&& (_waccess ((part.MountPoint + L"\\bootmgr").c_str(), 0) == 0 || _waccess ((part.MountPoint + L"\\ntldr").c_str(), 0) == 0))
|
||||
{
|
||||
config.SystemLoaderPresent = true;
|
||||
}
|
||||
@@ -1006,12 +1003,12 @@ namespace VeraCrypt
|
||||
{
|
||||
config.DriveNumber = driveNumber;
|
||||
|
||||
stringstream ss;
|
||||
ss << "PhysicalDrive" << driveNumber;
|
||||
wstringstream ss;
|
||||
ss << L"PhysicalDrive" << driveNumber;
|
||||
config.DevicePath = ss.str();
|
||||
|
||||
stringstream kernelPath;
|
||||
kernelPath << "\\Device\\Harddisk" << driveNumber << "\\Partition0";
|
||||
wstringstream kernelPath;
|
||||
kernelPath << L"\\Device\\Harddisk" << driveNumber << L"\\Partition0";
|
||||
config.DeviceKernelPath = kernelPath.str();
|
||||
|
||||
config.DrivePartition = partitions.front();
|
||||
@@ -1187,7 +1184,7 @@ namespace VeraCrypt
|
||||
|
||||
// Boot sector
|
||||
DWORD size;
|
||||
byte *bootSecResourceImg = MapResource ("BIN", bootSectorId, &size);
|
||||
byte *bootSecResourceImg = MapResource (L"BIN", bootSectorId, &size);
|
||||
if (!bootSecResourceImg || size != TC_SECTOR_SIZE_BIOS)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
@@ -1215,14 +1212,14 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
// Decompressor
|
||||
byte *decompressor = MapResource ("BIN", IDR_BOOT_LOADER_DECOMPRESSOR, &size);
|
||||
byte *decompressor = MapResource (L"BIN", IDR_BOOT_LOADER_DECOMPRESSOR, &size);
|
||||
if (!decompressor || size > TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
memcpy (buffer + TC_SECTOR_SIZE_BIOS, decompressor, size);
|
||||
|
||||
// Compressed boot loader
|
||||
byte *bootLoader = MapResource ("BIN", bootLoaderId, &size);
|
||||
byte *bootLoader = MapResource (L"BIN", bootLoaderId, &size);
|
||||
if (!bootLoader || size > TC_MAX_BOOT_LOADER_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
@@ -1254,7 +1251,7 @@ namespace VeraCrypt
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
GetSystemDriveConfigurationRequest request;
|
||||
StringCbPrintfW (request.DevicePath, sizeof (request.DevicePath), L"%hs", GetSystemDriveConfiguration().DeviceKernelPath.c_str());
|
||||
StringCbCopyW (request.DevicePath, sizeof (request.DevicePath), GetSystemDriveConfiguration().DeviceKernelPath.c_str());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1584,35 +1581,35 @@ namespace VeraCrypt
|
||||
}
|
||||
#endif
|
||||
|
||||
string BootEncryption::GetSystemLoaderBackupPath ()
|
||||
wstring BootEncryption::GetSystemLoaderBackupPath ()
|
||||
{
|
||||
char pathBuf[MAX_PATH];
|
||||
WCHAR pathBuf[MAX_PATH];
|
||||
|
||||
throw_sys_if (!SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, pathBuf)));
|
||||
|
||||
string path = string (pathBuf) + "\\" TC_APP_NAME;
|
||||
wstring path = wstring (pathBuf) + L"\\" _T(TC_APP_NAME);
|
||||
CreateDirectory (path.c_str(), NULL);
|
||||
|
||||
return path + '\\' + TC_SYS_BOOT_LOADER_BACKUP_NAME;
|
||||
return path + L'\\' + TC_SYS_BOOT_LOADER_BACKUP_NAME;
|
||||
}
|
||||
|
||||
|
||||
void BootEncryption::RenameDeprecatedSystemLoaderBackup ()
|
||||
{
|
||||
char pathBuf[MAX_PATH];
|
||||
WCHAR pathBuf[MAX_PATH];
|
||||
|
||||
if (SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA, NULL, 0, pathBuf)))
|
||||
{
|
||||
string path = string (pathBuf) + "\\" TC_APP_NAME + '\\' + TC_SYS_BOOT_LOADER_BACKUP_NAME_LEGACY;
|
||||
wstring path = wstring (pathBuf) + L"\\" _T(TC_APP_NAME) + L'\\' + TC_SYS_BOOT_LOADER_BACKUP_NAME_LEGACY;
|
||||
|
||||
if (FileExists (path.c_str()) && !FileExists (GetSystemLoaderBackupPath().c_str()))
|
||||
throw_sys_if (rename (path.c_str(), GetSystemLoaderBackupPath().c_str()) != 0);
|
||||
throw_sys_if (_wrename (path.c_str(), GetSystemLoaderBackupPath().c_str()) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef SETUP
|
||||
void BootEncryption::CreateRescueIsoImage (bool initialSetup, const string &isoImagePath)
|
||||
void BootEncryption::CreateRescueIsoImage (bool initialSetup, const wstring &isoImagePath)
|
||||
{
|
||||
BootEncryptionStatus encStatus = GetStatus();
|
||||
if (encStatus.SetupInProgress)
|
||||
@@ -1764,12 +1761,12 @@ namespace VeraCrypt
|
||||
if (!RescueIsoImage)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
|
||||
for (char drive = 'Z'; drive >= 'C'; --drive)
|
||||
for (WCHAR drive = L'Z'; drive >= L'C'; --drive)
|
||||
{
|
||||
try
|
||||
{
|
||||
char rootPath[4] = { drive, ':', '\\', 0};
|
||||
UINT driveType = GetDriveTypeA (rootPath);
|
||||
WCHAR rootPath[4] = { drive, L':', L'\\', 0};
|
||||
UINT driveType = GetDriveType (rootPath);
|
||||
// check that it is a CD/DVD drive or a removable media in case a bootable
|
||||
// USB key was created from the rescue disk ISO file
|
||||
if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType))
|
||||
@@ -1795,7 +1792,7 @@ namespace VeraCrypt
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BootEncryption::VerifyRescueDiskIsoImage (const char* imageFile)
|
||||
bool BootEncryption::VerifyRescueDiskIsoImage (const wchar_t* imageFile)
|
||||
{
|
||||
if (!RescueIsoImage)
|
||||
throw ParameterIncorrect (SRC_POS);
|
||||
@@ -1967,7 +1964,7 @@ namespace VeraCrypt
|
||||
|
||||
filter = "veracrypt.sys";
|
||||
filterReg = "DumpFilters";
|
||||
SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, ®Key));
|
||||
SetLastError (RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\CrashControl", 0, KEY_READ | KEY_WRITE, ®Key));
|
||||
throw_sys_if (GetLastError() != ERROR_SUCCESS);
|
||||
|
||||
break;
|
||||
@@ -1989,18 +1986,18 @@ namespace VeraCrypt
|
||||
// SetupInstallFromInfSection() does not support prepending of values so we have to modify the registry directly
|
||||
StringCbCopyA ((char *) regKeyBuf, sizeof(regKeyBuf), filter.c_str());
|
||||
|
||||
if (RegQueryValueEx (regKey, filterReg.c_str(), NULL, NULL, regKeyBuf + strSize, &size) != ERROR_SUCCESS)
|
||||
if (RegQueryValueExA (regKey, filterReg.c_str(), NULL, NULL, regKeyBuf + strSize, &size) != ERROR_SUCCESS)
|
||||
size = 1;
|
||||
|
||||
SetLastError (RegSetValueEx (regKey, filterReg.c_str(), 0, REG_MULTI_SZ, regKeyBuf, (DWORD) strSize + size));
|
||||
SetLastError (RegSetValueExA (regKey, filterReg.c_str(), 0, REG_MULTI_SZ, regKeyBuf, (DWORD) strSize + size));
|
||||
throw_sys_if (GetLastError() != ERROR_SUCCESS);
|
||||
}
|
||||
else
|
||||
{
|
||||
string infFileName = GetTempPath() + "\\veracrypt_driver_setup.inf";
|
||||
wstring infFileName = GetTempPath() + L"\\veracrypt_driver_setup.inf";
|
||||
|
||||
File infFile (infFileName, false, true);
|
||||
finally_do_arg (string, infFileName, { DeleteFile (finally_arg.c_str()); });
|
||||
finally_do_arg (wstring, infFileName, { DeleteFile (finally_arg.c_str()); });
|
||||
|
||||
string infTxt = "[veracrypt]\r\n"
|
||||
+ string (registerFilter ? "Add" : "Del") + "Reg=veracrypt_reg\r\n\r\n"
|
||||
@@ -2014,7 +2011,7 @@ namespace VeraCrypt
|
||||
throw_sys_if (hInf == INVALID_HANDLE_VALUE);
|
||||
finally_do_arg (HINF, hInf, { SetupCloseInfFile (finally_arg); });
|
||||
|
||||
throw_sys_if (!SetupInstallFromInfSection (ParentWindow, hInf, "veracrypt", SPINST_REGISTRY, regKey, NULL, 0, NULL, NULL, NULL, NULL));
|
||||
throw_sys_if (!SetupInstallFromInfSection (ParentWindow, hInf, L"veracrypt", SPINST_REGISTRY, regKey, NULL, 0, NULL, NULL, NULL, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2052,8 +2049,8 @@ namespace VeraCrypt
|
||||
throw_sys_if (!scm);
|
||||
finally_do_arg (SC_HANDLE, scm, { CloseServiceHandle (finally_arg); });
|
||||
|
||||
string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe", false);
|
||||
string serviceLegacyPath = GetServiceConfigPath (TC_APP_NAME ".exe", true);
|
||||
wstring servicePath = GetServiceConfigPath (_T(TC_APP_NAME) L".exe", false);
|
||||
wstring serviceLegacyPath = GetServiceConfigPath (_T(TC_APP_NAME) L".exe", true);
|
||||
|
||||
if (registerService)
|
||||
{
|
||||
@@ -2065,20 +2062,20 @@ namespace VeraCrypt
|
||||
|
||||
if (!noFileHandling)
|
||||
{
|
||||
char appPath[TC_MAX_PATH];
|
||||
throw_sys_if (!GetModuleFileName (NULL, appPath, sizeof (appPath)));
|
||||
wchar_t appPath[TC_MAX_PATH];
|
||||
throw_sys_if (!GetModuleFileName (NULL, appPath, ARRAYSIZE (appPath)));
|
||||
|
||||
throw_sys_if (!CopyFile (appPath, servicePath.c_str(), FALSE));
|
||||
}
|
||||
|
||||
SC_HANDLE service = CreateService (scm,
|
||||
TC_SYSTEM_FAVORITES_SERVICE_NAME,
|
||||
TC_APP_NAME " System Favorites",
|
||||
_T(TC_APP_NAME) L" System Favorites",
|
||||
SERVICE_ALL_ACCESS,
|
||||
SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_AUTO_START,
|
||||
SERVICE_ERROR_NORMAL,
|
||||
(string ("\"") + servicePath + "\" " TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION).c_str(),
|
||||
(wstring (L"\"") + servicePath + L"\" " TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION).c_str(),
|
||||
TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -2088,15 +2085,15 @@ namespace VeraCrypt
|
||||
throw_sys_if (!service);
|
||||
|
||||
SERVICE_DESCRIPTION description;
|
||||
description.lpDescription = "Mounts VeraCrypt system favorite volumes.";
|
||||
description.lpDescription = L"Mounts VeraCrypt system favorite volumes.";
|
||||
ChangeServiceConfig2 (service, SERVICE_CONFIG_DESCRIPTION, &description);
|
||||
|
||||
CloseServiceHandle (service);
|
||||
|
||||
try
|
||||
{
|
||||
WriteLocalMachineRegistryString ("SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\" TC_SYSTEM_FAVORITES_SERVICE_NAME, NULL, "Service", FALSE);
|
||||
WriteLocalMachineRegistryString ("SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Network\\" TC_SYSTEM_FAVORITES_SERVICE_NAME, NULL, "Service", FALSE);
|
||||
WriteLocalMachineRegistryString (L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal\\" TC_SYSTEM_FAVORITES_SERVICE_NAME, NULL, L"Service", FALSE);
|
||||
WriteLocalMachineRegistryString (L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Network\\" TC_SYSTEM_FAVORITES_SERVICE_NAME, NULL, L"Service", FALSE);
|
||||
|
||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES, true);
|
||||
}
|
||||
@@ -2115,8 +2112,8 @@ namespace VeraCrypt
|
||||
{
|
||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES, false);
|
||||
|
||||
DeleteLocalMachineRegistryKey ("SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal", TC_SYSTEM_FAVORITES_SERVICE_NAME);
|
||||
DeleteLocalMachineRegistryKey ("SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Network", TC_SYSTEM_FAVORITES_SERVICE_NAME);
|
||||
DeleteLocalMachineRegistryKey (L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Minimal", TC_SYSTEM_FAVORITES_SERVICE_NAME);
|
||||
DeleteLocalMachineRegistryKey (L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Network", TC_SYSTEM_FAVORITES_SERVICE_NAME);
|
||||
|
||||
SC_HANDLE service = OpenService (scm, TC_SYSTEM_FAVORITES_SERVICE_NAME, SERVICE_ALL_ACCESS);
|
||||
throw_sys_if (!service);
|
||||
@@ -2140,7 +2137,7 @@ namespace VeraCrypt
|
||||
|
||||
finally_do_arg (SC_HANDLE, scm, { CloseServiceHandle (finally_arg); });
|
||||
|
||||
string servicePath = GetServiceConfigPath (TC_APP_NAME ".exe", false);
|
||||
wstring servicePath = GetServiceConfigPath (_T(TC_APP_NAME) L".exe", false);
|
||||
|
||||
// check if service exists
|
||||
SC_HANDLE service = OpenService (scm, TC_SYSTEM_FAVORITES_SERVICE_NAME, SERVICE_ALL_ACCESS);
|
||||
@@ -2151,13 +2148,13 @@ namespace VeraCrypt
|
||||
SERVICE_WIN32_OWN_PROCESS,
|
||||
SERVICE_AUTO_START,
|
||||
SERVICE_ERROR_NORMAL,
|
||||
(string ("\"") + servicePath + "\" " TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION).c_str(),
|
||||
(wstring (L"\"") + servicePath + L"\" " TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION).c_str(),
|
||||
TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
TC_APP_NAME " System Favorites"));
|
||||
_T(TC_APP_NAME) L" System Favorites"));
|
||||
|
||||
}
|
||||
else
|
||||
@@ -2175,9 +2172,9 @@ namespace VeraCrypt
|
||||
else
|
||||
configMap &= ~flag;
|
||||
#ifdef SETUP
|
||||
WriteLocalMachineRegistryDword ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, configMap);
|
||||
WriteLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, configMap);
|
||||
#else
|
||||
WriteLocalMachineRegistryDwordValue ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, configMap);
|
||||
WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, configMap);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2260,20 +2257,20 @@ namespace VeraCrypt
|
||||
|
||||
void BootEncryption::InitialSecurityChecksForHiddenOS ()
|
||||
{
|
||||
char windowsDrive = (char) toupper (GetWindowsDirectory()[0]);
|
||||
wchar_t windowsDrive = (wchar_t) towupper (GetWindowsDirectory()[0]);
|
||||
|
||||
// Paging files
|
||||
bool pagingFilesOk = !IsPagingFileActive (TRUE);
|
||||
|
||||
char pagingFileRegData[65536];
|
||||
wchar_t pagingFileRegData[65536];
|
||||
DWORD pagingFileRegDataSize = sizeof (pagingFileRegData);
|
||||
|
||||
if (ReadLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", "PagingFiles", pagingFileRegData, &pagingFileRegDataSize)
|
||||
&& pagingFileRegDataSize > 4)
|
||||
if (ReadLocalMachineRegistryMultiString (L"System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", L"PagingFiles", pagingFileRegData, &pagingFileRegDataSize)
|
||||
&& pagingFileRegDataSize > 8)
|
||||
{
|
||||
for (size_t i = 1; i < pagingFileRegDataSize - 2; ++i)
|
||||
for (size_t i = 1; i < pagingFileRegDataSize/2 - 2; ++i)
|
||||
{
|
||||
if (memcmp (pagingFileRegData + i, ":\\", 2) == 0 && toupper (pagingFileRegData[i - 1]) != windowsDrive)
|
||||
if (wmemcmp (pagingFileRegData + i, L":\\", 2) == 0 && towupper (pagingFileRegData[i - 1]) != windowsDrive)
|
||||
{
|
||||
pagingFilesOk = false;
|
||||
break;
|
||||
@@ -2299,15 +2296,15 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
// User profile
|
||||
char *configPath = GetConfigPath ("dummy");
|
||||
if (configPath && toupper (configPath[0]) != windowsDrive)
|
||||
wchar_t *configPath = GetConfigPath (L"dummy");
|
||||
if (configPath && towupper (configPath[0]) != windowsDrive)
|
||||
{
|
||||
throw ErrorException (wstring (GetString ("USER_PROFILE_NOT_ON_SYS_PARTITION"))
|
||||
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS);
|
||||
}
|
||||
|
||||
// Temporary files
|
||||
if (toupper (GetTempPath()[0]) != windowsDrive)
|
||||
if (towupper (GetTempPath()[0]) != windowsDrive)
|
||||
{
|
||||
throw ErrorException (wstring (GetString ("TEMP_NOT_ON_SYS_PARTITION"))
|
||||
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS);
|
||||
@@ -2602,7 +2599,7 @@ namespace VeraCrypt
|
||||
}
|
||||
|
||||
|
||||
void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath)
|
||||
void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const wstring &rescueIsoImagePath)
|
||||
{
|
||||
BootEncryptionStatus encStatus = GetStatus();
|
||||
if (encStatus.DriveMounted)
|
||||
@@ -2671,14 +2668,14 @@ namespace VeraCrypt
|
||||
|
||||
void BootEncryption::RestrictPagingFilesToSystemPartition ()
|
||||
{
|
||||
char pagingFiles[128];
|
||||
StringCbCopyA (pagingFiles, sizeof(pagingFiles), "X:\\pagefile.sys 0 0");
|
||||
wchar_t pagingFiles[128] = {0};
|
||||
StringCbCopyW (pagingFiles, sizeof(pagingFiles), L"X:\\pagefile.sys 0 0");
|
||||
pagingFiles[0] = GetWindowsDirectory()[0];
|
||||
|
||||
throw_sys_if (!WriteLocalMachineRegistryMultiString ("System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", "PagingFiles", pagingFiles, (DWORD) strlen (pagingFiles) + 2));
|
||||
throw_sys_if (!WriteLocalMachineRegistryMultiString (L"System\\CurrentControlSet\\Control\\Session Manager\\Memory Management", L"PagingFiles", pagingFiles, (DWORD) (wcslen (pagingFiles) + 2) * sizeof (wchar_t)));
|
||||
}
|
||||
|
||||
void BootEncryption::WriteLocalMachineRegistryDwordValue (char *keyPath, char *valueName, DWORD value)
|
||||
void BootEncryption::WriteLocalMachineRegistryDwordValue (wchar_t *keyPath, wchar_t *valueName, DWORD value)
|
||||
{
|
||||
if (!IsAdmin() && IsUacSupported())
|
||||
{
|
||||
@@ -2722,7 +2719,7 @@ namespace VeraCrypt
|
||||
CallDriver (TC_IOCTL_BOOT_ENCRYPTION_SETUP, &request, sizeof (request), NULL, 0);
|
||||
}
|
||||
|
||||
void BootEncryption::CopyFileAdmin (const string &sourceFile, const string &destinationFile)
|
||||
void BootEncryption::CopyFileAdmin (const wstring &sourceFile, const wstring &destinationFile)
|
||||
{
|
||||
if (!IsAdmin())
|
||||
{
|
||||
@@ -2738,7 +2735,7 @@ namespace VeraCrypt
|
||||
throw_sys_if (!::CopyFile (sourceFile.c_str(), destinationFile.c_str(), FALSE));
|
||||
}
|
||||
|
||||
void BootEncryption::DeleteFileAdmin (const string &file)
|
||||
void BootEncryption::DeleteFileAdmin (const wstring &file)
|
||||
{
|
||||
if (!IsAdmin() && IsUacSupported())
|
||||
Elevator::DeleteFile (file);
|
||||
@@ -2752,7 +2749,7 @@ namespace VeraCrypt
|
||||
{
|
||||
DWORD configMap;
|
||||
|
||||
if (!ReadLocalMachineRegistryDword ("SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, &configMap))
|
||||
if (!ReadLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", TC_DRIVER_CONFIG_REG_VALUE_NAME, &configMap))
|
||||
configMap = 0;
|
||||
|
||||
return configMap;
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace VeraCrypt
|
||||
{
|
||||
public:
|
||||
File () : Elevated (false), FileOpen (false), FilePointerPosition(0), Handle(INVALID_HANDLE_VALUE), IsDevice(false), LastError(0) { }
|
||||
File (string path,bool readOnly = false, bool create = false);
|
||||
File (wstring path,bool readOnly = false, bool create = false);
|
||||
virtual ~File () { Close(); }
|
||||
|
||||
void CheckOpened (const char* srcPos) { if (!FileOpen) { SetLastError (LastError); throw SystemException (srcPos);} }
|
||||
@@ -42,7 +42,7 @@ namespace VeraCrypt
|
||||
uint64 FilePointerPosition;
|
||||
HANDLE Handle;
|
||||
bool IsDevice;
|
||||
string Path;
|
||||
wstring Path;
|
||||
DWORD LastError;
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace VeraCrypt
|
||||
class Device : public File
|
||||
{
|
||||
public:
|
||||
Device (string path,bool readOnly = false);
|
||||
Device (wstring path,bool readOnly = false);
|
||||
virtual ~Device () {}
|
||||
};
|
||||
|
||||
@@ -77,9 +77,9 @@ namespace VeraCrypt
|
||||
|
||||
struct Partition
|
||||
{
|
||||
string DevicePath;
|
||||
wstring DevicePath;
|
||||
PARTITION_INFORMATION Info;
|
||||
string MountPoint;
|
||||
wstring MountPoint;
|
||||
size_t Number;
|
||||
BOOL IsGPT;
|
||||
wstring VolumeNameId;
|
||||
@@ -119,8 +119,8 @@ namespace VeraCrypt
|
||||
|
||||
struct SystemDriveConfiguration
|
||||
{
|
||||
string DeviceKernelPath;
|
||||
string DevicePath;
|
||||
wstring DeviceKernelPath;
|
||||
wstring DevicePath;
|
||||
int DriveNumber;
|
||||
Partition DrivePartition;
|
||||
bool ExtraBootPartitionPresent;
|
||||
@@ -154,19 +154,19 @@ namespace VeraCrypt
|
||||
void CheckEncryptionSetupResult ();
|
||||
void CheckRequirements ();
|
||||
void CheckRequirementsHiddenOS ();
|
||||
void CopyFileAdmin (const string &sourceFile, const string &destinationFile);
|
||||
void CreateRescueIsoImage (bool initialSetup, const string &isoImagePath);
|
||||
void CopyFileAdmin (const wstring &sourceFile, const wstring &destinationFile);
|
||||
void CreateRescueIsoImage (bool initialSetup, const wstring &isoImagePath);
|
||||
void Deinstall (bool displayWaitDialog = false);
|
||||
void DeleteFileAdmin (const string &file);
|
||||
void DeleteFileAdmin (const wstring &file);
|
||||
DecoySystemWipeStatus GetDecoyOSWipeStatus ();
|
||||
DWORD GetDriverServiceStartType ();
|
||||
unsigned int GetHiddenOSCreationPhase ();
|
||||
uint16 GetInstalledBootLoaderVersion ();
|
||||
void GetInstalledBootLoaderFingerprint (byte fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE]);
|
||||
Partition GetPartitionForHiddenOS ();
|
||||
bool IsBootLoaderOnDrive (char *devicePath);
|
||||
bool IsBootLoaderOnDrive (wchar_t *devicePath);
|
||||
BootEncryptionStatus GetStatus ();
|
||||
string GetTempPath ();
|
||||
wstring GetTempPath ();
|
||||
void GetVolumeProperties (VOLUME_PROPERTIES_STRUCT *properties);
|
||||
SystemDriveConfiguration GetSystemDriveConfiguration ();
|
||||
void Install (bool hiddenSystem);
|
||||
@@ -178,7 +178,7 @@ namespace VeraCrypt
|
||||
bool IsHiddenSystemRunning ();
|
||||
bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
||||
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
|
||||
void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath);
|
||||
void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const wstring &rescueIsoImagePath);
|
||||
void ProbeRealSystemDriveSize ();
|
||||
void ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
|
||||
uint32 ReadDriverConfigurationFlags ();
|
||||
@@ -203,12 +203,12 @@ namespace VeraCrypt
|
||||
bool SystemPartitionCoversWholeDrive ();
|
||||
bool SystemDriveIsDynamic ();
|
||||
bool VerifyRescueDisk ();
|
||||
bool VerifyRescueDiskIsoImage (const char* imageFile);
|
||||
bool VerifyRescueDiskIsoImage (const wchar_t* imageFile);
|
||||
void WipeHiddenOSCreationConfig ();
|
||||
void WriteBootDriveSector (uint64 offset, byte *data);
|
||||
void WriteBootSectorConfig (const byte newConfig[]);
|
||||
void WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage);
|
||||
void WriteLocalMachineRegistryDwordValue (char *keyPath, char *valueName, DWORD value);
|
||||
void WriteLocalMachineRegistryDwordValue (wchar_t *keyPath, wchar_t *valueName, DWORD value);
|
||||
|
||||
protected:
|
||||
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
|
||||
@@ -216,12 +216,12 @@ namespace VeraCrypt
|
||||
void BackupSystemLoader ();
|
||||
void CreateBootLoaderInMemory (byte *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation = false);
|
||||
void CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim);
|
||||
string GetSystemLoaderBackupPath ();
|
||||
wstring GetSystemLoaderBackupPath ();
|
||||
uint32 GetChecksum (byte *data, size_t size);
|
||||
DISK_GEOMETRY GetDriveGeometry (int driveNumber);
|
||||
PartitionList GetDrivePartitions (int driveNumber);
|
||||
wstring GetRemarksOnHiddenOS ();
|
||||
string GetWindowsDirectory ();
|
||||
wstring GetWindowsDirectory ();
|
||||
void RegisterFilter (bool registerFilter, FilterType filterType, const GUID *deviceClassGuid = nullptr);
|
||||
void RestoreSystemLoader ();
|
||||
void InstallVolumeHeader ();
|
||||
@@ -246,11 +246,11 @@ namespace VeraCrypt
|
||||
#define MIN_HIDDENOS_DECOY_PARTITION_SIZE_RATIO_NTFS 2.1
|
||||
#define MIN_HIDDENOS_DECOY_PARTITION_SIZE_RATIO_FAT 1.05
|
||||
|
||||
#define TC_SYS_BOOT_LOADER_BACKUP_NAME "Original System Loader"
|
||||
#define TC_SYS_BOOT_LOADER_BACKUP_NAME_LEGACY "Original System Loader.bak" // Deprecated to prevent removal by some "cleaners"
|
||||
#define TC_SYS_BOOT_LOADER_BACKUP_NAME L"Original System Loader"
|
||||
#define TC_SYS_BOOT_LOADER_BACKUP_NAME_LEGACY L"Original System Loader.bak" // Deprecated to prevent removal by some "cleaners"
|
||||
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_NAME TC_APP_NAME "SystemFavorites"
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP "Event Log"
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION "/systemFavoritesService"
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_NAME _T(TC_APP_NAME) L"SystemFavorites"
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_LOAD_ORDER_GROUP L"Event Log"
|
||||
#define TC_SYSTEM_FAVORITES_SERVICE_CMDLINE_OPTION L"/systemFavoritesService"
|
||||
|
||||
#endif // TC_HEADER_Common_BootEncryption
|
||||
|
||||
@@ -40,8 +40,8 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
char * tmp = err_malloc(8192);
|
||||
char tmp2[MAX_PATH * 2];
|
||||
wchar_t * tmp = err_malloc(8192 * sizeof (wchar_t));
|
||||
wchar_t tmp2[MAX_PATH * 2];
|
||||
argumentspec *as;
|
||||
int i;
|
||||
|
||||
@@ -51,29 +51,29 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
|
||||
*tmp = 0;
|
||||
|
||||
StringCbCopyA (tmp, 8192, "VeraCrypt " VERSION_STRING);
|
||||
StringCchCopyW (tmp, 8192, L"VeraCrypt " _T(VERSION_STRING));
|
||||
#ifdef _WIN64
|
||||
StringCbCatA (tmp, 8192, " (64-bit)");
|
||||
StringCchCatW (tmp, 8192, L" (64-bit)");
|
||||
#else
|
||||
StringCbCatA (tmp, 8192, " (32-bit)");
|
||||
StringCchCatW (tmp, 8192, L" (32-bit)");
|
||||
#endif
|
||||
#if (defined(_DEBUG) || defined(DEBUG))
|
||||
StringCbCatA (tmp, 8192, " (debug)");
|
||||
StringCchCatW (tmp, 8192, L" (debug)");
|
||||
#endif
|
||||
|
||||
StringCbCatA (tmp, 8192, "\n\nCommand line options:\n\n");
|
||||
StringCchCatW (tmp, 8192, L"\n\nCommand line options:\n\n");
|
||||
for (i = 0; i < as->arg_cnt; i ++)
|
||||
{
|
||||
if (!as->args[i].Internal)
|
||||
{
|
||||
StringCchPrintf(tmp2, MAX_PATH * 2, "%s\t%s\n", as->args[i].short_name, as->args[i].long_name);
|
||||
StringCchCat(tmp, 8192, tmp2);
|
||||
StringCchPrintfW(tmp2, MAX_PATH * 2, L"%s\t%s\n", as->args[i].short_name, as->args[i].long_name);
|
||||
StringCchCatW(tmp, 8192, tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
StringCbCatA (tmp, 8192, "\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nDismount a volume X:\tveracrypt.exe /q /d X");
|
||||
StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nDismount a volume X:\tveracrypt.exe /q /d X");
|
||||
|
||||
SetWindowText (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), (char*) tmp);
|
||||
SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp);
|
||||
|
||||
TCfree(tmp);
|
||||
return 1;
|
||||
@@ -90,7 +90,7 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Win32CommandLine (char *lpszCommandLine, char ***lpszArgs)
|
||||
int Win32CommandLine (wchar_t ***lpszArgs)
|
||||
{
|
||||
int argumentCount;
|
||||
int i;
|
||||
@@ -109,30 +109,16 @@ int Win32CommandLine (char *lpszCommandLine, char ***lpszArgs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
*lpszArgs = malloc (sizeof (char *) * argumentCount);
|
||||
*lpszArgs = malloc (sizeof (wchar_t *) * argumentCount);
|
||||
if (!*lpszArgs)
|
||||
AbortProcess ("OUTOFMEMORY");
|
||||
|
||||
for (i = 0; i < argumentCount; ++i)
|
||||
{
|
||||
size_t argLen = wcslen (arguments[i + 1]);
|
||||
|
||||
char *arg = malloc (argLen + 1);
|
||||
wchar_t *arg = _wcsdup (arguments[i + 1]);
|
||||
if (!arg)
|
||||
AbortProcess ("OUTOFMEMORY");
|
||||
|
||||
if (argLen > 0)
|
||||
{
|
||||
int len = WideCharToMultiByte (CP_ACP, 0, arguments[i + 1], -1, arg, (int) argLen + 1, NULL, NULL);
|
||||
if (len == 0)
|
||||
{
|
||||
handleWin32Error (NULL, SRC_POS);
|
||||
AbortProcessSilent();
|
||||
}
|
||||
}
|
||||
else
|
||||
arg[0] = 0;
|
||||
|
||||
(*lpszArgs)[i] = arg;
|
||||
}
|
||||
|
||||
@@ -140,21 +126,21 @@ int Win32CommandLine (char *lpszCommandLine, char ***lpszArgs)
|
||||
return argumentCount;
|
||||
}
|
||||
|
||||
int GetArgSepPosOffset (char *lpszArgument)
|
||||
int GetArgSepPosOffset (wchar_t *lpszArgument)
|
||||
{
|
||||
if (lpszArgument[0] == '/')
|
||||
if (lpszArgument[0] == L'/')
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetArgumentID (argumentspec *as, char *lpszArgument)
|
||||
int GetArgumentID (argumentspec *as, wchar_t *lpszArgument)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < as->arg_cnt; i++)
|
||||
{
|
||||
if (_stricmp (as->args[i].long_name, lpszArgument) == 0)
|
||||
if (_wcsicmp (as->args[i].long_name, lpszArgument) == 0)
|
||||
{
|
||||
return as->args[i].Id;
|
||||
}
|
||||
@@ -165,7 +151,7 @@ int GetArgumentID (argumentspec *as, char *lpszArgument)
|
||||
if (as->args[i].short_name[0] == 0)
|
||||
continue;
|
||||
|
||||
if (_stricmp (as->args[i].short_name, lpszArgument) == 0)
|
||||
if (_wcsicmp (as->args[i].short_name, lpszArgument) == 0)
|
||||
{
|
||||
return as->args[i].Id;
|
||||
}
|
||||
@@ -175,8 +161,8 @@ int GetArgumentID (argumentspec *as, char *lpszArgument)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetArgumentValue (char **lpszCommandLineArgs, int *nArgIdx,
|
||||
int nNoCommandLineArgs, char *lpszValue, int nValueSize)
|
||||
int GetArgumentValue (wchar_t **lpszCommandLineArgs, int *nArgIdx,
|
||||
int nNoCommandLineArgs, wchar_t *lpszValue, int nValueSize)
|
||||
{
|
||||
*lpszValue = 0;
|
||||
|
||||
@@ -187,7 +173,7 @@ int GetArgumentValue (char **lpszCommandLineArgs, int *nArgIdx,
|
||||
{
|
||||
/* Handles the case of space between parameter code
|
||||
and value */
|
||||
StringCbCopyA (lpszValue, nValueSize, lpszCommandLineArgs[*nArgIdx + 1]);
|
||||
StringCbCopyW (lpszValue, nValueSize, lpszCommandLineArgs[*nArgIdx + 1]);
|
||||
lpszValue[nValueSize - 1] = 0;
|
||||
(*nArgIdx)++;
|
||||
return HAS_ARGUMENT;
|
||||
|
||||
@@ -21,8 +21,8 @@ extern "C" {
|
||||
typedef struct argument_t
|
||||
{
|
||||
int Id;
|
||||
char long_name[32];
|
||||
char short_name[8];
|
||||
wchar_t long_name[32];
|
||||
wchar_t short_name[8];
|
||||
BOOL Internal;
|
||||
} argument;
|
||||
|
||||
@@ -33,10 +33,10 @@ typedef struct argumentspec_t
|
||||
} argumentspec;
|
||||
|
||||
BOOL CALLBACK CommandHelpDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
|
||||
int Win32CommandLine ( char *lpszCommandLine , char ***lpszArgs );
|
||||
int GetArgSepPosOffset ( char *lpszArgument );
|
||||
int GetArgumentID ( argumentspec *as , char *lpszArgument );
|
||||
int GetArgumentValue ( char **lpszCommandLineArgs , int *nArgIdx , int nNoCommandLineArgs , char *lpszValue , int nValueSize );
|
||||
int Win32CommandLine ( wchar_t ***lpszArgs );
|
||||
int GetArgSepPosOffset ( wchar_t *lpszArgument );
|
||||
int GetArgumentID ( argumentspec *as , wchar_t *lpszArgument );
|
||||
int GetArgumentValue ( wchar_t **lpszCommandLineArgs , int *nArgIdx , int nNoCommandLineArgs , wchar_t *lpszValue , int nValueSize );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#define SIZEOF_MRU_LIST 20
|
||||
|
||||
void AddComboItem (HWND hComboBox, char *lpszFileName, BOOL saveHistory)
|
||||
void AddComboItem (HWND hComboBox, const wchar_t *lpszFileName, BOOL saveHistory)
|
||||
{
|
||||
LPARAM nIndex;
|
||||
|
||||
@@ -53,19 +53,19 @@ void AddComboItem (HWND hComboBox, char *lpszFileName, BOOL saveHistory)
|
||||
|
||||
LPARAM MoveEditToCombo (HWND hComboBox, BOOL saveHistory)
|
||||
{
|
||||
char szTmp[TC_MAX_PATH] = {0};
|
||||
wchar_t szTmp[TC_MAX_PATH] = {0};
|
||||
|
||||
if (!saveHistory)
|
||||
{
|
||||
GetWindowText (hComboBox, szTmp, sizeof (szTmp));
|
||||
GetWindowText (hComboBox, szTmp, ARRAYSIZE (szTmp));
|
||||
SendMessage (hComboBox, CB_RESETCONTENT, 0, 0);
|
||||
SetWindowText (hComboBox, szTmp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GetWindowText (hComboBox, szTmp, sizeof (szTmp));
|
||||
GetWindowText (hComboBox, szTmp, ARRAYSIZE (szTmp));
|
||||
|
||||
if (strlen (szTmp) > 0)
|
||||
if (wcslen (szTmp) > 0)
|
||||
{
|
||||
LPARAM nIndex = SendMessage (hComboBox, CB_FINDSTRINGEXACT, (WPARAM) - 1,
|
||||
(LPARAM) & szTmp[0]);
|
||||
@@ -169,19 +169,22 @@ void LoadCombo (HWND hComboBox, BOOL bEnabled, BOOL bOnlyCheckModified, BOOL *pb
|
||||
i = 0;
|
||||
while (xml = XmlFindElement (xml, "volume"))
|
||||
{
|
||||
char szTmp[MAX_PATH] = { 0 };
|
||||
wchar_t szTmp[MAX_PATH] = { 0 };
|
||||
wchar_t wszVolume[MAX_PATH] = {0};
|
||||
|
||||
if (i < count)
|
||||
{
|
||||
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < sizeof (szTmp))
|
||||
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp))
|
||||
SendMessage (hComboBox, CB_GETLBTEXT, nComboIdx[i], (LPARAM) & szTmp[0]);
|
||||
}
|
||||
|
||||
XmlGetNodeText (xml, volume, sizeof (volume));
|
||||
if (0 == MultiByteToWideChar (CP_UTF8, 0, volume, -1, wszVolume, MAX_PATH))
|
||||
wszVolume [0] = 0;
|
||||
if (!bOnlyCheckModified)
|
||||
AddComboItem (hComboBox, volume, TRUE);
|
||||
AddComboItem (hComboBox, wszVolume, TRUE);
|
||||
|
||||
if (pbModified && strcmp (volume, szTmp))
|
||||
if (pbModified && wcscmp (wszVolume, szTmp))
|
||||
*pbModified = TRUE;
|
||||
|
||||
xml++;
|
||||
@@ -208,11 +211,11 @@ void DumpCombo (HWND hComboBox, int bClear)
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen (GetConfigPath (TC_APPD_FILENAME_HISTORY), "w");
|
||||
f = _wfopen (GetConfigPath (TC_APPD_FILENAME_HISTORY), L"w,ccs=UTF-8");
|
||||
if (f == NULL) return;
|
||||
|
||||
XmlWriteHeader (f);
|
||||
fputs ("\n\t<history>", f);
|
||||
fputws (L"\n\t<history>", f);
|
||||
|
||||
/* combo list part:- get mru items */
|
||||
for (i = 0; i < SIZEOF_MRU_LIST; i++)
|
||||
@@ -221,21 +224,21 @@ void DumpCombo (HWND hComboBox, int bClear)
|
||||
/* combo list part:- write out mru items */
|
||||
for (i = 0; i < SIZEOF_MRU_LIST; i++)
|
||||
{
|
||||
char szTmp[MAX_PATH] = { 0 };
|
||||
wchar_t szTmp[MAX_PATH] = { 0 };
|
||||
|
||||
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < sizeof (szTmp))
|
||||
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp))
|
||||
SendMessage (hComboBox, CB_GETLBTEXT, nComboIdx[i], (LPARAM) & szTmp[0]);
|
||||
|
||||
if (szTmp[0] != 0)
|
||||
{
|
||||
char q[MAX_PATH * 2] = { 0 };
|
||||
XmlQuoteText (szTmp, q, sizeof (q));
|
||||
wchar_t q[MAX_PATH * 2] = { 0 };
|
||||
XmlQuoteTextW (szTmp, q, sizeof (q));
|
||||
|
||||
fprintf (f, "\n\t\t<volume>%s</volume>", q);
|
||||
fwprintf (f, L"\n\t\t<volume>%s</volume>", q);
|
||||
}
|
||||
}
|
||||
|
||||
fputs ("\n\t</history>", f);
|
||||
fputws (L"\n\t</history>", f);
|
||||
XmlWriteFooter (f);
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void AddComboItem (HWND hComboBox, char *lpszFileName, BOOL saveHistory);
|
||||
void AddComboItem (HWND hComboBox, const wchar_t *lpszFileName, BOOL saveHistory);
|
||||
LPARAM MoveEditToCombo (HWND hComboBox, BOOL saveHistory);
|
||||
int GetOrderComboIdx ( HWND hComboBox , int *nIdxList , int nElems );
|
||||
LPARAM UpdateComboOrder ( HWND hComboBox );
|
||||
|
||||
@@ -44,9 +44,15 @@ static Cipher Ciphers[] =
|
||||
{
|
||||
// Block Size Key Size Key Schedule Size
|
||||
// ID Name (Bytes) (Bytes) (Bytes)
|
||||
#ifdef TC_WINDOWS_BOOT
|
||||
{ AES, "AES", 16, 32, AES_KS },
|
||||
{ SERPENT, "Serpent", 16, 32, 140*4 },
|
||||
{ TWOFISH, "Twofish", 16, 32, TWOFISH_KS },
|
||||
#else
|
||||
{ AES, L"AES", 16, 32, AES_KS },
|
||||
{ SERPENT, L"Serpent", 16, 32, 140*4 },
|
||||
{ TWOFISH, L"Twofish", 16, 32, TWOFISH_KS },
|
||||
#endif
|
||||
{ 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -88,18 +94,17 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
// Hash algorithms
|
||||
static Hash Hashes[] =
|
||||
{ // ID Name Deprecated System Encryption
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
{ SHA512, "SHA-512", FALSE, FALSE },
|
||||
{ WHIRLPOOL, "Whirlpool", FALSE, FALSE },
|
||||
#endif
|
||||
{ SHA256, "SHA-256", FALSE, TRUE },
|
||||
{ RIPEMD160, "RIPEMD-160", TRUE, TRUE },
|
||||
{ SHA512, L"SHA-512", FALSE, FALSE },
|
||||
{ WHIRLPOOL, L"Whirlpool", FALSE, FALSE },
|
||||
{ SHA256, L"SHA-256", FALSE, TRUE },
|
||||
{ RIPEMD160, L"RIPEMD-160", TRUE, TRUE },
|
||||
{ 0, 0, 0 }
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Return values: 0 = success, ERR_CIPHER_INIT_FAILURE (fatal), ERR_CIPHER_INIT_WEAK_KEY (non-fatal) */
|
||||
int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
|
||||
@@ -279,17 +284,12 @@ Cipher *CipherGet (int id)
|
||||
}
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
const
|
||||
#endif
|
||||
char *CipherGetName (int cipherId)
|
||||
const wchar_t *CipherGetName (int cipherId)
|
||||
{
|
||||
#ifdef TC_WINDOWS_BOOT
|
||||
return CipherGet (cipherId) -> Name;
|
||||
#else
|
||||
Cipher* pCipher = CipherGet (cipherId);
|
||||
return pCipher? pCipher -> Name : "";
|
||||
#endif
|
||||
return pCipher? pCipher -> Name : L"";
|
||||
}
|
||||
#endif
|
||||
|
||||
int CipherGetBlockSize (int cipherId)
|
||||
{
|
||||
@@ -410,19 +410,19 @@ BOOL EAInitMode (PCRYPTO_INFO ci)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void EAGetDisplayName(char *buf, int ea, int i)
|
||||
static void EAGetDisplayName(wchar_t *buf, int ea, int i)
|
||||
{
|
||||
strcpy (buf, CipherGetName (i));
|
||||
wcscpy (buf, CipherGetName (i));
|
||||
if (i = EAGetPreviousCipher(ea, i))
|
||||
{
|
||||
strcat (buf, "(");
|
||||
EAGetDisplayName (&buf[strlen(buf)], ea, i);
|
||||
strcat (buf, ")");
|
||||
wcscat (buf, L"(");
|
||||
EAGetDisplayName (&buf[wcslen(buf)], ea, i);
|
||||
wcscat (buf, L")");
|
||||
}
|
||||
}
|
||||
|
||||
// Returns name of EA, cascaded cipher names are separated by hyphens
|
||||
char *EAGetName (char *buf, int ea, int guiDisplay)
|
||||
wchar_t *EAGetName (wchar_t *buf, int ea, int guiDisplay)
|
||||
{
|
||||
if (guiDisplay)
|
||||
{
|
||||
@@ -431,27 +431,27 @@ char *EAGetName (char *buf, int ea, int guiDisplay)
|
||||
else
|
||||
{
|
||||
int i = EAGetLastCipher(ea);
|
||||
strcpy (buf, (i != 0) ? CipherGetName (i) : "?");
|
||||
wcscpy (buf, (i != 0) ? CipherGetName (i) : L"?");
|
||||
|
||||
while (i = EAGetPreviousCipher(ea, i))
|
||||
{
|
||||
strcat (buf, "-");
|
||||
strcat (buf, CipherGetName (i));
|
||||
wcscat (buf, L"-");
|
||||
wcscat (buf, CipherGetName (i));
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
int EAGetByName (char *name)
|
||||
int EAGetByName (wchar_t *name)
|
||||
{
|
||||
int ea = EAGetFirst ();
|
||||
char n[128];
|
||||
wchar_t n[128];
|
||||
|
||||
do
|
||||
{
|
||||
EAGetName (n, ea, 1);
|
||||
if (_stricmp (n, name) == 0)
|
||||
if (_wcsicmp (n, name) == 0)
|
||||
return ea;
|
||||
}
|
||||
while (ea = EAGetNext (ea));
|
||||
@@ -499,16 +499,16 @@ int EAGetNextMode (int ea, int previousModeId)
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
|
||||
// Returns the name of the mode of operation of the whole EA
|
||||
char *EAGetModeName (int ea, int mode, BOOL capitalLetters)
|
||||
wchar_t *EAGetModeName (int ea, int mode, BOOL capitalLetters)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case XTS:
|
||||
|
||||
return "XTS";
|
||||
return L"XTS";
|
||||
|
||||
}
|
||||
return "[unknown]";
|
||||
return L"[unknown]";
|
||||
}
|
||||
|
||||
#endif // TC_WINDOWS_BOOT
|
||||
@@ -635,7 +635,7 @@ BOOL EAIsModeSupported (int ea, int testedMode)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
Hash *HashGet (int id)
|
||||
{
|
||||
int i;
|
||||
@@ -647,37 +647,29 @@ Hash *HashGet (int id)
|
||||
}
|
||||
|
||||
|
||||
int HashGetIdByName (char *name)
|
||||
int HashGetIdByName (wchar_t *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; Hashes[i].Id != 0; i++)
|
||||
if (strcmp (Hashes[i].Name, name) == 0)
|
||||
if (wcscmp (Hashes[i].Name, name) == 0)
|
||||
return Hashes[i].Id;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
const
|
||||
#endif
|
||||
char *HashGetName (int hashId)
|
||||
const wchar_t *HashGetName (int hashId)
|
||||
{
|
||||
#ifdef TC_WINDOWS_BOOT
|
||||
return HashGet(hashId) -> Name;
|
||||
#else
|
||||
Hash* pHash = HashGet(hashId);
|
||||
return pHash? pHash -> Name : "";
|
||||
#endif
|
||||
return pHash? pHash -> Name : L"";
|
||||
}
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
void HashGetName2 (char *buf, int hashId)
|
||||
void HashGetName2 (wchar_t *buf, int hashId)
|
||||
{
|
||||
Hash* pHash = HashGet(hashId);
|
||||
if (pHash)
|
||||
strcpy(buf, pHash -> Name);
|
||||
wcscpy(buf, pHash -> Name);
|
||||
else
|
||||
buf[0] = '\0';
|
||||
buf[0] = L'\0';
|
||||
}
|
||||
|
||||
BOOL HashIsDeprecated (int hashId)
|
||||
|
||||
@@ -112,7 +112,11 @@ enum
|
||||
typedef struct
|
||||
{
|
||||
int Id; // Cipher ID
|
||||
#ifdef TC_WINDOWS_BOOT
|
||||
char *Name; // Name
|
||||
#else
|
||||
wchar_t *Name; // Name
|
||||
#endif
|
||||
int BlockSize; // Block size (bytes)
|
||||
int KeySize; // Key size (bytes)
|
||||
int KeyScheduleSize; // Scheduled key size (bytes)
|
||||
@@ -125,13 +129,15 @@ typedef struct
|
||||
int FormatEnabled;
|
||||
} EncryptionAlgorithm;
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
typedef struct
|
||||
{
|
||||
int Id; // Hash ID
|
||||
char *Name; // Name
|
||||
wchar_t *Name; // Name
|
||||
BOOL Deprecated;
|
||||
BOOL SystemEncryption; // Available for system encryption
|
||||
} Hash;
|
||||
#endif
|
||||
|
||||
// Maxium length of scheduled key
|
||||
#if !defined (TC_WINDOWS_BOOT) || defined (TC_WINDOWS_BOOT_AES)
|
||||
@@ -276,9 +282,8 @@ int CipherGetKeyScheduleSize (int cipher);
|
||||
BOOL CipherSupportsIntraDataUnitParallelization (int cipher);
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
const
|
||||
const wchar_t * CipherGetName (int cipher);
|
||||
#endif
|
||||
char * CipherGetName (int cipher);
|
||||
|
||||
int CipherInit (int cipher, unsigned char *key, unsigned char *ks);
|
||||
#ifndef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
|
||||
@@ -297,12 +302,16 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount);
|
||||
int EAGetFirst ();
|
||||
int EAGetCount (void);
|
||||
int EAGetNext (int previousEA);
|
||||
char * EAGetName (char *buf, int ea, int guiDisplay);
|
||||
int EAGetByName (char *name);
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
wchar_t * EAGetName (wchar_t *buf, int ea, int guiDisplay);
|
||||
int EAGetByName (wchar_t *name);
|
||||
#endif
|
||||
int EAGetKeySize (int ea);
|
||||
int EAGetFirstMode (int ea);
|
||||
int EAGetNextMode (int ea, int previousModeId);
|
||||
char * EAGetModeName (int ea, int mode, BOOL capitalLetters);
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
wchar_t * EAGetModeName (int ea, int mode, BOOL capitalLetters);
|
||||
#endif
|
||||
int EAGetKeyScheduleSize (int ea);
|
||||
int EAGetLargestKey ();
|
||||
int EAGetLargestKeyForMode (int mode);
|
||||
@@ -317,13 +326,10 @@ BOOL EAIsModeSupported (int ea, int testedMode);
|
||||
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
const
|
||||
#endif
|
||||
char *HashGetName (int hash_algo_id);
|
||||
const wchar_t *HashGetName (int hash_algo_id);
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
Hash *HashGet (int id);
|
||||
void HashGetName2 (char *buf, int hashId);
|
||||
void HashGetName2 (wchar_t *buf, int hashId);
|
||||
BOOL HashIsDeprecated (int hashId);
|
||||
BOOL HashForSystemEncryption (int hashId);
|
||||
int GetMaxPkcs5OutSize (void);
|
||||
|
||||
1462
src/Common/Dlgcode.c
1462
src/Common/Dlgcode.c
File diff suppressed because it is too large
Load Diff
@@ -48,10 +48,10 @@ enum
|
||||
|
||||
#define TC_APPLICATION_ID L"IDRIX.VeraCrypt"
|
||||
|
||||
#define TC_MUTEX_NAME_SYSENC "Global\\VeraCrypt System Encryption Wizard"
|
||||
#define TC_MUTEX_NAME_NONSYS_INPLACE_ENC "Global\\VeraCrypt In-Place Encryption Wizard"
|
||||
#define TC_MUTEX_NAME_APP_SETUP "Global\\VeraCrypt Setup"
|
||||
#define TC_MUTEX_NAME_DRIVER_SETUP "Global\\VeraCrypt Driver Setup"
|
||||
#define TC_MUTEX_NAME_SYSENC L"Global\\VeraCrypt System Encryption Wizard"
|
||||
#define TC_MUTEX_NAME_NONSYS_INPLACE_ENC L"Global\\VeraCrypt In-Place Encryption Wizard"
|
||||
#define TC_MUTEX_NAME_APP_SETUP L"Global\\VeraCrypt Setup"
|
||||
#define TC_MUTEX_NAME_DRIVER_SETUP L"Global\\VeraCrypt Driver Setup"
|
||||
|
||||
#define IDC_ABOUT 0x7fff /* ID for AboutBox on system menu in wm_user range */
|
||||
|
||||
@@ -68,18 +68,18 @@ enum
|
||||
|
||||
#define MAX_MULTI_CHOICES 10 /* Maximum number of options for mutliple-choice dialog */
|
||||
|
||||
#define TC_APPD_FILENAME_CONFIGURATION "Configuration.xml"
|
||||
#define TC_APPD_FILENAME_SYSTEM_ENCRYPTION "System Encryption.xml"
|
||||
#define TC_APPD_FILENAME_DEFAULT_KEYFILES "Default Keyfiles.xml"
|
||||
#define TC_APPD_FILENAME_HISTORY "History.xml"
|
||||
#define TC_APPD_FILENAME_FAVORITE_VOLUMES "Favorite Volumes.xml"
|
||||
#define TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES TC_APP_NAME " System Favorite Volumes.xml"
|
||||
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC "In-Place Encryption"
|
||||
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE "In-Place Encryption Wipe Algo"
|
||||
#define TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL "Post-Install Task - Tutorial"
|
||||
#define TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES "Post-Install Task - Release Notes"
|
||||
#define TC_APPD_FILENAME_CONFIGURATION L"Configuration.xml"
|
||||
#define TC_APPD_FILENAME_SYSTEM_ENCRYPTION L"System Encryption.xml"
|
||||
#define TC_APPD_FILENAME_DEFAULT_KEYFILES L"Default Keyfiles.xml"
|
||||
#define TC_APPD_FILENAME_HISTORY L"History.xml"
|
||||
#define TC_APPD_FILENAME_FAVORITE_VOLUMES L"Favorite Volumes.xml"
|
||||
#define TC_APPD_FILENAME_SYSTEM_FAVORITE_VOLUMES _T(TC_APP_NAME) L" System Favorite Volumes.xml"
|
||||
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC L"In-Place Encryption"
|
||||
#define TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE L"In-Place Encryption Wipe Algo"
|
||||
#define TC_APPD_FILENAME_POST_INSTALL_TASK_TUTORIAL L"Post-Install Task - Tutorial"
|
||||
#define TC_APPD_FILENAME_POST_INSTALL_TASK_RELEASE_NOTES L"Post-Install Task - Release Notes"
|
||||
|
||||
#define VC_FILENAME_RENAMED_SUFFIX "_old"
|
||||
#define VC_FILENAME_RENAMED_SUFFIX L"_old"
|
||||
|
||||
#ifndef USER_DEFAULT_SCREEN_DPI
|
||||
#define USER_DEFAULT_SCREEN_DPI 96
|
||||
@@ -98,9 +98,9 @@ enum
|
||||
|
||||
extern char *LastDialogId;
|
||||
extern char *ConfigBuffer;
|
||||
extern char szHelpFile[TC_MAX_PATH];
|
||||
extern char szHelpFile2[TC_MAX_PATH];
|
||||
extern char SecurityTokenLibraryPath[TC_MAX_PATH];
|
||||
extern wchar_t szHelpFile[TC_MAX_PATH];
|
||||
extern wchar_t szHelpFile2[TC_MAX_PATH];
|
||||
extern wchar_t SecurityTokenLibraryPath[TC_MAX_PATH];
|
||||
extern HFONT hFixedDigitFont;
|
||||
extern HFONT hBoldFont;
|
||||
extern HFONT hTitleFont;
|
||||
@@ -132,8 +132,8 @@ extern WipeAlgorithmId nWipeMode;
|
||||
extern BOOL bSysPartitionSelected;
|
||||
extern BOOL bSysDriveSelected;
|
||||
|
||||
extern char SysPartitionDevicePath [TC_MAX_PATH];
|
||||
extern char SysDriveDevicePath [TC_MAX_PATH];
|
||||
extern wchar_t SysPartitionDevicePath [TC_MAX_PATH];
|
||||
extern wchar_t SysDriveDevicePath [TC_MAX_PATH];
|
||||
extern char bCachedSysDevicePathsValid;
|
||||
|
||||
extern BOOL bHyperLinkBeingTracked;
|
||||
@@ -226,15 +226,15 @@ typedef struct
|
||||
#define ICON_HAND MB_ICONHAND
|
||||
#define YES_NO MB_YESNO
|
||||
|
||||
#define ISO_BURNER_TOOL "isoburn.exe"
|
||||
#define PRINT_TOOL "notepad.exe"
|
||||
#define ISO_BURNER_TOOL L"isoburn.exe"
|
||||
#define PRINT_TOOL L"notepad.exe"
|
||||
|
||||
void cleanup ( void );
|
||||
void LowerCaseCopy ( char *lpszDest , const char *lpszSource );
|
||||
void UpperCaseCopy ( char *lpszDest , size_t cbDest, const char *lpszSource );
|
||||
void CreateFullVolumePath ( char *lpszDiskFile , size_t cbDiskFile, const char *lpszFileName , BOOL *bDevice );
|
||||
int FakeDosNameForDevice ( const char *lpszDiskFile , char *lpszDosDevice , size_t cbDosDevice, char *lpszCFDevice , size_t cbCFDevice, BOOL bNameOnly );
|
||||
int RemoveFakeDosName ( char *lpszDiskFile , char *lpszDosDevice );
|
||||
void LowerCaseCopy ( wchar_t *lpszDest , const wchar_t *lpszSource );
|
||||
void UpperCaseCopy ( wchar_t *lpszDest , size_t cbDest, const wchar_t *lpszSource );
|
||||
void CreateFullVolumePath ( wchar_t *lpszDiskFile , size_t cbDiskFile, const wchar_t *lpszFileName , BOOL *bDevice );
|
||||
int FakeDosNameForDevice ( const wchar_t *lpszDiskFile , wchar_t *lpszDosDevice , size_t cbDosDevice, wchar_t *lpszCFDevice , size_t cbCFDevice, BOOL bNameOnly );
|
||||
int RemoveFakeDosName ( wchar_t *lpszDiskFile , wchar_t *lpszDosDevice );
|
||||
void AbortProcessDirect ( wchar_t *abortMsg );
|
||||
void AbortProcess ( char *stringId );
|
||||
void AbortProcessSilent ( void );
|
||||
@@ -251,13 +251,11 @@ void DisplayStaticModelessWaitDlg (HWND parent);
|
||||
void CloseStaticModelessWaitDlg (void);
|
||||
BOOL IsButtonChecked ( HWND hButton );
|
||||
void CheckButton ( HWND hButton );
|
||||
void LeftPadString (char *szTmp, int len, int targetLen, char filler);
|
||||
void ToSBCS ( LPWSTR lpszText, size_t cbSize );
|
||||
void ToUNICODE ( char *lpszText , size_t cbSize);
|
||||
void LeftPadString (wchar_t *szTmp, int len, int targetLen, wchar_t filler);
|
||||
void InitDialog ( HWND hwndDlg );
|
||||
void ProcessPaintMessages (HWND hwnd, int maxMessagesToProcess);
|
||||
HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , char *resource );
|
||||
HBITMAP RenderBitmap ( char *resource , HWND hwndDest , int x , int y , int nWidth , int nHeight , BOOL bDirectRender , BOOL bKeepAspectRatio);
|
||||
HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , wchar_t *resource );
|
||||
HBITMAP RenderBitmap ( wchar_t *resource , HWND hwndDest , int x , int y , int nWidth , int nHeight , BOOL bDirectRender , BOOL bKeepAspectRatio);
|
||||
LRESULT CALLBACK RedTick ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
|
||||
BOOL RegisterRedTick ( HINSTANCE hInstance );
|
||||
BOOL UnregisterRedTick ( HINSTANCE hInstance );
|
||||
@@ -271,11 +269,11 @@ void AddComboPairW (HWND hComboBox, const wchar_t *lpszItem, int value);
|
||||
void SelectAlgo ( HWND hComboBox , int *nCipher );
|
||||
void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, BOOL bHeaderWipe);
|
||||
wchar_t *GetWipeModeName (WipeAlgorithmId modeId);
|
||||
wchar_t *GetPathType (const char *path, BOOL bUpperCase, BOOL *bIsPartition);
|
||||
wchar_t *GetPathType (const wchar_t *path, BOOL bUpperCase, BOOL *bIsPartition);
|
||||
LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
|
||||
BOOL TCCreateMutex (volatile HANDLE *hMutex, char *name);
|
||||
BOOL TCCreateMutex (volatile HANDLE *hMutex, wchar_t *name);
|
||||
void TCCloseMutex (volatile HANDLE *hMutex);
|
||||
BOOL MutexExistsOnSystem (char *name);
|
||||
BOOL MutexExistsOnSystem (wchar_t *name);
|
||||
BOOL CreateSysEncMutex (void);
|
||||
BOOL InstanceHasSysEncMutex (void);
|
||||
void CloseSysEncMutex (void);
|
||||
@@ -297,15 +295,15 @@ void RemoveNonSysInPlaceEncNotifications (void);
|
||||
void SavePostInstallTasksSettings (int command);
|
||||
void DoPostInstallTasks (HWND hwndDlg);
|
||||
void InitOSVersionInfo ();
|
||||
void InitApp ( HINSTANCE hInstance, char *lpszCommandLine );
|
||||
void InitApp ( HINSTANCE hInstance, wchar_t *lpszCommandLine );
|
||||
void FinalizeApp (void);
|
||||
void InitHelpFileName (void);
|
||||
BOOL OpenDevice (const char *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem);
|
||||
BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectFilesystem);
|
||||
void NotifyDriverOfPortableMode (void);
|
||||
int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath );
|
||||
int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
|
||||
int IsSystemDevicePath (const char *path, HWND hwndDlg, BOOL bReliableRequired);
|
||||
int IsNonSysPartitionOnSysDrive (const char *path);
|
||||
int IsSystemDevicePath (const wchar_t *path, HWND hwndDlg, BOOL bReliableRequired);
|
||||
int IsNonSysPartitionOnSysDrive (const wchar_t *path);
|
||||
BOOL CALLBACK RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
|
||||
INT_PTR TextInfoDialogBox (int nID);
|
||||
BOOL CALLBACK TextInfoDialogBoxDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
@@ -318,50 +316,49 @@ int DriverAttach ( void );
|
||||
BOOL CALLBACK CipherTestDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
|
||||
void ResetCipherTest ( HWND hwndDlg , int idTestCipher );
|
||||
void ResetCurrentDirectory ();
|
||||
BOOL BrowseFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter);
|
||||
BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName);
|
||||
BOOL BrowseFiles (HWND hwndDlg, char *stringId, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter);
|
||||
BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, wchar_t *dirName);
|
||||
void handleError ( HWND hwndDlg , int code, const char* srcPos );
|
||||
BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const char *fileName);
|
||||
BOOL CheckFileStreamWriteErrors (HWND hwndDlg, FILE *file, const wchar_t *fileName);
|
||||
void LocalizeDialog ( HWND hwnd, char *stringId );
|
||||
void OpenVolumeExplorerWindow (int driveNo);
|
||||
static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo);
|
||||
BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo);
|
||||
BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValue);
|
||||
BOOL CheckCapsLock (HWND hwnd, BOOL quiet);
|
||||
BOOL CheckFileExtension (char *fileName);
|
||||
void CorrectFileName (char* fileName);
|
||||
BOOL CheckFileExtension (wchar_t *fileName);
|
||||
void CorrectFileName (wchar_t* fileName);
|
||||
void IncreaseWrongPwdRetryCount (int count);
|
||||
void ResetWrongPwdRetryCount (void);
|
||||
BOOL WrongPwdRetryCountOverLimit (void);
|
||||
int GetFirstAvailableDrive ();
|
||||
int GetLastAvailableDrive ();
|
||||
BOOL IsDriveAvailable (int driveNo);
|
||||
BOOL IsDeviceMounted (char *deviceName);
|
||||
BOOL IsDeviceMounted (wchar_t *deviceName);
|
||||
int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
|
||||
void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
|
||||
int MountVolume (HWND hwndDlg, int driveNo, char *volumePath, Password *password, int pkcs5, int pim, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword);
|
||||
int MountVolume (HWND hwndDlg, int driveNo, wchar_t *volumePath, Password *password, int pkcs5, int pim, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword);
|
||||
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
|
||||
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
|
||||
BOOL IsPasswordCacheEmpty (void);
|
||||
BOOL IsMountedVolume (const char *volname);
|
||||
int GetMountedVolumeDriveNo (char *volname);
|
||||
BOOL IsMountedVolume (const wchar_t *volname);
|
||||
int GetMountedVolumeDriveNo (wchar_t *volname);
|
||||
BOOL IsAdmin (void);
|
||||
BOOL IsBuiltInAdmin ();
|
||||
BOOL IsUacSupported ();
|
||||
BOOL ResolveSymbolicLink (const wchar_t *symLinkName, PWSTR targetName, size_t cbTargetName);
|
||||
int GetDiskDeviceDriveLetter (PWSTR deviceName);
|
||||
int FileSystemAppearsEmpty (const char *devicePath);
|
||||
__int64 GetStatsFreeSpaceOnPartition (const char *devicePath, float *percent, __int64 *occupiedBytes, BOOL silent);
|
||||
__int64 GetDeviceSize (const char *devicePath);
|
||||
HANDLE DismountDrive (char *devName, char *devicePath);
|
||||
int FileSystemAppearsEmpty (const wchar_t *devicePath);
|
||||
__int64 GetStatsFreeSpaceOnPartition (const wchar_t *devicePath, float *percent, __int64 *occupiedBytes, BOOL silent);
|
||||
__int64 GetDeviceSize (const wchar_t *devicePath);
|
||||
HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath);
|
||||
int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset);
|
||||
BOOL FileExists (const char *filePathPtr);
|
||||
__int64 FindStringInFile (const char *filePath, const char *str, int strLen);
|
||||
BOOL TCCopyFile (char *sourceFileName, char *destinationFile);
|
||||
BOOL TCCopyFileW (wchar_t *sourceFileName, wchar_t *destinationFile);
|
||||
BOOL SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed);
|
||||
BOOL FileExists (const wchar_t *filePathPtr);
|
||||
__int64 FindStringInFile (const wchar_t *filePath, const char *str, int strLen);
|
||||
BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile);
|
||||
BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed);
|
||||
BOOL TCFlushFile (FILE *f);
|
||||
BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t byteLen);
|
||||
BOOL PrintHardCopyTextUTF16 (wchar_t *text, wchar_t *title, size_t byteLen);
|
||||
void GetSpeedString (unsigned __int64 speed, wchar_t *str, size_t cbStr);
|
||||
BOOL IsNonInstallMode ();
|
||||
BOOL DriverUnload ();
|
||||
@@ -369,25 +366,23 @@ LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state);
|
||||
BOOL GetCheckBox (HWND hwndDlg, int dlgItem);
|
||||
void SetListScrollHPos (HWND hList, int topMostVisibleItem);
|
||||
void ManageStartupSeq (void);
|
||||
void ManageStartupSeqWiz (BOOL bRemove, const char *arg);
|
||||
void ManageStartupSeqWiz (BOOL bRemove, const wchar_t *arg);
|
||||
void CleanLastVisitedMRU (void);
|
||||
void ClearHistory (HWND hwndDlgItem);
|
||||
LRESULT ListItemAdd (HWND list, int index, char *string);
|
||||
LRESULT ListItemAddW (HWND list, int index, wchar_t *string);
|
||||
LRESULT ListSubItemSet (HWND list, int index, int subIndex, char *string);
|
||||
LRESULT ListSubItemSetW (HWND list, int index, int subIndex, wchar_t *string);
|
||||
LRESULT ListItemAdd (HWND list, int index, const wchar_t *string);
|
||||
LRESULT ListSubItemSet (HWND list, int index, int subIndex, const wchar_t *string);
|
||||
BOOL GetMountList (MOUNT_LIST_STRUCT *list);
|
||||
int GetDriverRefCount ();
|
||||
void GetSizeString (unsigned __int64 size, wchar_t *str, size_t cbStr);
|
||||
__int64 GetFileSize64 (const char *path);
|
||||
BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset);
|
||||
BOOL LoadInt32 (char *filePath, unsigned __int32 *result, __int64 fileOffset);
|
||||
char *LoadFile (const char *fileName, DWORD *size);
|
||||
char *LoadFileBlock (char *fileName, __int64 fileOffset, DWORD count);
|
||||
char *GetModPath (char *path, int maxSize);
|
||||
char *GetConfigPath (char *fileName);
|
||||
char *GetProgramConfigPath (char *fileName);
|
||||
char GetSystemDriveLetter (void);
|
||||
__int64 GetFileSize64 (const wchar_t *path);
|
||||
BOOL LoadInt16 (const wchar_t *filePath, int *result, __int64 fileOffset);
|
||||
BOOL LoadInt32 (const wchar_t *filePath, unsigned __int32 *result, __int64 fileOffset);
|
||||
char *LoadFile (const wchar_t *fileName, DWORD *size);
|
||||
char *LoadFileBlock (const wchar_t *fileName, __int64 fileOffset, DWORD count);
|
||||
wchar_t *GetModPath (wchar_t *path, int maxSize);
|
||||
wchar_t *GetConfigPath (wchar_t *fileName);
|
||||
wchar_t *GetProgramConfigPath (wchar_t *fileName);
|
||||
wchar_t GetSystemDriveLetter (void);
|
||||
void OpenPageHelp (HWND hwndDlg, int nPage);
|
||||
void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *text, BOOL warning);
|
||||
void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd);
|
||||
@@ -425,6 +420,7 @@ int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd);
|
||||
BOOL ConfigWriteBegin ();
|
||||
BOOL ConfigWriteEnd (HWND hwnd);
|
||||
BOOL ConfigWriteString (char *configKey, char *configValue);
|
||||
BOOL ConfigWriteStringW (char *configKey, wchar_t *configValue);
|
||||
BOOL ConfigWriteInt (char *configKey, int configValue);
|
||||
int ConfigReadInt (char *configKey, int defaultValue);
|
||||
char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen);
|
||||
@@ -442,20 +438,20 @@ BOOL IsHiddenOSRunning (void);
|
||||
BOOL EnableWow64FsRedirection (BOOL enable);
|
||||
BOOL RestartComputer (void);
|
||||
void Applink (char *dest, BOOL bSendOS, char *extraOutput);
|
||||
char *RelativePath2Absolute (char *szFileName);
|
||||
wchar_t *RelativePath2Absolute (wchar_t *szFileName);
|
||||
void HandleDriveNotReadyError (HWND hwnd);
|
||||
BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam);
|
||||
BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam);
|
||||
BYTE *MapResource (char *resourceType, int resourceId, PDWORD size);
|
||||
BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size);
|
||||
void InconsistencyResolved (char *msg);
|
||||
void ReportUnexpectedState (char *techInfo);
|
||||
BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, char *lpszFileName, size_t cbFileName, BOOL keepHistory);
|
||||
BOOL SelectMultipleFilesNext (char *lpszFileName, size_t cbFileName);
|
||||
BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileName, size_t cbFileName, BOOL keepHistory);
|
||||
BOOL SelectMultipleFilesNext (wchar_t *lpszFileName, size_t cbFileName);
|
||||
void OpenOnlineHelp ();
|
||||
BOOL GetPartitionInfo (const char *deviceName, PPARTITION_INFORMATION rpartInfo);
|
||||
BOOL GetDeviceInfo (const char *deviceName, DISK_PARTITION_INFO_STRUCT *info);
|
||||
BOOL GetDriveGeometry (const char *deviceName, PDISK_GEOMETRY diskGeometry);
|
||||
BOOL IsVolumeDeviceHosted (const char *lpszDiskFile);
|
||||
BOOL GetPartitionInfo (const wchar_t *deviceName, PPARTITION_INFORMATION rpartInfo);
|
||||
BOOL GetDeviceInfo (const wchar_t *deviceName, DISK_PARTITION_INFO_STRUCT *info);
|
||||
BOOL GetDriveGeometry (const wchar_t *deviceName, PDISK_GEOMETRY diskGeometry);
|
||||
BOOL IsVolumeDeviceHosted (const wchar_t *lpszDiskFile);
|
||||
int CompensateXDPI (int val);
|
||||
int CompensateYDPI (int val);
|
||||
int CompensateDPIFont (int val);
|
||||
@@ -470,7 +466,7 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h
|
||||
BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
|
||||
BOOL GetSysDevicePaths (HWND hwndDlg);
|
||||
BOOL DoDriverInstall (HWND hwndDlg);
|
||||
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
|
||||
int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
|
||||
void CloseVolume (OpenVolumeContext *context);
|
||||
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode);
|
||||
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
||||
@@ -479,20 +475,22 @@ BOOL DisablePagingFile ();
|
||||
BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL InitSecurityTokenLibrary (HWND hwndDlg);
|
||||
BOOL FileHasReadOnlyAttribute (const char *path);
|
||||
BOOL IsFileOnReadOnlyFilesystem (const char *path);
|
||||
BOOL FileHasReadOnlyAttribute (const wchar_t *path);
|
||||
BOOL IsFileOnReadOnlyFilesystem (const wchar_t *path);
|
||||
void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors);
|
||||
BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str);
|
||||
int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL* pbDecrypt);
|
||||
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, char *devicePath);
|
||||
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, wchar_t *devicePath);
|
||||
void EnableElevatedCursorChange (HWND parent);
|
||||
BOOL DisableFileCompression (HANDLE file);
|
||||
BOOL VolumePathExists (const char *volumePath);
|
||||
BOOL VolumePathExists (const wchar_t *volumePath);
|
||||
BOOL IsWindowsIsoBurnerAvailable ();
|
||||
BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath);
|
||||
BOOL IsApplicationInstalled (const char *appName);
|
||||
BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath);
|
||||
BOOL IsApplicationInstalled (const wchar_t *appName);
|
||||
int GetPim (HWND hwndDlg, UINT ctrlId);
|
||||
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
|
||||
BOOL GetPassword (HWND hwndDlg, UINT ctrlID, char* passValue, int bufSize, BOOL bShowError);
|
||||
void SetPassword (HWND hwndDlg, UINT ctrlID, char* passValue);
|
||||
void HandleShowPasswordFieldAction (HWND hwndDlg, UINT checkBoxId, UINT edit1Id, UINT edit2Id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -527,9 +525,9 @@ struct HostDevice
|
||||
bool IsPartition;
|
||||
bool IsVirtualPartition;
|
||||
bool HasUnencryptedFilesystem;
|
||||
std::string MountPoint;
|
||||
std::wstring MountPoint;
|
||||
std::wstring Name;
|
||||
std::string Path;
|
||||
std::wstring Path;
|
||||
bool Removable;
|
||||
uint64 Size;
|
||||
uint32 SystemNumber;
|
||||
@@ -540,10 +538,10 @@ struct HostDevice
|
||||
struct RawDevicesDlgParam
|
||||
{
|
||||
std::vector <HostDevice> devices;
|
||||
char *pszFileName;
|
||||
wchar_t *pszFileName;
|
||||
};
|
||||
|
||||
BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, char *initialDir, char *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName = NULL, const wchar_t *defaultExtension = NULL);
|
||||
BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, wchar_t *initialDir, wchar_t *lpszFileName, BOOL keepHistory, BOOL saveMode, wchar_t *browseFilter, const wchar_t *initialFileName = NULL, const wchar_t *defaultExtension = NULL);
|
||||
std::wstring SingleStringToWide (const std::string &singleString);
|
||||
std::wstring Utf8StringToWide (const std::string &utf8String);
|
||||
std::string WideToSingleString (const std::wstring &wideString);
|
||||
@@ -551,14 +549,15 @@ std::string WideToUtf8String (const std::wstring &wideString);
|
||||
std::string StringToUpperCase (const std::string &str);
|
||||
std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties = false, bool singleList = false, bool noFloppy = true, bool detectUnencryptedFilesystems = false);
|
||||
std::string ToUpperCase (const std::string &str);
|
||||
std::wstring ToUpperCase (const std::wstring &str);
|
||||
std::wstring GetWrongPasswordErrorMessage (HWND hwndDlg);
|
||||
std::string GetWindowsEdition ();
|
||||
std::string FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::string &path);
|
||||
std::string GetServiceConfigPath (const char *fileName, bool useLegacy);
|
||||
std::string VolumeGuidPathToDevicePath (std::string volumeGuidPath);
|
||||
std::string HarddiskVolumePathToPartitionPath (const std::string &harddiskVolumePath);
|
||||
std::string FindLatestFileOrDirectory (const std::string &directory, const char *namePattern, bool findDirectory, bool findFile);
|
||||
std::string GetUserFriendlyVersionString (int version);
|
||||
std::wstring GetWindowsEdition ();
|
||||
std::wstring FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::wstring &path);
|
||||
std::wstring GetServiceConfigPath (const wchar_t *fileName, bool useLegacy);
|
||||
std::wstring VolumeGuidPathToDevicePath (std::wstring volumeGuidPath);
|
||||
std::wstring HarddiskVolumePathToPartitionPath (const std::wstring &harddiskVolumePath);
|
||||
std::wstring FindLatestFileOrDirectory (const std::wstring &directory, const wchar_t *namePattern, bool findDirectory, bool findFile);
|
||||
std::wstring GetUserFriendlyVersionString (int version);
|
||||
std::string IntToString (int val);
|
||||
std::wstring IntToWideString (int val);
|
||||
inline std::wstring AppendSrcPos (const wchar_t* msg, const char* srcPos)
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace VeraCrypt
|
||||
void Show (HWND parent) const
|
||||
{
|
||||
string msgBody = "Parameter incorrect.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + string (SrcPos) + ")";
|
||||
MessageBox (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
const char *SrcPos;
|
||||
@@ -77,9 +77,9 @@ namespace VeraCrypt
|
||||
void Show (HWND parent) const
|
||||
{
|
||||
char szErrCode[16];
|
||||
StringCbPrintf (szErrCode, sizeof(szErrCode), "0x%.8X", LastError);
|
||||
StringCbPrintfA (szErrCode, sizeof(szErrCode), "0x%.8X", LastError);
|
||||
string msgBody = "The Random Generator initialization failed.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + string (SrcPos) + "\nLast Error = " + string (szErrCode) + ")";
|
||||
MessageBox (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
const char *SrcPos;
|
||||
@@ -93,9 +93,9 @@ namespace VeraCrypt
|
||||
void Show (HWND parent) const
|
||||
{
|
||||
char szErrCode[16];
|
||||
StringCbPrintf (szErrCode, sizeof(szErrCode), "0x%.8X", LastError);
|
||||
StringCbPrintfA (szErrCode, sizeof(szErrCode), "0x%.8X", LastError);
|
||||
string msgBody = "Windows Crypto API failed.\n\n\n(If you report a bug in connection with this, please include the following technical information in the bug report:\n" + string (SrcPos) + "\nLast Error = " + string (szErrCode) + ")";
|
||||
MessageBox (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
MessageBoxA (parent, msgBody.c_str(), "VeraCrypt", MB_ICONERROR | MB_SETFOREGROUND);
|
||||
}
|
||||
|
||||
const char *SrcPos;
|
||||
|
||||
@@ -92,8 +92,8 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
||||
FILETIME ftLastAccessTime;
|
||||
BOOL bTimeStampValid = FALSE;
|
||||
BOOL bInstantRetryOtherFilesys = FALSE;
|
||||
char dosDev[TC_MAX_PATH] = { 0 };
|
||||
char devName[MAX_PATH] = { 0 };
|
||||
WCHAR dosDev[TC_MAX_PATH] = { 0 };
|
||||
WCHAR devName[MAX_PATH] = { 0 };
|
||||
int driveLetter = -1;
|
||||
WCHAR deviceName[MAX_PATH];
|
||||
uint64 dataOffset, dataAreaSize;
|
||||
@@ -138,8 +138,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
||||
|
||||
if (volParams->bDevice)
|
||||
{
|
||||
StringCbCopyA ((char *)deviceName, sizeof(deviceName), volParams->volumePath);
|
||||
ToUNICODE ((char *)deviceName, sizeof(deviceName));
|
||||
StringCbCopyW (deviceName, sizeof(deviceName), volParams->volumePath);
|
||||
|
||||
driveLetter = GetDiskDeviceDriveLetter (deviceName);
|
||||
}
|
||||
@@ -213,9 +212,9 @@ begin_format:
|
||||
// to which no drive letter has been assigned under the system. This problem can be worked
|
||||
// around by assigning a drive letter to the partition temporarily.
|
||||
|
||||
char szDriveLetter[] = { 'A', ':', 0 };
|
||||
char rootPath[] = { 'A', ':', '\\', 0 };
|
||||
char uniqVolName[MAX_PATH+1] = { 0 };
|
||||
wchar_t szDriveLetter[] = { L'A', L':', 0 };
|
||||
wchar_t rootPath[] = { L'A', L':', L'\\', 0 };
|
||||
wchar_t uniqVolName[MAX_PATH+1] = { 0 };
|
||||
int tmpDriveLetter = -1;
|
||||
BOOL bResult = FALSE;
|
||||
|
||||
@@ -223,8 +222,8 @@ begin_format:
|
||||
|
||||
if (tmpDriveLetter != -1)
|
||||
{
|
||||
rootPath[0] += (char) tmpDriveLetter;
|
||||
szDriveLetter[0] += (char) tmpDriveLetter;
|
||||
rootPath[0] += (wchar_t) tmpDriveLetter;
|
||||
szDriveLetter[0] += (wchar_t) tmpDriveLetter;
|
||||
|
||||
if (DefineDosDevice (DDD_RAW_TARGET_PATH, szDriveLetter, volParams->volumePath))
|
||||
{
|
||||
@@ -863,25 +862,25 @@ BOOLEAN __stdcall FormatExCallback (int command, DWORD subCommand, PVOID paramet
|
||||
|
||||
BOOL FormatNtfs (int driveNo, int clusterSize)
|
||||
{
|
||||
char dllPath[MAX_PATH] = {0};
|
||||
WCHAR dir[8] = { (WCHAR) driveNo + 'A', 0 };
|
||||
wchar_t dllPath[MAX_PATH] = {0};
|
||||
WCHAR dir[8] = { (WCHAR) driveNo + L'A', 0 };
|
||||
PFORMATEX FormatEx;
|
||||
HMODULE hModule;
|
||||
int i;
|
||||
|
||||
if (GetSystemDirectory (dllPath, MAX_PATH))
|
||||
{
|
||||
StringCbCatA(dllPath, sizeof(dllPath), "\\fmifs.dll");
|
||||
StringCbCatW(dllPath, sizeof(dllPath), L"\\fmifs.dll");
|
||||
}
|
||||
else
|
||||
StringCbCopyA(dllPath, sizeof(dllPath), "C:\\Windows\\System32\\fmifs.dll");
|
||||
StringCbCopyW(dllPath, sizeof(dllPath), L"C:\\Windows\\System32\\fmifs.dll");
|
||||
|
||||
hModule = LoadLibrary (dllPath);
|
||||
|
||||
if (hModule == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!(FormatEx = (PFORMATEX) GetProcAddress (GetModuleHandle ("fmifs.dll"), "FormatEx")))
|
||||
if (!(FormatEx = (PFORMATEX) GetProcAddress (GetModuleHandle (L"fmifs.dll"), "FormatEx")))
|
||||
{
|
||||
FreeLibrary (hModule);
|
||||
return FALSE;
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct
|
||||
{
|
||||
BOOL bDevice;
|
||||
BOOL hiddenVol;
|
||||
char *volumePath;
|
||||
wchar_t *volumePath;
|
||||
unsigned __int64 size;
|
||||
unsigned __int64 hiddenVolHostSize;
|
||||
int ea;
|
||||
|
||||
@@ -112,7 +112,7 @@ KeyFile *KeyFileClone (KeyFile *keyFile)
|
||||
clone = (KeyFile *) malloc (sizeof (KeyFile));
|
||||
if (clone)
|
||||
{
|
||||
StringCbCopyA (clone->FileName, sizeof(clone->FileName), keyFile->FileName);
|
||||
StringCbCopyW (clone->FileName, sizeof(clone->FileName), keyFile->FileName);
|
||||
clone->Next = NULL;
|
||||
}
|
||||
return clone;
|
||||
@@ -170,7 +170,7 @@ static BOOL KeyFileProcess (unsigned __int8 *keyPool, KeyFile *keyFile)
|
||||
CloseHandle (finally_arg);
|
||||
});
|
||||
|
||||
f = fopen (keyFile->FileName, "rb");
|
||||
f = _wfopen (keyFile->FileName, L"rb");
|
||||
if (f == NULL) return FALSE;
|
||||
|
||||
while ((bytesRead = fread (buffer, 1, sizeof (buffer), f)) > 0)
|
||||
@@ -225,7 +225,7 @@ close:
|
||||
}
|
||||
|
||||
|
||||
BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, const char* volumeFileName)
|
||||
BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, const wchar_t* volumeFileName)
|
||||
{
|
||||
BOOL status = TRUE;
|
||||
KeyFile kfSubStruct;
|
||||
@@ -234,8 +234,8 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
static unsigned __int8 keyPool [KEYFILE_POOL_SIZE];
|
||||
size_t i;
|
||||
struct stat statStruct;
|
||||
char searchPath [TC_MAX_PATH*2];
|
||||
struct _finddata_t fBuf;
|
||||
wchar_t searchPath [TC_MAX_PATH*2];
|
||||
struct _wfinddata_t fBuf;
|
||||
intptr_t searchHandle;
|
||||
|
||||
HiddenFilesPresentInKeyfilePath = FALSE;
|
||||
@@ -250,11 +250,12 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
// Determine whether it's a security token path
|
||||
try
|
||||
{
|
||||
if (SecurityToken::IsKeyfilePathValid (SingleStringToWide (kf->FileName)))
|
||||
if (SecurityToken::IsKeyfilePathValid (kf->FileName))
|
||||
{
|
||||
// Apply security token keyfile
|
||||
vector <byte> keyfileData;
|
||||
SecurityToken::GetKeyfileData (SecurityTokenKeyfile (SingleStringToWide (kf->FileName)), keyfileData);
|
||||
SecurityTokenKeyfilePath secPath (kf->FileName);
|
||||
SecurityToken::GetKeyfileData (SecurityTokenKeyfile (secPath), keyfileData);
|
||||
|
||||
if (keyfileData.empty())
|
||||
{
|
||||
@@ -296,7 +297,7 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
}
|
||||
|
||||
// Determine whether it's a path or a file
|
||||
if (stat (kf->FileName, &statStruct) != 0)
|
||||
if (_wstat (kf->FileName, &statStruct) != 0)
|
||||
{
|
||||
handleWin32Error (hwndDlg, SRC_POS);
|
||||
Error ("ERR_PROCESS_KEYFILE", hwndDlg);
|
||||
@@ -309,8 +310,8 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
/* Find and process all keyfiles in the directory */
|
||||
int keyfileCount = 0;
|
||||
|
||||
StringCbPrintfA (searchPath, sizeof (searchPath), "%s\\*.*", kf->FileName);
|
||||
if ((searchHandle = _findfirst (searchPath, &fBuf)) == -1)
|
||||
StringCbPrintfW (searchPath, sizeof (searchPath), L"%s\\*.*", kf->FileName);
|
||||
if ((searchHandle = _wfindfirst (searchPath, &fBuf)) == -1)
|
||||
{
|
||||
handleWin32Error (hwndDlg, SRC_POS);
|
||||
Error ("ERR_PROCESS_KEYFILE_PATH", hwndDlg);
|
||||
@@ -322,13 +323,13 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
{
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileAttributes;
|
||||
|
||||
StringCbPrintfA (kfSub->FileName, sizeof(kfSub->FileName), "%s%c%s", kf->FileName,
|
||||
'\\',
|
||||
StringCbPrintfW (kfSub->FileName, sizeof(kfSub->FileName), L"%s%c%s", kf->FileName,
|
||||
L'\\',
|
||||
fBuf.name
|
||||
);
|
||||
|
||||
// Determine whether it's a path or a file
|
||||
if (stat (kfSub->FileName, &statStruct) != 0)
|
||||
if (_wstat (kfSub->FileName, &statStruct) != 0)
|
||||
{
|
||||
handleWin32Error (hwndDlg, SRC_POS);
|
||||
Error ("ERR_PROCESS_KEYFILE", hwndDlg);
|
||||
@@ -342,7 +343,7 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
}
|
||||
|
||||
// Skip hidden files
|
||||
if (GetFileAttributesEx (kfSub->FileName, GetFileExInfoStandard, &fileAttributes)
|
||||
if (GetFileAttributesExW (kfSub->FileName, GetFileExInfoStandard, &fileAttributes)
|
||||
&& (fileAttributes.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)
|
||||
{
|
||||
HiddenFilesPresentInKeyfilePath = TRUE;
|
||||
@@ -350,7 +351,7 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
}
|
||||
|
||||
CorrectFileName (kfSub->FileName);
|
||||
if (volumeFileName && (_stricmp (volumeFileName, kfSub->FileName) == 0))
|
||||
if (volumeFileName && (_wcsicmp (volumeFileName, kfSub->FileName) == 0))
|
||||
{
|
||||
// skip if it is the current container file name
|
||||
continue;
|
||||
@@ -366,14 +367,14 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
|
||||
status = FALSE;
|
||||
}
|
||||
|
||||
} while (_findnext (searchHandle, &fBuf) != -1);
|
||||
} while (_wfindnext (searchHandle, &fBuf) != -1);
|
||||
_findclose (searchHandle);
|
||||
|
||||
burn (&kfSubStruct, sizeof (kfSubStruct));
|
||||
|
||||
if (keyfileCount == 0)
|
||||
{
|
||||
ErrorDirect ((wstring (GetString ("ERR_KEYFILE_PATH_EMPTY")) + L"\n\n" + SingleStringToWide (kf->FileName)).c_str(), hwndDlg);
|
||||
ErrorDirect ((wstring (GetString ("ERR_KEYFILE_PATH_EMPTY")) + L"\n\n" + wstring (kf->FileName)).c_str(), hwndDlg);
|
||||
status = FALSE;
|
||||
}
|
||||
}
|
||||
@@ -499,7 +500,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
||||
do
|
||||
{
|
||||
CorrectFileName (kf->FileName);
|
||||
if (_stricmp (param->VolumeFileName, kf->FileName) == 0)
|
||||
if (_wcsicmp (param->VolumeFileName, kf->FileName) == 0)
|
||||
containerFileSkipped = true;
|
||||
else
|
||||
{
|
||||
@@ -547,7 +548,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
||||
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
|
||||
if (kf)
|
||||
{
|
||||
strcpy_s (kf->FileName, sizeof (kf->FileName), WideToSingleString (keyPath).c_str());
|
||||
StringCbCopyW (kf->FileName, sizeof (kf->FileName), wstring(keyPath).c_str ());
|
||||
|
||||
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
|
||||
LoadKeyList (hwndDlg, param->FirstKeyFile);
|
||||
@@ -741,7 +742,7 @@ BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *par
|
||||
KeyFile *kf = (KeyFile *) malloc (sizeof (KeyFile));
|
||||
if (kf)
|
||||
{
|
||||
strcpy_s (kf->FileName, sizeof (kf->FileName), WideToSingleString (keyPath).c_str());
|
||||
StringCbCopyW (kf->FileName, sizeof (kf->FileName), wstring (keyPath).c_str());
|
||||
|
||||
param->FirstKeyFile = KeyFileAdd (param->FirstKeyFile, kf);
|
||||
param->EnableKeyFiles = TRUE;
|
||||
|
||||
@@ -24,13 +24,13 @@ extern "C" {
|
||||
|
||||
typedef struct KeyFileStruct
|
||||
{
|
||||
char FileName[MAX_PATH + 1];
|
||||
wchar_t FileName[MAX_PATH + 1];
|
||||
struct KeyFileStruct *Next;
|
||||
} KeyFile;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char VolumeFileName[MAX_PATH + 1];
|
||||
wchar_t VolumeFileName[MAX_PATH + 1];
|
||||
BOOL EnableKeyFiles;
|
||||
KeyFile *FirstKeyFile;
|
||||
} KeyFilesDlgParam;
|
||||
@@ -39,7 +39,7 @@ KeyFile *KeyFileAdd (KeyFile *firstKeyFile, KeyFile *keyFile);
|
||||
void KeyFileRemoveAll (KeyFile **firstKeyFile);
|
||||
KeyFile *KeyFileClone (KeyFile *keyFile);
|
||||
KeyFile *KeyFileCloneAll (KeyFile *firstKeyFile);
|
||||
BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFilem, const char* volumeFileName);
|
||||
BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFilem, const wchar_t* volumeFileName);
|
||||
|
||||
BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL KeyfilesPopupMenu (HWND hwndDlg, POINT popupPosition, KeyFilesDlgParam *dialogParam);
|
||||
|
||||
@@ -62,7 +62,7 @@ static char *MapFirstLanguageFile ()
|
||||
if (LanguageResource == NULL)
|
||||
{
|
||||
DWORD size;
|
||||
LanguageResource = MapResource ("Xml", IDR_LANGUAGE, &size);
|
||||
LanguageResource = MapResource (L"Xml", IDR_LANGUAGE, &size);
|
||||
if (LanguageResource)
|
||||
LanguageResourceSize = size;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ BOOL LoadLanguageFile ()
|
||||
case 't': *out++ = '\t'; break;
|
||||
case 'n': *out++ = 13; *out++ = 10; break;
|
||||
default:
|
||||
MessageBox (0, key, "VeraCrypt: Unknown '\\' escape sequence in string", MB_ICONERROR);
|
||||
MessageBoxA (0, key, "VeraCrypt: Unknown '\\' escape sequence in string", MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ BOOL LoadLanguageFile ()
|
||||
len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0]));
|
||||
if (len == 0)
|
||||
{
|
||||
MessageBox (0, key, "VeraCrypt: Error while decoding UTF-8 string", MB_ICONERROR);
|
||||
MessageBoxA (0, key, "VeraCrypt: Error while decoding UTF-8 string", MB_ICONERROR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ BOOL LoadLanguageFile ()
|
||||
{
|
||||
if (HeaderResource[i] == NULL)
|
||||
{
|
||||
HeaderResource[i] = MapResource ("Header", headers[i], &size);
|
||||
HeaderResource[i] = MapResource (L"Header", headers[i], &size);
|
||||
if (HeaderResource[i])
|
||||
HeaderResourceSize[i] = size;
|
||||
}
|
||||
|
||||
@@ -416,13 +416,13 @@
|
||||
<string lang="en" key="CIPHER_TITLE">Encryption Options</string>
|
||||
<string lang="en" key="CLEAN_WINMRU_FAILED">WARNING: Failed to clear the path of the last selected volume/keyfile (remembered by file selector)!</string>
|
||||
<string lang="en" key="COMPRESSION_NOT_SUPPORTED">Error: The container has been compressed at the filesystem level. VeraCrypt does not support compressed containers (note that compression of encrypted data is ineffective and redundant).\n\nPlease disable compression for the container by following these steps:\n1) Right-click the container in Windows Explorer (not in VeraCrypt).\n2) Select 'Properties'.\n3) In the 'Properties' dialog box, click 'Advanced'.\n4) In the 'Advanced Attributes' dialog box, disable the option 'Compress contents to save disk space' and click 'OK'.\n5) In the 'Properties' dialog box, click 'OK'.</string>
|
||||
<string lang="en" key="CREATE_FAILED">Failed to create volume %hs</string>
|
||||
<string lang="en" key="DEVICE_FREE_BYTES">Size of %hs is %.2f bytes</string>
|
||||
<string lang="en" key="DEVICE_FREE_KB">Size of %hs is %.2f KB</string>
|
||||
<string lang="en" key="DEVICE_FREE_MB">Size of %hs is %.2f MB</string>
|
||||
<string lang="en" key="DEVICE_FREE_GB">Size of %hs is %.2f GB</string>
|
||||
<string lang="en" key="DEVICE_FREE_TB">Size of %hs is %.2f TB</string>
|
||||
<string lang="en" key="DEVICE_FREE_PB">Size of %hs is %.2f PB</string>
|
||||
<string lang="en" key="CREATE_FAILED">Failed to create volume %s</string>
|
||||
<string lang="en" key="DEVICE_FREE_BYTES">Size of %s is %.2f bytes</string>
|
||||
<string lang="en" key="DEVICE_FREE_KB">Size of %s is %.2f KB</string>
|
||||
<string lang="en" key="DEVICE_FREE_MB">Size of %s is %.2f MB</string>
|
||||
<string lang="en" key="DEVICE_FREE_GB">Size of %s is %.2f GB</string>
|
||||
<string lang="en" key="DEVICE_FREE_TB">Size of %s is %.2f TB</string>
|
||||
<string lang="en" key="DEVICE_FREE_PB">Size of %s is %.2f PB</string>
|
||||
<string lang="en" key="DEVICE_IN_USE_FORMAT">WARNING: The device/partition is in use by the operating system or applications. Formatting the device/partition might cause data corruption and system instability.\n\nContinue?</string>
|
||||
<string lang="en" key="DEVICE_IN_USE_INPLACE_ENC">Warning: The partition is in use by the operating system or applications. You should close any applications that might be using the partition (including antivirus software).\n\nContinue?</string>
|
||||
<string lang="en" key="FORMAT_CANT_DISMOUNT_FILESYS">Error: The device/partition contains a file system that could not be dismounted. The file system may be in use by the operating system. Formatting the device/partition would very likely cause data corruption and system instability.\n\nTo solve this issue, we recommend that you first delete the partition and then recreate it without formatting. To do so, follow these steps:\n1) Right-click the 'Computer' (or 'My Computer') icon in the 'Start Menu' and select 'Manage'. The 'Computer Management' window should appear.\n2) In the 'Computer Management' window, select 'Storage' > 'Disk Management'.\n3) Right-click the partition you want to encrypt and select either 'Delete Partition', or 'Delete Volume', or 'Delete Logical Drive'.\n4) Click 'Yes'. If Windows asks you to restart the computer, do so. Then repeat the steps 1 and 2 and continue from the step 5.\n5) Right-click the unallocated/free space area and select either 'New Partition', or 'New Simple Volume', or 'New Logical Drive'.\n6) The 'New Partition Wizard' or 'New Simple Volume Wizard' window should appear now; follow its instructions. On the wizard page entitled 'Format Partition', select either 'Do not format this partition' or 'Do not format this volume'. In the same wizard, click 'Next' and then 'Finish'.\n7) Note that the device path you have selected in VeraCrypt may be wrong now. Therefore, exit the VeraCrypt Volume Creation Wizard (if it is still running) and then start it again.\n8) Try encrypting the device/partition again.\n\nIf VeraCrypt repeatedly fails to encrypt the device/partition, you may want to consider creating a file container instead.</string>
|
||||
@@ -441,12 +441,12 @@
|
||||
<string lang="en" key="INPLACE_ENC_INVALID_PATH">Error: VeraCrypt can in-place encrypt only a partition, a dynamic volume, or an entire system drive. Please make sure the specified path is valid.</string>
|
||||
<string lang="en" key="CANNOT_RESIZE_FILESYS">Error: Cannot shrink the filesystem (the filesystem needs to be shrunk to make space for the volume header and backup header).\n\nPossible causes and solutions:\n\n- Not enough free space on the volume. Please make sure no other application is writing to the filesystem.\n\n- Corrupted file system. Try to check it and fix any errors (right-click the corresponding drive letter in the 'Computer' list, then select Properties > Tools > 'Check Now', make sure the option 'Automatically fix file system errors' is enabled and click Start).\n\nIf the above steps do not help, please follow the below steps.</string>
|
||||
<string lang="en" key="NOT_ENOUGH_FREE_FILESYS_SPACE_FOR_SHRINK">Error: There is not enough free space on the volume and so the filesystem cannot be shrunk (the filesystem needs to be shrunk to make space for the volume header and backup header).\n\nPlease delete any redundant files and empty the Recycle Bin so as to free at least 256 KB of space and then try again. Note that due to a Windows issue, the amount of free space reported by the Windows Explorer may be incorrect until the operating system is restarted. If restarting the system does not help, the file system may be corrupted. Try to check it and fix any errors (right-click the corresponding drive letter in the 'Computer' list, then select Properties > Tools > 'Check Now', make sure the option 'Automatically fix file system errors' is enabled and click Start).\n\nIf the above steps do not help, please follow the below steps.</string>
|
||||
<string lang="en" key="DISK_FREE_BYTES">Free space on drive %hs is %.2f bytes.</string>
|
||||
<string lang="en" key="DISK_FREE_KB">Free space on drive %hs is %.2f KB</string>
|
||||
<string lang="en" key="DISK_FREE_MB">Free space on drive %hs is %.2f MB</string>
|
||||
<string lang="en" key="DISK_FREE_GB">Free space on drive %hs is %.2f GB</string>
|
||||
<string lang="en" key="DISK_FREE_TB">Free space on drive %hs is %.2f TB</string>
|
||||
<string lang="en" key="DISK_FREE_PB">Free space on drive %hs is %.2f PB</string>
|
||||
<string lang="en" key="DISK_FREE_BYTES">Free space on drive %s is %.2f bytes.</string>
|
||||
<string lang="en" key="DISK_FREE_KB">Free space on drive %s is %.2f KB</string>
|
||||
<string lang="en" key="DISK_FREE_MB">Free space on drive %s is %.2f MB</string>
|
||||
<string lang="en" key="DISK_FREE_GB">Free space on drive %s is %.2f GB</string>
|
||||
<string lang="en" key="DISK_FREE_TB">Free space on drive %s is %.2f TB</string>
|
||||
<string lang="en" key="DISK_FREE_PB">Free space on drive %s is %.2f PB</string>
|
||||
<string lang="en" key="DRIVELETTERS">Could not get available drive letters.</string>
|
||||
<string lang="en" key="DRIVER_NOT_FOUND">Error: VeraCrypt driver not found.\n\nPlease copy the files 'veracrypt.sys' and 'veracrypt-x64.sys' to the directory where the main VeraCrypt application (VeraCrypt.exe) is located.</string>
|
||||
<string lang="en" key="DRIVER_VERSION">Error: An incompatible version of the VeraCrypt driver is currently running.\n\nIf you are trying to run VeraCrypt in portable mode (i.e. without installing it) and a different version of VeraCrypt is already installed, you must uninstall it first (or upgrade it using the VeraCrypt installer). To uninstall it, follow these steps: On Windows Vista or later, select 'Start Menu' > Computer > 'Uninstall or change a program' > VeraCrypt > Uninstall; on Windows XP, select 'Start Menu' > Settings > 'Control Panel' > 'Add Or Remove Programs' > VeraCrypt > Remove.\n\nSimilarly, if you are trying to run VeraCrypt in portable mode (i.e. without installing it) and a different version of VeraCrypt is already running in portable mode, you must restart the system first and then run only this new version.</string>
|
||||
@@ -598,12 +598,12 @@
|
||||
<string lang="en" key="SELECT_PKCS11_MODULE">Select PKCS #11 Library</string>
|
||||
<string lang="en" key="OUTOFMEMORY">Out of Memory</string>
|
||||
<string lang="en" key="FORMAT_DEVICE_FOR_ADVANCED_ONLY">IMPORTANT: We strongly recommend that inexperienced users create a VeraCrypt file container on the selected device/partition, instead of attempting to encrypt the entire device/partition.\n\nWhen you create a VeraCrypt file container (as opposed to encrypting a device or partition) there is, for example, no risk of destroying a large number of files. Note that a VeraCrypt file container (even though it contains a virtual encrypted disk) is actually just like any normal file. For more information, see the chapter Beginner's Tutorial in the VeraCrypt User Guide.\n\nAre you sure you want to encrypt the entire device/partition?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT">WARNING: The file '%hs' already exists!\n\nIMPORTANT: VERACRYPT WILL NOT ENCRYPT THE FILE, BUT IT WILL DELETE IT. Are you sure you want to delete the file and replace it with a new VeraCrypt container?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT_DEVICE">CAUTION: ALL FILES CURRENTLY STORED ON THE SELECTED %s '%hs'%s WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</string>
|
||||
<string lang="en" key="NONSYS_INPLACE_ENC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully encrypted.\n\nAre you sure you want to start encrypting the selected %s '%hs'%s?</string>
|
||||
<string lang="en" key="NONSYS_INPLACE_DEC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully decrypted.\n\nAre you sure you want to start decrypting the selected %s '%hs'%s?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT">WARNING: The file '%s' already exists!\n\nIMPORTANT: VERACRYPT WILL NOT ENCRYPT THE FILE, BUT IT WILL DELETE IT. Are you sure you want to delete the file and replace it with a new VeraCrypt container?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT_DEVICE">CAUTION: ALL FILES CURRENTLY STORED ON THE SELECTED %s '%s'%s WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</string>
|
||||
<string lang="en" key="NONSYS_INPLACE_ENC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully encrypted.\n\nAre you sure you want to start encrypting the selected %s '%s'%s?</string>
|
||||
<string lang="en" key="NONSYS_INPLACE_DEC_CONFIRM">WARNING: You will not be able to mount the volume or access any files stored on it until it has been fully decrypted.\n\nAre you sure you want to start decrypting the selected %s '%s'%s?</string>
|
||||
<string lang="en" key="NONSYS_INPLACE_ENC_CONFIRM_BACKUP">WARNING: Please note that if power supply is suddenly interrupted while encrypting/decrypting existing data in place, or when the operating system crashes due to a software error or hardware malfunction while VeraCrypt is encrypting/decrypting existing data in place, portions of the data will be corrupted or lost. Therefore, before you start encrypting/decrypting, please make sure that you have backup copies of the files you want to encrypt/decrypt.\n\nDo you have such a backup?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT_DEVICE_HIDDEN_OS_PARTITION">CAUTION: ANY FILES CURRENTLY STORED ON THE PARTITION '%hs'%s (I.E. ON THE FIRST PARTITION BEHIND THE SYSTEM PARTITION) WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT_DEVICE_HIDDEN_OS_PARTITION">CAUTION: ANY FILES CURRENTLY STORED ON THE PARTITION '%s'%s (I.E. ON THE FIRST PARTITION BEHIND THE SYSTEM PARTITION) WILL BE ERASED AND LOST (THEY WILL NOT BE ENCRYPTED)!\n\nAre you sure you want to proceed with format?</string>
|
||||
<string lang="en" key="OVERWRITEPROMPT_DEVICE_SECOND_WARNING_LOTS_OF_DATA">WARNING: THE SELECTED PARTITION CONTAINS A LARGE AMOUNT OF DATA! Any files stored on the partition will be erased and lost (they will NOT be encrypted)!</string>
|
||||
<string lang="en" key="ERASE_FILES_BY_CREATING_VOLUME">Erase any files stored on the partition by creating a VeraCrypt volume within it</string>
|
||||
<string lang="en" key="PASSWORD">Password</string>
|
||||
@@ -641,6 +641,8 @@
|
||||
<string lang="en" key="PASSWORD_WRONG_AUTOMOUNT">Auto-mount failed due to one or more of the following:\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found.</string>
|
||||
<string lang="en" key="PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT">Auto-mount failed due to one or more of the following:\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found.</string>
|
||||
<string lang="en" key="PASSWORD_WRONG_CAPSLOCK_ON">\n\nWarning: Caps Lock is on. This may cause you to enter your password incorrectly.</string>
|
||||
<string lang="en" key="PASSWORD_UTF8_TOO_LONG">The entered password is too long: its UTF-8 representation exceeds 64 bytes.</string>
|
||||
<string lang="en" key="PASSWORD_UTF8_INVALID">The entered password contains Unicode characters that couldn't be converted to UTF-8 representation.</string>
|
||||
<string lang="en" key="PIM_CHANGE_WARNING">Remember Number to Mount Volume</string>
|
||||
<string lang="en" key="PIM_HIDVOL_HOST_TITLE">Outer Volume PIM</string>
|
||||
<string lang="en" key="PIM_HIDVOL_TITLE">Hidden Volume PIM</string>
|
||||
@@ -663,7 +665,7 @@
|
||||
<string lang="en" key="CANT_DECRYPT_PARTITION_ON_ENTIRELY_ENCRYPTED_SYS_DRIVE_UNSURE">Warning: As the drive contains the VeraCrypt Boot Loader, it may be an entirely encrypted system drive. If it is, please note that VeraCrypt cannot decrypt an individual partition on an entirely encrypted system drive (you can decrypt only the entire system drive). If that is the case, you will be able to continue now but you will receive the 'Incorrect password' error message later.</string>
|
||||
<string lang="en" key="PREV">< &Back</string>
|
||||
<string lang="en" key="RAWDEVICES">Unable to list raw devices installed on your system!</string>
|
||||
<string lang="en" key="READONLYPROMPT">The volume '%hs' exists, and is read-only. Are you sure you want to replace it?</string>
|
||||
<string lang="en" key="READONLYPROMPT">The volume '%s' exists, and is read-only. Are you sure you want to replace it?</string>
|
||||
<string lang="en" key="SELECT_DEST_DIR">Select destination directory</string>
|
||||
<string lang="en" key="SELECT_KEYFILE">Select Keyfile</string>
|
||||
<string lang="en" key="SELECT_KEYFILE_PATH">Select a keyfile search path. WARNING: Note that only the path will be remembered, not the filenames!</string>
|
||||
@@ -687,13 +689,13 @@
|
||||
<string lang="en" key="TEST_CIPHERTEXT_SIZE">The test ciphertext you have supplied is too long or short.</string>
|
||||
<string lang="en" key="TEST_KEY_SIZE">The test key you have supplied is too long or short.</string>
|
||||
<string lang="en" key="TEST_PLAINTEXT_SIZE">The test plaintext you have supplied is too long or short.</string>
|
||||
<string lang="en" key="TWO_LAYER_CASCADE_HELP">Two ciphers in a cascade operating in XTS mode. Each block is first encrypted with %hs (%d-bit key) and then with %hs (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</string>
|
||||
<string lang="en" key="THREE_LAYER_CASCADE_HELP">Three ciphers in a cascade operating in XTS mode. Each block is first encrypted with %hs (%d-bit key), then with %hs (%d-bit key), and finally with %hs (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</string>
|
||||
<string lang="en" key="TWO_LAYER_CASCADE_HELP">Two ciphers in a cascade operating in XTS mode. Each block is first encrypted with %s (%d-bit key) and then with %s (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</string>
|
||||
<string lang="en" key="THREE_LAYER_CASCADE_HELP">Three ciphers in a cascade operating in XTS mode. Each block is first encrypted with %s (%d-bit key), then with %s (%d-bit key), and finally with %s (%d-bit key). Each cipher uses its own key. All keys are mutually independent.</string>
|
||||
<string lang="en" key="AUTORUN_MAY_NOT_ALWAYS_WORK">Note that, depending on the operating system configuration, these auto-run and auto-mount features may work only when the traveler disk files are created on a non-writable CD/DVD-like medium. Also note that this is not a bug in VeraCrypt (it is a limitation of Windows).</string>
|
||||
<string lang="en" key="TRAVELER_DISK_CREATED">VeraCrypt traveler disk has been successfully created.\n\nNote that you need administrator privileges to run VeraCrypt in portable mode. Also note that, after examining the registry file, it may be possible to tell that VeraCrypt was run on a Windows system even if it is run in portable mode.</string>
|
||||
<string lang="en" key="TC_TRAVELER_DISK">VeraCrypt Traveler Disk</string>
|
||||
<string lang="en" key="TWOFISH_HELP">Designed by Bruce Schneier, John Kelsey, Doug Whiting, David Wagner, Chris Hall, and Niels Ferguson. Published in 1998. 256-bit key, 128-bit block. Mode of operation is XTS. Twofish was one of the AES finalists.</string>
|
||||
<string lang="en" key="MORE_INFO_ABOUT">More information on %hs</string>
|
||||
<string lang="en" key="MORE_INFO_ABOUT">More information on %s</string>
|
||||
<string lang="en" key="UNKNOWN">Unknown</string>
|
||||
<string lang="en" key="ERR_UNKNOWN">An unspecified or unknown error occurred (%d).</string>
|
||||
<string lang="en" key="UNMOUNTALL_LOCK_FAILED">Some volumes contain files or folders being used by applications or system.\n\nForce dismount?</string>
|
||||
@@ -858,7 +860,7 @@
|
||||
<string lang="en" key="INSTALL_FAILED">Installation failed.</string>
|
||||
<string lang="en" key="UNINSTALL_FAILED">Uninstallation failed.</string>
|
||||
<string lang="en" key="DIST_PACKAGE_CORRUPTED">This distribution package is damaged. Please try downloading it again (preferably from the official VeraCrypt website at https://veracrypt.codeplex.com).</string>
|
||||
<string lang="en" key="CANNOT_WRITE_FILE_X">Cannot write file %hs</string>
|
||||
<string lang="en" key="CANNOT_WRITE_FILE_X">Cannot write file %s</string>
|
||||
<string lang="en" key="EXTRACTING_VERB">Extracting</string>
|
||||
<string lang="en" key="CANNOT_READ_FROM_PACKAGE">Cannot read data from the package.</string>
|
||||
<string lang="en" key="CANT_VERIFY_PACKAGE_INTEGRITY">Cannot verify the integrity of this distribution package.</string>
|
||||
@@ -868,7 +870,7 @@
|
||||
<string lang="en" key="SETUP_UPDATE_OK">VeraCrypt has been successfully updated.</string>
|
||||
<string lang="en" key="UPGRADE_OK_REBOOT_REQUIRED">VeraCrypt has been successfully upgraded. However, before you can start using it, the computer must be restarted.\n\nDo you want to restart it now?</string>
|
||||
<string lang="en" key="SYS_ENC_UPGRADE_FAILED">Failed to upgrade VeraCrypt!\n\nIMPORTANT: Before you shut down or restart the system, we strongly recommend that you use System Restore (Windows Start menu > All programs > Accessories > System Tools > System Restore) to restore your system to the restore point named 'VeraCrypt installation'. If System Restore is not available, you should try installing the original or the new version of VeraCrypt again before you shut down or restart the system.</string>
|
||||
<string lang="en" key="UNINSTALL_OK">VeraCrypt has been successfully uninstalled.\n\nClick 'Finish' to remove the VeraCrypt installer and the folder %hs. Note that the folder will not be removed if it contains any files that were not installed by the VeraCrypt installer or created by VeraCrypt.</string>
|
||||
<string lang="en" key="UNINSTALL_OK">VeraCrypt has been successfully uninstalled.\n\nClick 'Finish' to remove the VeraCrypt installer and the folder %s. Note that the folder will not be removed if it contains any files that were not installed by the VeraCrypt installer or created by VeraCrypt.</string>
|
||||
<string lang="en" key="REMOVING_REG">Removing VeraCrypt registry entries</string>
|
||||
<string lang="en" key="ADDING_REG">Adding registry entry</string>
|
||||
<string lang="en" key="REMOVING_APPDATA">Removing application-specific data</string>
|
||||
@@ -879,10 +881,10 @@
|
||||
<string lang="en" key="CREATING_SYS_RESTORE">Creating System Restore point</string>
|
||||
<string lang="en" key="FAILED_SYS_RESTORE">Failed to create System Restore point!</string>
|
||||
<string lang="en" key="INSTALLER_UPDATING_BOOT_LOADER">Updating boot loader</string>
|
||||
<string lang="en" key="INSTALL_OF_FAILED">Failed to install '%hs'. %hs\nDo you want to continue installing?</string>
|
||||
<string lang="en" key="UNINSTALL_OF_FAILED">Failed to uninstall '%hs'. %hs\nDo you want to continue uninstalling?</string>
|
||||
<string lang="en" key="INSTALL_OF_FAILED">Failed to install '%s'. %s\nDo you want to continue installing?</string>
|
||||
<string lang="en" key="UNINSTALL_OF_FAILED">Failed to uninstall '%s'. %s\nDo you want to continue uninstalling?</string>
|
||||
<string lang="en" key="INSTALL_COMPLETED">Installation completed.</string>
|
||||
<string lang="en" key="CANT_CREATE_FOLDER">The folder '%hs' could not be created</string>
|
||||
<string lang="en" key="CANT_CREATE_FOLDER">The folder '%s' could not be created</string>
|
||||
<string lang="en" key="CLOSE_TC_FIRST">The VeraCrypt device driver cannot be unloaded.\n\nPlease close all open VeraCrypt windows first. If it does not help, please restart Windows and then try again.</string>
|
||||
<string lang="en" key="DISMOUNT_ALL_FIRST">All VeraCrypt volumes must be dismounted before installing or uninstalling VeraCrypt.</string>
|
||||
<string lang="en" key="UNINSTALL_OLD_VERSION_FIRST">An obsolete version of VeraCrypt is currently installed on this system. It needs to be uninstalled before you can install this new version of VeraCrypt.\n\nAs soon as you close this message box, the uninstaller of the old version will be launched. Note that no volume will be decrypted when you uninstall VeraCrypt. After you uninstall the old version of VeraCrypt, run the installer of the new version of VeraCrypt again.</string>
|
||||
@@ -935,7 +937,7 @@
|
||||
<string lang="en" key="FAVORITE_LABEL_DEVICE_PATH_ERR">The device displayed below is neither a partition nor a dynamic volume. Therefore, no label can be assigned to it.</string>
|
||||
<string lang="en" key="FAVORITE_LABEL_PARTITION_TYPE_ERR">Please set the type of the partition displayed below to a type recognized by Windows (use the SETID command of the Windows 'diskpart' tool). Then remove the partition from favorites and add it again. This will enable VeraCrypt to assign a label to the partition.</string>
|
||||
<string lang="en" key="SYSTEM_FAVORITE_NETWORK_PATH_ERR">Due to a Windows limitation, a container stored in a remote filesystem shared over a network cannot be mounted as a system favorite volume (however, it can be mounted as a non-system favorite volume when a user logs on).</string>
|
||||
<string lang="en" key="ENTER_PASSWORD_FOR">Enter password for %hs</string>
|
||||
<string lang="en" key="ENTER_PASSWORD_FOR">Enter password for %s</string>
|
||||
<string lang="en" key="ENTER_PASSWORD_FOR_LABEL">Enter password for '%s'</string>
|
||||
<string lang="en" key="ENTER_NORMAL_VOL_PASSWORD">Enter password for the normal/outer volume</string>
|
||||
<string lang="en" key="ENTER_HIDDEN_VOL_PASSWORD">Enter password for the hidden volume</string>
|
||||
@@ -950,8 +952,8 @@
|
||||
<string lang="en" key="VOL_HEADER_BACKED_UP">Volume header backup has been successfully created.\n\nIMPORTANT: Restoring the volume header using this backup will also restore the current volume password. Moreover, if keyfile(s) are/is necessary to mount the volume, the same keyfile(s) will be necessary to mount the volume again when the volume header is restored.\n\nWARNING: This volume header backup may be used to restore the header ONLY of this particular volume. If you use this header backup to restore a header of a different volume, you will be able to mount the volume, but you will NOT be able to decrypt any data stored in the volume (because you will change its master key).</string>
|
||||
<string lang="en" key="VOL_HEADER_RESTORED">The volume header has been successfully restored.\n\nIMPORTANT: Please note that an old password may have been restored as well. Moreover, if keyfile(s) were/was necessary to mount the volume when the backup was created, the same keyfile(s) are now necessary to mount the volume again.</string>
|
||||
<string lang="en" key="EXTERNAL_VOL_HEADER_BAK_FIRST_INFO">For security reasons, you will have to enter the correct password (and/or supply the correct keyfiles) for the volume.\n\nNote: If the volume contains a hidden volume, you will have to enter the correct password (and/or supply the correct keyfiles) for the outer volume first. Afterwards, if you choose to back up the header of the hidden volume, you will have to enter the correct password (and/or supply the correct keyfiles) for the hidden volume.</string>
|
||||
<string lang="en" key="CONFIRM_VOL_HEADER_BAK">Are you sure you want to create volume header backup for %hs?\n\nAfter you click Yes, you will prompted for a filename for the header backup.\n\nNote: Both the standard and the hidden volume headers will be re-encrypted using a new salt and stored in the backup file. If there is no hidden volume within this volume, the area reserved for the hidden volume header in the backup file will be filled with random data (to preserve plausible deniability). When restoring a volume header from the backup file, you will need to enter the correct password (and/or to supply the correct keyfiles) that was/were valid when the volume header backup was created. The password (and/or keyfiles) will also automatically determine the type of the volume header to restore, i.e. standard or hidden (note that VeraCrypt determines the type through the process of trial and error).</string>
|
||||
<string lang="en" key="CONFIRM_VOL_HEADER_RESTORE">Are you sure you want to restore volume header of %hs?\n\nWARNING: Restoring a volume header also restores the volume password that was valid when the backup was created. Moreover, if keyfile(s) were/was necessary to mount the volume when the backup was created, the same keyfile(s) will be necessary to mount the volume again after the volume header is restored.\n\nAfter you click Yes, you will select the header backup file.</string>
|
||||
<string lang="en" key="CONFIRM_VOL_HEADER_BAK">Are you sure you want to create volume header backup for %s?\n\nAfter you click Yes, you will prompted for a filename for the header backup.\n\nNote: Both the standard and the hidden volume headers will be re-encrypted using a new salt and stored in the backup file. If there is no hidden volume within this volume, the area reserved for the hidden volume header in the backup file will be filled with random data (to preserve plausible deniability). When restoring a volume header from the backup file, you will need to enter the correct password (and/or to supply the correct keyfiles) that was/were valid when the volume header backup was created. The password (and/or keyfiles) will also automatically determine the type of the volume header to restore, i.e. standard or hidden (note that VeraCrypt determines the type through the process of trial and error).</string>
|
||||
<string lang="en" key="CONFIRM_VOL_HEADER_RESTORE">Are you sure you want to restore volume header of %s?\n\nWARNING: Restoring a volume header also restores the volume password that was valid when the backup was created. Moreover, if keyfile(s) were/was necessary to mount the volume when the backup was created, the same keyfile(s) will be necessary to mount the volume again after the volume header is restored.\n\nAfter you click Yes, you will select the header backup file.</string>
|
||||
<string lang="en" key="DOES_VOLUME_CONTAIN_HIDDEN">Does the volume contain a hidden volume?</string>
|
||||
<string lang="en" key="VOLUME_CONTAINS_HIDDEN">The volume contains a hidden volume</string>
|
||||
<string lang="en" key="VOLUME_DOES_NOT_CONTAIN_HIDDEN">The volume does not contain a hidden volume</string>
|
||||
@@ -963,8 +965,8 @@
|
||||
<string lang="en" key="BACKUP_HEADER_NOT_FOR_SYS_DEVICE">You are attempting to back up the header of the system partition/drive. This is not allowed. Backup/restore operations pertaining to the system partition/drive can be performed only using the VeraCrypt Rescue Disk.\n\nDo you want to create a VeraCrypt Rescue Disk?</string>
|
||||
<string lang="en" key="RESTORE_HEADER_NOT_FOR_SYS_DEVICE">You are attempting to restore the header of a virtual VeraCrypt volume but you selected the system partition/drive. This is not allowed. Backup/restore operations pertaining to the system partition/drive can be performed only using the VeraCrypt Rescue Disk.\n\nDo you want to create a VeraCrypt Rescue Disk?</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_SELECT_PATH">After you click OK, you will select a filename for the new VeraCrypt Rescue Disk ISO image and the location where you wish to place it.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_BURN">The Rescue Disk image has been created and stored in this file:\n%hs\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nIMPORTANT: Note that the file must be written to the CD/DVD as an ISO disk image (not as an individual file). For information on how to do so, please refer to the documentation of your CD/DVD recording software.\n\nAfter you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_WIN_ISOBURN">The Rescue Disk image has been created and stored in this file:\n%hs\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nDo you want to launch the Microsoft Windows Disc Image Burner now?\n\nNote: After you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_BURN">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nIMPORTANT: Note that the file must be written to the CD/DVD as an ISO disk image (not as an individual file). For information on how to do so, please refer to the documentation of your CD/DVD recording software.\n\nAfter you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CREATION_WIN_ISOBURN">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn the Rescue Disk image to a CD or DVD.\n\nDo you want to launch the Microsoft Windows Disc Image Burner now?\n\nNote: After you burn the Rescue Disk, select 'System' > 'Verify Rescue Disk' to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_INSERT">Please insert your VeraCrypt Rescue Disk into your CD/DVD drive and click OK to verify it.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_PASSED">The VeraCrypt Rescue Disk has been successfully verified.</string>
|
||||
<string lang="en" key="RESCUE_DISK_NON_WIZARD_CHECK_FAILED">Cannot verify that the Rescue Disk has been correctly burned.\n\nIf you have burned the Rescue Disk, please eject and reinsert the CD/DVD; then try again. If this does not help, please try other CD/DVD recording software and/or medium.\n\nIf you attempted to verify a VeraCrypt Rescue Disk created for a different master key, password, salt, etc., please note that such Rescue Disk will always fail this verification. To create a new Rescue Disk fully compatible with your current configuration, select 'System' > 'Create Rescue Disk'.</string>
|
||||
@@ -1059,8 +1061,8 @@
|
||||
<string lang="en" key="NO_SYS_ENC_PROCESS_TO_RESUME">There is no interrupted process of encryption/decryption of the system partition/drive to resume.\n\nNote: If you want to resume an interrupted process of encryption/decryption of a non-system partition/volume, select 'Volumes' > 'Resume Interrupted Process'.</string>
|
||||
<string lang="en" key="HIDVOL_PROT_BKG_TASK_WARNING">WARNING: VeraCrypt Background Task is disabled. After you exit VeraCrypt, you will not be notified if damage to hidden volume is prevented.\n\nNote: You may shut down the Background Task anytime by right-clicking the VeraCrypt tray icon and selecting 'Exit'.\n\nEnable VeraCrypt Background Task?</string>
|
||||
<string lang="en" key="LANG_PACK_VERSION">Language pack version: %s</string>
|
||||
<string lang="en" key="CHECKING_FS">Checking the file system on the VeraCrypt volume mounted as %hs...</string>
|
||||
<string lang="en" key="REPAIRING_FS">Attempting to repair the file system on the VeraCrypt volume mounted as %hs...</string>
|
||||
<string lang="en" key="CHECKING_FS">Checking the file system on the VeraCrypt volume mounted as %s...</string>
|
||||
<string lang="en" key="REPAIRING_FS">Attempting to repair the file system on the VeraCrypt volume mounted as %s...</string>
|
||||
<string lang="en" key="WARN_64_BIT_BLOCK_CIPHER">Warning: This volume is encrypted with a legacy encryption algorithm.\n\nAll 64-bit-block encryption algorithms (e.g., Blowfish, CAST-128, or Triple DES) are deprecated. It will be possible to mount this volume using future versions of VeraCrypt. However, there will be no further enhancements to the implementations of these legacy encryption algorithms. We recommend that you create a new VeraCrypt volume encrypted with a 128-bit-block encryption algorithm (e.g., AES, Serpent, Twofish, etc.) and that you move all files from this volume to the new volume.</string>
|
||||
<string lang="en" key="SYS_AUTOMOUNT_DISABLED">Your system is not configured to auto-mount new volumes. It may be impossible to mount device-hosted VeraCrypt volumes. Auto-mounting can be enabled by executing the following command and restarting the system.\n\nmountvol.exe /E</string>
|
||||
<string lang="en" key="SYS_ASSIGN_DRIVE_LETTER">Please assign a drive letter to the partition/device before proceeding ('Control Panel' > 'System and Maintenance' > 'Administrative Tools' - 'Create and format hard disk partitions').\n\nNote that this is a requirement of the operating system.</string>
|
||||
@@ -1116,8 +1118,8 @@
|
||||
<string lang="en" key="KEYB_LAYOUT_SYS_ENC_EXPLANATION">Note: The password will need to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available. Therefore, the password must always be typed using the standard US keyboard layout. However, it is important to note that you do NOT need a real US keyboard. VeraCrypt automatically ensures that you can safely type the password (right now and in the pre-boot environment) even if you do NOT have a real US keyboard.</string>
|
||||
<string lang="en" key="RESCUE_DISK_INFO">Before you can encrypt the partition/drive, you must create a VeraCrypt Rescue Disk (VRD), which serves the following purposes:\n\n- If the VeraCrypt Boot Loader, master key, or other critical data gets damaged, the VRD allows you to restore it (note, however, that you will still have to enter the correct password then).\n\n- If Windows gets damaged and cannot start, the VRD allows you to permanently decrypt the partition/drive before Windows starts.\n\n- The VRD will contain a backup of the present content of the first drive track (which typically contains a system loader or boot manager) and will allow you to restore it if necessary.\n\nThe VeraCrypt Rescue Disk ISO image will be created in the location specified below.</string>
|
||||
<string lang="en" key="RESCUE_DISK_WIN_ISOBURN_PRELAUNCH_NOTE">After you click OK, Microsoft Windows Disc Image Burner will be launched. Please use it to burn the VeraCrypt Rescue Disk ISO image to a CD or DVD.\n\nAfter you do so, return to the VeraCrypt Volume Creation Wizard and follow its instructions.</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_INFO">The Rescue Disk image has been created and stored in this file:\n%hs\n\nNow you need to burn it to a CD or DVD.\n\n%lsAfter you burn the Rescue Disk, click Next to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_INFO_NO_CHECK">The Rescue Disk image has been created and stored in this file:\n%hs\n\nNow you should either burn the image to a CD/DVD or move it to a safe location for later use.\n\n%lsClick Next to continue.</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_INFO">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you need to burn it to a CD or DVD.\n\n%lsAfter you burn the Rescue Disk, click Next to verify that it has been correctly burned.</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_INFO_NO_CHECK">The Rescue Disk image has been created and stored in this file:\n%s\n\nNow you should either burn the image to a CD/DVD or move it to a safe location for later use.\n\n%lsClick Next to continue.</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_INFO_NONWIN_ISO_BURNER">IMPORTANT: Note that the file must be written to the CD/DVD as an ISO disk image (not as an individual file). For information on how to do so, please refer to the documentation of your CD/DVD recording software. If you do not have any CD/DVD recording software that can write the ISO disk image to a CD/DVD, click the link below to download such free software.\n\n</string>
|
||||
<string lang="en" key="LAUNCH_WIN_ISOBURN">Launch Microsoft Windows Disc Image Burner</string>
|
||||
<string lang="en" key="RESCUE_DISK_BURN_NO_CHECK_WARN">WARNING: If you already created a VeraCrypt Rescue Disk in the past, it cannot be reused for this system partition/drive because it was created for a different master key! Every time you encrypt a system partition/drive, you must create a new VeraCrypt Rescue Disk for it even if you use the same password.</string>
|
||||
|
||||
@@ -33,17 +33,25 @@ void VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword,
|
||||
char *szVerify,
|
||||
BOOL keyFilesEnabled)
|
||||
{
|
||||
char szTmp1[MAX_PASSWORD + 1];
|
||||
char szTmp2[MAX_PASSWORD + 1];
|
||||
wchar_t szTmp1[MAX_PASSWORD + 1];
|
||||
wchar_t szTmp2[MAX_PASSWORD + 1];
|
||||
char szTmp1Utf8[MAX_PASSWORD + 1];
|
||||
char szTmp2Utf8[MAX_PASSWORD + 1];
|
||||
int k = GetWindowTextLength (hPassword);
|
||||
BOOL bEnable = FALSE;
|
||||
int utf8Len1, utf8Len2;
|
||||
|
||||
UNREFERENCED_PARAMETER (hwndDlg); /* Remove warning */
|
||||
|
||||
GetWindowText (hPassword, szTmp1, sizeof (szTmp1));
|
||||
GetWindowText (hVerify, szTmp2, sizeof (szTmp2));
|
||||
|
||||
if (strcmp (szTmp1, szTmp2) != 0)
|
||||
utf8Len1 = WideCharToMultiByte (CP_UTF8, 0, szTmp1, -1, szTmp1Utf8, MAX_PASSWORD + 1, NULL, NULL);
|
||||
utf8Len2 = WideCharToMultiByte (CP_UTF8, 0, szTmp2, -1, szTmp2Utf8, MAX_PASSWORD + 1, NULL, NULL);
|
||||
|
||||
if (wcscmp (szTmp1, szTmp2) != 0)
|
||||
bEnable = FALSE;
|
||||
else if (utf8Len1 <= 0)
|
||||
bEnable = FALSE;
|
||||
else
|
||||
{
|
||||
@@ -54,13 +62,25 @@ void VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword,
|
||||
}
|
||||
|
||||
if (szPassword != NULL)
|
||||
memcpy (szPassword, szTmp1, sizeof (szTmp1));
|
||||
{
|
||||
if (utf8Len1 > 0)
|
||||
memcpy (szPassword, szTmp1Utf8, sizeof (szTmp1Utf8));
|
||||
else
|
||||
szPassword [0] = 0;
|
||||
}
|
||||
|
||||
if (szVerify != NULL)
|
||||
memcpy (szVerify, szTmp2, sizeof (szTmp2));
|
||||
{
|
||||
if (utf8Len2 > 0)
|
||||
memcpy (szVerify, szTmp2Utf8, sizeof (szTmp2Utf8));
|
||||
else
|
||||
szVerify [0] = 0;
|
||||
}
|
||||
|
||||
burn (szTmp1, sizeof (szTmp1));
|
||||
burn (szTmp2, sizeof (szTmp2));
|
||||
burn (szTmp1Utf8, sizeof (szTmp1Utf8));
|
||||
burn (szTmp2Utf8, sizeof (szTmp2Utf8));
|
||||
|
||||
EnableWindow (hButton, bEnable);
|
||||
}
|
||||
@@ -146,11 +166,11 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
|
||||
int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
|
||||
{
|
||||
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
|
||||
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
||||
char szDosDevice[TC_MAX_PATH];
|
||||
wchar_t szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
||||
wchar_t szDosDevice[TC_MAX_PATH];
|
||||
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
|
||||
PCRYPTO_INFO cryptoInfo = NULL, ci = NULL;
|
||||
void *dev = INVALID_HANDLE_VALUE;
|
||||
@@ -190,7 +210,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int
|
||||
|
||||
if (bDevice == FALSE)
|
||||
{
|
||||
strcpy (szCFDevice, szDiskFile);
|
||||
wcscpy (szCFDevice, szDiskFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ typedef struct
|
||||
void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled );
|
||||
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning);
|
||||
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
|
||||
int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
|
||||
int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
|
||||
|
||||
#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
|
||||
|
||||
|
||||
@@ -736,24 +736,24 @@ void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, uin
|
||||
}
|
||||
|
||||
|
||||
char *get_pkcs5_prf_name (int pkcs5_prf_id)
|
||||
wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id)
|
||||
{
|
||||
switch (pkcs5_prf_id)
|
||||
{
|
||||
case SHA512:
|
||||
return "HMAC-SHA-512";
|
||||
return L"HMAC-SHA-512";
|
||||
|
||||
case SHA256:
|
||||
return "HMAC-SHA-256";
|
||||
return L"HMAC-SHA-256";
|
||||
|
||||
case RIPEMD160:
|
||||
return "HMAC-RIPEMD-160";
|
||||
return L"HMAC-RIPEMD-160";
|
||||
|
||||
case WHIRLPOOL:
|
||||
return "HMAC-Whirlpool";
|
||||
return L"HMAC-Whirlpool";
|
||||
|
||||
default:
|
||||
return "(Unknown)";
|
||||
return L"(Unknown)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,24 +20,26 @@
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* output written to input_digest which must be at lease 20 bytes long */
|
||||
void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len);
|
||||
void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
|
||||
|
||||
/* output written to d which must be at lease 32 bytes long */
|
||||
void hmac_sha256 (char *k, int lk, char *d, int ld);
|
||||
void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
|
||||
|
||||
#ifndef TC_WINDOWS_BOOT
|
||||
/* output written to d which must be at lease 64 bytes long */
|
||||
void hmac_sha512 (char *k, int lk, char *d, int ld);
|
||||
void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
|
||||
|
||||
/* output written to input_digest which must be at lease 20 bytes long */
|
||||
void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len);
|
||||
void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
|
||||
|
||||
/* output written to d which must be at lease 64 bytes long */
|
||||
void hmac_whirlpool (char *k, int lk, char *d, int ld);
|
||||
void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen);
|
||||
|
||||
int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot);
|
||||
char *get_pkcs5_prf_name (int pkcs5_prf_id);
|
||||
wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id);
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -631,17 +631,17 @@ BOOL SlowPoll (void)
|
||||
HKEY hKey;
|
||||
|
||||
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
|
||||
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
||||
L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
|
||||
0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
unsigned char szValue[32];
|
||||
wchar_t szValue[32];
|
||||
dwSize = sizeof (szValue);
|
||||
|
||||
isWorkstation = TRUE;
|
||||
status = RegQueryValueEx (hKey, "ProductType", 0, NULL,
|
||||
szValue, &dwSize);
|
||||
status = RegQueryValueEx (hKey, L"ProductType", 0, NULL,
|
||||
(LPBYTE) szValue, &dwSize);
|
||||
|
||||
if (status == ERROR_SUCCESS && _stricmp ((char *) szValue, "WinNT"))
|
||||
if (status == ERROR_SUCCESS && _wcsicmp (szValue, L"WinNT"))
|
||||
/* Note: There are (at least) three cases for
|
||||
ProductType: WinNT = NT Workstation,
|
||||
ServerNT = NT Server, LanmanNT = NT Server
|
||||
@@ -656,13 +656,13 @@ BOOL SlowPoll (void)
|
||||
{
|
||||
/* Obtain a handle to the module containing the Lan Manager
|
||||
functions */
|
||||
char dllPath[MAX_PATH];
|
||||
wchar_t dllPath[MAX_PATH];
|
||||
if (GetSystemDirectory (dllPath, MAX_PATH))
|
||||
{
|
||||
StringCbCatA(dllPath, sizeof(dllPath), "\\NETAPI32.DLL");
|
||||
StringCbCatW(dllPath, sizeof(dllPath), L"\\NETAPI32.DLL");
|
||||
}
|
||||
else
|
||||
StringCbCopyA(dllPath, sizeof(dllPath), "C:\\Windows\\System32\\NETAPI32.DLL");
|
||||
StringCbCopyW(dllPath, sizeof(dllPath), L"C:\\Windows\\System32\\NETAPI32.DLL");
|
||||
|
||||
hNetAPI32 = LoadLibrary (dllPath);
|
||||
if (hNetAPI32 != NULL)
|
||||
@@ -710,10 +710,10 @@ BOOL SlowPoll (void)
|
||||
for (nDrive = 0;; nDrive++)
|
||||
{
|
||||
DISK_PERFORMANCE diskPerformance;
|
||||
char szDevice[24];
|
||||
wchar_t szDevice[24];
|
||||
|
||||
/* Check whether we can access this device */
|
||||
StringCbPrintfA (szDevice, sizeof(szDevice), "\\\\.\\PhysicalDrive%d", nDrive);
|
||||
StringCbPrintfW (szDevice, sizeof(szDevice), L"\\\\.\\PhysicalDrive%d", nDrive);
|
||||
hDevice = CreateFile (szDevice, 0, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
NULL, OPEN_EXISTING, 0, NULL);
|
||||
if (hDevice == INVALID_HANDLE_VALUE)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "Registry.h"
|
||||
#include <Strsafe.h>
|
||||
|
||||
BOOL ReadLocalMachineRegistryDword (char *subKey, char *name, DWORD *value)
|
||||
BOOL ReadLocalMachineRegistryDword (wchar_t *subKey, wchar_t *name, DWORD *value)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD size = sizeof (*value);
|
||||
@@ -33,7 +33,7 @@ BOOL ReadLocalMachineRegistryDword (char *subKey, char *name, DWORD *value)
|
||||
return type == REG_DWORD;
|
||||
}
|
||||
|
||||
BOOL ReadLocalMachineRegistryMultiString (char *subKey, char *name, char *value, DWORD *size)
|
||||
BOOL ReadLocalMachineRegistryMultiString (wchar_t *subKey, wchar_t *name, wchar_t *value, DWORD *size)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD type;
|
||||
@@ -51,7 +51,7 @@ BOOL ReadLocalMachineRegistryMultiString (char *subKey, char *name, char *value,
|
||||
return type == REG_MULTI_SZ;
|
||||
}
|
||||
|
||||
BOOL ReadLocalMachineRegistryString (const char *subKey, char *name, char *str, DWORD *size)
|
||||
BOOL ReadLocalMachineRegistryString (const wchar_t *subKey, wchar_t *name, wchar_t *str, DWORD *size)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD type;
|
||||
@@ -69,7 +69,7 @@ BOOL ReadLocalMachineRegistryString (const char *subKey, char *name, char *str,
|
||||
return type == REG_SZ;
|
||||
}
|
||||
|
||||
BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size, BOOL b32bitApp)
|
||||
BOOL ReadLocalMachineRegistryStringNonReflected (const wchar_t *subKey, wchar_t *name, wchar_t *str, DWORD *size, BOOL b32bitApp)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD type;
|
||||
@@ -87,7 +87,7 @@ BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name,
|
||||
return type == REG_SZ;
|
||||
}
|
||||
|
||||
int ReadRegistryInt (char *subKey, char *name, int defaultValue)
|
||||
int ReadRegistryInt (wchar_t *subKey, wchar_t *name, int defaultValue)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD value, size = sizeof (DWORD);
|
||||
@@ -103,27 +103,27 @@ int ReadRegistryInt (char *subKey, char *name, int defaultValue)
|
||||
return value;
|
||||
}
|
||||
|
||||
char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *str, int maxLen)
|
||||
wchar_t *ReadRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *defaultValue, wchar_t *str, int maxLen)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
char value[MAX_PATH*4];
|
||||
wchar_t value[MAX_PATH*4];
|
||||
DWORD size = sizeof (value);
|
||||
|
||||
str[maxLen-1] = 0;
|
||||
StringCbCopyA (str, maxLen, defaultValue);
|
||||
str[maxLen/2-1] = 0;
|
||||
StringCbCopyW (str, maxLen, defaultValue);
|
||||
|
||||
ZeroMemory (value, sizeof value);
|
||||
if (RegOpenKeyEx (HKEY_CURRENT_USER, subKey,
|
||||
0, KEY_READ, &hkey) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx (hkey, name, 0, 0, (LPBYTE) value, &size) == ERROR_SUCCESS)
|
||||
StringCbCopyA (str, maxLen,value);
|
||||
StringCbCopyW (str, maxLen,value);
|
||||
|
||||
if (hkey)
|
||||
RegCloseKey (hkey);
|
||||
return str;
|
||||
}
|
||||
|
||||
DWORD ReadRegistryBytes (char *path, char *name, char *value, int maxLen)
|
||||
DWORD ReadRegistryBytes (wchar_t *path, wchar_t *name, char *value, int maxLen)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD size = maxLen;
|
||||
@@ -138,7 +138,7 @@ DWORD ReadRegistryBytes (char *path, char *name, char *value, int maxLen)
|
||||
return success ? size : 0;
|
||||
}
|
||||
|
||||
void WriteRegistryInt (char *subKey, char *name, int value)
|
||||
void WriteRegistryInt (wchar_t *subKey, wchar_t *name, int value)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -151,7 +151,7 @@ void WriteRegistryInt (char *subKey, char *name, int value)
|
||||
RegCloseKey (hkey);
|
||||
}
|
||||
|
||||
BOOL WriteLocalMachineRegistryDword (char *subKey, char *name, DWORD value)
|
||||
BOOL WriteLocalMachineRegistryDword (wchar_t *subKey, wchar_t *name, DWORD value)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -175,31 +175,7 @@ BOOL WriteLocalMachineRegistryDword (char *subKey, char *name, DWORD value)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WriteLocalMachineRegistryDwordW (WCHAR *subKey, WCHAR *name, DWORD value)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
LONG status;
|
||||
|
||||
if ((status = RegCreateKeyExW (HKEY_LOCAL_MACHINE, subKey,
|
||||
0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &disp)) != ERROR_SUCCESS)
|
||||
{
|
||||
SetLastError (status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((status = RegSetValueExW (hkey, name, 0, REG_DWORD, (BYTE *) &value, sizeof value)) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey (hkey);
|
||||
SetLastError (status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
RegCloseKey (hkey);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WriteLocalMachineRegistryMultiString (char *subKey, char *name, char *multiString, DWORD size)
|
||||
BOOL WriteLocalMachineRegistryMultiString (wchar_t *subKey, wchar_t *name, wchar_t *multiString, DWORD size)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -223,7 +199,7 @@ BOOL WriteLocalMachineRegistryMultiString (char *subKey, char *name, char *multi
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WriteLocalMachineRegistryString (char *subKey, char *name, char *str, BOOL expandable)
|
||||
BOOL WriteLocalMachineRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *str, BOOL expandable)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -236,7 +212,7 @@ BOOL WriteLocalMachineRegistryString (char *subKey, char *name, char *str, BOOL
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((status = RegSetValueEx (hkey, name, 0, expandable ? REG_EXPAND_SZ : REG_SZ, (BYTE *) str, (DWORD) strlen (str) + 1)) != ERROR_SUCCESS)
|
||||
if ((status = RegSetValueEx (hkey, name, 0, expandable ? REG_EXPAND_SZ : REG_SZ, (BYTE *) str, (DWORD) (wcslen (str) + 1) * sizeof (wchar_t))) != ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey (hkey);
|
||||
SetLastError (status);
|
||||
@@ -247,7 +223,7 @@ BOOL WriteLocalMachineRegistryString (char *subKey, char *name, char *str, BOOL
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void WriteRegistryString (char *subKey, char *name, char *str)
|
||||
void WriteRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *str)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -256,11 +232,11 @@ void WriteRegistryString (char *subKey, char *name, char *str)
|
||||
0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, &disp) != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
RegSetValueEx (hkey, name, 0, REG_SZ, (BYTE *) str, (DWORD) strlen (str) + 1);
|
||||
RegSetValueEx (hkey, name, 0, REG_SZ, (BYTE *) str, (DWORD) (wcslen (str) + 1) * sizeof (wchar_t));
|
||||
RegCloseKey (hkey);
|
||||
}
|
||||
|
||||
BOOL WriteRegistryBytes (char *path, char *name, char *str, DWORD size)
|
||||
BOOL WriteRegistryBytes (wchar_t *path, wchar_t *name, char *str, DWORD size)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
DWORD disp;
|
||||
@@ -275,7 +251,7 @@ BOOL WriteRegistryBytes (char *path, char *name, char *str, DWORD size)
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
BOOL DeleteLocalMachineRegistryKey (char *parentKey, char *subKeyToDelete)
|
||||
BOOL DeleteLocalMachineRegistryKey (wchar_t *parentKey, wchar_t *subKeyToDelete)
|
||||
{
|
||||
LONG status;
|
||||
HKEY hkey = 0;
|
||||
@@ -297,7 +273,7 @@ BOOL DeleteLocalMachineRegistryKey (char *parentKey, char *subKeyToDelete)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DeleteRegistryValue (char *subKey, char *name)
|
||||
void DeleteRegistryValue (wchar_t *subKey, wchar_t *name)
|
||||
{
|
||||
HKEY hkey = 0;
|
||||
|
||||
@@ -309,16 +285,16 @@ void DeleteRegistryValue (char *subKey, char *name)
|
||||
}
|
||||
|
||||
|
||||
void GetStartupRegKeyName (char *regk, size_t cbRegk)
|
||||
void GetStartupRegKeyName (wchar_t *regk, size_t cbRegk)
|
||||
{
|
||||
// The string is split in order to prevent some antivirus packages from falsely reporting
|
||||
// VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan).
|
||||
StringCbPrintfA (regk, cbRegk,"%s%s", "Software\\Microsoft\\Windows\\Curren", "tVersion\\Run");
|
||||
StringCbPrintfW (regk, cbRegk,L"%s%s", L"Software\\Microsoft\\Windows\\Curren", L"tVersion\\Run");
|
||||
}
|
||||
|
||||
void GetRestorePointRegKeyName (char *regk, size_t cbRegk)
|
||||
void GetRestorePointRegKeyName (wchar_t *regk, size_t cbRegk)
|
||||
{
|
||||
// The string is split in order to prevent some antivirus packages from falsely reporting
|
||||
// VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan).
|
||||
StringCbPrintfA (regk, cbRegk,"%s%s%s%s", "Software\\Microsoft\\Windows", " NT\\Curren", "tVersion\\Sy", "stemRestore");
|
||||
StringCbPrintfW (regk, cbRegk,L"%s%s%s%s", L"Software\\Microsoft\\Windows", L" NT\\Curren", L"tVersion\\Sy", L"stemRestore");
|
||||
}
|
||||
@@ -14,24 +14,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
BOOL ReadLocalMachineRegistryDword (char *subKey, char *name, DWORD *value);
|
||||
BOOL ReadLocalMachineRegistryMultiString (char *subKey, char *name, char *value, DWORD *size);
|
||||
BOOL ReadLocalMachineRegistryString (const char *subKey, char *name, char *value, DWORD *size);
|
||||
BOOL ReadLocalMachineRegistryStringNonReflected (const char *subKey, char *name, char *str, DWORD *size, BOOL b32bitApp);
|
||||
int ReadRegistryInt (char *subKey, char *name, int defaultValue);
|
||||
char *ReadRegistryString (char *subKey, char *name, char *defaultValue, char *str, int maxLen);
|
||||
DWORD ReadRegistryBytes (char *path, char *name, char *value, int maxLen);
|
||||
void WriteRegistryInt (char *subKey, char *name, int value);
|
||||
BOOL WriteLocalMachineRegistryDword (char *subKey, char *name, DWORD value);
|
||||
BOOL WriteLocalMachineRegistryDwordW (WCHAR *subKey, WCHAR *name, DWORD value);
|
||||
BOOL WriteLocalMachineRegistryMultiString (char *subKey, char *name, char *multiString, DWORD size);
|
||||
BOOL WriteLocalMachineRegistryString (char *subKey, char *name, char *str, BOOL expandable);
|
||||
void WriteRegistryString (char *subKey, char *name, char *str);
|
||||
BOOL WriteRegistryBytes (char *path, char *name, char *str, DWORD size);
|
||||
BOOL DeleteLocalMachineRegistryKey (char *parentKey, char *subKeyToDelete);
|
||||
void DeleteRegistryValue (char *subKey, char *name);
|
||||
void GetStartupRegKeyName (char *regk, size_t cbRegk);
|
||||
void GetRestorePointRegKeyName (char *regk, size_t cbRegk);
|
||||
BOOL ReadLocalMachineRegistryDword (wchar_t *subKey, wchar_t *name, DWORD *value);
|
||||
BOOL ReadLocalMachineRegistryMultiString (wchar_t *subKey, wchar_t *name, wchar_t *value, DWORD *size);
|
||||
BOOL ReadLocalMachineRegistryString (const wchar_t *subKey, wchar_t *name, wchar_t *value, DWORD *size);
|
||||
BOOL ReadLocalMachineRegistryStringNonReflected (const wchar_t *subKey, wchar_t *name, wchar_t *str, DWORD *size, BOOL b32bitApp);
|
||||
int ReadRegistryInt (wchar_t *subKey, wchar_t *name, int defaultValue);
|
||||
wchar_t *ReadRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *defaultValue, wchar_t *str, int maxLen);
|
||||
DWORD ReadRegistryBytes (wchar_t *path, wchar_t *name, char *value, int maxLen);
|
||||
void WriteRegistryInt (wchar_t *subKey, wchar_t *name, int value);
|
||||
BOOL WriteLocalMachineRegistryDword (wchar_t *subKey, wchar_t *name, DWORD value);
|
||||
BOOL WriteLocalMachineRegistryMultiString (wchar_t *subKey, wchar_t *name, wchar_t *multiString, DWORD size);
|
||||
BOOL WriteLocalMachineRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *str, BOOL expandable);
|
||||
void WriteRegistryString (wchar_t *subKey, wchar_t *name, wchar_t *str);
|
||||
BOOL WriteRegistryBytes (wchar_t *path, wchar_t *name, char *str, DWORD size);
|
||||
BOOL DeleteLocalMachineRegistryKey (wchar_t *parentKey, wchar_t *subKeyToDelete);
|
||||
void DeleteRegistryValue (wchar_t *subKey, wchar_t *name);
|
||||
void GetStartupRegKeyName (wchar_t *regk, size_t cbRegk);
|
||||
void GetRestorePointRegKeyName (wchar_t *regk, size_t cbRegk);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace VeraCrypt
|
||||
SlotId = slotId;
|
||||
|
||||
size_t keyIdPos = pathStr.find (L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/");
|
||||
if (keyIdPos == string::npos)
|
||||
if (keyIdPos == wstring::npos)
|
||||
throw InvalidSecurityTokenKeyfilePath();
|
||||
|
||||
Id = pathStr.substr (keyIdPos + wstring (L"/" TC_SECURITY_TOKEN_KEYFILE_URL_FILE L"/").size());
|
||||
@@ -510,13 +510,17 @@ namespace VeraCrypt
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TC_WINDOWS
|
||||
void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
|
||||
#else
|
||||
void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
|
||||
#endif
|
||||
{
|
||||
if (Initialized)
|
||||
CloseLibrary();
|
||||
|
||||
#ifdef TC_WINDOWS
|
||||
Pkcs11LibraryHandle = LoadLibraryA (pkcs11LibraryPath.c_str());
|
||||
Pkcs11LibraryHandle = LoadLibraryW (pkcs11LibraryPath.c_str());
|
||||
#else
|
||||
Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
|
||||
#endif
|
||||
|
||||
@@ -189,7 +189,11 @@ namespace VeraCrypt
|
||||
static void GetKeyfileData (const SecurityTokenKeyfile &keyfile, vector <byte> &keyfileData);
|
||||
static list <SecurityTokenInfo> GetAvailableTokens ();
|
||||
static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId);
|
||||
#ifdef TC_WINDOWS
|
||||
static void InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
|
||||
#else
|
||||
static void InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
|
||||
#endif
|
||||
static bool IsInitialized () { return Initialized; }
|
||||
static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@ typedef int BOOL;
|
||||
#include <process.h> /* Process control */
|
||||
#include <winioctl.h>
|
||||
#include <stdio.h> /* For sprintf */
|
||||
#include <tchar.h>
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
@@ -254,7 +255,7 @@ void EraseMemory (void *memory, int size);
|
||||
#define TC_MAX_PATH 260 /* Includes the null terminator */
|
||||
#endif
|
||||
|
||||
#define TC_STR_RELEASED_BY "Released by IDRIX on " TC_STR_RELEASE_DATE
|
||||
#define TC_STR_RELEASED_BY L"Released by IDRIX on " TC_STR_RELEASE_DATE
|
||||
|
||||
#define MAX_URL_LENGTH 2084 /* Internet Explorer limit. Includes the terminating null character. */
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ BOOL XTSAesTest (PCRYPTO_INFO ci)
|
||||
|
||||
for (i = 0; i < XTS_TEST_COUNT; i++)
|
||||
{
|
||||
ci->ea = EAGetByName ("AES");
|
||||
ci->ea = EAGetByName (L"AES");
|
||||
if (ci->ea == 0)
|
||||
return FALSE;
|
||||
|
||||
@@ -476,7 +476,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
{
|
||||
unsigned char buf [ENCRYPTION_DATA_UNIT_SIZE * 4];
|
||||
unsigned int i;
|
||||
char name[64];
|
||||
wchar_t name[64];
|
||||
unsigned __int32 crc;
|
||||
UINT64_STRUCT unitNo;
|
||||
uint32 nbrUnits;
|
||||
@@ -538,7 +538,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
|
||||
crc = GetCrc32 (buf, sizeof (buf));
|
||||
|
||||
if (strcmp (name, "AES") == 0)
|
||||
if (wcscmp (name, L"AES") == 0)
|
||||
{
|
||||
// Verify the ciphertext of the "moving" data unit using the IEEE test vector #14
|
||||
if (memcmp (XTS_vectors[XTS_TEST_COUNT-1].ciphertext,
|
||||
@@ -573,7 +573,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "Serpent") == 0)
|
||||
else if (wcscmp (name, L"Serpent") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -599,7 +599,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "Twofish") == 0)
|
||||
else if (wcscmp (name, L"Twofish") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -625,7 +625,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "AES-Twofish") == 0)
|
||||
else if (wcscmp (name, L"AES-Twofish") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -651,7 +651,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "AES-Twofish-Serpent") == 0)
|
||||
else if (wcscmp (name, L"AES-Twofish-Serpent") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -677,7 +677,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "Serpent-AES") == 0)
|
||||
else if (wcscmp (name, L"Serpent-AES") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -703,7 +703,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "Serpent-Twofish-AES") == 0)
|
||||
else if (wcscmp (name, L"Serpent-Twofish-AES") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -729,7 +729,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp (name, "Twofish-Serpent") == 0)
|
||||
else if (wcscmp (name, L"Twofish-Serpent") == 0)
|
||||
{
|
||||
switch (testCase)
|
||||
{
|
||||
@@ -801,49 +801,49 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
|
||||
|
||||
crc = GetCrc32 (buf, sizeof (buf));
|
||||
|
||||
if (strcmp (name, "AES") == 0)
|
||||
if (wcscmp (name, L"AES") == 0)
|
||||
{
|
||||
if (crc != 0x33b91fab)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "Serpent") == 0)
|
||||
else if (wcscmp (name, L"Serpent") == 0)
|
||||
{
|
||||
if (crc != 0x3494d480)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "Twofish") == 0)
|
||||
else if (wcscmp (name, L"Twofish") == 0)
|
||||
{
|
||||
if (crc != 0xc4d65b46)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "AES-Twofish") == 0)
|
||||
else if (wcscmp (name, L"AES-Twofish") == 0)
|
||||
{
|
||||
if (crc != 0x14ce7385)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "AES-Twofish-Serpent") == 0)
|
||||
else if (wcscmp (name, L"AES-Twofish-Serpent") == 0)
|
||||
{
|
||||
if (crc != 0x0ec81bf7)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "Serpent-AES") == 0)
|
||||
else if (wcscmp (name, L"Serpent-AES") == 0)
|
||||
{
|
||||
if (crc != 0x42f919ad)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "Serpent-Twofish-AES") == 0)
|
||||
else if (wcscmp (name, L"Serpent-Twofish-AES") == 0)
|
||||
{
|
||||
if (crc != 0x208d5c58)
|
||||
return FALSE;
|
||||
nTestsPerformed++;
|
||||
}
|
||||
else if (strcmp (name, "Twofish-Serpent") == 0)
|
||||
else if (wcscmp (name, L"Twofish-Serpent") == 0)
|
||||
{
|
||||
if (crc != 0xbe78cec1)
|
||||
return FALSE;
|
||||
|
||||
@@ -210,26 +210,59 @@ char *XmlQuoteText (const char *textSrc, char *textDst, int textDstMaxSize)
|
||||
return textDst;
|
||||
}
|
||||
|
||||
|
||||
int XmlWriteHeader (FILE *file)
|
||||
wchar_t *XmlQuoteTextW (const wchar_t *textSrc, wchar_t *textDst, int textDstMaxSize)
|
||||
{
|
||||
return fputs ("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<VeraCrypt>", file);
|
||||
wchar_t *textDstLast = textDst + textDstMaxSize - 1;
|
||||
|
||||
if (textDstMaxSize == 0)
|
||||
return NULL;
|
||||
|
||||
while (*textSrc != 0 && textDst <= textDstLast)
|
||||
{
|
||||
wchar_t c = *textSrc++;
|
||||
switch (c)
|
||||
{
|
||||
case L'&':
|
||||
if (textDst + 6 > textDstLast)
|
||||
return NULL;
|
||||
wcscpy (textDst, L"&");
|
||||
textDst += 5;
|
||||
continue;
|
||||
|
||||
case L'>':
|
||||
if (textDst + 5 > textDstLast)
|
||||
return NULL;
|
||||
wcscpy (textDst, L">");
|
||||
textDst += 4;
|
||||
continue;
|
||||
|
||||
case L'<':
|
||||
if (textDst + 5 > textDstLast)
|
||||
return NULL;
|
||||
wcscpy (textDst, L"<");
|
||||
textDst += 4;
|
||||
continue;
|
||||
|
||||
default:
|
||||
*textDst++ = c;
|
||||
}
|
||||
}
|
||||
|
||||
if (textDst > textDstLast)
|
||||
return NULL;
|
||||
|
||||
*textDst = 0;
|
||||
return textDst;
|
||||
}
|
||||
|
||||
|
||||
int XmlWriteHeaderW (FILE *file)
|
||||
int XmlWriteHeader (FILE *file)
|
||||
{
|
||||
return fputws (L"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<VeraCrypt>", file);
|
||||
}
|
||||
|
||||
|
||||
int XmlWriteFooter (FILE *file)
|
||||
{
|
||||
return fputs ("\n</VeraCrypt>", file);
|
||||
}
|
||||
|
||||
|
||||
int XmlWriteFooterW (FILE *file)
|
||||
{
|
||||
return fputws (L"\n</VeraCrypt>", file);
|
||||
}
|
||||
|
||||
@@ -19,11 +19,10 @@ char *XmlFindElement (char *xmlNode, char *nodeName);
|
||||
char *XmlGetAttributeText (char *xmlNode, char *xmlAttrName, char *xmlAttrValue, int xmlAttrValueSize);
|
||||
char *XmlGetNodeText (char *xmlNode, char *xmlText, int xmlTextSize);
|
||||
int XmlWriteHeader (FILE *file);
|
||||
int XmlWriteHeaderW (FILE *file);
|
||||
int XmlWriteFooter (FILE *file);
|
||||
int XmlWriteFooterW (FILE *file);
|
||||
char *XmlFindElementByAttributeValue (char *xml, char *nodeName, char *attrName, char *attrValue);
|
||||
char *XmlQuoteText (const char *textSrc, char *textDst, int textDstMaxSize);
|
||||
wchar_t *XmlQuoteTextW (const wchar_t *textSrc, wchar_t *textDst, int textDstMaxSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user