Revert change disabling redetection of i2c interfaces and fix disconnected WMI failure by always reconnecting before query

This commit is contained in:
Adam Honse 2021-05-24 18:38:26 -05:00
parent 2a3a736f09
commit 33b840b2b9
2 changed files with 27 additions and 10 deletions

View file

@ -147,6 +147,18 @@ HRESULT Wmi::query(std::string queryStr, std::vector<QueryObj>& queryVectorOut,
int nIdx = 0;
IEnumWbemClassObject* pEnumerator = nullptr;
// Reconnect to server before each query as we were seeing disconnected failures
hres = pLoc->ConnectServer(
_bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
nullptr, // User name. NULL = current user
nullptr, // User password. NULL = current
nullptr, // Locale. NULL indicates current
0, // Security flags.
nullptr, // Authority (for example, Kerberos)
nullptr, // Context object
&pSvc // pointer to IWbemServices proxy
);
// Make the WMI query
hres = pSvc->ExecQuery(
bstr_t("WQL"),