VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Mount.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-08-05 00:45:39 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-08-05 00:45:39 +0200
commite8f83544ead2011112788d48bff610574f5d6395 (patch)
tree4f61fbc0b3364d6b529a86f4155b1b412b9e3e8d /src/Mount/Mount.h
parent5a6b445f0ed51b0f06c4f0212f060ab45113b670 (diff)
downloadVeraCrypt-e8f83544ead2011112788d48bff610574f5d6395.tar.gz
VeraCrypt-e8f83544ead2011112788d48bff610574f5d6395.zip
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.
Diffstat (limited to 'src/Mount/Mount.h')
-rw-r--r--src/Mount/Mount.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/Mount/Mount.h b/src/Mount/Mount.h
index d884ede4..cd2636b1 100644
--- a/src/Mount/Mount.h
+++ b/src/Mount/Mount.h
@@ -128,4 +128,42 @@ 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);
+// A class that represents a device based on its device ID
+class CDevice
+{
+public:
+ WCHAR m_szDeviceID[MAX_PATH];
+
+ CDevice()
+ {
+ ZeroMemory(m_szDeviceID, sizeof(m_szDeviceID));
+ }
+
+ CDevice(WCHAR* szDevicePath)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, szDevicePath);
+ }
+
+ CDevice(const CDevice& src)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID);
+ }
+
+ CDevice& operator=(const CDevice& src)
+ {
+ StringCchCopyW(m_szDeviceID, MAX_PATH, src.m_szDeviceID);
+ return *this;
+ }
+
+ BOOL operator==(const CDevice& src)
+ {
+ return wcscmp(m_szDeviceID, src.m_szDeviceID) == 0;
+ }
+
+ ~CDevice()
+ {
+ }
+};
+
+
#endif