返回 DeepSeek-Reasonix
process_windows.go
根目录 / internal / crashreport / process_windows.go
1 //go:build windows
2
3 package crashreport
4
5 import (
6 "errors"
7
8 "golang.org/x/sys/windows"
9 )
10
11 const stillActiveExitCode = 259
12
13 func processAlive(pid int) bool {
14 if pid <= 0 {
15 return false
16 }
17 handle, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
18 if err != nil {
19 return errors.Is(err, windows.ERROR_ACCESS_DENIED)
20 }
21 defer windows.CloseHandle(handle)
22 var code uint32
23 return windows.GetExitCodeProcess(handle, &code) == nil && code == stillActiveExitCode
24 }
25
25 lines GO