try { const wchar_t* Query=(const wchar_t *)this->TriggerRequest.utf16(); dhCheck( dhGetObject(L"winmgmts:{impersonationLevel=impersonate,(Security)}!\\\\.\\root\\cimv2",NULL, &wmiSvc) ); dhCheck( dhGetValue(L"%o", &wmiEventSrc, wmiSvc, L".ExecNotificationQuery(%S)",Query) ); emit this->TriggerState(this->TriggerName,1); while (TRUE) { CDispPtr wmiLatestEvent; dhCheck( dhGetValue(L"%o", &wmiLatestEvent, wmiEventSrc, L".NextEvent") ); emit this->Triggered(this->TriggerName,this->GenerateTriggerMsg(wmiLatestEvent),this->TriggerIcon); wmiLatestEvent.Dispose(); } } catch (string errstr) { ErrorMSG=this->GenerateErrorMSG(QString::fromStdString(errstr)); emit this->TriggerState(this->TriggerName,-1); }
dhCheck( dhGetObject(L"winmgmts:{impersonationLevel=impersonate,(Security)}!\\\\.\\root\\cimv2",NULL, &wmiSvc) );