VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Format/Tcformat.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-03 15:12:29 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-03 22:06:26 (GMT)
commit061292130d7a5342077d8edb58600a538641cda1 (patch)
treebf6a00aa6c4fbae81516979f54e2fc3d7fc162a5 /src/Format/Tcformat.c
parentd1c1aa369ca0f7247b663e22bc4bef06d1531f7e (diff)
downloadVeraCrypt-061292130d7a5342077d8edb58600a538641cda1.zip
VeraCrypt-061292130d7a5342077d8edb58600a538641cda1.tar.gz
Windows: When resuming in-place encryption, add manual selection of partition possible. Display wait dialog when performing detection.
Diffstat (limited to 'src/Format/Tcformat.c')
-rw-r--r--src/Format/Tcformat.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index eabd312..2617d9b 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -253,6 +253,44 @@ volatile int NonSysInplaceEncStatus = NONSYS_INPLACE_ENC_STATUS_NONE;
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)
{
@@ -6892,27 +6930,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
/* Scan all available partitions to discover all partitions where non-system in-place
encryption has been interrupted. */
- BOOL tmpbDevice;
- DeferredNonSysInPlaceEncDevices.clear();
+ BOOL tmpbDevice;
- foreach (const HostDevice &device, GetAvailableHostDevices (true, true))
- {
- if (device.IsPartition || device.DynamicVolume)
- {
- OpenVolumeContext volume;
+ NormalCursor ();
- 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);
- }
+ ShowWaitDialog (hwndDlg, TRUE, ResumeInPlaceEncWaitThreadProc, NULL);
- CloseVolume (&volume);
- }
- }
- }
+ WaitCursor();
if (DeferredNonSysInPlaceEncDevices.empty())
{