mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-28 05:53:29 +01:00
Use Pim name for internal variables instead of the old name Pin
This commit is contained in:
parent
7a01453f00
commit
6ef41abdd2
@ -145,14 +145,14 @@ static int AskSelection (const char *options[], size_t optionCount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static byte AskPassword (Password &password, int& pin)
|
static byte AskPassword (Password &password, int& pim)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
byte scanCode;
|
byte scanCode;
|
||||||
byte asciiCode;
|
byte asciiCode;
|
||||||
byte hidePassword = 1;
|
byte hidePassword = 1;
|
||||||
|
|
||||||
pin = 0;
|
pim = 0;
|
||||||
|
|
||||||
Print ("Enter password");
|
Print ("Enter password");
|
||||||
Print (PreventNormalSystemBoot ? " for hidden system:\r\n" : ": ");
|
Print (PreventNormalSystemBoot ? " for hidden system:\r\n" : ": ");
|
||||||
@ -238,7 +238,7 @@ static byte AskPassword (Password &password, int& pin)
|
|||||||
PrintCharAtCursor (' ');
|
PrintCharAtCursor (' ');
|
||||||
|
|
||||||
--pos;
|
--pos;
|
||||||
pin /= 10;
|
pim /= 10;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ static byte AskPassword (Password &password, int& pin)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pin = 10*pin + (asciiCode - '0');
|
pim = 10*pim + (asciiCode - '0');
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
if (pos < MAX_PIM)
|
if (pos < MAX_PIM)
|
||||||
@ -296,7 +296,7 @@ static void ExecuteBootSector (byte drive, byte *sectorBuffer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool OpenVolume (byte drive, Password &password, int pin, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
|
static bool OpenVolume (byte drive, Password &password, int pim, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
|
||||||
{
|
{
|
||||||
int volumeType;
|
int volumeType;
|
||||||
bool hiddenVolume;
|
bool hiddenVolume;
|
||||||
@ -327,7 +327,7 @@ static bool OpenVolume (byte drive, Password &password, int pin, CRYPTO_INFO **c
|
|||||||
if (ReadSectors (SectorBuffer, drive, headerSec, 1) != BiosResultSuccess)
|
if (ReadSectors (SectorBuffer, drive, headerSec, 1) != BiosResultSuccess)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ReadVolumeHeader (!hiddenVolume, (char *) SectorBuffer, &password, pin, cryptoInfo, nullptr) == ERR_SUCCESS)
|
if (ReadVolumeHeader (!hiddenVolume, (char *) SectorBuffer, &password, pim, cryptoInfo, nullptr) == ERR_SUCCESS)
|
||||||
{
|
{
|
||||||
// Prevent opening a non-system hidden volume
|
// Prevent opening a non-system hidden volume
|
||||||
if (hiddenVolume && !((*cryptoInfo)->HeaderFlags & TC_HEADER_FLAG_ENCRYPTED_SYSTEM))
|
if (hiddenVolume && !((*cryptoInfo)->HeaderFlags & TC_HEADER_FLAG_ENCRYPTED_SYSTEM))
|
||||||
@ -381,21 +381,21 @@ static bool CheckMemoryRequirements ()
|
|||||||
static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHidden)
|
static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHidden)
|
||||||
{
|
{
|
||||||
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
|
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
|
||||||
int incorrectPasswordCount = 0, pin = 0;
|
int incorrectPasswordCount = 0, pim = 0;
|
||||||
|
|
||||||
EraseMemory (bootArguments, sizeof (*bootArguments));
|
EraseMemory (bootArguments, sizeof (*bootArguments));
|
||||||
|
|
||||||
// Open volume header
|
// Open volume header
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
exitKey = AskPassword (bootArguments->BootPassword, pin);
|
exitKey = AskPassword (bootArguments->BootPassword, pim);
|
||||||
|
|
||||||
if (exitKey != TC_BIOS_KEY_ENTER)
|
if (exitKey != TC_BIOS_KEY_ENTER)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Print ("Verifying password...");
|
Print ("Verifying password...");
|
||||||
|
|
||||||
if (OpenVolume (BootDrive, bootArguments->BootPassword, pin, &BootCryptoInfo, &bootArguments->HeaderSaltCrc32, skipNormal, skipHidden))
|
if (OpenVolume (BootDrive, bootArguments->BootPassword, pim, &BootCryptoInfo, &bootArguments->HeaderSaltCrc32, skipNormal, skipHidden))
|
||||||
{
|
{
|
||||||
Print ("OK\r\n");
|
Print ("OK\r\n");
|
||||||
break;
|
break;
|
||||||
@ -421,7 +421,7 @@ static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHi
|
|||||||
bootArguments->BootLoaderVersion = VERSION_NUM;
|
bootArguments->BootLoaderVersion = VERSION_NUM;
|
||||||
bootArguments->CryptoInfoOffset = (uint16) BootCryptoInfo;
|
bootArguments->CryptoInfoOffset = (uint16) BootCryptoInfo;
|
||||||
bootArguments->CryptoInfoLength = sizeof (*BootCryptoInfo);
|
bootArguments->CryptoInfoLength = sizeof (*BootCryptoInfo);
|
||||||
bootArguments->Flags = (((uint32)pin) << 16);
|
bootArguments->Flags = (((uint32)pim) << 16);
|
||||||
|
|
||||||
if (BootCryptoInfo->hiddenVolume)
|
if (BootCryptoInfo->hiddenVolume)
|
||||||
bootArguments->HiddenSystemPartitionStart = PartitionFollowingActive.StartSector << TC_LB_SIZE_BIT_SHIFT_DIVISOR;
|
bootArguments->HiddenSystemPartitionStart = PartitionFollowingActive.StartSector << TC_LB_SIZE_BIT_SHIFT_DIVISOR;
|
||||||
@ -1023,8 +1023,8 @@ static void RepairMenu ()
|
|||||||
uint32 masterKeyScheduleCrc;
|
uint32 masterKeyScheduleCrc;
|
||||||
|
|
||||||
Password password;
|
Password password;
|
||||||
int pin;
|
int pim;
|
||||||
byte exitKey = AskPassword (password, pin);
|
byte exitKey = AskPassword (password, pim);
|
||||||
|
|
||||||
if (exitKey != TC_BIOS_KEY_ENTER)
|
if (exitKey != TC_BIOS_KEY_ENTER)
|
||||||
goto abort;
|
goto abort;
|
||||||
@ -1035,7 +1035,7 @@ static void RepairMenu ()
|
|||||||
ReleaseSectorBuffer();
|
ReleaseSectorBuffer();
|
||||||
|
|
||||||
// Restore volume header only if the current one cannot be used
|
// Restore volume header only if the current one cannot be used
|
||||||
if (OpenVolume (TC_FIRST_BIOS_DRIVE, password, pin, &cryptoInfo, nullptr, false, true))
|
if (OpenVolume (TC_FIRST_BIOS_DRIVE, password, pim, &cryptoInfo, nullptr, false, true))
|
||||||
{
|
{
|
||||||
validHeaderPresent = true;
|
validHeaderPresent = true;
|
||||||
masterKeyScheduleCrc = GetCrc32 (cryptoInfo->ks, sizeof (cryptoInfo->ks));
|
masterKeyScheduleCrc = GetCrc32 (cryptoInfo->ks, sizeof (cryptoInfo->ks));
|
||||||
@ -1045,7 +1045,7 @@ static void RepairMenu ()
|
|||||||
AcquireSectorBuffer();
|
AcquireSectorBuffer();
|
||||||
CopyMemory (TC_BOOT_LOADER_BUFFER_SEGMENT, 0, SectorBuffer, TC_LB_SIZE);
|
CopyMemory (TC_BOOT_LOADER_BUFFER_SEGMENT, 0, SectorBuffer, TC_LB_SIZE);
|
||||||
|
|
||||||
if (ReadVolumeHeader (TRUE, (char *) SectorBuffer, &password, pin, &cryptoInfo, nullptr) == 0)
|
if (ReadVolumeHeader (TRUE, (char *) SectorBuffer, &password, pim, &cryptoInfo, nullptr) == 0)
|
||||||
{
|
{
|
||||||
if (validHeaderPresent)
|
if (validHeaderPresent)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "TCdefs.h"
|
#include "TCdefs.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
static byte AskPassword (Password &password, int& pin);
|
static byte AskPassword (Password &password, int& pim);
|
||||||
static int AskSelection (const char *options[], size_t optionCount);
|
static int AskSelection (const char *options[], size_t optionCount);
|
||||||
static bool AskYesNo (const char *message);
|
static bool AskYesNo (const char *message);
|
||||||
static byte BootEncryptedDrive ();
|
static byte BootEncryptedDrive ();
|
||||||
|
@ -104,8 +104,8 @@ typedef struct
|
|||||||
int ProtectedHidVolPkcs5Prf;
|
int ProtectedHidVolPkcs5Prf;
|
||||||
BOOL bTrueCryptMode;
|
BOOL bTrueCryptMode;
|
||||||
uint32 BytesPerPhysicalSector;
|
uint32 BytesPerPhysicalSector;
|
||||||
int VolumePin;
|
int VolumePim;
|
||||||
int ProtectedHidVolPin;
|
int ProtectedHidVolPim;
|
||||||
} MOUNT_STRUCT;
|
} MOUNT_STRUCT;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -145,7 +145,7 @@ typedef struct
|
|||||||
unsigned __int64 totalBytesWritten;
|
unsigned __int64 totalBytesWritten;
|
||||||
int hiddenVolProtection; /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
|
int hiddenVolProtection; /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
|
||||||
int volFormatVersion;
|
int volFormatVersion;
|
||||||
int volumePin;
|
int volumePim;
|
||||||
} VOLUME_PROPERTIES_STRUCT;
|
} VOLUME_PROPERTIES_STRUCT;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -244,7 +244,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
Password VolumePassword;
|
Password VolumePassword;
|
||||||
int pkcs5_prf;
|
int pkcs5_prf;
|
||||||
int pin;
|
int pim;
|
||||||
} ReopenBootVolumeHeaderRequest;
|
} ReopenBootVolumeHeaderRequest;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1737,21 +1737,21 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
#ifndef SETUP
|
#ifndef SETUP
|
||||||
|
|
||||||
void BootEncryption::CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pin)
|
void BootEncryption::CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim)
|
||||||
{
|
{
|
||||||
PCRYPTO_INFO cryptoInfo = NULL;
|
PCRYPTO_INFO cryptoInfo = NULL;
|
||||||
|
|
||||||
if (!IsRandomNumberGeneratorStarted())
|
if (!IsRandomNumberGeneratorStarted())
|
||||||
throw ParameterIncorrect (SRC_POS);
|
throw ParameterIncorrect (SRC_POS);
|
||||||
|
|
||||||
throw_sys_if (CreateVolumeHeaderInMemory (ParentWindow, TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, pin, NULL, &cryptoInfo,
|
throw_sys_if (CreateVolumeHeaderInMemory (ParentWindow, TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, pim, NULL, &cryptoInfo,
|
||||||
volumeSize, 0, encryptedAreaStart, 0, TC_SYSENC_KEYSCOPE_MIN_REQ_PROG_VERSION, TC_HEADER_FLAG_ENCRYPTED_SYSTEM, TC_SECTOR_SIZE_BIOS, FALSE) != 0);
|
volumeSize, 0, encryptedAreaStart, 0, TC_SYSENC_KEYSCOPE_MIN_REQ_PROG_VERSION, TC_HEADER_FLAG_ENCRYPTED_SYSTEM, TC_SECTOR_SIZE_BIOS, FALSE) != 0);
|
||||||
|
|
||||||
finally_do_arg (PCRYPTO_INFO*, &cryptoInfo, { crypto_close (*finally_arg); });
|
finally_do_arg (PCRYPTO_INFO*, &cryptoInfo, { crypto_close (*finally_arg); });
|
||||||
|
|
||||||
// Initial rescue disk assumes encryption of the drive has been completed (EncryptedAreaLength == volumeSize)
|
// Initial rescue disk assumes encryption of the drive has been completed (EncryptedAreaLength == volumeSize)
|
||||||
memcpy (RescueVolumeHeader, VolumeHeader, sizeof (RescueVolumeHeader));
|
memcpy (RescueVolumeHeader, VolumeHeader, sizeof (RescueVolumeHeader));
|
||||||
if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pin, FALSE, NULL, cryptoInfo))
|
if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pim, FALSE, NULL, cryptoInfo))
|
||||||
throw ParameterIncorrect (SRC_POS);
|
throw ParameterIncorrect (SRC_POS);
|
||||||
|
|
||||||
DecryptBuffer (RescueVolumeHeader + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
|
DecryptBuffer (RescueVolumeHeader + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
|
||||||
@ -2234,7 +2234,7 @@ namespace VeraCrypt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BootEncryption::ChangePassword (Password *oldPassword, int old_pkcs5, int old_pin, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg)
|
int BootEncryption::ChangePassword (Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
|
||||||
{
|
{
|
||||||
BootEncryptionStatus encStatus = GetStatus();
|
BootEncryptionStatus encStatus = GetStatus();
|
||||||
|
|
||||||
@ -2277,7 +2277,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
PCRYPTO_INFO cryptoInfo = NULL;
|
PCRYPTO_INFO cryptoInfo = NULL;
|
||||||
|
|
||||||
int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pin, FALSE, &cryptoInfo, NULL);
|
int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, FALSE, &cryptoInfo, NULL);
|
||||||
finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); });
|
finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); });
|
||||||
|
|
||||||
if (status != 0)
|
if (status != 0)
|
||||||
@ -2339,7 +2339,7 @@ namespace VeraCrypt
|
|||||||
cryptoInfo->mode,
|
cryptoInfo->mode,
|
||||||
newPassword,
|
newPassword,
|
||||||
cryptoInfo->pkcs5,
|
cryptoInfo->pkcs5,
|
||||||
pin,
|
pim,
|
||||||
(char *) cryptoInfo->master_keydata,
|
(char *) cryptoInfo->master_keydata,
|
||||||
&tmpCryptoInfo,
|
&tmpCryptoInfo,
|
||||||
cryptoInfo->VolumeSize.Value,
|
cryptoInfo->VolumeSize.Value,
|
||||||
@ -2383,7 +2383,7 @@ namespace VeraCrypt
|
|||||||
ReopenBootVolumeHeaderRequest reopenRequest;
|
ReopenBootVolumeHeaderRequest reopenRequest;
|
||||||
reopenRequest.VolumePassword = *newPassword;
|
reopenRequest.VolumePassword = *newPassword;
|
||||||
reopenRequest.pkcs5_prf = cryptoInfo->pkcs5;
|
reopenRequest.pkcs5_prf = cryptoInfo->pkcs5;
|
||||||
reopenRequest.pin = pin;
|
reopenRequest.pim = pim;
|
||||||
finally_do_arg (ReopenBootVolumeHeaderRequest*, &reopenRequest, { burn (finally_arg, sizeof (*finally_arg)); });
|
finally_do_arg (ReopenBootVolumeHeaderRequest*, &reopenRequest, { burn (finally_arg, sizeof (*finally_arg)); });
|
||||||
|
|
||||||
CallDriver (TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER, &reopenRequest, sizeof (reopenRequest));
|
CallDriver (TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER, &reopenRequest, sizeof (reopenRequest));
|
||||||
@ -2444,7 +2444,7 @@ namespace VeraCrypt
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pin, const string &rescueIsoImagePath)
|
void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath)
|
||||||
{
|
{
|
||||||
BootEncryptionStatus encStatus = GetStatus();
|
BootEncryptionStatus encStatus = GetStatus();
|
||||||
if (encStatus.DriveMounted)
|
if (encStatus.DriveMounted)
|
||||||
@ -2497,7 +2497,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
SelectedEncryptionAlgorithmId = ea;
|
SelectedEncryptionAlgorithmId = ea;
|
||||||
SelectedPrfAlgorithmId = pkcs5;
|
SelectedPrfAlgorithmId = pkcs5;
|
||||||
CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pin);
|
CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pim);
|
||||||
|
|
||||||
if (!rescueIsoImagePath.empty())
|
if (!rescueIsoImagePath.empty())
|
||||||
CreateRescueIsoImage (true, rescueIsoImagePath);
|
CreateRescueIsoImage (true, rescueIsoImagePath);
|
||||||
|
@ -144,7 +144,7 @@ namespace VeraCrypt
|
|||||||
void AbortSetup ();
|
void AbortSetup ();
|
||||||
void AbortSetupWait ();
|
void AbortSetupWait ();
|
||||||
void CallDriver (DWORD ioctl, void *input = nullptr, DWORD inputSize = 0, void *output = nullptr, DWORD outputSize = 0);
|
void CallDriver (DWORD ioctl, void *input = nullptr, DWORD inputSize = 0, void *output = nullptr, DWORD outputSize = 0);
|
||||||
int ChangePassword (Password *oldPassword, int old_pkcs5, int old_pin, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg);
|
int ChangePassword (Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
|
||||||
void CheckDecoyOSWipeResult ();
|
void CheckDecoyOSWipeResult ();
|
||||||
void CheckEncryptionSetupResult ();
|
void CheckEncryptionSetupResult ();
|
||||||
void CheckRequirements ();
|
void CheckRequirements ();
|
||||||
@ -170,7 +170,7 @@ namespace VeraCrypt
|
|||||||
bool IsHiddenSystemRunning ();
|
bool IsHiddenSystemRunning ();
|
||||||
bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
||||||
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
|
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
|
||||||
void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pin, const string &rescueIsoImagePath);
|
void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath);
|
||||||
void ProbeRealSystemDriveSize ();
|
void ProbeRealSystemDriveSize ();
|
||||||
void ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
|
void ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
|
||||||
uint32 ReadDriverConfigurationFlags ();
|
uint32 ReadDriverConfigurationFlags ();
|
||||||
@ -204,7 +204,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
void BackupSystemLoader ();
|
void BackupSystemLoader ();
|
||||||
void CreateBootLoaderInMemory (byte *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation = false);
|
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 pin);
|
void CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim);
|
||||||
string GetSystemLoaderBackupPath ();
|
string GetSystemLoaderBackupPath ();
|
||||||
uint32 GetChecksum (byte *data, size_t size);
|
uint32 GetChecksum (byte *data, size_t size);
|
||||||
DISK_GEOMETRY GetDriveGeometry (int driveNumber);
|
DISK_GEOMETRY GetDriveGeometry (int driveNumber);
|
||||||
|
@ -21,7 +21,7 @@ Password CachedPasswords[CACHE_SIZE];
|
|||||||
int cacheEmpty = 1;
|
int cacheEmpty = 1;
|
||||||
static int nPasswordIdx = 0;
|
static int nPasswordIdx = 0;
|
||||||
|
|
||||||
int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo)
|
int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo)
|
||||||
{
|
{
|
||||||
int nReturnCode = ERR_PASSWORD_WRONG;
|
int nReturnCode = ERR_PASSWORD_WRONG;
|
||||||
int i;
|
int i;
|
||||||
@ -29,7 +29,7 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *pas
|
|||||||
/* Attempt to recognize volume using mount password */
|
/* Attempt to recognize volume using mount password */
|
||||||
if (password->Length > 0)
|
if (password->Length > 0)
|
||||||
{
|
{
|
||||||
nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pin, truecryptMode, retInfo, NULL);
|
nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pim, truecryptMode, retInfo, NULL);
|
||||||
|
|
||||||
/* Save mount passwords back into cache if asked to do so */
|
/* Save mount passwords back into cache if asked to do so */
|
||||||
if (bCache && (nReturnCode == 0 || nReturnCode == ERR_CIPHER_INIT_WEAK_KEY))
|
if (bCache && (nReturnCode == 0 || nReturnCode == ERR_CIPHER_INIT_WEAK_KEY))
|
||||||
@ -59,7 +59,7 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *pas
|
|||||||
{
|
{
|
||||||
if (CachedPasswords[i].Length > 0)
|
if (CachedPasswords[i].Length > 0)
|
||||||
{
|
{
|
||||||
nReturnCode = ReadVolumeHeader (bBoot, header, &CachedPasswords[i], pkcs5_prf, pin, truecryptMode, retInfo, NULL);
|
nReturnCode = ReadVolumeHeader (bBoot, header, &CachedPasswords[i], pkcs5_prf, pim, truecryptMode, retInfo, NULL);
|
||||||
|
|
||||||
if (nReturnCode != ERR_PASSWORD_WRONG)
|
if (nReturnCode != ERR_PASSWORD_WRONG)
|
||||||
break;
|
break;
|
||||||
|
@ -19,5 +19,5 @@
|
|||||||
extern int cacheEmpty;
|
extern int cacheEmpty;
|
||||||
|
|
||||||
void AddPasswordToCache (Password *password);
|
void AddPasswordToCache (Password *password);
|
||||||
int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo);
|
int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo);
|
||||||
void WipeCache (void);
|
void WipeCache (void);
|
||||||
|
@ -76,7 +76,7 @@ typedef struct
|
|||||||
BOOL UseBackupHeader;
|
BOOL UseBackupHeader;
|
||||||
BOOL RecoveryMode;
|
BOOL RecoveryMode;
|
||||||
int ProtectedHidVolPkcs5Prf;
|
int ProtectedHidVolPkcs5Prf;
|
||||||
int ProtectedHidVolPin;
|
int ProtectedHidVolPim;
|
||||||
} MountOptions;
|
} MountOptions;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,7 +213,7 @@ typedef struct CRYPTO_INFO_t
|
|||||||
unsigned __int8 salt[PKCS5_SALT_SIZE];
|
unsigned __int8 salt[PKCS5_SALT_SIZE];
|
||||||
int noIterations;
|
int noIterations;
|
||||||
BOOL bTrueCryptMode;
|
BOOL bTrueCryptMode;
|
||||||
int volumePin;
|
int volumePim;
|
||||||
|
|
||||||
uint64 volume_creation_time; // Legacy
|
uint64 volume_creation_time; // Legacy
|
||||||
uint64 header_creation_time; // Legacy
|
uint64 header_creation_time; // Legacy
|
||||||
|
@ -6543,7 +6543,7 @@ int MountVolume (HWND hwndDlg,
|
|||||||
char *volumePath,
|
char *volumePath,
|
||||||
Password *password,
|
Password *password,
|
||||||
int pkcs5,
|
int pkcs5,
|
||||||
int pin,
|
int pim,
|
||||||
BOOL truecryptMode,
|
BOOL truecryptMode,
|
||||||
BOOL cachePassword,
|
BOOL cachePassword,
|
||||||
BOOL sharedAccess,
|
BOOL sharedAccess,
|
||||||
@ -6606,7 +6606,7 @@ int MountVolume (HWND hwndDlg,
|
|||||||
mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword;
|
mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword;
|
||||||
mount.bProtectHiddenVolume = TRUE;
|
mount.bProtectHiddenVolume = TRUE;
|
||||||
mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf;
|
mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf;
|
||||||
mount.ProtectedHidVolPin = mountOptions->ProtectedHidVolPin;
|
mount.ProtectedHidVolPim = mountOptions->ProtectedHidVolPim;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mount.bProtectHiddenVolume = FALSE;
|
mount.bProtectHiddenVolume = FALSE;
|
||||||
@ -6618,7 +6618,7 @@ int MountVolume (HWND hwndDlg,
|
|||||||
mount.bMountManager = TRUE;
|
mount.bMountManager = TRUE;
|
||||||
mount.pkcs5_prf = pkcs5;
|
mount.pkcs5_prf = pkcs5;
|
||||||
mount.bTrueCryptMode = truecryptMode;
|
mount.bTrueCryptMode = truecryptMode;
|
||||||
mount.VolumePin = pin;
|
mount.VolumePim = pim;
|
||||||
|
|
||||||
// Windows 2000 mount manager causes problems with remounted volumes
|
// Windows 2000 mount manager causes problems with remounted volumes
|
||||||
if (CurrentOSMajor == 5 && CurrentOSMinor == 0)
|
if (CurrentOSMajor == 5 && CurrentOSMinor == 0)
|
||||||
@ -9314,7 +9314,7 @@ void ReportUnexpectedState (char *techInfo)
|
|||||||
|
|
||||||
#ifndef SETUP
|
#ifndef SETUP
|
||||||
|
|
||||||
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
|
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
|
||||||
{
|
{
|
||||||
int status = ERR_PARAMETER_INCORRECT;
|
int status = ERR_PARAMETER_INCORRECT;
|
||||||
int volumeType;
|
int volumeType;
|
||||||
@ -9464,7 +9464,7 @@ int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt volume header
|
// Decrypt volume header
|
||||||
status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pin, truecryptMode, &context->CryptoInfo, NULL);
|
status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pim, truecryptMode, &context->CryptoInfo, NULL);
|
||||||
|
|
||||||
if (status == ERR_PASSWORD_WRONG)
|
if (status == ERR_PASSWORD_WRONG)
|
||||||
continue; // Try next volume type
|
continue; // Try next volume type
|
||||||
@ -9509,7 +9509,7 @@ void CloseVolume (OpenVolumeContext *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pin, BOOL wipeMode)
|
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode)
|
||||||
{
|
{
|
||||||
CRYPTO_INFO *newCryptoInfo = NULL;
|
CRYPTO_INFO *newCryptoInfo = NULL;
|
||||||
|
|
||||||
@ -9531,7 +9531,7 @@ int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *
|
|||||||
cryptoInfo->mode,
|
cryptoInfo->mode,
|
||||||
password,
|
password,
|
||||||
cryptoInfo->pkcs5,
|
cryptoInfo->pkcs5,
|
||||||
pin,
|
pim,
|
||||||
(char *) cryptoInfo->master_keydata,
|
(char *) cryptoInfo->master_keydata,
|
||||||
&newCryptoInfo,
|
&newCryptoInfo,
|
||||||
cryptoInfo->VolumeSize.Value,
|
cryptoInfo->VolumeSize.Value,
|
||||||
@ -10762,29 +10762,29 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char
|
|||||||
return string (directory) + "\\" + name;
|
return string (directory) + "\\" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPin (HWND hwndDlg, UINT ctrlId)
|
int GetPim (HWND hwndDlg, UINT ctrlId)
|
||||||
{
|
{
|
||||||
int pin = 0;
|
int pim = 0;
|
||||||
if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId)))
|
if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId)))
|
||||||
{
|
{
|
||||||
char szTmp[MAX_PIM + 1] = {0};
|
char szTmp[MAX_PIM + 1] = {0};
|
||||||
if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIM + 1) > 0)
|
if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIM + 1) > 0)
|
||||||
{
|
{
|
||||||
char* endPtr = NULL;
|
char* endPtr = NULL;
|
||||||
pin = strtol(szTmp, &endPtr, 10);
|
pim = strtol(szTmp, &endPtr, 10);
|
||||||
if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
|
if (pim < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
|
||||||
pin = 0;
|
pim = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pin;
|
return pim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPin (HWND hwndDlg, UINT ctrlId, int pin)
|
void SetPim (HWND hwndDlg, UINT ctrlId, int pim)
|
||||||
{
|
{
|
||||||
if (pin > 0)
|
if (pim > 0)
|
||||||
{
|
{
|
||||||
char szTmp[MAX_PIM + 1];
|
char szTmp[MAX_PIM + 1];
|
||||||
StringCbPrintfA (szTmp, sizeof(szTmp), "%d", pin);
|
StringCbPrintfA (szTmp, sizeof(szTmp), "%d", pim);
|
||||||
SetDlgItemText (hwndDlg, ctrlId, szTmp);
|
SetDlgItemText (hwndDlg, ctrlId, szTmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -334,7 +334,7 @@ BOOL IsDriveAvailable (int driveNo);
|
|||||||
BOOL IsDeviceMounted (char *deviceName);
|
BOOL IsDeviceMounted (char *deviceName);
|
||||||
int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
|
int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
|
||||||
void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
|
void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
|
||||||
int MountVolume (HWND hwndDlg, int driveNo, char *volumePath, Password *password, int pkcs5, int pin, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword);
|
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);
|
||||||
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
|
BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
|
||||||
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
|
BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo);
|
||||||
BOOL IsPasswordCacheEmpty (void);
|
BOOL IsPasswordCacheEmpty (void);
|
||||||
@ -462,9 +462,9 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h
|
|||||||
BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
|
BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
|
||||||
BOOL GetSysDevicePaths (HWND hwndDlg);
|
BOOL GetSysDevicePaths (HWND hwndDlg);
|
||||||
BOOL DoDriverInstall (HWND hwndDlg);
|
BOOL DoDriverInstall (HWND hwndDlg);
|
||||||
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
|
int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader);
|
||||||
void CloseVolume (OpenVolumeContext *context);
|
void CloseVolume (OpenVolumeContext *context);
|
||||||
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pin, BOOL wipeMode);
|
int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode);
|
||||||
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
||||||
BOOL IsPagingFileWildcardActive ();
|
BOOL IsPagingFileWildcardActive ();
|
||||||
BOOL DisablePagingFile ();
|
BOOL DisablePagingFile ();
|
||||||
@ -483,8 +483,8 @@ BOOL VolumePathExists (const char *volumePath);
|
|||||||
BOOL IsWindowsIsoBurnerAvailable ();
|
BOOL IsWindowsIsoBurnerAvailable ();
|
||||||
BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath);
|
BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath);
|
||||||
BOOL IsApplicationInstalled (const char *appName);
|
BOOL IsApplicationInstalled (const char *appName);
|
||||||
int GetPin (HWND hwndDlg, UINT ctrlId);
|
int GetPim (HWND hwndDlg, UINT ctrlId);
|
||||||
void SetPin (HWND hwndDlg, UINT ctrlId, int pin);
|
void SetPim (HWND hwndDlg, UINT ctrlId, int pim);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
|||||||
FIRST_MODE_OF_OPERATION_ID,
|
FIRST_MODE_OF_OPERATION_ID,
|
||||||
volParams->password,
|
volParams->password,
|
||||||
volParams->pkcs5,
|
volParams->pkcs5,
|
||||||
volParams->pin,
|
volParams->pim,
|
||||||
NULL,
|
NULL,
|
||||||
&cryptoInfo,
|
&cryptoInfo,
|
||||||
dataAreaSize,
|
dataAreaSize,
|
||||||
@ -543,7 +543,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
|||||||
FIRST_MODE_OF_OPERATION_ID,
|
FIRST_MODE_OF_OPERATION_ID,
|
||||||
volParams->password,
|
volParams->password,
|
||||||
volParams->pkcs5,
|
volParams->pkcs5,
|
||||||
volParams->pin,
|
volParams->pim,
|
||||||
cryptoInfo->master_keydata,
|
cryptoInfo->master_keydata,
|
||||||
&cryptoInfo,
|
&cryptoInfo,
|
||||||
dataAreaSize,
|
dataAreaSize,
|
||||||
@ -630,7 +630,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
|||||||
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
||||||
mountOptions.UseBackupHeader = FALSE;
|
mountOptions.UseBackupHeader = FALSE;
|
||||||
|
|
||||||
if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
||||||
{
|
{
|
||||||
MessageBoxW (volParams->hwndDlg, GetString ("CANT_MOUNT_VOLUME"), lpszTitle, ICON_HAND);
|
MessageBoxW (volParams->hwndDlg, GetString ("CANT_MOUNT_VOLUME"), lpszTitle, ICON_HAND);
|
||||||
MessageBoxW (volParams->hwndDlg, GetString ("FORMAT_NTFS_STOP"), lpszTitle, ICON_HAND);
|
MessageBoxW (volParams->hwndDlg, GetString ("FORMAT_NTFS_STOP"), lpszTitle, ICON_HAND);
|
||||||
|
@ -39,7 +39,7 @@ typedef struct
|
|||||||
int sectorSize;
|
int sectorSize;
|
||||||
int *realClusterSize;
|
int *realClusterSize;
|
||||||
Password *password;
|
Password *password;
|
||||||
int pin;
|
int pim;
|
||||||
HWND hwndDlg;
|
HWND hwndDlg;
|
||||||
}
|
}
|
||||||
FORMAT_VOL_PARAMETERS;
|
FORMAT_VOL_PARAMETERS;
|
||||||
|
@ -111,12 +111,12 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin, BOOL bForBoot, BOOL bSkipPasswordWarning)
|
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning)
|
||||||
{
|
{
|
||||||
BOOL bCustomPinSmall = ((pin != 0) && (pin < (bForBoot? 98 : 485)))? TRUE : FALSE;
|
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bForBoot? 98 : 485)))? TRUE : FALSE;
|
||||||
if (passwordLength < PASSWORD_LEN_WARNING)
|
if (passwordLength < PASSWORD_LEN_WARNING)
|
||||||
{
|
{
|
||||||
if (bCustomPinSmall)
|
if (bCustomPimSmall)
|
||||||
{
|
{
|
||||||
Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg);
|
Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -128,7 +128,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
else if (bCustomPinSmall)
|
else if (bCustomPimSmall)
|
||||||
{
|
{
|
||||||
if (MessageBoxW (hwndDlg, GetString ("PIM_SMALL_WARNING"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2) != IDYES)
|
if (MessageBoxW (hwndDlg, GetString ("PIM_SMALL_WARNING"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2) != IDYES)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -137,7 +137,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg)
|
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 nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
|
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
|
||||||
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
||||||
@ -305,7 +305,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int
|
|||||||
|
|
||||||
/* Try to decrypt the header */
|
/* Try to decrypt the header */
|
||||||
|
|
||||||
nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pin, truecryptMode, &cryptoInfo, NULL);
|
nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pim, truecryptMode, &cryptoInfo, NULL);
|
||||||
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
|
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
|
||||||
nStatus = 0; // We can ignore this error here
|
nStatus = 0; // We can ignore this error here
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int
|
|||||||
cryptoInfo->mode,
|
cryptoInfo->mode,
|
||||||
newPassword,
|
newPassword,
|
||||||
cryptoInfo->pkcs5,
|
cryptoInfo->pkcs5,
|
||||||
pin,
|
pim,
|
||||||
cryptoInfo->master_keydata,
|
cryptoInfo->master_keydata,
|
||||||
&ci,
|
&ci,
|
||||||
cryptoInfo->VolumeSize.Value,
|
cryptoInfo->VolumeSize.Value,
|
||||||
|
@ -36,9 +36,9 @@ typedef struct
|
|||||||
#if defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
|
#if defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
|
||||||
|
|
||||||
void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled );
|
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 pin, BOOL bForBoot, BOOL bSkipPasswordWarning);
|
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning);
|
||||||
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
|
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
|
||||||
int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg);
|
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);
|
||||||
|
|
||||||
#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
|
#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u
|
|||||||
|
|
||||||
#ifdef TC_WINDOWS_BOOT
|
#ifdef TC_WINDOWS_BOOT
|
||||||
/* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise)
|
/* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise)
|
||||||
* and the most significant 16 bits hold the pin value
|
* and the most significant 16 bits hold the pim value
|
||||||
* This enables us to save code space needed for implementing other features.
|
* This enables us to save code space needed for implementing other features.
|
||||||
*/
|
*/
|
||||||
c = iterations >> 16;
|
c = iterations >> 16;
|
||||||
@ -483,7 +483,7 @@ static void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len
|
|||||||
|
|
||||||
#ifdef TC_WINDOWS_BOOT
|
#ifdef TC_WINDOWS_BOOT
|
||||||
/* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise)
|
/* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise)
|
||||||
* and the most significant 16 bits hold the pin value
|
* and the most significant 16 bits hold the pim value
|
||||||
* This enables us to save code space needed for implementing other features.
|
* This enables us to save code space needed for implementing other features.
|
||||||
*/
|
*/
|
||||||
c = iterations >> 16;
|
c = iterations >> 16;
|
||||||
@ -757,10 +757,10 @@ char *get_pkcs5_prf_name (int pkcs5_prf_id)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int get_pkcs5_iteration_count (int pkcs5_prf_id, int pin, BOOL truecryptMode, BOOL bBoot)
|
int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot)
|
||||||
{
|
{
|
||||||
if ( (pin < 0)
|
if ( (pim < 0)
|
||||||
|| (truecryptMode && pin > 0) /* No PIM for TrueCrypt mode */
|
|| (truecryptMode && pim > 0) /* No PIM for TrueCrypt mode */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -772,27 +772,27 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pin, BOOL truecryptMode, BO
|
|||||||
case RIPEMD160:
|
case RIPEMD160:
|
||||||
if (truecryptMode)
|
if (truecryptMode)
|
||||||
return bBoot ? 1000 : 2000;
|
return bBoot ? 1000 : 2000;
|
||||||
else if (pin == 0)
|
else if (pim == 0)
|
||||||
return bBoot? 327661 : 655331;
|
return bBoot? 327661 : 655331;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return bBoot? pin * 2048 : 15000 + pin * 1000;
|
return bBoot? pim * 2048 : 15000 + pim * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SHA512:
|
case SHA512:
|
||||||
return truecryptMode? 1000 : ((pin == 0)? 500000 : 15000 + pin * 1000);
|
return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
|
||||||
|
|
||||||
case WHIRLPOOL:
|
case WHIRLPOOL:
|
||||||
return truecryptMode? 1000 : ((pin == 0)? 500000 : 15000 + pin * 1000);
|
return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
|
||||||
|
|
||||||
case SHA256:
|
case SHA256:
|
||||||
if (truecryptMode)
|
if (truecryptMode)
|
||||||
return 0; // SHA-256 not supported by TrueCrypt
|
return 0; // SHA-256 not supported by TrueCrypt
|
||||||
else if (pin == 0)
|
else if (pim == 0)
|
||||||
return bBoot? 200000 : 500000;
|
return bBoot? 200000 : 500000;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return bBoot? pin * 2048 : 15000 + pin * 1000;
|
return bBoot? pim * 2048 : 15000 + pim * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -34,7 +34,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin
|
|||||||
void hmac_whirlpool (char *k, int lk, char *d, int ld);
|
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);
|
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 pin, BOOL truecryptMode, BOOL bBoot);
|
int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot);
|
||||||
char *get_pkcs5_prf_name (int pkcs5_prf_id);
|
char *get_pkcs5_prf_name (int pkcs5_prf_id);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
@ -163,7 +163,7 @@ typedef struct
|
|||||||
|
|
||||||
BOOL ReadVolumeHeaderRecoveryMode = FALSE;
|
BOOL ReadVolumeHeaderRecoveryMode = FALSE;
|
||||||
|
|
||||||
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
|
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
|
||||||
{
|
{
|
||||||
char header[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
|
char header[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
|
||||||
KEY_INFO keyInfo;
|
KEY_INFO keyInfo;
|
||||||
@ -274,7 +274,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
|
|||||||
|
|
||||||
EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent,
|
EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent,
|
||||||
&item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey,
|
&item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey,
|
||||||
keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pin, truecryptMode, bBoot), item->DerivedKey);
|
keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey);
|
||||||
|
|
||||||
++queuedWorkItems;
|
++queuedWorkItems;
|
||||||
break;
|
break;
|
||||||
@ -296,7 +296,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
|
|||||||
if (!item->Free && InterlockedExchangeAdd (&item->KeyReady, 0) == TRUE)
|
if (!item->Free && InterlockedExchangeAdd (&item->KeyReady, 0) == TRUE)
|
||||||
{
|
{
|
||||||
pkcs5_prf = item->Pkcs5Prf;
|
pkcs5_prf = item->Pkcs5Prf;
|
||||||
keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pin, truecryptMode, bBoot);
|
keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, truecryptMode, bBoot);
|
||||||
memcpy (dk, item->DerivedKey, sizeof (dk));
|
memcpy (dk, item->DerivedKey, sizeof (dk));
|
||||||
|
|
||||||
item->Free = TRUE;
|
item->Free = TRUE;
|
||||||
@ -314,7 +314,7 @@ KeyReady: ;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
pkcs5_prf = enqPkcs5Prf;
|
pkcs5_prf = enqPkcs5Prf;
|
||||||
keyInfo.noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pin, truecryptMode, bBoot);
|
keyInfo.noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot);
|
||||||
|
|
||||||
switch (pkcs5_prf)
|
switch (pkcs5_prf)
|
||||||
{
|
{
|
||||||
@ -494,7 +494,7 @@ KeyReady: ;
|
|||||||
cryptoInfo->pkcs5 = pkcs5_prf;
|
cryptoInfo->pkcs5 = pkcs5_prf;
|
||||||
cryptoInfo->noIterations = keyInfo.noIterations;
|
cryptoInfo->noIterations = keyInfo.noIterations;
|
||||||
cryptoInfo->bTrueCryptMode = truecryptMode;
|
cryptoInfo->bTrueCryptMode = truecryptMode;
|
||||||
cryptoInfo->volumePin = pin;
|
cryptoInfo->volumePim = pim;
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,7 +517,7 @@ KeyReady: ;
|
|||||||
cryptoInfo->pkcs5 = pkcs5_prf;
|
cryptoInfo->pkcs5 = pkcs5_prf;
|
||||||
cryptoInfo->noIterations = keyInfo.noIterations;
|
cryptoInfo->noIterations = keyInfo.noIterations;
|
||||||
cryptoInfo->bTrueCryptMode = truecryptMode;
|
cryptoInfo->bTrueCryptMode = truecryptMode;
|
||||||
cryptoInfo->volumePin = pin;
|
cryptoInfo->volumePim = pim;
|
||||||
|
|
||||||
// Init the cipher with the decrypted master key
|
// Init the cipher with the decrypted master key
|
||||||
status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
|
status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
|
||||||
@ -580,7 +580,7 @@ KeyReady: ;
|
|||||||
|
|
||||||
#else // TC_WINDOWS_BOOT
|
#else // TC_WINDOWS_BOOT
|
||||||
|
|
||||||
int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
|
int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo)
|
||||||
{
|
{
|
||||||
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
|
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
|
||||||
char dk[32 * 2]; // 2 * 256-bit key
|
char dk[32 * 2]; // 2 * 256-bit key
|
||||||
@ -590,7 +590,7 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCR
|
|||||||
|
|
||||||
PCRYPTO_INFO cryptoInfo;
|
PCRYPTO_INFO cryptoInfo;
|
||||||
int status = ERR_SUCCESS;
|
int status = ERR_SUCCESS;
|
||||||
uint32 iterations = pin;
|
uint32 iterations = pim;
|
||||||
iterations <<= 16;
|
iterations <<= 16;
|
||||||
iterations |= bBoot;
|
iterations |= bBoot;
|
||||||
|
|
||||||
@ -750,7 +750,7 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCR
|
|||||||
|
|
||||||
// Creates a volume header in memory
|
// Creates a volume header in memory
|
||||||
int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, int mode, Password *password,
|
int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, int mode, Password *password,
|
||||||
int pkcs5_prf, int pin, char *masterKeydata, PCRYPTO_INFO *retInfo,
|
int pkcs5_prf, int pim, char *masterKeydata, PCRYPTO_INFO *retInfo,
|
||||||
unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize,
|
unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize,
|
||||||
unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode)
|
unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode)
|
||||||
{
|
{
|
||||||
@ -799,7 +799,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
|||||||
// User key
|
// User key
|
||||||
memcpy (keyInfo.userKey, password->Text, nUserKeyLen);
|
memcpy (keyInfo.userKey, password->Text, nUserKeyLen);
|
||||||
keyInfo.keyLength = nUserKeyLen;
|
keyInfo.keyLength = nUserKeyLen;
|
||||||
keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pin, FALSE, bBoot);
|
keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, FALSE, bBoot);
|
||||||
|
|
||||||
// User selected encryption algorithm
|
// User selected encryption algorithm
|
||||||
cryptoInfo->ea = ea;
|
cryptoInfo->ea = ea;
|
||||||
@ -808,7 +808,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
|||||||
cryptoInfo->pkcs5 = pkcs5_prf;
|
cryptoInfo->pkcs5 = pkcs5_prf;
|
||||||
cryptoInfo->bTrueCryptMode = FALSE;
|
cryptoInfo->bTrueCryptMode = FALSE;
|
||||||
cryptoInfo->noIterations = keyInfo.noIterations;
|
cryptoInfo->noIterations = keyInfo.noIterations;
|
||||||
cryptoInfo->volumePin = pin;
|
cryptoInfo->volumePim = pim;
|
||||||
|
|
||||||
// Mode of operation
|
// Mode of operation
|
||||||
cryptoInfo->mode = mode;
|
cryptoInfo->mode = mode;
|
||||||
|
@ -127,13 +127,13 @@ uint16 GetHeaderField16 (byte *header, int offset);
|
|||||||
uint32 GetHeaderField32 (byte *header, int offset);
|
uint32 GetHeaderField32 (byte *header, int offset);
|
||||||
UINT64_STRUCT GetHeaderField64 (byte *header, int offset);
|
UINT64_STRUCT GetHeaderField64 (byte *header, int offset);
|
||||||
#ifdef TC_WINDOWS_BOOT
|
#ifdef TC_WINDOWS_BOOT
|
||||||
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pin, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
|
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
|
||||||
#else
|
#else
|
||||||
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
|
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (DEVICE_DRIVER) && !defined (TC_WINDOWS_BOOT)
|
#if !defined (DEVICE_DRIVER) && !defined (TC_WINDOWS_BOOT)
|
||||||
int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, int pin, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode);
|
int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, int pim, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode);
|
||||||
BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DWORD *bytesRead);
|
BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DWORD *bytesRead);
|
||||||
BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header);
|
BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header);
|
||||||
int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly);
|
int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly);
|
||||||
|
@ -224,7 +224,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
|
|||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
char *header;
|
char *header;
|
||||||
int pkcs5_prf = 0, pin = 0;
|
int pkcs5_prf = 0, pim = 0;
|
||||||
byte *mappedCryptoInfo = NULL;
|
byte *mappedCryptoInfo = NULL;
|
||||||
|
|
||||||
Dump ("MountDrive pdo=%p\n", Extension->Pdo);
|
Dump ("MountDrive pdo=%p\n", Extension->Pdo);
|
||||||
@ -295,9 +295,9 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pin = (int) (BootArgs.Flags >> 16);
|
pim = (int) (BootArgs.Flags >> 16);
|
||||||
|
|
||||||
if (ReadVolumeHeader (!hiddenVolume, header, password, pkcs5_prf, pin, FALSE, &Extension->Queue.CryptoInfo, Extension->HeaderCryptoInfo) == 0)
|
if (ReadVolumeHeader (!hiddenVolume, header, password, pkcs5_prf, pim, FALSE, &Extension->Queue.CryptoInfo, Extension->HeaderCryptoInfo) == 0)
|
||||||
{
|
{
|
||||||
// Header decrypted
|
// Header decrypted
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
@ -777,8 +777,8 @@ void ReopenBootVolumeHeader (PIRP irp, PIO_STACK_LOCATION irpSp)
|
|||||||
|| request->VolumePassword.Length > MAX_PASSWORD
|
|| request->VolumePassword.Length > MAX_PASSWORD
|
||||||
|| request->pkcs5_prf < 0
|
|| request->pkcs5_prf < 0
|
||||||
|| request->pkcs5_prf > LAST_PRF_ID
|
|| request->pkcs5_prf > LAST_PRF_ID
|
||||||
|| request->pin < 0
|
|| request->pim < 0
|
||||||
|| request->pin > 65535
|
|| request->pim > 65535
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
|
||||||
@ -804,14 +804,14 @@ void ReopenBootVolumeHeader (PIRP irp, PIO_STACK_LOCATION irpSp)
|
|||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReadVolumeHeader (!BootDriveFilterExtension->HiddenSystem, header, &request->VolumePassword, request->pkcs5_prf, request->pin, FALSE, NULL, BootDriveFilterExtension->HeaderCryptoInfo) == 0)
|
if (ReadVolumeHeader (!BootDriveFilterExtension->HiddenSystem, header, &request->VolumePassword, request->pkcs5_prf, request->pim, FALSE, NULL, BootDriveFilterExtension->HeaderCryptoInfo) == 0)
|
||||||
{
|
{
|
||||||
Dump ("Header reopened\n");
|
Dump ("Header reopened\n");
|
||||||
|
|
||||||
BootDriveFilterExtension->Queue.CryptoInfo->header_creation_time = BootDriveFilterExtension->HeaderCryptoInfo->header_creation_time;
|
BootDriveFilterExtension->Queue.CryptoInfo->header_creation_time = BootDriveFilterExtension->HeaderCryptoInfo->header_creation_time;
|
||||||
BootDriveFilterExtension->Queue.CryptoInfo->pkcs5 = BootDriveFilterExtension->HeaderCryptoInfo->pkcs5;
|
BootDriveFilterExtension->Queue.CryptoInfo->pkcs5 = BootDriveFilterExtension->HeaderCryptoInfo->pkcs5;
|
||||||
BootDriveFilterExtension->Queue.CryptoInfo->noIterations = BootDriveFilterExtension->HeaderCryptoInfo->noIterations;
|
BootDriveFilterExtension->Queue.CryptoInfo->noIterations = BootDriveFilterExtension->HeaderCryptoInfo->noIterations;
|
||||||
BootDriveFilterExtension->Queue.CryptoInfo->volumePin = BootDriveFilterExtension->HeaderCryptoInfo->volumePin;
|
BootDriveFilterExtension->Queue.CryptoInfo->volumePim = BootDriveFilterExtension->HeaderCryptoInfo->volumePim;
|
||||||
|
|
||||||
irp->IoStatus.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1585,7 +1585,7 @@ void GetBootDriveVolumeProperties (PIRP irp, PIO_STACK_LOCATION irpSp)
|
|||||||
prop->mode = Extension->Queue.CryptoInfo->mode;
|
prop->mode = Extension->Queue.CryptoInfo->mode;
|
||||||
prop->pkcs5 = Extension->Queue.CryptoInfo->pkcs5;
|
prop->pkcs5 = Extension->Queue.CryptoInfo->pkcs5;
|
||||||
prop->pkcs5Iterations = Extension->Queue.CryptoInfo->noIterations;
|
prop->pkcs5Iterations = Extension->Queue.CryptoInfo->noIterations;
|
||||||
prop->volumePin = Extension->Queue.CryptoInfo->volumePin;
|
prop->volumePim = Extension->Queue.CryptoInfo->volumePim;
|
||||||
#if 0
|
#if 0
|
||||||
prop->volumeCreationTime = Extension->Queue.CryptoInfo->volume_creation_time;
|
prop->volumeCreationTime = Extension->Queue.CryptoInfo->volume_creation_time;
|
||||||
prop->headerCreationTime = Extension->Queue.CryptoInfo->header_creation_time;
|
prop->headerCreationTime = Extension->Queue.CryptoInfo->header_creation_time;
|
||||||
|
@ -1227,7 +1227,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
|
|||||||
prop->mode = ListExtension->cryptoInfo->mode;
|
prop->mode = ListExtension->cryptoInfo->mode;
|
||||||
prop->pkcs5 = ListExtension->cryptoInfo->pkcs5;
|
prop->pkcs5 = ListExtension->cryptoInfo->pkcs5;
|
||||||
prop->pkcs5Iterations = ListExtension->cryptoInfo->noIterations;
|
prop->pkcs5Iterations = ListExtension->cryptoInfo->noIterations;
|
||||||
prop->volumePin = ListExtension->cryptoInfo->volumePin;
|
prop->volumePim = ListExtension->cryptoInfo->volumePim;
|
||||||
#if 0
|
#if 0
|
||||||
prop->volumeCreationTime = ListExtension->cryptoInfo->volume_creation_time;
|
prop->volumeCreationTime = ListExtension->cryptoInfo->volume_creation_time;
|
||||||
prop->headerCreationTime = ListExtension->cryptoInfo->header_creation_time;
|
prop->headerCreationTime = ListExtension->cryptoInfo->header_creation_time;
|
||||||
@ -1404,7 +1404,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
|
|||||||
|
|
||||||
if (mount->VolumePassword.Length > MAX_PASSWORD || mount->ProtectedHidVolPassword.Length > MAX_PASSWORD
|
if (mount->VolumePassword.Length > MAX_PASSWORD || mount->ProtectedHidVolPassword.Length > MAX_PASSWORD
|
||||||
|| mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID
|
|| mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID
|
||||||
|| mount->VolumePin < 0 || mount->VolumePin == INT_MAX
|
|| mount->VolumePim < 0 || mount->VolumePim == INT_MAX
|
||||||
|| mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID
|
|| mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID
|
||||||
|| (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE)
|
|| (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE)
|
||||||
)
|
)
|
||||||
@ -1422,10 +1422,10 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
|
|||||||
burn (&mount->VolumePassword, sizeof (mount->VolumePassword));
|
burn (&mount->VolumePassword, sizeof (mount->VolumePassword));
|
||||||
burn (&mount->ProtectedHidVolPassword, sizeof (mount->ProtectedHidVolPassword));
|
burn (&mount->ProtectedHidVolPassword, sizeof (mount->ProtectedHidVolPassword));
|
||||||
burn (&mount->pkcs5_prf, sizeof (mount->pkcs5_prf));
|
burn (&mount->pkcs5_prf, sizeof (mount->pkcs5_prf));
|
||||||
burn (&mount->VolumePin, sizeof (mount->VolumePin));
|
burn (&mount->VolumePim, sizeof (mount->VolumePim));
|
||||||
burn (&mount->bTrueCryptMode, sizeof (mount->bTrueCryptMode));
|
burn (&mount->bTrueCryptMode, sizeof (mount->bTrueCryptMode));
|
||||||
burn (&mount->ProtectedHidVolPkcs5Prf, sizeof (mount->ProtectedHidVolPkcs5Prf));
|
burn (&mount->ProtectedHidVolPkcs5Prf, sizeof (mount->ProtectedHidVolPkcs5Prf));
|
||||||
burn (&mount->ProtectedHidVolPin, sizeof (mount->ProtectedHidVolPin));
|
burn (&mount->ProtectedHidVolPim, sizeof (mount->ProtectedHidVolPim));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
|
|||||||
readBuffer,
|
readBuffer,
|
||||||
&mount->ProtectedHidVolPassword,
|
&mount->ProtectedHidVolPassword,
|
||||||
mount->ProtectedHidVolPkcs5Prf,
|
mount->ProtectedHidVolPkcs5Prf,
|
||||||
mount->ProtectedHidVolPin,
|
mount->ProtectedHidVolPim,
|
||||||
mount->bTrueCryptMode,
|
mount->bTrueCryptMode,
|
||||||
&tmpCryptoInfo);
|
&tmpCryptoInfo);
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
|
|||||||
readBuffer,
|
readBuffer,
|
||||||
&mount->VolumePassword,
|
&mount->VolumePassword,
|
||||||
mount->pkcs5_prf,
|
mount->pkcs5_prf,
|
||||||
mount->VolumePin,
|
mount->VolumePim,
|
||||||
mount->bTrueCryptMode,
|
mount->bTrueCryptMode,
|
||||||
&Extension->cryptoInfo);
|
&Extension->cryptoInfo);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
|
|||||||
namespace VeraCryptExpander
|
namespace VeraCryptExpander
|
||||||
{
|
{
|
||||||
/* defined in WinMain.c, referenced by ExpandVolumeWizard() */
|
/* defined in WinMain.c, referenced by ExpandVolumeWizard() */
|
||||||
int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pin, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions);
|
int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -406,7 +406,7 @@ typedef struct
|
|||||||
const char *volumePath;
|
const char *volumePath;
|
||||||
Password *password;
|
Password *password;
|
||||||
int pkcs5_prf;
|
int pkcs5_prf;
|
||||||
int pin;
|
int pim;
|
||||||
BOOL truecryptMode;
|
BOOL truecryptMode;
|
||||||
BOOL write;
|
BOOL write;
|
||||||
BOOL preserveTimestamps;
|
BOOL preserveTimestamps;
|
||||||
@ -419,7 +419,7 @@ void CALLBACK OpenVolumeWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
OpenVolumeThreadParam* pThreadParam = (OpenVolumeThreadParam*) pArg;
|
OpenVolumeThreadParam* pThreadParam = (OpenVolumeThreadParam*) pArg;
|
||||||
|
|
||||||
*(pThreadParam)->nStatus = OpenVolume(pThreadParam->context, pThreadParam->volumePath, pThreadParam->password, pThreadParam->pkcs5_prf,
|
*(pThreadParam)->nStatus = OpenVolume(pThreadParam->context, pThreadParam->volumePath, pThreadParam->password, pThreadParam->pkcs5_prf,
|
||||||
pThreadParam->pin, pThreadParam->truecryptMode, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader);
|
pThreadParam->pim, pThreadParam->truecryptMode, pThreadParam->write, pThreadParam->preserveTimestamps, pThreadParam->useBackupHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -445,7 +445,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume)
|
|||||||
int nStatus = ERR_OS_ERROR;
|
int nStatus = ERR_OS_ERROR;
|
||||||
wchar_t szTmp[4096];
|
wchar_t szTmp[4096];
|
||||||
Password VolumePassword;
|
Password VolumePassword;
|
||||||
int VolumePkcs5 = 0, VolumePin = -1;
|
int VolumePkcs5 = 0, VolumePim = -1;
|
||||||
uint64 hostSize, volSize, hostSizeFree, maxSizeFS;
|
uint64 hostSize, volSize, hostSizeFree, maxSizeFS;
|
||||||
BOOL bIsDevice, bIsLegacy;
|
BOOL bIsDevice, bIsLegacy;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
@ -513,7 +513,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume)
|
|||||||
OpenVolumeContext expandVol;
|
OpenVolumeContext expandVol;
|
||||||
BOOL truecryptMode = FALSE;
|
BOOL truecryptMode = FALSE;
|
||||||
|
|
||||||
if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePin, &truecryptMode, "ENTER_NORMAL_VOL_PASSWORD", FALSE))
|
if (!VeraCryptExpander::ExtcvAskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePim, &truecryptMode, "ENTER_NORMAL_VOL_PASSWORD", FALSE))
|
||||||
{
|
{
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume)
|
|||||||
threadParam.volumePath = lpszVolume;
|
threadParam.volumePath = lpszVolume;
|
||||||
threadParam.password = &VolumePassword;
|
threadParam.password = &VolumePassword;
|
||||||
threadParam.pkcs5_prf = VolumePkcs5;
|
threadParam.pkcs5_prf = VolumePkcs5;
|
||||||
threadParam.pin = VolumePin;
|
threadParam.pim = VolumePim;
|
||||||
threadParam.truecryptMode = FALSE;
|
threadParam.truecryptMode = FALSE;
|
||||||
threadParam.write = FALSE;
|
threadParam.write = FALSE;
|
||||||
threadParam.preserveTimestamps = bPreserveTimestamp;
|
threadParam.preserveTimestamps = bPreserveTimestamp;
|
||||||
@ -578,7 +578,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume)
|
|||||||
WaitCursor();
|
WaitCursor();
|
||||||
|
|
||||||
// auto mount the volume to check the file system type
|
// auto mount the volume to check the file system type
|
||||||
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, &VolumePassword, VolumePkcs5, VolumePin);
|
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, &VolumePassword, VolumePkcs5, VolumePim);
|
||||||
|
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
@ -653,7 +653,7 @@ void ExpandVolumeWizard (HWND hwndDlg, char *lpszVolume)
|
|||||||
VolExpandParam.FileSystem = volFSType;
|
VolExpandParam.FileSystem = volFSType;
|
||||||
VolExpandParam.pVolumePassword = &VolumePassword;
|
VolExpandParam.pVolumePassword = &VolumePassword;
|
||||||
VolExpandParam.VolumePkcs5 = VolumePkcs5;
|
VolExpandParam.VolumePkcs5 = VolumePkcs5;
|
||||||
VolExpandParam.VolumePin = VolumePin;
|
VolExpandParam.VolumePim = VolumePim;
|
||||||
VolExpandParam.bIsDevice = bIsDevice;
|
VolExpandParam.bIsDevice = bIsDevice;
|
||||||
VolExpandParam.bIsLegacy = bIsLegacy;
|
VolExpandParam.bIsLegacy = bIsLegacy;
|
||||||
VolExpandParam.oldSize = bIsDevice ? volSize : hostSize;
|
VolExpandParam.oldSize = bIsDevice ? volSize : hostSize;
|
||||||
|
@ -102,7 +102,7 @@ static int FsctlExtendVolume(char * szVolume, LONGLONG nTotalSectors );
|
|||||||
int with Truecrypt error code (ERR_SUCCESS on success)
|
int with Truecrypt error code (ERR_SUCCESS on success)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5, int pin)
|
int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5, int pim)
|
||||||
{
|
{
|
||||||
MountOptions mountOptions;
|
MountOptions mountOptions;
|
||||||
ZeroMemory (&mountOptions, sizeof (mountOptions));
|
ZeroMemory (&mountOptions, sizeof (mountOptions));
|
||||||
@ -122,7 +122,7 @@ int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *passwo
|
|||||||
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
||||||
mountOptions.UseBackupHeader = FALSE;
|
mountOptions.UseBackupHeader = FALSE;
|
||||||
|
|
||||||
if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1)
|
if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5, pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, FALSE) < 1)
|
||||||
{
|
{
|
||||||
*driveNo = -3;
|
*driveNo = -3;
|
||||||
return ERR_VOL_MOUNT_FAILED;
|
return ERR_VOL_MOUNT_FAILED;
|
||||||
@ -389,7 +389,7 @@ uint64 GetVolumeSizeByDataAreaSize (uint64 dataAreaSize, BOOL legacyVolume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePin, uint64 newDataAreaSize)
|
int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePim, uint64 newDataAreaSize)
|
||||||
{
|
{
|
||||||
char szVolumeGUID[128];
|
char szVolumeGUID[128];
|
||||||
int driveNo = -1;
|
int driveNo = -1;
|
||||||
@ -403,7 +403,7 @@ int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword
|
|||||||
|
|
||||||
DebugAddProgressDlgStatus (hwndDlg, "Mounting volume ...\r\n");
|
DebugAddProgressDlgStatus (hwndDlg, "Mounting volume ...\r\n");
|
||||||
|
|
||||||
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePin);
|
nStatus=MountVolTemp(hwndDlg, lpszVolume, &driveNo, pVolumePassword, VolumePkcs5, VolumePim);
|
||||||
if (nStatus!=ERR_SUCCESS)
|
if (nStatus!=ERR_SUCCESS)
|
||||||
{
|
{
|
||||||
driveNo = -1;
|
driveNo = -1;
|
||||||
@ -504,7 +504,7 @@ int ExtendFileSystem (HWND hwndDlg , char *lpszVolume, Password *pVolumePassword
|
|||||||
Remarks: a lot of code is from TrueCrypt 'Common\Password.c' :: ChangePwd()
|
Remarks: a lot of code is from TrueCrypt 'Common\Password.c' :: ChangePwd()
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePin, uint64 newHostSize, BOOL initFreeSpace)
|
static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePassword, int VolumePkcs5, int VolumePim, uint64 newHostSize, BOOL initFreeSpace)
|
||||||
{
|
{
|
||||||
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
|
int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
|
||||||
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
|
||||||
@ -648,7 +648,7 @@ static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePasswo
|
|||||||
|
|
||||||
/* Try to decrypt the header */
|
/* Try to decrypt the header */
|
||||||
|
|
||||||
nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, VolumePin, FALSE, &cryptoInfo, NULL);
|
nStatus = ReadVolumeHeader (FALSE, buffer, pVolumePassword, VolumePkcs5, VolumePim, FALSE, &cryptoInfo, NULL);
|
||||||
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
|
if (nStatus == ERR_CIPHER_INIT_WEAK_KEY)
|
||||||
nStatus = 0; // We can ignore this error here
|
nStatus = 0; // We can ignore this error here
|
||||||
|
|
||||||
@ -806,7 +806,7 @@ static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePasswo
|
|||||||
cryptoInfo->mode,
|
cryptoInfo->mode,
|
||||||
pVolumePassword,
|
pVolumePassword,
|
||||||
cryptoInfo->pkcs5,
|
cryptoInfo->pkcs5,
|
||||||
VolumePin,
|
VolumePim,
|
||||||
(char*)(cryptoInfo->master_keydata),
|
(char*)(cryptoInfo->master_keydata),
|
||||||
&ci,
|
&ci,
|
||||||
newDataAreaSize,
|
newDataAreaSize,
|
||||||
@ -973,7 +973,7 @@ static int ExpandVolume (HWND hwndDlg, char *lpszVolume, Password *pVolumePasswo
|
|||||||
|
|
||||||
if (nStatus == ERR_SUCCESS)
|
if (nStatus == ERR_SUCCESS)
|
||||||
{
|
{
|
||||||
nStatus = ExtendFileSystem (hwndDlg, lpszVolume, pVolumePassword, VolumePkcs5, VolumePin, newDataAreaSize);
|
nStatus = ExtendFileSystem (hwndDlg, lpszVolume, pVolumePassword, VolumePkcs5, VolumePim, newDataAreaSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nStatus;
|
return nStatus;
|
||||||
@ -988,7 +988,7 @@ void __cdecl volTransformThreadFunction (void *pExpandDlgParam)
|
|||||||
HWND hwndDlg = (HWND) pParam->hwndDlg;
|
HWND hwndDlg = (HWND) pParam->hwndDlg;
|
||||||
|
|
||||||
nStatus = ExpandVolume (hwndDlg, (char*)pParam->szVolumeName, pParam->pVolumePassword,
|
nStatus = ExpandVolume (hwndDlg, (char*)pParam->szVolumeName, pParam->pVolumePassword,
|
||||||
pParam->VolumePkcs5, pParam->VolumePin, pParam->newSize, pParam->bInitFreeSpace );
|
pParam->VolumePkcs5, pParam->VolumePim, pParam->newSize, pParam->bInitFreeSpace );
|
||||||
|
|
||||||
if (nStatus!=ERR_SUCCESS && nStatus!=ERR_USER_ABORT)
|
if (nStatus!=ERR_SUCCESS && nStatus!=ERR_USER_ABORT)
|
||||||
handleError (hwndDlg, nStatus, SRC_POS);
|
handleError (hwndDlg, nStatus, SRC_POS);
|
||||||
|
@ -59,7 +59,7 @@ typedef struct
|
|||||||
BOOL bInitFreeSpace;
|
BOOL bInitFreeSpace;
|
||||||
Password *pVolumePassword;
|
Password *pVolumePassword;
|
||||||
int VolumePkcs5;
|
int VolumePkcs5;
|
||||||
int VolumePin;
|
int VolumePim;
|
||||||
HWND hwndDlg;
|
HWND hwndDlg;
|
||||||
} EXPAND_VOL_THREAD_PARAMS;
|
} EXPAND_VOL_THREAD_PARAMS;
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ extern volatile BOOL bVolTransformThreadCancel; /* TRUE if the user cancels/paus
|
|||||||
uint64 GetVolumeDataAreaSize (uint64 volumeSize, BOOL legacyVolume);
|
uint64 GetVolumeDataAreaSize (uint64 volumeSize, BOOL legacyVolume);
|
||||||
uint64 GetVolumeSizeByDataAreaSize (uint64 dataSize, BOOL legacyVolume);
|
uint64 GetVolumeSizeByDataAreaSize (uint64 dataSize, BOOL legacyVolume);
|
||||||
int QueryVolumeInfo (HWND hwndDlg, const char *lpszVolume, uint64 * pHostSizeFree, uint64 * pSizeLimitFS );
|
int QueryVolumeInfo (HWND hwndDlg, const char *lpszVolume, uint64 * pHostSizeFree, uint64 * pSizeLimitFS );
|
||||||
int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5, int pin);
|
int MountVolTemp (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5, int pim);
|
||||||
BOOL GetFileSystemType(const char *szFileName, enum EV_FileSystem *pFS);
|
BOOL GetFileSystemType(const char *szFileName, enum EV_FileSystem *pFS);
|
||||||
BOOL GetNtfsNumberOfSectors(char *rootPath, uint64 *pNumberOfSectors, DWORD *pBytesPerSector);
|
BOOL GetNtfsNumberOfSectors(char *rootPath, uint64 *pNumberOfSectors, DWORD *pBytesPerSector);
|
||||||
void __cdecl volTransformThreadFunction (void *hwndDlgArg);
|
void __cdecl volTransformThreadFunction (void *hwndDlgArg);
|
||||||
|
@ -392,7 +392,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
WORD lw = LOWORD (wParam);
|
WORD lw = LOWORD (wParam);
|
||||||
static Password *szXPwd;
|
static Password *szXPwd;
|
||||||
static int *pkcs5;
|
static int *pkcs5;
|
||||||
static int *pin;
|
static int *pim;
|
||||||
static BOOL* truecryptMode;
|
static BOOL* truecryptMode;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
@ -402,7 +402,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
int i, nIndex;
|
int i, nIndex;
|
||||||
szXPwd = ((PasswordDlgParam *) lParam) -> password;
|
szXPwd = ((PasswordDlgParam *) lParam) -> password;
|
||||||
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
|
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
|
||||||
pin = ((PasswordDlgParam *) lParam) -> pin;
|
pim = ((PasswordDlgParam *) lParam) -> pim;
|
||||||
truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
|
truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
|
||||||
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
|
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
|
||||||
DragAcceptFiles (hwndDlg, TRUE);
|
DragAcceptFiles (hwndDlg, TRUE);
|
||||||
@ -447,7 +447,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
||||||
|
|
||||||
SetPin (hwndDlg, IDC_PIM, *pin);
|
SetPim (hwndDlg, IDC_PIM, *pim);
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
|
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), FALSE);
|
||||||
|
|
||||||
SetPin (hwndDlg, IDC_PIM, *pin);
|
SetPim (hwndDlg, IDC_PIM, *pim);
|
||||||
|
|
||||||
bPrebootPasswordDlgMode = TRUE;
|
bPrebootPasswordDlgMode = TRUE;
|
||||||
}
|
}
|
||||||
@ -661,9 +661,9 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
|
|
||||||
GetWindowText (GetDlgItem (hwndDlg, IDC_PIM), tmp, MAX_PIM + 1);
|
GetWindowText (GetDlgItem (hwndDlg, IDC_PIM), tmp, MAX_PIM + 1);
|
||||||
if (strlen(tmp))
|
if (strlen(tmp))
|
||||||
*pin = (int) strtol(tmp, NULL, 10); /* IDC_PIM is configured to accept only numbers */
|
*pim = (int) strtol(tmp, NULL, 10); /* IDC_PIM is configured to accept only numbers */
|
||||||
else
|
else
|
||||||
*pin = 0;
|
*pim = 0;
|
||||||
|
|
||||||
/* SHA-256 is not supported by TrueCrypt */
|
/* SHA-256 is not supported by TrueCrypt */
|
||||||
if ( (*truecryptMode)
|
if ( (*truecryptMode)
|
||||||
@ -675,7 +675,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( (*truecryptMode)
|
if ( (*truecryptMode)
|
||||||
&& (*pin != 0)
|
&& (*pim != 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
||||||
@ -779,7 +779,7 @@ int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pin, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
|
int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
PasswordDlgParam dlgParam;
|
PasswordDlgParam dlgParam;
|
||||||
@ -789,7 +789,7 @@ int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *p
|
|||||||
|
|
||||||
dlgParam.password = password;
|
dlgParam.password = password;
|
||||||
dlgParam.pkcs5 = pkcs5;
|
dlgParam.pkcs5 = pkcs5;
|
||||||
dlgParam.pin = pin;
|
dlgParam.pim = pim;
|
||||||
dlgParam.truecryptMode = truecryptMode;
|
dlgParam.truecryptMode = truecryptMode;
|
||||||
|
|
||||||
result = DialogBoxParamW (hInst,
|
result = DialogBoxParamW (hInst,
|
||||||
@ -800,7 +800,7 @@ int ExtcvAskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *p
|
|||||||
{
|
{
|
||||||
password->Length = 0;
|
password->Length = 0;
|
||||||
*pkcs5 = 0;
|
*pkcs5 = 0;
|
||||||
*pin = 0;
|
*pim = 0;
|
||||||
*truecryptMode = FALSE;
|
*truecryptMode = FALSE;
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
||||||
|
@ -570,7 +570,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
|
|||||||
FIRST_MODE_OF_OPERATION_ID,
|
FIRST_MODE_OF_OPERATION_ID,
|
||||||
volParams->password,
|
volParams->password,
|
||||||
volParams->pkcs5,
|
volParams->pkcs5,
|
||||||
volParams->pin,
|
volParams->pim,
|
||||||
wipePass == 0 ? NULL : (char *) cryptoInfo->master_keydata,
|
wipePass == 0 ? NULL : (char *) cryptoInfo->master_keydata,
|
||||||
&cryptoInfo,
|
&cryptoInfo,
|
||||||
dataAreaSize,
|
dataAreaSize,
|
||||||
@ -610,7 +610,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
|
|||||||
|
|
||||||
/* Now we will try to decrypt the backup header to verify it has been correctly written. */
|
/* Now we will try to decrypt the backup header to verify it has been correctly written. */
|
||||||
|
|
||||||
nStatus = OpenBackupHeader (dev, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pin, &cryptoInfo2, NULL, deviceSize);
|
nStatus = OpenBackupHeader (dev, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, &cryptoInfo2, NULL, deviceSize);
|
||||||
|
|
||||||
if (nStatus != ERR_SUCCESS
|
if (nStatus != ERR_SUCCESS
|
||||||
|| cryptoInfo->EncryptedAreaStart.Value != cryptoInfo2->EncryptedAreaStart.Value
|
|| cryptoInfo->EncryptedAreaStart.Value != cryptoInfo2->EncryptedAreaStart.Value
|
||||||
@ -726,7 +726,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
|||||||
char *devicePath = volParams->volumePath;
|
char *devicePath = volParams->volumePath;
|
||||||
Password *password = volParams->password;
|
Password *password = volParams->password;
|
||||||
int pkcs5_prf = volParams->pkcs5;
|
int pkcs5_prf = volParams->pkcs5;
|
||||||
int pin = volParams->pin;
|
int pim = volParams->pim;
|
||||||
DISK_GEOMETRY driveGeometry;
|
DISK_GEOMETRY driveGeometry;
|
||||||
HWND hwndDlg = volParams->hwndDlg;
|
HWND hwndDlg = volParams->hwndDlg;
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
|||||||
sectorSize = driveGeometry.BytesPerSector;
|
sectorSize = driveGeometry.BytesPerSector;
|
||||||
|
|
||||||
|
|
||||||
nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pin, &masterCryptoInfo, headerCryptoInfo, deviceSize);
|
nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pim, &masterCryptoInfo, headerCryptoInfo, deviceSize);
|
||||||
|
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto closing_seq;
|
goto closing_seq;
|
||||||
@ -1050,7 +1050,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
|||||||
headerCryptoInfo->mode,
|
headerCryptoInfo->mode,
|
||||||
password,
|
password,
|
||||||
masterCryptoInfo->pkcs5,
|
masterCryptoInfo->pkcs5,
|
||||||
pin,
|
pim,
|
||||||
(char *) masterCryptoInfo->master_keydata,
|
(char *) masterCryptoInfo->master_keydata,
|
||||||
&tmpCryptoInfo,
|
&tmpCryptoInfo,
|
||||||
masterCryptoInfo->VolumeSize.Value,
|
masterCryptoInfo->VolumeSize.Value,
|
||||||
@ -1201,7 +1201,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
|
|||||||
Password *password = volParams->password;
|
Password *password = volParams->password;
|
||||||
HWND hwndDlg = volParams->hwndDlg;
|
HWND hwndDlg = volParams->hwndDlg;
|
||||||
int pkcs5_prf = volParams->pkcs5;
|
int pkcs5_prf = volParams->pkcs5;
|
||||||
int pin = volParams->pin;
|
int pim = volParams->pim;
|
||||||
DISK_GEOMETRY driveGeometry;
|
DISK_GEOMETRY driveGeometry;
|
||||||
|
|
||||||
|
|
||||||
@ -1295,7 +1295,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pin, &masterCryptoInfo, headerCryptoInfo, deviceSize);
|
nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pim, &masterCryptoInfo, headerCryptoInfo, deviceSize);
|
||||||
|
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto closing_seq;
|
goto closing_seq;
|
||||||
@ -2085,7 +2085,7 @@ int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pin, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize)
|
static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER offset;
|
LARGE_INTEGER offset;
|
||||||
DWORD n;
|
DWORD n;
|
||||||
@ -2111,7 +2111,7 @@ static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *passw
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pin, FALSE, retMasterCryptoInfo, headerCryptoInfo);
|
nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pim, FALSE, retMasterCryptoInfo, headerCryptoInfo);
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto closing_seq;
|
goto closing_seq;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ static int ConcealNTFS (HANDLE dev);
|
|||||||
BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId wipeAlgorithm, BOOL bDecrypting);
|
BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId wipeAlgorithm, BOOL bDecrypting);
|
||||||
static void ExportProgressStats (__int64 bytesDone, __int64 totalSize);
|
static void ExportProgressStats (__int64 bytesDone, __int64 totalSize);
|
||||||
int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount);
|
int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount);
|
||||||
static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pin, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize);
|
static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize);
|
||||||
BOOL MoveClustersBeforeThreshold (HANDLE volumeHandle, PWSTR volumeDevicePath, int64 clusterThreshold);
|
BOOL MoveClustersBeforeThreshold (HANDLE volumeHandle, PWSTR volumeDevicePath, int64 clusterThreshold);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -229,7 +229,7 @@ Password volumePassword; /* User password */
|
|||||||
char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */
|
char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */
|
||||||
char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */
|
char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */
|
||||||
|
|
||||||
int volumePin = 0;
|
int volumePim = 0;
|
||||||
|
|
||||||
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
|
BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */
|
||||||
BOOL ComServerMode = FALSE;
|
BOOL ComServerMode = FALSE;
|
||||||
@ -280,7 +280,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
if (device.Path == szDevicePath)
|
if (device.Path == szDevicePath)
|
||||||
{
|
{
|
||||||
OpenVolumeContext volume;
|
OpenVolumeContext volume;
|
||||||
int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePin, FALSE, FALSE, FALSE, TRUE);
|
int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE);
|
||||||
|
|
||||||
if ( status == ERR_SUCCESS)
|
if ( status == ERR_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -326,7 +326,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
|
|
||||||
OpenVolumeContext volume;
|
OpenVolumeContext volume;
|
||||||
|
|
||||||
if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePin, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS)
|
if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS)
|
||||||
{
|
{
|
||||||
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
|
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
|
||||||
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
|
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
|
||||||
@ -382,7 +382,7 @@ static void WipePasswordsAndKeyfiles (void)
|
|||||||
burn (&szVerify[0], sizeof (szVerify));
|
burn (&szVerify[0], sizeof (szVerify));
|
||||||
burn (&volumePassword, sizeof (volumePassword));
|
burn (&volumePassword, sizeof (volumePassword));
|
||||||
burn (&szRawPassword[0], sizeof (szRawPassword));
|
burn (&szRawPassword[0], sizeof (szRawPassword));
|
||||||
burn (&volumePin, sizeof (volumePin));
|
burn (&volumePim, sizeof (volumePim));
|
||||||
|
|
||||||
SetWindowText (hPasswordInputField, "");
|
SetWindowText (hPasswordInputField, "");
|
||||||
SetWindowText (hVerifyPasswordInputField, "");
|
SetWindowText (hVerifyPasswordInputField, "");
|
||||||
@ -2555,7 +2555,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
|
|||||||
volParams->sectorSize = GetFormatSectorSize();
|
volParams->sectorSize = GetFormatSectorSize();
|
||||||
volParams->realClusterSize = &realClusterSize;
|
volParams->realClusterSize = &realClusterSize;
|
||||||
volParams->password = &volumePassword;
|
volParams->password = &volumePassword;
|
||||||
volParams->pin = volumePin;
|
volParams->pim = volumePim;
|
||||||
volParams->hwndDlg = hwndDlg;
|
volParams->hwndDlg = hwndDlg;
|
||||||
|
|
||||||
if (bInPlaceDecNonSys)
|
if (bInPlaceDecNonSys)
|
||||||
@ -2627,7 +2627,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
|
|||||||
if (bHiddenVolHost && !bVolTransformThreadCancel && nStatus == 0)
|
if (bHiddenVolHost && !bVolTransformThreadCancel && nStatus == 0)
|
||||||
{
|
{
|
||||||
/* Auto mount the newly created hidden volume host */
|
/* Auto mount the newly created hidden volume host */
|
||||||
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, FALSE))
|
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, FALSE))
|
||||||
{
|
{
|
||||||
case ERR_NO_FREE_DRIVES:
|
case ERR_NO_FREE_DRIVES:
|
||||||
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
|
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
|
||||||
@ -2748,7 +2748,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg)
|
|||||||
// Clear the outer volume password
|
// Clear the outer volume password
|
||||||
memset(&szVerify[0], 0, sizeof (szVerify));
|
memset(&szVerify[0], 0, sizeof (szVerify));
|
||||||
memset(&szRawPassword[0], 0, sizeof (szRawPassword));
|
memset(&szRawPassword[0], 0, sizeof (szRawPassword));
|
||||||
memset(&volumePin, 0, sizeof (volumePin));
|
memset(&volumePim, 0, sizeof (volumePim));
|
||||||
|
|
||||||
MessageBeep (MB_OK);
|
MessageBeep (MB_OK);
|
||||||
}
|
}
|
||||||
@ -3538,14 +3538,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
WORD lw = LOWORD (wParam);
|
WORD lw = LOWORD (wParam);
|
||||||
WORD hw = HIWORD (wParam);
|
WORD hw = HIWORD (wParam);
|
||||||
static BOOL PinValueChangedWarning = FALSE;
|
static BOOL PimValueChangedWarning = FALSE;
|
||||||
|
|
||||||
hCurPage = hwndDlg;
|
hCurPage = hwndDlg;
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
PinValueChangedWarning = FALSE;
|
PimValueChangedWarning = FALSE;
|
||||||
LocalizeDialog (hwndDlg, "IDD_VOL_CREATION_WIZARD_DLG");
|
LocalizeDialog (hwndDlg, "IDD_VOL_CREATION_WIZARD_DLG");
|
||||||
|
|
||||||
UpdateLastDialogId ();
|
UpdateLastDialogId ();
|
||||||
@ -4128,10 +4128,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT));
|
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT));
|
||||||
|
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
||||||
if (volumePin > 0)
|
if (volumePim > 0)
|
||||||
{
|
{
|
||||||
char szTmp[MAX_PIM + 1];
|
char szTmp[MAX_PIM + 1];
|
||||||
StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin);
|
StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePim);
|
||||||
SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
|
SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4242,13 +4242,13 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
case PIM_PAGE:
|
case PIM_PAGE:
|
||||||
{
|
{
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0);
|
||||||
if (volumePin > 0)
|
if (volumePim > 0)
|
||||||
{
|
{
|
||||||
char szTmp[MAX_PIM + 1];
|
char szTmp[MAX_PIM + 1];
|
||||||
StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin);
|
StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePim);
|
||||||
SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
|
SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp);
|
||||||
|
|
||||||
PinValueChangedWarning = TRUE;
|
PimValueChangedWarning = TRUE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5002,7 +5002,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
if (PinValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) )
|
if (PimValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) )
|
||||||
{
|
{
|
||||||
// we're about to draw the static
|
// we're about to draw the static
|
||||||
// set the text colour in (HDC)lParam
|
// set the text colour in (HDC)lParam
|
||||||
@ -5396,14 +5396,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (lw == IDC_PIM)
|
if (lw == IDC_PIM)
|
||||||
{
|
{
|
||||||
if(GetPin (hwndDlg, IDC_PIM) != 0)
|
if(GetPim (hwndDlg, IDC_PIM) != 0)
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = TRUE;
|
PimValueChangedWarning = TRUE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = FALSE;
|
PimValueChangedWarning = FALSE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5415,14 +5415,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
if (lw == IDC_PIM)
|
if (lw == IDC_PIM)
|
||||||
{
|
{
|
||||||
if(GetPin (hwndDlg, IDC_PIM) != 0)
|
if(GetPim (hwndDlg, IDC_PIM) != 0)
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = TRUE;
|
PimValueChangedWarning = TRUE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = FALSE;
|
PimValueChangedWarning = FALSE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7146,19 +7146,19 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
else if (nCurPageNo == PIM_PAGE)
|
else if (nCurPageNo == PIM_PAGE)
|
||||||
{
|
{
|
||||||
volumePin = GetPin (hCurPage, IDC_PIM);
|
volumePim = GetPim (hCurPage, IDC_PIM);
|
||||||
|
|
||||||
if (volumePassword.Length > 0)
|
if (volumePassword.Length > 0)
|
||||||
{
|
{
|
||||||
// Password character encoding
|
// Password character encoding
|
||||||
if (SysEncInEffect() && (volumePin > MAX_BOOT_PIM_VALUE))
|
if (SysEncInEffect() && (volumePim > MAX_BOOT_PIM_VALUE))
|
||||||
{
|
{
|
||||||
SetFocus (GetDlgItem(hCurPage, IDC_PIM));
|
SetFocus (GetDlgItem(hCurPage, IDC_PIM));
|
||||||
Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
|
Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
|
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
|
||||||
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePin, SysEncInEffect(), TRUE))
|
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), TRUE))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -7192,7 +7192,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
||||||
|
|
||||||
volumePin = GetPin (hCurPage, IDC_PIM);
|
volumePim = GetPim (hCurPage, IDC_PIM);
|
||||||
|
|
||||||
// Store the password in case we need to restore it after keyfile is applied to it
|
// Store the password in case we need to restore it after keyfile is applied to it
|
||||||
GetWindowText (GetDlgItem (hCurPage, IDC_PASSWORD_DIRECT), szRawPassword, sizeof (szRawPassword));
|
GetWindowText (GetDlgItem (hCurPage, IDC_PASSWORD_DIRECT), szRawPassword, sizeof (szRawPassword));
|
||||||
@ -7231,7 +7231,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
// Mount the hidden volume host as read-only (to ensure consistent and secure
|
// Mount the hidden volume host as read-only (to ensure consistent and secure
|
||||||
// results of the volume bitmap scanning)
|
// results of the volume bitmap scanning)
|
||||||
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, TRUE))
|
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE))
|
||||||
{
|
{
|
||||||
case ERR_NO_FREE_DRIVES:
|
case ERR_NO_FREE_DRIVES:
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
@ -7399,7 +7399,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
// Check that it is not a hidden or legacy volume
|
// Check that it is not a hidden or legacy volume
|
||||||
|
|
||||||
if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
||||||
{
|
{
|
||||||
NormalCursor();
|
NormalCursor();
|
||||||
return 1;
|
return 1;
|
||||||
@ -7441,7 +7441,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
mountOptions.UseBackupHeader = TRUE; // This must be TRUE at this point (we won't be using the regular header, which will be lost soon after the decryption process starts)
|
mountOptions.UseBackupHeader = TRUE; // This must be TRUE at this point (we won't be using the regular header, which will be lost soon after the decryption process starts)
|
||||||
|
|
||||||
if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
||||||
{
|
{
|
||||||
NormalCursor();
|
NormalCursor();
|
||||||
return 1;
|
return 1;
|
||||||
@ -7507,7 +7507,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
WaitCursor();
|
WaitCursor();
|
||||||
BootEncObj->PrepareInstallation (!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePin, "");
|
BootEncObj->PrepareInstallation (!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePim, "");
|
||||||
}
|
}
|
||||||
catch (Exception &e)
|
catch (Exception &e)
|
||||||
{
|
{
|
||||||
@ -8053,7 +8053,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
// Remount the hidden volume host as read-only (to ensure consistent and secure
|
// Remount the hidden volume host as read-only (to ensure consistent and secure
|
||||||
// results of the volume bitmap scanning)
|
// results of the volume bitmap scanning)
|
||||||
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, TRUE))
|
switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE))
|
||||||
{
|
{
|
||||||
case ERR_NO_FREE_DRIVES:
|
case ERR_NO_FREE_DRIVES:
|
||||||
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
|
MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND);
|
||||||
@ -8301,7 +8301,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
else if (nCurPageNo == PIM_PAGE)
|
else if (nCurPageNo == PIM_PAGE)
|
||||||
{
|
{
|
||||||
volumePin = GetPin (hCurPage, IDC_PIM);
|
volumePim = GetPim (hCurPage, IDC_PIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|
else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE
|
||||||
@ -8878,7 +8878,7 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi
|
|||||||
|
|
||||||
|
|
||||||
// Mounts a volume within which the user intends to create a hidden volume
|
// Mounts a volume within which the user intends to create a hidden volume
|
||||||
int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pin, BOOL bReadOnly)
|
int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly)
|
||||||
{
|
{
|
||||||
MountOptions mountOptions;
|
MountOptions mountOptions;
|
||||||
ZeroMemory (&mountOptions, sizeof (mountOptions));
|
ZeroMemory (&mountOptions, sizeof (mountOptions));
|
||||||
@ -8898,7 +8898,7 @@ int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password *
|
|||||||
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
mountOptions.PartitionInInactiveSysEncScope = FALSE;
|
||||||
mountOptions.UseBackupHeader = FALSE;
|
mountOptions.UseBackupHeader = FALSE;
|
||||||
|
|
||||||
if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1)
|
||||||
{
|
{
|
||||||
*driveNo = -3;
|
*driveNo = -3;
|
||||||
return ERR_VOL_MOUNT_FAILED;
|
return ERR_VOL_MOUNT_FAILED;
|
||||||
@ -9592,7 +9592,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm
|
|||||||
VirtualLock (&volumePassword, sizeof(volumePassword));
|
VirtualLock (&volumePassword, sizeof(volumePassword));
|
||||||
VirtualLock (szVerify, sizeof(szVerify));
|
VirtualLock (szVerify, sizeof(szVerify));
|
||||||
VirtualLock (szRawPassword, sizeof(szRawPassword));
|
VirtualLock (szRawPassword, sizeof(szRawPassword));
|
||||||
VirtualLock (&volumePin, sizeof(volumePin));
|
VirtualLock (&volumePim, sizeof(volumePim));
|
||||||
|
|
||||||
VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView));
|
VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView));
|
||||||
VirtualLock (HeaderKeyGUIView, sizeof(HeaderKeyGUIView));
|
VirtualLock (HeaderKeyGUIView, sizeof(HeaderKeyGUIView));
|
||||||
|
@ -68,7 +68,7 @@ static void NonSysInplaceEncPause (void);
|
|||||||
static void NonSysInplaceEncResume (void);
|
static void NonSysInplaceEncResume (void);
|
||||||
void ShowNonSysInPlaceEncUIStatus (void);
|
void ShowNonSysInPlaceEncUIStatus (void);
|
||||||
void UpdateNonSysInPlaceEncControls (void);
|
void UpdateNonSysInPlaceEncControls (void);
|
||||||
int MountHiddenVolHost ( HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pin, BOOL bReadOnly );
|
int MountHiddenVolHost ( HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly );
|
||||||
int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters);
|
int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters);
|
||||||
int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters);
|
int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters);
|
||||||
static void WipeStart (void);
|
static void WipeStart (void);
|
||||||
|
@ -3213,9 +3213,9 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
|
|||||||
VolumePimTextCtrl->SetMaxLength( 10 );
|
VolumePimTextCtrl->SetMaxLength( 10 );
|
||||||
GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 );
|
GridBagSizer->Add( VolumePimTextCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND, 5 );
|
||||||
|
|
||||||
VolumePinHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
|
VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
VolumePinHelpStaticText->Wrap( -1 );
|
VolumePimHelpStaticText->Wrap( -1 );
|
||||||
GridBagSizer->Add( VolumePinHelpStaticText, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
GridBagSizer->Add( VolumePimHelpStaticText, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||||
|
|
||||||
CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("Cach&e passwords and keyfiles in memory "), wxDefaultPosition, wxDefaultSize, 0 );
|
CacheCheckBox = new wxCheckBox( this, wxID_ANY, _("Cach&e passwords and keyfiles in memory "), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
GridBagSizer->Add( CacheCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
GridBagSizer->Add( CacheCheckBox, wxGBPosition( 4, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
@ -3349,9 +3349,9 @@ VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID i
|
|||||||
VolumePimTextCtrl->SetMaxLength( 10 );
|
VolumePimTextCtrl->SetMaxLength( 10 );
|
||||||
PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 );
|
PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 );
|
||||||
|
|
||||||
VolumePinHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
|
VolumePimHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
VolumePinHelpStaticText->Wrap( -1 );
|
VolumePimHelpStaticText->Wrap( -1 );
|
||||||
PimSizer->Add( VolumePinHelpStaticText, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
PimSizer->Add( VolumePimHelpStaticText, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
PimPanelSizer->Add( PimSizer, 1, wxEXPAND, 5 );
|
PimPanelSizer->Add( PimSizer, 1, wxEXPAND, 5 );
|
||||||
|
@ -962,7 +962,7 @@ namespace VeraCrypt
|
|||||||
wxTextCtrl* ConfirmPasswordTextCtrl;
|
wxTextCtrl* ConfirmPasswordTextCtrl;
|
||||||
wxStaticText* VolumePimStaticText;
|
wxStaticText* VolumePimStaticText;
|
||||||
wxTextCtrl* VolumePimTextCtrl;
|
wxTextCtrl* VolumePimTextCtrl;
|
||||||
wxStaticText* VolumePinHelpStaticText;
|
wxStaticText* VolumePimHelpStaticText;
|
||||||
wxCheckBox* CacheCheckBox;
|
wxCheckBox* CacheCheckBox;
|
||||||
wxCheckBox* DisplayPasswordCheckBox;
|
wxCheckBox* DisplayPasswordCheckBox;
|
||||||
wxCheckBox* UseKeyfilesCheckBox;
|
wxCheckBox* UseKeyfilesCheckBox;
|
||||||
@ -1023,7 +1023,7 @@ namespace VeraCrypt
|
|||||||
wxBoxSizer* PimSizer;
|
wxBoxSizer* PimSizer;
|
||||||
wxStaticText* VolumePimStaticText;
|
wxStaticText* VolumePimStaticText;
|
||||||
wxTextCtrl* VolumePimTextCtrl;
|
wxTextCtrl* VolumePimTextCtrl;
|
||||||
wxStaticText* VolumePinHelpStaticText;
|
wxStaticText* VolumePimHelpStaticText;
|
||||||
wxStaticText* InfoStaticText;
|
wxStaticText* InfoStaticText;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
@ -26056,7 +26056,7 @@
|
|||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">VolumePinHelpStaticText</property>
|
<property name="name">VolumePimHelpStaticText</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
@ -27402,7 +27402,7 @@
|
|||||||
<property name="minimize_button">0</property>
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
<property name="moveable">1</property>
|
<property name="moveable">1</property>
|
||||||
<property name="name">VolumePinHelpStaticText</property>
|
<property name="name">VolumePimHelpStaticText</property>
|
||||||
<property name="pane_border">1</property>
|
<property name="pane_border">1</property>
|
||||||
<property name="pane_position"></property>
|
<property name="pane_position"></property>
|
||||||
<property name="pane_size"></property>
|
<property name="pane_size"></property>
|
||||||
|
@ -57,7 +57,7 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
VolumePimStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
VolumePimStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
||||||
VolumePimTextCtrl->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
VolumePimTextCtrl->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
||||||
VolumePinHelpStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
VolumePimHelpStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword)));
|
||||||
|
|
||||||
ConfirmPasswordStaticText->Show (enableConfirmation);
|
ConfirmPasswordStaticText->Show (enableConfirmation);
|
||||||
ConfirmPasswordTextCtrl->Show (enableConfirmation);
|
ConfirmPasswordTextCtrl->Show (enableConfirmation);
|
||||||
@ -78,7 +78,7 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
VolumePimStaticText->Enable (false);
|
VolumePimStaticText->Enable (false);
|
||||||
VolumePimTextCtrl->Enable (false);
|
VolumePimTextCtrl->Enable (false);
|
||||||
VolumePinHelpStaticText->Enable (false);
|
VolumePimHelpStaticText->Enable (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,12 +227,12 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
if (VolumePimTextCtrl->IsEnabled ())
|
if (VolumePimTextCtrl->IsEnabled ())
|
||||||
{
|
{
|
||||||
wxString pinStr (VolumePimTextCtrl->GetValue());
|
wxString pimStr (VolumePimTextCtrl->GetValue());
|
||||||
long pin = 0;
|
long pim = 0;
|
||||||
if (pinStr.IsEmpty())
|
if (pimStr.IsEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
if (pinStr.ToLong (&pin))
|
if (pimStr.ToLong (&pim))
|
||||||
return (int) pin;
|
return (int) pim;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -386,13 +386,13 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
if (GetVolumePim() != 0)
|
if (GetVolumePim() != 0)
|
||||||
{
|
{
|
||||||
VolumePinHelpStaticText->SetForegroundColour(*wxRED);
|
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
|
||||||
VolumePinHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
|
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolumePinHelpStaticText->SetForegroundColour(*wxBLACK);
|
VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
|
||||||
VolumePinHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
|
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -402,6 +402,6 @@ namespace VeraCrypt
|
|||||||
bool bEnablePIM = !GetTrueCryptMode ();
|
bool bEnablePIM = !GetTrueCryptMode ();
|
||||||
VolumePimStaticText->Enable (bEnablePIM);
|
VolumePimStaticText->Enable (bEnablePIM);
|
||||||
VolumePimTextCtrl->Enable (bEnablePIM);
|
VolumePimTextCtrl->Enable (bEnablePIM);
|
||||||
VolumePinHelpStaticText->Enable (bEnablePIM);
|
VolumePimHelpStaticText->Enable (bEnablePIM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,12 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
if (VolumePimTextCtrl->IsEnabled ())
|
if (VolumePimTextCtrl->IsEnabled ())
|
||||||
{
|
{
|
||||||
wxString pinStr (VolumePimTextCtrl->GetValue());
|
wxString pimStr (VolumePimTextCtrl->GetValue());
|
||||||
long pin = 0;
|
long pim = 0;
|
||||||
if (pinStr.IsEmpty())
|
if (pimStr.IsEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
if (pinStr.ToLong (&pin))
|
if (pimStr.ToLong (&pim))
|
||||||
return (int) pin;
|
return (int) pim;
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -55,13 +55,13 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
if (GetVolumePim() != 0)
|
if (GetVolumePim() != 0)
|
||||||
{
|
{
|
||||||
VolumePinHelpStaticText->SetForegroundColour(*wxRED);
|
VolumePimHelpStaticText->SetForegroundColour(*wxRED);
|
||||||
VolumePinHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
|
VolumePimHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolumePinHelpStaticText->SetForegroundColour(*wxBLACK);
|
VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
|
||||||
VolumePinHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
|
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ namespace VeraCrypt
|
|||||||
favorite.Removable = prop.removable ? true : false;
|
favorite.Removable = prop.removable ? true : false;
|
||||||
favorite.SystemEncryption = prop.partitionInInactiveSysEncScope ? true : false;
|
favorite.SystemEncryption = prop.partitionInInactiveSysEncScope ? true : false;
|
||||||
favorite.OpenExplorerWindow = (bExplore == TRUE);
|
favorite.OpenExplorerWindow = (bExplore == TRUE);
|
||||||
favorite.Pin = prop.volumePin;
|
favorite.Pim = prop.volumePim;
|
||||||
|
|
||||||
if (favorite.VolumePathId.empty()
|
if (favorite.VolumePathId.empty()
|
||||||
&& IsVolumeDeviceHosted (favorite.Path.c_str())
|
&& IsVolumeDeviceHosted (favorite.Path.c_str())
|
||||||
@ -555,9 +555,9 @@ namespace VeraCrypt
|
|||||||
/* support old attribute name before it was changed to PIM*/
|
/* support old attribute name before it was changed to PIM*/
|
||||||
XmlGetAttributeText (xml, "pin", label, sizeof (label));
|
XmlGetAttributeText (xml, "pin", label, sizeof (label));
|
||||||
}
|
}
|
||||||
favorite.Pin = strtol (label, NULL, 10);
|
favorite.Pim = strtol (label, NULL, 10);
|
||||||
if (favorite.Pin < 0)
|
if (favorite.Pim < 0)
|
||||||
favorite.Pin = 0;
|
favorite.Pim = 0;
|
||||||
|
|
||||||
char boolVal[2];
|
char boolVal[2];
|
||||||
XmlGetAttributeText (xml, "readonly", boolVal, sizeof (boolVal));
|
XmlGetAttributeText (xml, "readonly", boolVal, sizeof (boolVal));
|
||||||
@ -688,8 +688,8 @@ namespace VeraCrypt
|
|||||||
if (!favorite.Label.empty())
|
if (!favorite.Label.empty())
|
||||||
s += L" label=\"" + favorite.Label + L"\"";
|
s += L" label=\"" + favorite.Label + L"\"";
|
||||||
|
|
||||||
if (favorite.Pin > 0)
|
if (favorite.Pim > 0)
|
||||||
s += L" pim=\"" + IntToWideString(favorite.Pin) + L"\"";
|
s += L" pim=\"" + IntToWideString(favorite.Pim) + L"\"";
|
||||||
|
|
||||||
if (favorite.ReadOnly)
|
if (favorite.ReadOnly)
|
||||||
s += L" readonly=\"1\"";
|
s += L" readonly=\"1\"";
|
||||||
@ -778,10 +778,10 @@ namespace VeraCrypt
|
|||||||
|
|
||||||
static void SetControls (HWND hwndDlg, const FavoriteVolume &favorite, bool systemFavoritesMode, bool enable)
|
static void SetControls (HWND hwndDlg, const FavoriteVolume &favorite, bool systemFavoritesMode, bool enable)
|
||||||
{
|
{
|
||||||
if (favorite.Pin > 0)
|
if (favorite.Pim > 0)
|
||||||
{
|
{
|
||||||
char szTmp[MAX_PIM + 1];
|
char szTmp[MAX_PIM + 1];
|
||||||
StringCbPrintfA (szTmp, sizeof(szTmp), "%d", favorite.Pin);
|
StringCbPrintfA (szTmp, sizeof(szTmp), "%d", favorite.Pim);
|
||||||
SetDlgItemText (hwndDlg, IDC_PIM, szTmp);
|
SetDlgItemText (hwndDlg, IDC_PIM, szTmp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -841,7 +841,7 @@ namespace VeraCrypt
|
|||||||
else
|
else
|
||||||
favorite.Label.clear();
|
favorite.Label.clear();
|
||||||
|
|
||||||
favorite.Pin = GetPin (hwndDlg, IDC_PIM);
|
favorite.Pim = GetPim (hwndDlg, IDC_PIM);
|
||||||
|
|
||||||
favorite.ReadOnly = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_READONLY) != 0);
|
favorite.ReadOnly = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_READONLY) != 0);
|
||||||
favorite.Removable = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE) != 0);
|
favorite.Removable = (IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_MOUNT_REMOVABLE) != 0);
|
||||||
|
@ -17,7 +17,7 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
FavoriteVolume()
|
FavoriteVolume()
|
||||||
:
|
:
|
||||||
Pin (0),
|
Pim (0),
|
||||||
DisableHotkeyMount (false),
|
DisableHotkeyMount (false),
|
||||||
DisconnectedDevice (false),
|
DisconnectedDevice (false),
|
||||||
MountOnLogOn (false),
|
MountOnLogOn (false),
|
||||||
@ -33,7 +33,7 @@ namespace VeraCrypt
|
|||||||
string MountPoint;
|
string MountPoint;
|
||||||
string VolumePathId;
|
string VolumePathId;
|
||||||
wstring Label;
|
wstring Label;
|
||||||
int Pin;
|
int Pim;
|
||||||
|
|
||||||
bool DisableHotkeyMount;
|
bool DisableHotkeyMount;
|
||||||
bool DisconnectedDevice;
|
bool DisconnectedDevice;
|
||||||
|
@ -173,13 +173,13 @@ class TrueCryptMainCom : public ITrueCryptMainCom
|
|||||||
return ERR_OUTOFMEMORY;
|
return ERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, LONG_PTR hWnd)
|
virtual int STDMETHODCALLTYPE ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, LONG_PTR hWnd)
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
CW2A volumePathA(volumePath);
|
CW2A volumePathA(volumePath);
|
||||||
MainDlg = (HWND) hWnd;
|
MainDlg = (HWND) hWnd;
|
||||||
if (volumePathA.m_psz)
|
if (volumePathA.m_psz)
|
||||||
return ::ChangePwd (volumePathA.m_psz, oldPassword, old_pkcs5, old_pin, truecryptMode, newPassword, pkcs5, pin, wipePassCount, (HWND) hWnd);
|
return ::ChangePwd (volumePathA.m_psz, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (HWND) hWnd);
|
||||||
else
|
else
|
||||||
return ERR_OUTOFMEMORY;
|
return ERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
@ -297,7 +297,7 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg)
|
extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg)
|
||||||
{
|
{
|
||||||
CComPtr<ITrueCryptMainCom> tc;
|
CComPtr<ITrueCryptMainCom> tc;
|
||||||
int r;
|
int r;
|
||||||
@ -313,7 +313,7 @@ extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, int old_pk
|
|||||||
{
|
{
|
||||||
volumeBstr.Attach (bstr);
|
volumeBstr.Attach (bstr);
|
||||||
|
|
||||||
r = tc->ChangePasswordEx3 (volumeBstr, oldPassword, old_pkcs5, old_pin, truecryptMode, newPassword, pkcs5, pin, wipePassCount, (LONG_PTR) hwndDlg);
|
r = tc->ChangePasswordEx3 (volumeBstr, oldPassword, old_pkcs5, old_pim, truecryptMode, newPassword, pkcs5, pim, wipePassCount, (LONG_PTR) hwndDlg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
r = ERR_OUTOFMEMORY;
|
r = ERR_OUTOFMEMORY;
|
||||||
|
@ -22,7 +22,7 @@ extern "C" {
|
|||||||
BOOL ComServerMain ();
|
BOOL ComServerMain ();
|
||||||
int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
|
int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
|
||||||
int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
|
int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
|
||||||
int UacChangePwd (char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg);
|
int UacChangePwd (char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ library TrueCryptMainCom
|
|||||||
DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value);
|
DWORD WriteLocalMachineRegistryDwordValue (BSTR keyPath, BSTR valueName, DWORD value);
|
||||||
int ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd);
|
int ChangePasswordEx (BSTR volumePath, Password *oldPassword, int old_pkcs5, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd);
|
||||||
int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd);
|
int ChangePasswordEx2 (BSTR volumePath, Password *oldPassword, int old_pkcs5, BOOL truecryptMode, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd);
|
||||||
int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, LONG_PTR hWnd);
|
int ChangePasswordEx3 (BSTR volumePath, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, LONG_PTR hWnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -124,8 +124,8 @@ Password VolumePassword; /* Password used for mounting volumes */
|
|||||||
Password CmdVolumePassword; /* Password passed from command line */
|
Password CmdVolumePassword; /* Password passed from command line */
|
||||||
int VolumePkcs5 = 0;
|
int VolumePkcs5 = 0;
|
||||||
int CmdVolumePkcs5 = 0;
|
int CmdVolumePkcs5 = 0;
|
||||||
int VolumePin = 0;
|
int VolumePim = 0;
|
||||||
int CmdVolumePin = 0;
|
int CmdVolumePim = 0;
|
||||||
int DefaultVolumePkcs5 = 0;
|
int DefaultVolumePkcs5 = 0;
|
||||||
BOOL VolumeTrueCryptMode = FALSE;
|
BOOL VolumeTrueCryptMode = FALSE;
|
||||||
BOOL CmdVolumeTrueCryptMode = FALSE;
|
BOOL CmdVolumeTrueCryptMode = FALSE;
|
||||||
@ -223,8 +223,8 @@ static void localcleanup (void)
|
|||||||
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&CmdVolumePkcs5, sizeof (CmdVolumePkcs5));
|
burn (&CmdVolumePkcs5, sizeof (CmdVolumePkcs5));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&CmdVolumePin, sizeof (CmdVolumePin));
|
burn (&CmdVolumePim, sizeof (CmdVolumePim));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&CmdVolumeTrueCryptMode, sizeof (CmdVolumeTrueCryptMode));
|
burn (&CmdVolumeTrueCryptMode, sizeof (CmdVolumeTrueCryptMode));
|
||||||
burn (&mountOptions, sizeof (mountOptions));
|
burn (&mountOptions, sizeof (mountOptions));
|
||||||
@ -737,7 +737,7 @@ void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, BOOL*
|
|||||||
{
|
{
|
||||||
defaultMountOptions.ProtectHiddenVolume = FALSE;
|
defaultMountOptions.ProtectHiddenVolume = FALSE;
|
||||||
defaultMountOptions.ProtectedHidVolPkcs5Prf = 0;
|
defaultMountOptions.ProtectedHidVolPkcs5Prf = 0;
|
||||||
defaultMountOptions.ProtectedHidVolPin = 0;
|
defaultMountOptions.ProtectedHidVolPim = 0;
|
||||||
defaultMountOptions.PartitionInInactiveSysEncScope = FALSE;
|
defaultMountOptions.PartitionInInactiveSysEncScope = FALSE;
|
||||||
defaultMountOptions.RecoveryMode = FALSE;
|
defaultMountOptions.RecoveryMode = FALSE;
|
||||||
defaultMountOptions.UseBackupHeader = FALSE;
|
defaultMountOptions.UseBackupHeader = FALSE;
|
||||||
@ -1776,10 +1776,10 @@ typedef struct
|
|||||||
{
|
{
|
||||||
Password *oldPassword;
|
Password *oldPassword;
|
||||||
int old_pkcs5;
|
int old_pkcs5;
|
||||||
int old_pin;
|
int old_pim;
|
||||||
Password *newPassword;
|
Password *newPassword;
|
||||||
int pkcs5;
|
int pkcs5;
|
||||||
int pin;
|
int pim;
|
||||||
int wipePassCount;
|
int wipePassCount;
|
||||||
BOOL truecryptMode;
|
BOOL truecryptMode;
|
||||||
int* pnStatus;
|
int* pnStatus;
|
||||||
@ -1806,7 +1806,7 @@ void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
*pThreadParam->pnStatus = BootEncObj->ChangePassword (pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pin, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pin, pThreadParam->wipePassCount, hwndDlg);
|
*pThreadParam->pnStatus = BootEncObj->ChangePassword (pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
|
||||||
}
|
}
|
||||||
catch (Exception &e)
|
catch (Exception &e)
|
||||||
{
|
{
|
||||||
@ -1818,14 +1818,14 @@ void CALLBACK ChangePwdWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
{
|
{
|
||||||
// Non-system
|
// Non-system
|
||||||
|
|
||||||
*pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pin, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pin, pThreadParam->wipePassCount, hwndDlg);
|
*pThreadParam->pnStatus = ChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
|
||||||
|
|
||||||
if (*pThreadParam->pnStatus == ERR_OS_ERROR
|
if (*pThreadParam->pnStatus == ERR_OS_ERROR
|
||||||
&& GetLastError () == ERROR_ACCESS_DENIED
|
&& GetLastError () == ERROR_ACCESS_DENIED
|
||||||
&& IsUacSupported ()
|
&& IsUacSupported ()
|
||||||
&& IsVolumeDeviceHosted (szFileName))
|
&& IsVolumeDeviceHosted (szFileName))
|
||||||
{
|
{
|
||||||
*pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pin, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pin, pThreadParam->wipePassCount, hwndDlg);
|
*pThreadParam->pnStatus = UacChangePwd (szFileName, pThreadParam->oldPassword, pThreadParam->old_pkcs5, pThreadParam->old_pim, pThreadParam->truecryptMode, pThreadParam->newPassword, pThreadParam->pkcs5, pThreadParam->pim, pThreadParam->wipePassCount, hwndDlg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1873,7 +1873,7 @@ void CALLBACK RestoreHeaderWaitThreadProc(void* pArg, HWND hwndDlg)
|
|||||||
BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static KeyFilesDlgParam newKeyFilesParam;
|
static KeyFilesDlgParam newKeyFilesParam;
|
||||||
static BOOL PinValueChangedWarning = FALSE;
|
static BOOL PimValueChangedWarning = FALSE;
|
||||||
static int* NewPimValuePtr = NULL;
|
static int* NewPimValuePtr = NULL;
|
||||||
|
|
||||||
WORD lw = LOWORD (wParam);
|
WORD lw = LOWORD (wParam);
|
||||||
@ -1890,7 +1890,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
NewPimValuePtr = (int*) lParam;
|
NewPimValuePtr = (int*) lParam;
|
||||||
|
|
||||||
PinValueChangedWarning = FALSE;
|
PimValueChangedWarning = FALSE;
|
||||||
|
|
||||||
ZeroMemory (&newKeyFilesParam, sizeof (newKeyFilesParam));
|
ZeroMemory (&newKeyFilesParam, sizeof (newKeyFilesParam));
|
||||||
|
|
||||||
@ -2122,7 +2122,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
case WM_CTLCOLORSTATIC:
|
case WM_CTLCOLORSTATIC:
|
||||||
{
|
{
|
||||||
if (PinValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) )
|
if (PimValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) )
|
||||||
{
|
{
|
||||||
// we're about to draw the static
|
// we're about to draw the static
|
||||||
// set the text colour in (HDC)lParam
|
// set the text colour in (HDC)lParam
|
||||||
@ -2167,14 +2167,14 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
if (lw == IDC_PIM)
|
if (lw == IDC_PIM)
|
||||||
{
|
{
|
||||||
if(GetPin (hwndDlg, IDC_OLD_PIM) != GetPin (hwndDlg, IDC_PIM))
|
if(GetPim (hwndDlg, IDC_OLD_PIM) != GetPim (hwndDlg, IDC_PIM))
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = TRUE;
|
PimValueChangedWarning = TRUE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (bSysEncPwdChangeDlgMode? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (bSysEncPwdChangeDlgMode? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PinValueChangedWarning = FALSE;
|
PimValueChangedWarning = FALSE;
|
||||||
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2293,10 +2293,10 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
if (lw == IDC_TRUECRYPT_MODE)
|
if (lw == IDC_TRUECRYPT_MODE)
|
||||||
{
|
{
|
||||||
BOOL bEnablePin = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
|
BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDT_OLD_PIM), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDT_OLD_PIM), bEnablePim);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM), bEnablePim);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM_HELP), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_OLD_PIM_HELP), bEnablePim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI)
|
if (lw == IDC_SHOW_PASSWORD_CHPWD_ORI)
|
||||||
@ -2341,15 +2341,15 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
||||||
BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
|
BOOL truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
|
||||||
|
|
||||||
int old_pin = GetPin (hwndDlg, IDC_OLD_PIM);
|
int old_pim = GetPim (hwndDlg, IDC_OLD_PIM);
|
||||||
int pin = GetPin (hwndDlg, IDC_PIM);
|
int pim = GetPim (hwndDlg, IDC_PIM);
|
||||||
|
|
||||||
if (truecryptMode && (old_pkcs5 == SHA256))
|
if (truecryptMode && (old_pkcs5 == SHA256))
|
||||||
{
|
{
|
||||||
Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
Error ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (truecryptMode && (old_pin != 0))
|
else if (truecryptMode && (old_pim != 0))
|
||||||
{
|
{
|
||||||
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
||||||
return 1;
|
return 1;
|
||||||
@ -2361,7 +2361,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bSysEncPwdChangeDlgMode && (pin > MAX_BOOT_PIM_VALUE))
|
if (bSysEncPwdChangeDlgMode && (pim > MAX_BOOT_PIM_VALUE))
|
||||||
{
|
{
|
||||||
SetFocus (GetDlgItem(hwndDlg, IDC_PIM));
|
SetFocus (GetDlgItem(hwndDlg, IDC_PIM));
|
||||||
Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
|
Error ("PIM_SYSENC_TOO_BIG", hwndDlg);
|
||||||
@ -2375,7 +2375,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL)
|
else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL)
|
||||||
&& pwdChangeDlgMode == PCDM_CHANGE_PASSWORD)
|
&& pwdChangeDlgMode == PCDM_CHANGE_PASSWORD)
|
||||||
{
|
{
|
||||||
if (!CheckPasswordLength (hwndDlg, GetWindowTextLength(GetDlgItem (hwndDlg, IDC_PASSWORD)), pin, bSysEncPwdChangeDlgMode, FALSE))
|
if (!CheckPasswordLength (hwndDlg, GetWindowTextLength(GetDlgItem (hwndDlg, IDC_PASSWORD)), pim, bSysEncPwdChangeDlgMode, FALSE))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2391,7 +2391,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
case PCDM_CHANGE_PKCS5_PRF:
|
case PCDM_CHANGE_PKCS5_PRF:
|
||||||
memcpy (newPassword.Text, oldPassword.Text, sizeof (newPassword.Text));
|
memcpy (newPassword.Text, oldPassword.Text, sizeof (newPassword.Text));
|
||||||
newPassword.Length = (unsigned __int32) strlen ((char *) oldPassword.Text);
|
newPassword.Length = (unsigned __int32) strlen ((char *) oldPassword.Text);
|
||||||
pin = old_pin;
|
pim = old_pim;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2416,10 +2416,10 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
ChangePwdThreadParam changePwdParam;
|
ChangePwdThreadParam changePwdParam;
|
||||||
changePwdParam.oldPassword = &oldPassword;
|
changePwdParam.oldPassword = &oldPassword;
|
||||||
changePwdParam.old_pkcs5 = old_pkcs5;
|
changePwdParam.old_pkcs5 = old_pkcs5;
|
||||||
changePwdParam.old_pin = old_pin;
|
changePwdParam.old_pim = old_pim;
|
||||||
changePwdParam.newPassword = &newPassword;
|
changePwdParam.newPassword = &newPassword;
|
||||||
changePwdParam.pkcs5 = pkcs5;
|
changePwdParam.pkcs5 = pkcs5;
|
||||||
changePwdParam.pin = pin;
|
changePwdParam.pim = pim;
|
||||||
changePwdParam.wipePassCount = GetWipePassCount(headerWiperMode);
|
changePwdParam.wipePassCount = GetWipePassCount(headerWiperMode);
|
||||||
changePwdParam.pnStatus = &nStatus;
|
changePwdParam.pnStatus = &nStatus;
|
||||||
changePwdParam.truecryptMode = truecryptMode;
|
changePwdParam.truecryptMode = truecryptMode;
|
||||||
@ -2430,16 +2430,16 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
|
|||||||
// notify the caller in case the PIM has changed
|
// notify the caller in case the PIM has changed
|
||||||
if (NewPimValuePtr)
|
if (NewPimValuePtr)
|
||||||
{
|
{
|
||||||
if (pin != old_pin)
|
if (pim != old_pim)
|
||||||
*NewPimValuePtr = pin;
|
*NewPimValuePtr = pim;
|
||||||
else
|
else
|
||||||
*NewPimValuePtr = -1;
|
*NewPimValuePtr = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
burn (&oldPassword, sizeof (oldPassword));
|
burn (&oldPassword, sizeof (oldPassword));
|
||||||
burn (&newPassword, sizeof (newPassword));
|
burn (&newPassword, sizeof (newPassword));
|
||||||
burn (&old_pin, sizeof(old_pin));
|
burn (&old_pim, sizeof(old_pim));
|
||||||
burn (&pin, sizeof(pin));
|
burn (&pim, sizeof(pim));
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
|
|
||||||
@ -2483,7 +2483,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
WORD lw = LOWORD (wParam);
|
WORD lw = LOWORD (wParam);
|
||||||
static Password *szXPwd;
|
static Password *szXPwd;
|
||||||
static int *pkcs5;
|
static int *pkcs5;
|
||||||
static int *pin;
|
static int *pim;
|
||||||
static BOOL* truecryptMode;
|
static BOOL* truecryptMode;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
@ -2493,7 +2493,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
int i, nIndex, defaultPrfIndex = 0;
|
int i, nIndex, defaultPrfIndex = 0;
|
||||||
szXPwd = ((PasswordDlgParam *) lParam) -> password;
|
szXPwd = ((PasswordDlgParam *) lParam) -> password;
|
||||||
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
|
pkcs5 = ((PasswordDlgParam *) lParam) -> pkcs5;
|
||||||
pin = ((PasswordDlgParam *) lParam) -> pin;
|
pim = ((PasswordDlgParam *) lParam) -> pim;
|
||||||
truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
|
truecryptMode = ((PasswordDlgParam *) lParam) -> truecryptMode;
|
||||||
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
|
LocalizeDialog (hwndDlg, "IDD_PASSWORD_DLG");
|
||||||
DragAcceptFiles (hwndDlg, TRUE);
|
DragAcceptFiles (hwndDlg, TRUE);
|
||||||
@ -2544,7 +2544,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_CACHE), BM_SETCHECK, bCacheInDriver ? BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0);
|
||||||
|
|
||||||
SetPin (hwndDlg, IDC_PIM, *pin);
|
SetPim (hwndDlg, IDC_PIM, *pim);
|
||||||
|
|
||||||
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
|
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable);
|
||||||
|
|
||||||
@ -2646,7 +2646,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES_ENABLE), FALSE);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES), FALSE);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_KEYFILES), FALSE);
|
||||||
|
|
||||||
SetPin (hwndDlg, IDC_PIM, *pin);
|
SetPim (hwndDlg, IDC_PIM, *pim);
|
||||||
|
|
||||||
bPrebootPasswordDlgMode = TRUE;
|
bPrebootPasswordDlgMode = TRUE;
|
||||||
}
|
}
|
||||||
@ -2699,8 +2699,8 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
/* Use default PRF specified by the user if any */
|
/* Use default PRF specified by the user if any */
|
||||||
if (mountOptions.ProtectedHidVolPkcs5Prf == 0)
|
if (mountOptions.ProtectedHidVolPkcs5Prf == 0)
|
||||||
mountOptions.ProtectedHidVolPkcs5Prf = *pkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = *pkcs5;
|
||||||
if (mountOptions.ProtectedHidVolPin == 0)
|
if (mountOptions.ProtectedHidVolPim == 0)
|
||||||
mountOptions.ProtectedHidVolPin = *pin;
|
mountOptions.ProtectedHidVolPim = *pim;
|
||||||
DialogBoxParamW (hInst,
|
DialogBoxParamW (hInst,
|
||||||
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
||||||
(DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions);
|
(DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions);
|
||||||
@ -2723,10 +2723,10 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
if (lw == IDC_TRUECRYPT_MODE)
|
if (lw == IDC_TRUECRYPT_MODE)
|
||||||
{
|
{
|
||||||
BOOL bEnablePin = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
|
BOOL bEnablePim = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE) ? FALSE: TRUE;
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), bEnablePim);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), bEnablePim);
|
||||||
EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), bEnablePin);
|
EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), bEnablePim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lw == IDC_KEY_FILES)
|
if (lw == IDC_KEY_FILES)
|
||||||
@ -2771,7 +2771,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
*pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
*pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
||||||
*truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
|
*truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE);
|
||||||
|
|
||||||
*pin = GetPin (hwndDlg, IDC_PIM);
|
*pim = GetPim (hwndDlg, IDC_PIM);
|
||||||
|
|
||||||
/* SHA-256 is not supported by TrueCrypt */
|
/* SHA-256 is not supported by TrueCrypt */
|
||||||
if ( (*truecryptMode)
|
if ( (*truecryptMode)
|
||||||
@ -2783,7 +2783,7 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( (*truecryptMode)
|
if ( (*truecryptMode)
|
||||||
&& (*pin != 0)
|
&& (*pim != 0)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
Error ("PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE", hwndDlg);
|
||||||
@ -3182,7 +3182,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
|||||||
if (mountOptions->ProtectedHidVolPassword.Length > 0)
|
if (mountOptions->ProtectedHidVolPassword.Length > 0)
|
||||||
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), (LPSTR) mountOptions->ProtectedHidVolPassword.Text);
|
SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), (LPSTR) mountOptions->ProtectedHidVolPassword.Text);
|
||||||
|
|
||||||
SetPin (hwndDlg, IDC_PIM, mountOptions->ProtectedHidVolPin);
|
SetPim (hwndDlg, IDC_PIM, mountOptions->ProtectedHidVolPim);
|
||||||
|
|
||||||
ToHyperlink (hwndDlg, IDC_LINK_HIDVOL_PROTECTION_INFO);
|
ToHyperlink (hwndDlg, IDC_LINK_HIDVOL_PROTECTION_INFO);
|
||||||
|
|
||||||
@ -3278,7 +3278,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
|||||||
mountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
|
mountOptions->ProtectedHidVolPkcs5Prf = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
|
||||||
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
|
||||||
|
|
||||||
mountOptions->ProtectedHidVolPin = GetPin (hwndDlg, IDC_PIM);
|
mountOptions->ProtectedHidVolPim = GetPim (hwndDlg, IDC_PIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
@ -3601,7 +3601,7 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
|
|||||||
|
|
||||||
// PKCS 5 PRF
|
// PKCS 5 PRF
|
||||||
ListItemAddW (list, i, GetString ("PKCS5_PRF"));
|
ListItemAddW (list, i, GetString ("PKCS5_PRF"));
|
||||||
if (prop.volumePin == 0)
|
if (prop.volumePim == 0)
|
||||||
ListSubItemSet (list, i++, 1, get_pkcs5_prf_name (prop.pkcs5));
|
ListSubItemSet (list, i++, 1, get_pkcs5_prf_name (prop.pkcs5));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4098,7 +4098,7 @@ LPARAM GetItemLong (HWND hTree, int itemNo)
|
|||||||
return item.lParam;
|
return item.lParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pin, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
|
static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int *pim, BOOL* truecryptMode, char *titleStringId, BOOL enableMountOptions)
|
||||||
{
|
{
|
||||||
INT_PTR result;
|
INT_PTR result;
|
||||||
PasswordDlgParam dlgParam;
|
PasswordDlgParam dlgParam;
|
||||||
@ -4108,7 +4108,7 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
|
|||||||
|
|
||||||
dlgParam.password = password;
|
dlgParam.password = password;
|
||||||
dlgParam.pkcs5 = pkcs5;
|
dlgParam.pkcs5 = pkcs5;
|
||||||
dlgParam.pin = pin;
|
dlgParam.pim = pim;
|
||||||
dlgParam.truecryptMode = truecryptMode;
|
dlgParam.truecryptMode = truecryptMode;
|
||||||
|
|
||||||
result = DialogBoxParamW (hInst,
|
result = DialogBoxParamW (hInst,
|
||||||
@ -4119,7 +4119,7 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
|
|||||||
{
|
{
|
||||||
password->Length = 0;
|
password->Length = 0;
|
||||||
*pkcs5 = 0;
|
*pkcs5 = 0;
|
||||||
*pin = 0;
|
*pim = 0;
|
||||||
*truecryptMode = FALSE;
|
*truecryptMode = FALSE;
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
||||||
@ -4130,13 +4130,13 @@ static int AskVolumePassword (HWND hwndDlg, Password *password, int *pkcs5, int
|
|||||||
|
|
||||||
// GUI actions
|
// GUI actions
|
||||||
|
|
||||||
static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pim)
|
||||||
{
|
{
|
||||||
BOOL status = FALSE;
|
BOOL status = FALSE;
|
||||||
char fileName[MAX_PATH];
|
char fileName[MAX_PATH];
|
||||||
int mounted = 0, EffectiveVolumePkcs5 = CmdVolumePkcs5;
|
int mounted = 0, EffectiveVolumePkcs5 = CmdVolumePkcs5;
|
||||||
BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
|
BOOL EffectiveVolumeTrueCryptMode = CmdVolumeTrueCryptMode;
|
||||||
int EffectiveVolumePin = (pin < 0)? CmdVolumePin : pin;
|
int EffectiveVolumePim = (pim < 0)? CmdVolumePim : pim;
|
||||||
BOOL bEffectiveCacheDuringMultipleMount = bCmdCacheDuringMultipleMount? TRUE: bCacheDuringMultipleMount;
|
BOOL bEffectiveCacheDuringMultipleMount = bCmdCacheDuringMultipleMount? TRUE: bCacheDuringMultipleMount;
|
||||||
|
|
||||||
/* Priority is given to command line parameters
|
/* Priority is given to command line parameters
|
||||||
@ -4157,7 +4157,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
VolumePassword.Length = 0;
|
VolumePassword.Length = 0;
|
||||||
VolumePkcs5 = 0;
|
VolumePkcs5 = 0;
|
||||||
VolumeTrueCryptMode = FALSE;
|
VolumeTrueCryptMode = FALSE;
|
||||||
VolumePin = 0;
|
VolumePim = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (szFileName == NULL)
|
if (szFileName == NULL)
|
||||||
@ -4193,11 +4193,11 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
// First try cached passwords and if they fail ask user for a new one
|
// First try cached passwords and if they fail ask user for a new one
|
||||||
WaitCursor ();
|
WaitCursor ();
|
||||||
|
|
||||||
// try TrueCrypt mode first since it is quick, only if pin = 0
|
// try TrueCrypt mode first since it is quick, only if pim = 0
|
||||||
if (EffectiveVolumePin == 0)
|
if (EffectiveVolumePim == 0)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
if (!mounted)
|
if (!mounted)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, EffectiveVolumePin, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, 0, EffectiveVolumePim, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
|
|
||||||
// If keyfiles are enabled, test empty password first
|
// If keyfiles are enabled, test empty password first
|
||||||
if (!mounted && KeyFilesEnable && FirstKeyFile)
|
if (!mounted && KeyFilesEnable && FirstKeyFile)
|
||||||
@ -4206,11 +4206,11 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
emptyPassword.Length = 0;
|
emptyPassword.Length = 0;
|
||||||
|
|
||||||
KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile);
|
KeyFilesApply (hwndDlg, &emptyPassword, FirstKeyFile);
|
||||||
// try TrueCrypt mode first since it is quick, only if pin = 0
|
// try TrueCrypt mode first since it is quick, only if pim = 0
|
||||||
if (EffectiveVolumePin == 0)
|
if (EffectiveVolumePim == 0)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
if (!mounted)
|
if (!mounted)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, EffectiveVolumePin, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &emptyPassword, 0, EffectiveVolumePim, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
|
|
||||||
burn (&emptyPassword, sizeof (emptyPassword));
|
burn (&emptyPassword, sizeof (emptyPassword));
|
||||||
}
|
}
|
||||||
@ -4218,11 +4218,11 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
// Test password and/or keyfiles used for the previous volume
|
// Test password and/or keyfiles used for the previous volume
|
||||||
if (!mounted && bEffectiveCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
|
if (!mounted && bEffectiveCacheDuringMultipleMount && MultipleMountOperationInProgress && VolumePassword.Length != 0)
|
||||||
{
|
{
|
||||||
// try TrueCrypt mode first as it is quick, only if pin = 0
|
// try TrueCrypt mode first as it is quick, only if pim = 0
|
||||||
if (EffectiveVolumePin == 0)
|
if (EffectiveVolumePim == 0)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, 0, TRUE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
if (!mounted)
|
if (!mounted)
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, EffectiveVolumePin, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, 0, EffectiveVolumePim, FALSE, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
@ -4242,25 +4242,25 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
VolumePassword = CmdVolumePassword;
|
VolumePassword = CmdVolumePassword;
|
||||||
VolumePkcs5 = EffectiveVolumePkcs5;
|
VolumePkcs5 = EffectiveVolumePkcs5;
|
||||||
VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
||||||
VolumePin = EffectiveVolumePin;
|
VolumePim = EffectiveVolumePim;
|
||||||
}
|
}
|
||||||
else if (!Silent)
|
else if (!Silent)
|
||||||
{
|
{
|
||||||
int GuiPkcs5 = EffectiveVolumePkcs5;
|
int GuiPkcs5 = EffectiveVolumePkcs5;
|
||||||
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
||||||
int GuiPin = EffectiveVolumePin;
|
int GuiPim = EffectiveVolumePim;
|
||||||
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName);
|
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), szFileName);
|
||||||
|
|
||||||
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPin, &GuiTrueCryptMode, NULL, TRUE))
|
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
|
||||||
goto ret;
|
goto ret;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolumePkcs5 = GuiPkcs5;
|
VolumePkcs5 = GuiPkcs5;
|
||||||
VolumeTrueCryptMode = GuiTrueCryptMode;
|
VolumeTrueCryptMode = GuiTrueCryptMode;
|
||||||
VolumePin = GuiPin;
|
VolumePim = GuiPim;
|
||||||
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
||||||
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
||||||
burn (&GuiPin, sizeof(GuiPin));
|
burn (&GuiPim, sizeof(GuiPim));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4269,7 +4269,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
if (KeyFilesEnable)
|
if (KeyFilesEnable)
|
||||||
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
||||||
|
|
||||||
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePin, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent);
|
mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, !Silent);
|
||||||
NormalCursor ();
|
NormalCursor ();
|
||||||
|
|
||||||
// Check for legacy non-ASCII passwords
|
// Check for legacy non-ASCII passwords
|
||||||
@ -4285,7 +4285,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
}
|
}
|
||||||
|
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
@ -4321,7 +4321,7 @@ static BOOL Mount (HWND hwndDlg, int nDosDriveNo, char *szFileName, int pin)
|
|||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
}
|
}
|
||||||
|
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
@ -4551,18 +4551,18 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
|
|||||||
{
|
{
|
||||||
int GuiPkcs5 = EffectiveVolumePkcs5;
|
int GuiPkcs5 = EffectiveVolumePkcs5;
|
||||||
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
||||||
int GuiPin = CmdVolumePin;
|
int GuiPim = CmdVolumePim;
|
||||||
PasswordDlgVolume[0] = '\0';
|
PasswordDlgVolume[0] = '\0';
|
||||||
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPin, &GuiTrueCryptMode, NULL, TRUE))
|
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
|
||||||
goto ret;
|
goto ret;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolumePkcs5 = GuiPkcs5;
|
VolumePkcs5 = GuiPkcs5;
|
||||||
VolumeTrueCryptMode = GuiTrueCryptMode;
|
VolumeTrueCryptMode = GuiTrueCryptMode;
|
||||||
VolumePin = GuiPin;
|
VolumePim = GuiPim;
|
||||||
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
||||||
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
||||||
burn (&GuiPin, sizeof(GuiPin));
|
burn (&GuiPim, sizeof(GuiPim));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (CmdVolumePasswordValid)
|
else if (CmdVolumePasswordValid)
|
||||||
@ -4571,7 +4571,7 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
|
|||||||
VolumePassword = CmdVolumePassword;
|
VolumePassword = CmdVolumePassword;
|
||||||
VolumePkcs5 = EffectiveVolumePkcs5;
|
VolumePkcs5 = EffectiveVolumePkcs5;
|
||||||
VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
VolumeTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
||||||
VolumePin = CmdVolumePin;
|
VolumePim = CmdVolumePim;
|
||||||
}
|
}
|
||||||
|
|
||||||
WaitCursor();
|
WaitCursor();
|
||||||
@ -4625,8 +4625,8 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
|
|||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
// First try user password then cached passwords
|
// First try user password then cached passwords
|
||||||
if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePin, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, TRUE, FALSE)) > 0
|
if ((mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, TRUE, FALSE)) > 0
|
||||||
|| (mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePin, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, TRUE, FALSE)) > 0)
|
|| (mounted = MountVolume (hwndDlg, nDosDriveNo, szFileName, NULL, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, TRUE, FALSE)) > 0)
|
||||||
{
|
{
|
||||||
// A volume has been successfully mounted
|
// A volume has been successfully mounted
|
||||||
|
|
||||||
@ -4706,7 +4706,7 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
|
|||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
||||||
}
|
}
|
||||||
@ -4744,7 +4744,7 @@ static BOOL MountAllDevicesThreadCode (HWND hwndDlg, BOOL bPasswordPrompt)
|
|||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
||||||
|
|
||||||
@ -4837,7 +4837,7 @@ static void ChangePassword (HWND hwndDlg)
|
|||||||
if (favorite->Path == szFileName)
|
if (favorite->Path == szFileName)
|
||||||
{
|
{
|
||||||
bFavoriteFound = true;
|
bFavoriteFound = true;
|
||||||
favorite->Pin = newPimValue;
|
favorite->Pim = newPimValue;
|
||||||
SaveFavoriteVolumes (hwndDlg, FavoriteVolumes, false);
|
SaveFavoriteVolumes (hwndDlg, FavoriteVolumes, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -4851,7 +4851,7 @@ static void ChangePassword (HWND hwndDlg)
|
|||||||
if (favorite->Path == szFileName)
|
if (favorite->Path == szFileName)
|
||||||
{
|
{
|
||||||
bFavoriteFound = true;
|
bFavoriteFound = true;
|
||||||
favorite->Pin = newPimValue;
|
favorite->Pim = newPimValue;
|
||||||
|
|
||||||
if (AskYesNo("FAVORITE_PIM_CHANGED", hwndDlg) == IDYES)
|
if (AskYesNo("FAVORITE_PIM_CHANGED", hwndDlg) == IDYES)
|
||||||
{
|
{
|
||||||
@ -5801,7 +5801,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
|
EffectiveVolumeTrueCryptMode = DefaultVolumeTrueCryptMode;
|
||||||
|
|
||||||
// Cached password
|
// Cached password
|
||||||
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePin, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, NULL, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, Silent, FALSE);
|
||||||
|
|
||||||
// Command line password or keyfiles
|
// Command line password or keyfiles
|
||||||
if (!mounted && (CmdVolumePassword.Length != 0 || FirstCmdKeyFile))
|
if (!mounted && (CmdVolumePassword.Length != 0 || FirstCmdKeyFile))
|
||||||
@ -5812,7 +5812,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
KeyFilesApply (hwndDlg, &CmdVolumePassword, FirstCmdKeyFile);
|
KeyFilesApply (hwndDlg, &CmdVolumePassword, FirstCmdKeyFile);
|
||||||
|
|
||||||
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A',
|
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A',
|
||||||
szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePin, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount,
|
szFileName, &CmdVolumePassword, EffectiveVolumePkcs5, CmdVolumePim, EffectiveVolumeTrueCryptMode, bCacheInDriver, bForceMount,
|
||||||
&mountOptions, Silent, reportBadPasswd);
|
&mountOptions, Silent, reportBadPasswd);
|
||||||
|
|
||||||
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
burn (&CmdVolumePassword, sizeof (CmdVolumePassword));
|
||||||
@ -5828,20 +5828,20 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
while (!mounted && !Silent)
|
while (!mounted && !Silent)
|
||||||
{
|
{
|
||||||
int GuiPkcs5 = EffectiveVolumePkcs5;
|
int GuiPkcs5 = EffectiveVolumePkcs5;
|
||||||
int GuiPin = CmdVolumePin;
|
int GuiPim = CmdVolumePim;
|
||||||
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
BOOL GuiTrueCryptMode = EffectiveVolumeTrueCryptMode;
|
||||||
VolumePassword.Length = 0;
|
VolumePassword.Length = 0;
|
||||||
|
|
||||||
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume),szFileName);
|
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume),szFileName);
|
||||||
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPin, &GuiTrueCryptMode, NULL, TRUE))
|
if (!AskVolumePassword (hwndDlg, &VolumePassword, &GuiPkcs5, &GuiPim, &GuiTrueCryptMode, NULL, TRUE))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VolumePkcs5 = GuiPkcs5;
|
VolumePkcs5 = GuiPkcs5;
|
||||||
VolumePin = GuiPin;
|
VolumePim = GuiPim;
|
||||||
VolumeTrueCryptMode = GuiTrueCryptMode;
|
VolumeTrueCryptMode = GuiTrueCryptMode;
|
||||||
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
burn (&GuiPkcs5, sizeof(GuiPkcs5));
|
||||||
burn (&GuiPin, sizeof(GuiPin));
|
burn (&GuiPim, sizeof(GuiPim));
|
||||||
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
burn (&GuiTrueCryptMode, sizeof(GuiTrueCryptMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5850,11 +5850,11 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
if (KeyFilesEnable && FirstKeyFile)
|
if (KeyFilesEnable && FirstKeyFile)
|
||||||
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
||||||
|
|
||||||
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, &VolumePassword, VolumePkcs5, VolumePin, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, FALSE, TRUE);
|
mounted = MountVolume (hwndDlg, szDriveLetter[0] - 'A', szFileName, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, bCacheInDriver, bForceMount, &mountOptions, FALSE, TRUE);
|
||||||
|
|
||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
burn (&mountOptions.ProtectedHidVolPassword, sizeof (mountOptions.ProtectedHidVolPassword));
|
||||||
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
burn (&mountOptions.ProtectedHidVolPkcs5Prf, sizeof (mountOptions.ProtectedHidVolPkcs5Prf));
|
||||||
@ -6574,7 +6574,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
||||||
else
|
else
|
||||||
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
||||||
mountOptions.ProtectedHidVolPin = CmdVolumePin;
|
mountOptions.ProtectedHidVolPim = CmdVolumePim;
|
||||||
|
|
||||||
if (IDCANCEL == DialogBoxParamW (hInst,
|
if (IDCANCEL == DialogBoxParamW (hInst,
|
||||||
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
||||||
@ -7722,7 +7722,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
|||||||
CommandWipeCache,
|
CommandWipeCache,
|
||||||
OptionPkcs5,
|
OptionPkcs5,
|
||||||
OptionTrueCryptMode,
|
OptionTrueCryptMode,
|
||||||
OptionPin,
|
OptionPim,
|
||||||
};
|
};
|
||||||
|
|
||||||
argument args[]=
|
argument args[]=
|
||||||
@ -7740,7 +7740,7 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
|||||||
{ OptionLetter, "/letter", "/l", FALSE },
|
{ OptionLetter, "/letter", "/l", FALSE },
|
||||||
{ OptionMountOption, "/mountoption", "/m", FALSE },
|
{ OptionMountOption, "/mountoption", "/m", FALSE },
|
||||||
{ OptionPassword, "/password", "/p", FALSE },
|
{ OptionPassword, "/password", "/p", FALSE },
|
||||||
{ OptionPin, "/pin", NULL, FALSE },
|
{ OptionPim, "/pim", NULL, FALSE },
|
||||||
{ OptionQuit, "/quit", "/q", FALSE },
|
{ OptionQuit, "/quit", "/q", FALSE },
|
||||||
{ OptionSilent, "/silent", "/s", FALSE },
|
{ OptionSilent, "/silent", "/s", FALSE },
|
||||||
{ OptionTokenLib, "/tokenlib", NULL, FALSE },
|
{ OptionTokenLib, "/tokenlib", NULL, FALSE },
|
||||||
@ -8026,17 +8026,17 @@ void ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OptionPin:
|
case OptionPim:
|
||||||
{
|
{
|
||||||
char szTmp[32] = {0};
|
char szTmp[32] = {0};
|
||||||
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs,
|
||||||
&i, nNoCommandLineArgs, szTmp, sizeof (szTmp)))
|
&i, nNoCommandLineArgs, szTmp, sizeof (szTmp)))
|
||||||
{
|
{
|
||||||
char* endPtr = NULL;
|
char* endPtr = NULL;
|
||||||
CmdVolumePin = (int) strtol(szTmp, &endPtr, 0);
|
CmdVolumePim = (int) strtol(szTmp, &endPtr, 0);
|
||||||
if (CmdVolumePin < 0 || endPtr == szTmp || *endPtr != '\0')
|
if (CmdVolumePim < 0 || endPtr == szTmp || *endPtr != '\0')
|
||||||
{
|
{
|
||||||
CmdVolumePin = 0;
|
CmdVolumePim = 0;
|
||||||
AbortProcess ("COMMAND_LINE_ERROR");
|
AbortProcess ("COMMAND_LINE_ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8348,7 +8348,7 @@ void DismountIdleVolumes ()
|
|||||||
&& prop.pkcs5 >= FIRST_PRF_ID && prop.pkcs5 <= LAST_PRF_ID
|
&& prop.pkcs5 >= FIRST_PRF_ID && prop.pkcs5 <= LAST_PRF_ID
|
||||||
&& prop.pkcs5Iterations > 0
|
&& prop.pkcs5Iterations > 0
|
||||||
&& prop.hiddenVolProtection >= 0 && prop.volFormatVersion >= 0
|
&& prop.hiddenVolProtection >= 0 && prop.volFormatVersion >= 0
|
||||||
&& prop.volumePin >= 0
|
&& prop.volumePim >= 0
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -8479,7 +8479,7 @@ BOOL MountFavoriteVolumes (BOOL systemFavorites, BOOL logOnMount, BOOL hotKeyMou
|
|||||||
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
||||||
else
|
else
|
||||||
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
||||||
mountOptions.ProtectedHidVolPin = CmdVolumePin;
|
mountOptions.ProtectedHidVolPim = CmdVolumePim;
|
||||||
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), MainDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions) == IDCANCEL)
|
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), MainDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions) == IDCANCEL)
|
||||||
{
|
{
|
||||||
status = FALSE;
|
status = FALSE;
|
||||||
@ -8489,7 +8489,7 @@ BOOL MountFavoriteVolumes (BOOL systemFavorites, BOOL logOnMount, BOOL hotKeyMou
|
|||||||
|
|
||||||
BOOL prevReadOnly = mountOptions.ReadOnly;
|
BOOL prevReadOnly = mountOptions.ReadOnly;
|
||||||
|
|
||||||
if (!Mount (MainDlg, drive, (char *) favorite.Path.c_str(), favorite.Pin))
|
if (!Mount (MainDlg, drive, (char *) favorite.Path.c_str(), favorite.Pim))
|
||||||
status = FALSE;
|
status = FALSE;
|
||||||
|
|
||||||
if (status && mountOptions.ReadOnly != prevReadOnly)
|
if (status && mountOptions.ReadOnly != prevReadOnly)
|
||||||
@ -8532,7 +8532,7 @@ BOOL MountFavoriteVolumes (BOOL systemFavorites, BOOL logOnMount, BOOL hotKeyMou
|
|||||||
MultipleMountOperationInProgress = FALSE;
|
MultipleMountOperationInProgress = FALSE;
|
||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
|
|
||||||
if (status && CloseSecurityTokenSessionsAfterMount)
|
if (status && CloseSecurityTokenSessionsAfterMount)
|
||||||
@ -8739,7 +8739,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
|
|||||||
OpenVolumeContext volume;
|
OpenVolumeContext volume;
|
||||||
OpenVolumeContext hiddenVolume;
|
OpenVolumeContext hiddenVolume;
|
||||||
Password hiddenVolPassword;
|
Password hiddenVolPassword;
|
||||||
int hiddenVolPkcs5 = 0, hiddenVolPin = 0;
|
int hiddenVolPkcs5 = 0, hiddenVolPim = 0;
|
||||||
byte temporaryKey[MASTER_KEYDATA_SIZE];
|
byte temporaryKey[MASTER_KEYDATA_SIZE];
|
||||||
byte originalK2[MASTER_KEYDATA_SIZE];
|
byte originalK2[MASTER_KEYDATA_SIZE];
|
||||||
|
|
||||||
@ -8786,11 +8786,11 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
|
|||||||
OpenVolumeContext *askVol = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolume : &volume);
|
OpenVolumeContext *askVol = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolume : &volume);
|
||||||
Password *askPassword = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPassword : &VolumePassword);
|
Password *askPassword = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPassword : &VolumePassword);
|
||||||
int* askPkcs5 = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPkcs5 : &VolumePkcs5);
|
int* askPkcs5 = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPkcs5 : &VolumePkcs5);
|
||||||
int* askPin = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPin : &VolumePin);
|
int* askPim = (type == TC_VOLUME_TYPE_HIDDEN ? &hiddenVolPim : &VolumePim);
|
||||||
|
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if (!AskVolumePassword (hwndDlg, askPassword, askPkcs5, askPin, &VolumeTrueCryptMode, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE))
|
if (!AskVolumePassword (hwndDlg, askPassword, askPkcs5, askPim, &VolumeTrueCryptMode, type == TC_VOLUME_TYPE_HIDDEN ? "ENTER_HIDDEN_VOL_PASSWORD" : "ENTER_NORMAL_VOL_PASSWORD", FALSE))
|
||||||
{
|
{
|
||||||
nStatus = ERR_SUCCESS;
|
nStatus = ERR_SUCCESS;
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -8801,7 +8801,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
|
|||||||
if (KeyFilesEnable && FirstKeyFile)
|
if (KeyFilesEnable && FirstKeyFile)
|
||||||
KeyFilesApply (hwndDlg, askPassword, FirstKeyFile);
|
KeyFilesApply (hwndDlg, askPassword, FirstKeyFile);
|
||||||
|
|
||||||
nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPin, VolumeTrueCryptMode, FALSE, bPreserveTimestamp, FALSE);
|
nStatus = OpenVolume (askVol, lpszVolume, askPassword, *askPkcs5, *askPim, VolumeTrueCryptMode, FALSE, bPreserveTimestamp, FALSE);
|
||||||
|
|
||||||
NormalCursor();
|
NormalCursor();
|
||||||
|
|
||||||
@ -8918,14 +8918,14 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Store header encrypted with a new key
|
// Store header encrypted with a new key
|
||||||
nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePin, FALSE);
|
nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE);
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (hiddenVolume.VolumeIsOpen)
|
if (hiddenVolume.VolumeIsOpen)
|
||||||
{
|
{
|
||||||
nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
|
nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
|
||||||
FALSE, hiddenVolume.CryptoInfo, &hiddenVolPassword, hiddenVolPin, FALSE);
|
FALSE, hiddenVolume.CryptoInfo, &hiddenVolPassword, hiddenVolPim, FALSE);
|
||||||
|
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
@ -8958,7 +8958,7 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const char *lps
|
|||||||
|
|
||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
burn (&hiddenVolPassword, sizeof (hiddenVolPassword));
|
burn (&hiddenVolPassword, sizeof (hiddenVolPassword));
|
||||||
burn (temporaryKey, sizeof (temporaryKey));
|
burn (temporaryKey, sizeof (temporaryKey));
|
||||||
@ -9061,7 +9061,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), lpszVolume);
|
StringCbCopyA (PasswordDlgVolume, sizeof(PasswordDlgVolume), lpszVolume);
|
||||||
if (!AskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePin, &VolumeTrueCryptMode, NULL, FALSE))
|
if (!AskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePim, &VolumeTrueCryptMode, NULL, FALSE))
|
||||||
{
|
{
|
||||||
nStatus = ERR_SUCCESS;
|
nStatus = ERR_SUCCESS;
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -9072,7 +9072,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
if (KeyFilesEnable && FirstKeyFile)
|
if (KeyFilesEnable && FirstKeyFile)
|
||||||
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile);
|
||||||
|
|
||||||
nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePin, VolumeTrueCryptMode,TRUE, bPreserveTimestamp, TRUE);
|
nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode,TRUE, bPreserveTimestamp, TRUE);
|
||||||
|
|
||||||
NormalCursor();
|
NormalCursor();
|
||||||
|
|
||||||
@ -9095,7 +9095,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
// Create a new header with a new salt
|
// Create a new header with a new salt
|
||||||
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
|
char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
|
||||||
|
|
||||||
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, volume.CryptoInfo, &VolumePassword, VolumePin, FALSE);
|
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE);
|
||||||
if (nStatus != 0)
|
if (nStatus != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -9263,7 +9263,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
// Open the header
|
// Open the header
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
if (!AskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePin, &VolumeTrueCryptMode, "ENTER_HEADER_BACKUP_PASSWORD", FALSE))
|
if (!AskVolumePassword (hwndDlg, &VolumePassword, &VolumePkcs5, &VolumePim, &VolumeTrueCryptMode, "ENTER_HEADER_BACKUP_PASSWORD", FALSE))
|
||||||
{
|
{
|
||||||
nStatus = ERR_SUCCESS;
|
nStatus = ERR_SUCCESS;
|
||||||
goto ret;
|
goto ret;
|
||||||
@ -9279,7 +9279,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
if (type == TC_VOLUME_TYPE_HIDDEN)
|
if (type == TC_VOLUME_TYPE_HIDDEN)
|
||||||
headerOffsetBackupFile += (legacyBackup ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE);
|
headerOffsetBackupFile += (legacyBackup ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE);
|
||||||
|
|
||||||
nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePin, VolumeTrueCryptMode, &restoredCryptoInfo, NULL);
|
nStatus = ReadVolumeHeader (FALSE, buffer + headerOffsetBackupFile, &VolumePassword, VolumePkcs5, VolumePim, VolumeTrueCryptMode, &restoredCryptoInfo, NULL);
|
||||||
if (nStatus == ERR_SUCCESS)
|
if (nStatus == ERR_SUCCESS)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -9308,7 +9308,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
WaitCursor();
|
WaitCursor();
|
||||||
|
|
||||||
// Restore header encrypted with a new key
|
// Restore header encrypted with a new key
|
||||||
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, VolumePin, FALSE);
|
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, VolumePim, FALSE);
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -9327,7 +9327,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
if (!restoredCryptoInfo->LegacyVolume)
|
if (!restoredCryptoInfo->LegacyVolume)
|
||||||
{
|
{
|
||||||
// Restore backup header encrypted with a new key
|
// Restore backup header encrypted with a new key
|
||||||
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, VolumePin, FALSE);
|
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, restoredCryptoInfo, &VolumePassword, VolumePim, FALSE);
|
||||||
if (nStatus != ERR_SUCCESS)
|
if (nStatus != ERR_SUCCESS)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -9384,7 +9384,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const char *lpszVolume)
|
|||||||
|
|
||||||
burn (&VolumePassword, sizeof (VolumePassword));
|
burn (&VolumePassword, sizeof (VolumePassword));
|
||||||
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
burn (&VolumePkcs5, sizeof (VolumePkcs5));
|
||||||
burn (&VolumePin, sizeof (VolumePin));
|
burn (&VolumePim, sizeof (VolumePim));
|
||||||
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
burn (&VolumeTrueCryptMode, sizeof (VolumeTrueCryptMode));
|
||||||
RestoreDefaultKeyFilesParam();
|
RestoreDefaultKeyFilesParam();
|
||||||
RandStop (FALSE);
|
RandStop (FALSE);
|
||||||
@ -9945,7 +9945,7 @@ void MountSelectedVolume (HWND hwndDlg, BOOL mountWithOptions)
|
|||||||
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = DefaultVolumePkcs5;
|
||||||
else
|
else
|
||||||
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
mountOptions.ProtectedHidVolPkcs5Prf = CmdVolumePkcs5;
|
||||||
mountOptions.ProtectedHidVolPin = CmdVolumePin;
|
mountOptions.ProtectedHidVolPim = CmdVolumePim;
|
||||||
if (IDCANCEL == DialogBoxParamW (hInst,
|
if (IDCANCEL == DialogBoxParamW (hInst,
|
||||||
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg,
|
||||||
(DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions))
|
(DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions))
|
||||||
|
@ -52,7 +52,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
Password *password;
|
Password *password;
|
||||||
int* pkcs5;
|
int* pkcs5;
|
||||||
int* pin;
|
int* pim;
|
||||||
BOOL* truecryptMode;
|
BOOL* truecryptMode;
|
||||||
} PasswordDlgParam;
|
} PasswordDlgParam;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user