Files
wisp-open/internal/windows/process.go
T

17 lines
391 B
Go

//go:build windows
package windows
import "syscall"
// IsProcessRunning checks if a process with the given PID exists on Windows.
func IsProcessRunning(pid int) bool {
const PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
handle, err := syscall.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
if err != nil {
return false
}
syscall.CloseHandle(handle)
return true
}