跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

process_windows.go

33 行 · 806 B历史下载
1package cage
2
3import (
4 "strconv"
5
6 "golang.org/x/sys/windows"
7)
8
9func profileProcessAlive(pid int) bool {
10 h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
11 if err != nil {
12 return err == windows.ERROR_ACCESS_DENIED
13 }
14 defer windows.CloseHandle(h)
15 var code uint32
16 return windows.GetExitCodeProcess(h, &code) == nil && code == 259
17}
18
19func processStartToken(pid int) string {
20 if pid <= 0 {
21 return ""
22 }
23 h, err := windows.OpenProcess(windows.PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
24 if err != nil {
25 return ""
26 }
27 defer windows.CloseHandle(h)
28 var created, exited, kernel, user windows.Filetime
29 if windows.GetProcessTimes(h, &created, &exited, &kernel, &user) != nil {
30 return ""
31 }
32 return strconv.FormatInt(created.Nanoseconds(), 10)
33}