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:
@@ -111,7 +111,7 @@ If it is followed by <strong>n</strong> or <strong>no</strong>: force the displa
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em>/cancelmount</em></td>
|
||||
<td>Cancels any currently running mount operation and exits without displaying a status message. The process returns exit code 0 when the cancel request is accepted by the driver, or 1 otherwise.</td>
|
||||
<td>Cancels any currently running mount operation and exits without displaying a status message. The process returns exit code 0 when the cancel request is accepted by the driver, or 1 otherwise. This switch only has an effect while a mount operation is active; if an auto-mount scan is between mount attempts, the scan is not stopped by this command.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><em>/secureDesktop</em></td>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -733,6 +733,7 @@ namespace VeraCrypt
|
||||
{
|
||||
FillFavoriteVolumesMenu();
|
||||
|
||||
::ClearFavoriteVolumeArrivalMountSuppressions ();
|
||||
FavoritesOnArrivalMountRequired.clear();
|
||||
|
||||
for (const FavoriteVolume& favorite: FavoriteVolumes)
|
||||
|
||||
+566
-108
File diff suppressed because it is too large
Load Diff
+1
-10
@@ -116,18 +116,9 @@ static BOOL CALLBACK DefaultMountParametersDlgProc (HWND hwndDlg, UINT msg, WPAR
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BOOL systemFavorites;
|
||||
BOOL logOnMount;
|
||||
BOOL hotKeyMount;
|
||||
/* Owned by the thread parameter when non-NULL. */
|
||||
VeraCrypt::FavoriteVolume* favoriteVolumeToMount;
|
||||
} mountFavoriteVolumeThreadParam;
|
||||
|
||||
void SetDriverConfigurationFlag (uint32 flag, BOOL state);
|
||||
BOOL MountFavoriteVolumes (HWND hwnd, BOOL systemFavorites = FALSE, BOOL logOnMount = FALSE, BOOL hotKeyMount = FALSE, const VeraCrypt::FavoriteVolume &favoriteVolumeToMount = VeraCrypt::FavoriteVolume());
|
||||
void __cdecl mountFavoriteVolumeThreadFunction (void *pArg);
|
||||
void ClearFavoriteVolumeArrivalMountSuppressions ();
|
||||
|
||||
// A class that represents a device based on its device ID
|
||||
class CDevice
|
||||
|
||||
Reference in New Issue
Block a user