mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-10-21 22:02:37 +00:00
Windows: restore drive notifications after failed dismounts
Restore notifications after silent open file failures and honor suppression. Use SHCNF_FLUSHNOWAIT to start delivery without waiting for completion.
This commit is contained in:
@@ -9806,15 +9806,16 @@ retry:
|
||||
forced = TRUE;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
// Undo SHCNE_DRIVEREMOVED
|
||||
wchar_t root[] = { (wchar_t) (nDosDriveNo + L'A'), L':', L'\\', 0 };
|
||||
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
Error ("UNMOUNT_FAILED", hwndDlg);
|
||||
|
||||
Error ("UNMOUNT_FAILED", hwndDlg);
|
||||
if (result == ERR_FILES_OPEN && !DeviceChangeBroadcastDisabled)
|
||||
{
|
||||
// Undo SHCNE_DRIVEREMOVED and start delivery without waiting for completion.
|
||||
wchar_t root[] = { (wchar_t) (nDosDriveNo + L'A'), L':', L'\\', 0 };
|
||||
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH | SHCNF_FLUSHNOWAIT, root, NULL);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+4
-3
@@ -6380,8 +6380,9 @@ retry:
|
||||
goto retry;
|
||||
}
|
||||
|
||||
// Undo SHCNE_DRIVEREMOVED
|
||||
if ( DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
|
||||
// Undo SHCNE_DRIVEREMOVED and start delivery without waiting for completion.
|
||||
if ( !DeviceChangeBroadcastDisabled
|
||||
&& DeviceIoControl (hDriver, TC_IOCTL_GET_MOUNTED_VOLUMES, NULL, 0, &mountList, sizeof (mountList), &dwResult, NULL)
|
||||
&& mountList.ulMountedDrives
|
||||
&& (mountList.ulMountedDrives < (1 << 26))
|
||||
)
|
||||
@@ -6391,7 +6392,7 @@ retry:
|
||||
if (mountList.ulMountedDrives & (1 << i))
|
||||
{
|
||||
wchar_t root[] = { (wchar_t) (i + L'A'), L':', L'\\', 0 };
|
||||
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL);
|
||||
SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH | SHCNF_FLUSHNOWAIT, root, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user