lfreist / hwinfo

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
MIT License
428 stars 74 forks source link

Problems with Qt GUI app on Windows11 and hwinfo #97

Open xohm opened 1 month ago

xohm commented 1 month ago

I run into problems when using hwinfo and my GUI app which uses Qt6/Windows11. QFileDialog::getOpenFileName and other functions did not work correctly (native was not working) after a call to the hwinfo lib. I found that the CoInitializeEx in the wmi_wrapper caused the problem, after changing from COINIT_MULTITHREADED to COINIT_APARTMENTTHREADED all seamed to work well:

hwinfo/src/windows/utils/wmi_wrapper.cpp, line 16

_WMI::_WMI() { auto res = CoInitializeSecurity(nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, nullptr, EOAC_NONE, nullptr); // res &= CoInitializeEx(nullptr, COINIT_MULTITHREADED); // $fixme: this is causing a crash res &= CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);

lfreist commented 1 month ago

Thank you for the report. I'll evaluate it and provide a fix as soon as possible.

lfreist commented 2 weeks ago

Should be fixed in 82161e7bb5d65d5165d530140c3fc51036733a9d.

Can you confirm @xohm ?