VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-29 02:04:13 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-05-29 02:22:08 +0200
commitfdc2143bfabb1e48ea0108fcf12c2e4ad438b44e (patch)
treec44b8541b125a1c4939ff9f6e63cc2592cc8e625 /src/Common/Dlgcode.c
parent5867250820d5676a2c4925aade2baeaa30aa2b12 (diff)
downloadVeraCrypt-fdc2143bfabb1e48ea0108fcf12c2e4ad438b44e.tar.gz
VeraCrypt-fdc2143bfabb1e48ea0108fcf12c2e4ad438b44e.zip
Windows: workaround FormatEx keeping references on formatted volume by adding extra delays.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index c9d01290..bfa8a32e 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -6889,12 +6889,12 @@ retry:
return 1;
}
-
-BOOL UnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forceUnmount)
+static BOOL UnmountVolumeBase (HWND hwndDlg, int nDosDriveNo, BOOL forceUnmount, BOOL ntfsFormatCase)
{
int result;
BOOL forced = forceUnmount;
- int dismountMaxRetries = UNMOUNT_MAX_AUTO_RETRIES;
+ int dismountMaxRetries = ntfsFormatCase? 5 : UNMOUNT_MAX_AUTO_RETRIES;
+ DWORD retryDelay = ntfsFormatCase? 2000: UNMOUNT_AUTO_RETRY_DELAY;
retry:
BroadcastDeviceChange (DBT_DEVICEREMOVEPENDING, nDosDriveNo, 0);
@@ -6904,7 +6904,7 @@ retry:
result = DriverUnmountVolume (hwndDlg, nDosDriveNo, forced);
if (result == ERR_FILES_OPEN)
- Sleep (UNMOUNT_AUTO_RETRY_DELAY);
+ Sleep (retryDelay);
else
break;
@@ -6940,6 +6940,16 @@ retry:
return TRUE;
}
+BOOL UnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forceUnmount)
+{
+ return UnmountVolumeBase (hwndDlg, nDosDriveNo, forceUnmount, FALSE);
+}
+
+BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo)
+{
+ return UnmountVolumeBase (hwndDlg, nDosDriveNo, FALSE, TRUE);
+}
+
BOOL IsPasswordCacheEmpty (void)
{