1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Fix false positive detection of new device insertion when clear keys option is enable

When this option is enabled, we first build the list of currently inserted devices then we start listening to insertion events.
When a device insertion occurs, we check if this device is on our list and if yes, we ignore its insertion.
We also ignore devices whose Device ID starts with "SWD\" and "ROOT\" since these are not real devices.
This commit is contained in:
Mounir IDRASSI
2023-08-05 00:45:39 +02:00
parent 5a6b445f0e
commit e8f83544ea
13 changed files with 255 additions and 9 deletions

View File

@@ -667,6 +667,18 @@ namespace VeraCrypt
}
}
static void NotifyService (DWORD dwNotifyCmd)
{
Elevate();
DWORD result = ElevatedComInstance->NotifyService (dwNotifyCmd);
if (result != ERROR_SUCCESS)
{
SetLastError (result);
throw SystemException(SRC_POS);
}
}
static void Release ()
{
if (--ReferenceCount == 0 && ElevatedComInstance)
@@ -5708,6 +5720,22 @@ namespace VeraCrypt
throw_sys_if (!WriteLocalMachineRegistryDword (keyPath, valueName, value));
}
void BootEncryption::NotifyService (DWORD dwNotifyCmd)
{
if (!IsAdmin() && IsUacSupported())
{
Elevator::NotifyService (dwNotifyCmd);
return;
}
DWORD dwRet = SendServiceNotification(dwNotifyCmd);
if (dwRet != ERROR_SUCCESS)
{
SetLastError(dwRet);
throw SystemException (SRC_POS);
}
}
void BootEncryption::StartDecryption (BOOL discardUnreadableEncryptedSectors)
{
BootEncryptionStatus encStatus = GetStatus();