gopsutil icon indicating copy to clipboard operation
gopsutil copied to clipboard

Process.Status Windows support

Open bantmen opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Process.Status is not yet implemented for Windows. Any thoughts on how we can go about implementing it?

Additional context

Python's psutil seems to have implemented it here.

bantmen avatar Dec 31 '20 05:12 bantmen

The code you linked is for windows services, not processes.

The process.status() function is defined here, it itself calls psutil_proc_is_suspended, which itself calls psutil_get_proc_info which itself calls win32 NtQuerySystemInformation with SystemProcessInformation, which results are hard to parse in Go.

It should be checked if there's another win32 API to retrieve threads state instead of NtQuerySystemInformation, we usually managed to use documented functions to get process info instead, but a quick search only return results with NtQuerySystemInformation.

https://stackoverflow.com/a/22949726 for some c++ code

Lomanic avatar Jan 02 '21 00:01 Lomanic