Edward83
Edward83

Reputation: 6686

WMI IWbemClassObject::GetNames status complete

I make WMI query SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'

hres = this->m_IWbemServicesComPtr->ExecNotificationQueryAsync(
    _bstr_t("WQL"), 
    _bstr_t(query.c_str()),
    WBEM_FLAG_SEND_STATUS, 
    0, 
    this->m_IWbemObjectStubSinkComPtr.GetInterfacePtr());

And always ok before I call method GetNames on instance of COM object IWbemClassObject (retrieved within my implementation of method IWbemObjectSink::Indicate). When I call IWbemClassObject::GetNames some WMI mechanism calls my IWbemObjectSink::SetStatus with flag WBEM_STATUS_COMPLETE and nothing new events happen!!! I do not call any cancel async methods.

What I do wrong? How to prevent stopping WMI events? How safely call GetNames? After calling IWbemClassObject::GetNames I wanna be still subscribed for new events.

UDPATE: How I call GetNames:

HRESULT EnumInstPropNameWMI( IN IWbemClassObject* piappObj, 
                             OUT LPSAFEARRAY* ppsarProp   )
{   
   if (0 == ppsarProp || 0 == piappObj)
      return E_INVALIDARG;       

   HRESULT hres;
   hres = piappObj->GetNames(   0,
                        0,//WBEM_FLAG_ALWAYS | WBEM_FLAG_NONSYSTEM_ONLY,
                        0,
                        ppsarProp);
   return hres;
}

piappObj is object that was grabbed by way shown in this answer

Upvotes: 1

Views: 1041

Answers (1)

Janus
Janus

Reputation: 135

This is a dated question, so it may be too late, but trying making the call like this:

HRESULT hres;
long unsigned result;

hres = piappObj->GetNames(   
                     WBEM_INFINITE,
                     1,
                     & piappObj,
                     & result);

Upvotes: 1

Related Questions