| 543 | } |
| 544 | |
| 545 | QString Interception_Worker::getDeviceDescriptionByHardwareID(const QString &hardwareID) |
| 546 | { |
| 547 | HDEVINFO deviceInfoSet = SetupDiGetClassDevs(nullptr, nullptr, nullptr, DIGCF_ALLCLASSES | DIGCF_PRESENT); |
| 548 | if (deviceInfoSet == INVALID_HANDLE_VALUE) |
| 549 | { |
| 550 | return QString(); |
| 551 | } |
| 552 | |
| 553 | SP_DEVINFO_DATA deviceInfoData; |
| 554 | ZeroMemory(&deviceInfoData, sizeof(SP_DEVINFO_DATA)); |
| 555 | deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); |
| 556 | |
| 557 | DWORD index = 0; |
| 558 | while (SetupDiEnumDeviceInfo(deviceInfoSet, index, &deviceInfoData)) |
| 559 | { |
| 560 | DWORD dataType; |
| 561 | WCHAR buffer[MAX_PATH]; |
| 562 | DWORD bufferSize = sizeof(buffer); |
| 563 | |
| 564 | if (SetupDiGetDeviceRegistryProperty(deviceInfoSet, &deviceInfoData, SPDRP_HARDWAREID, |
| 565 | &dataType, reinterpret_cast<PBYTE>(buffer), bufferSize, nullptr)) |
| 566 | { |
| 567 | QString hardwareIdStr = QString::fromWCharArray(buffer); |
| 568 | if (hardwareIdStr == hardwareID) |
| 569 | { |
| 570 | if (SetupDiGetDeviceRegistryProperty(deviceInfoSet, &deviceInfoData, SPDRP_DEVICEDESC, |
| 571 | &dataType, reinterpret_cast<PBYTE>(buffer), bufferSize, nullptr)) |
| 572 | { |
| 573 | QString deviceName = QString::fromWCharArray(buffer); |
| 574 | SetupDiDestroyDeviceInfoList(deviceInfoSet); |
| 575 | return deviceName; |
| 576 | } |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | index++; |
| 581 | } |
| 582 | |
| 583 | SetupDiDestroyDeviceInfoList(deviceInfoSet); |
| 584 | return QString(); |
| 585 | } |
| 586 | |
| 587 | InterceptionContext Interception_Worker::getInterceptionContext() |
| 588 | { |
nothing calls this directly
no outgoing calls
no test coverage detected