From 964bb59f712a89c2479b3feeb368259c30a6b481 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Mon, 3 Nov 2025 19:24:28 -0500 Subject: [PATCH] Fix error in hardware key detection code on Windows --- src/gui/osutils/winutils/DeviceListenerWin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/osutils/winutils/DeviceListenerWin.cpp b/src/gui/osutils/winutils/DeviceListenerWin.cpp index 408bf9d06..de805f215 100644 --- a/src/gui/osutils/winutils/DeviceListenerWin.cpp +++ b/src/gui/osutils/winutils/DeviceListenerWin.cpp @@ -56,7 +56,6 @@ void DeviceListenerWin::registerHotplugCallback(bool arrived, regex += QString("PID_%1&").arg(productId, 0, 16).toUpper(); } } - regex += QString(".*$"); // Qt won't match otherwise m_deviceIdMatch = QRegularExpression(regex); DEV_BROADCAST_DEVICEINTERFACE_W notificationFilter{ @@ -95,7 +94,7 @@ bool DeviceListenerWin::nativeEventFilter(const QByteArray& eventType, void* mes || (m_handleRemoval && m->wParam == DBT_DEVICEREMOVECOMPLETE)) { const auto pBrHdr = reinterpret_cast(m->lParam); const auto pDevIface = reinterpret_cast(pBrHdr); - const auto name = QString::fromWCharArray(pDevIface->dbcc_name, pDevIface->dbcc_size); + const auto name = QString::fromWCharArray(pDevIface->dbcc_name); if (m_deviceIdMatch.match(name).hasMatch()) { emit devicePlugged(m->wParam == DBT_DEVICEARRIVAL, nullptr, pDevIface); return true;