Space Rabbit Space Rabbit - 1 year ago 291
C++ Question

How to discard IUpdateSearcher::BeginSearch

I am going to enumerate not installed updates with Windows Update Agent. And I have one question. Is that a way to discard/stop BeginSearch method (searching process). I have tried to stop search process with EndSearch but it does not stop it. Thanks.

Answer Source

IUpdateSearcher::EndSearch() waits for the search to complete first. You can explicitly request the search to stop early by first calling ISearchJob::RequestAbort() on the ISearchJob you get from IUpdateSearcher::BeginSearch(). After doing that, the ISearchResults returned from EndSearch() should have a ResultCode of orcAborted, and you should be safe with just releasing it. (You should still call EndSearch(), because the abort operation is still asynchronous, as hinted by the name "request abort".)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download