1

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

Community
  • 1
  • 1
Edward83
  • 6,664
  • 14
  • 74
  • 102
  • The code which you post is incomplete. Can you show how you are calling the `GetNames` function? – RRUZ Jun 07 '13 at 15:30

1 Answers1

1

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);
Janus
  • 125
  • 1
  • 8