By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!Doesn't anything tell you that no handle/data/? (whatever you asked for) was returned?
v:\> wmiq . "Select ProcessId from Win32_process where name='tcc.exe'"
9924
v:\> wmiq . "Select ProcessId from Win32_process where name='garbage'"
v:\>
else
{
hr = pNameSpace->ExecQuery(L"WQL", bstrQuery, WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY, NULL, &pEnum);
if ( FAILED(hr) ) throw (DWORD) 5;
hr = WBEM_S_NO_ERROR;
if ( index > 1 ) hr = pEnum->Skip(WBEM_INFINITE, index - 1);
if ( hr == WBEM_S_NO_ERROR )
{
/* print queried properties of one or all class instances */
while ( pEnum->Next(WBEM_INFINITE, 1, &pWbemObject, &dwReturned)
== WBEM_S_NO_ERROR )
{
Printf(L"Test: OK\r\n"); // added
if ( bAllInstances && bHeaders ) Printf(L"CLASS INSTANCE %lu\r\n", index++); /* numbered header */
PrintProperties(pWbemObject); // this does the output
if ( bAllInstances && bSeparatorLine ) Printf(L"\r\n"); /* separator line */
if ( !bAllInstances ) break;
}
}
else throw (DWORD) 6;
}
If no error occurs, this receives the enumerator that allows the caller to retrieve the instances in the result set of the query. It is not an error for the query to have a result set with 0 instances. This is determined only by attempting to iterate through the instances.