Add time-out on query enumeration
Signed-off-by: Stavros Avramidis <stavros9899@gmail.com>
This commit is contained in:
parent
9c4bbec686
commit
234b006bee
2 changed files with 3 additions and 1 deletions
|
|
@ -155,7 +155,7 @@ HRESULT Wmi::query(std::string queryStr, std::vector<QueryObj>& queryVectorOut,
|
|||
|
||||
while (pEnumerator)
|
||||
{
|
||||
hres = pEnumerator->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
|
||||
hres = pEnumerator->Next(WMI_WAIT_TIME, 1, &pclsObj, &uReturn);
|
||||
|
||||
if (0==uReturn)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
#include <Wbemidl.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#define WMI_WAIT_TIME 2000 /// Max time to wait for next object in when enumerating next object in wmi query in milliseconds
|
||||
|
||||
#pragma comment(lib, "wbemuuid.lib")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue