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

Windows: When resuming in-place encryption, add manual selection of partition possible. Display wait dialog when performing detection.

This commit is contained in:
Mounir IDRASSI
2015-05-03 17:12:29 +02:00
parent d1c1aa369c
commit 061292130d

View File

@@ -253,6 +253,44 @@ volatile int NonSysInplaceEncStatus = NONSYS_INPLACE_ENC_STATUS_NONE;
vector <HostDevice> DeferredNonSysInPlaceEncDevices; vector <HostDevice> DeferredNonSysInPlaceEncDevices;
// specific definitions and implementation for support of resume operation
// in wait dialog mechanism
void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg)
{
char szDevicePath[MAX_PATH] = {0};
DeferredNonSysInPlaceEncDevices.clear();
if (IDOK != DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_RAWDEVICES_DLG), hwndDlg,
(DLGPROC) RawDevicesDlgProc, (LPARAM) & szDevicePath[0]))
{
szDevicePath[0] = 0;
}
foreach (const HostDevice &device, GetAvailableHostDevices (true, true))
{
if (device.IsPartition || device.DynamicVolume)
{
if ((strlen(szDevicePath) > 0) && (device.Path != szDevicePath))
continue;
OpenVolumeContext volume;
if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS)
{
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
{
DeferredNonSysInPlaceEncDevices.push_back (device);
}
CloseVolume (&volume);
}
}
}
}
static BOOL ElevateWholeWizardProcess (string arguments) static BOOL ElevateWholeWizardProcess (string arguments)
{ {
@@ -6893,26 +6931,12 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
encryption has been interrupted. */ encryption has been interrupted. */
BOOL tmpbDevice; BOOL tmpbDevice;
DeferredNonSysInPlaceEncDevices.clear();
foreach (const HostDevice &device, GetAvailableHostDevices (true, true)) NormalCursor ();
{
if (device.IsPartition || device.DynamicVolume)
{
OpenVolumeContext volume;
if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS) ShowWaitDialog (hwndDlg, TRUE, ResumeInPlaceEncWaitThreadProc, NULL);
{
if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0
&& volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value)
{
DeferredNonSysInPlaceEncDevices.push_back (device);
}
CloseVolume (&volume); WaitCursor();
}
}
}
if (DeferredNonSysInPlaceEncDevices.empty()) if (DeferredNonSysInPlaceEncDevices.empty())
{ {