I'm observing an program and want to kill it, if it is for some time in the state "wait:executive".
Here is a screenshot of the Process Explorer:
How can I get that state by code? Or could maybe tell me somebody what that state exactly mean? This will may help me to find the right query to solve my problem.
What Does State Mean? In computer science, the state of a program is defined as its condition regarding stored inputs.
Thus, the program goes through the required three states: initial, input, and procedure. Typically, a session also goes through the transformation state, but it can be skipped as shown in the example above and in the diagram in the preceding figure.
(1) In object-oriented programming, the state of an object is the combination of the original values in the object plus any modifications made to them. (2) The current or last-known status, or condition, of a process, transaction or setting. "Maintaining state" or "managing state" means keeping track of the process.
In general changing in state of the program occurs when the program alters some computer resource (eg. memory value at a given address) within the process address space related to the process your program is represented by and that change will have an effect on further execution of the process.
It is not state of program but it's state of thread.One process can have many threads.
You can call WaitForSingleObject to determine some states.
Also you can instantiate WMI using COM and selecting Win32_Thread class.
Here is some example.
More info here : How to determine that a win32 thread is either in Wait or Join or Sleep state in c++
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With