mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-10 06:46:59 -05:00
Windows: stop auto-mount scan on mount cancellation
Add a cancel callback and batch abort flag so auto-mount-all stops after dialog cancellation. Mark MountVolume ERR_USER_ABORT with ERROR_CANCELLED so external /cancelmount also stops the scan.
This commit is contained in:
@@ -67,6 +67,7 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
|
||||
}
|
||||
#if defined(TCMOUNT) && !defined(VCEXPANDER)
|
||||
StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nUnmount a volume X:\tveracrypt.exe /q /u X");
|
||||
StringCchCatW (tmp, 8192, L"\n\nNote: /cancelmount requests cancellation of the currently active mount operation only. If auto-mount scanning is between mount attempts, the scan is not stopped by this command.");
|
||||
#endif
|
||||
SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp);
|
||||
|
||||
|
||||
@@ -8883,8 +8883,6 @@ static UINT g_wmWaitDlg = ::RegisterWindowMessage(L"VeraCryptWaitDlgMessage");
|
||||
#define WAIT_DLG_CANCEL_RETRY_TIMER_ID 1
|
||||
#define WAIT_DLG_CANCEL_RETRY_INTERVAL 250
|
||||
|
||||
typedef BOOL (CALLBACK* WaitCancelProc)(void* pArg, HWND hWaitDlg);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HWND hwnd;
|
||||
@@ -9064,7 +9062,7 @@ static LRESULT CALLBACK ShowWaitDialogParentWndProc (HWND hWnd, UINT message, WP
|
||||
}
|
||||
|
||||
|
||||
static void ShowWaitDialogEx(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, WaitCancelProc cancelCallback, void* pArg)
|
||||
void ShowWaitDialogEx(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, WaitCancelProc cancelCallback, void* pArg)
|
||||
{
|
||||
BOOL bEffectiveHideWaitingDialog = bCmdHideWaitingDialogValid? bCmdHideWaitingDialog : bHideWaitingDialog;
|
||||
WaitThreadParam threadParam;
|
||||
@@ -9512,7 +9510,10 @@ retry:
|
||||
if (mount.nReturnCode != 0)
|
||||
{
|
||||
if (mount.nReturnCode == ERR_USER_ABORT)
|
||||
{
|
||||
SetLastError (ERROR_CANCELLED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mount.nReturnCode == ERR_PASSWORD_WRONG)
|
||||
{
|
||||
|
||||
@@ -767,7 +767,9 @@ INT_PTR TextEditDialogBox (BOOL readOnly, HWND parent, const WCHAR* Title, std::
|
||||
|
||||
// Display a wait dialog while calling the provided callback with the given parameter
|
||||
typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg);
|
||||
typedef BOOL (CALLBACK* WaitCancelProc)(void* pArg, HWND hWaitDlg);
|
||||
void BringToForeground(HWND hWnd);
|
||||
void ShowWaitDialogEx(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, WaitCancelProc cancelCallback, void* pArg);
|
||||
void ShowWaitDialog(HWND hwnd, BOOL bUseHwndAsParent, WaitThreadProc callback, void* pArg);
|
||||
|
||||
// classes used to implement support for password drag-n-drop from KeePass Password Safe
|
||||
|
||||
Reference in New Issue
Block a user