15 lines
420 B
Go
15 lines
420 B
Go
//go:build windows
|
|
|
|
package pi
|
|
|
|
import "golang.org/x/sys/windows"
|
|
|
|
func processAlive(pid int) bool {
|
|
handle, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
|
|
if err != nil { return err == windows.ERROR_ACCESS_DENIED }
|
|
defer windows.CloseHandle(handle)
|
|
var code uint32
|
|
if windows.GetExitCodeProcess(handle, &code) != nil { return true }
|
|
return code == 259 // STILL_ACTIVE
|
|
}
|