I am writing a windows service (c++) that need to detect specific windows process termination.
I thought about two different approaches to detect the termination:
- Using WMI as described here.
- Using winapi
WaitForSingleObject(hHandle, INFINITE)
function on the process' handle.
The obvious difference is that WMI uses a CALLBACK
function.
What are the other major differences, advantages and disadvantages, between the two approaches?
Thanks!