Null-DRM-Official/apps/streamd/internal/supervisor/proc_windows.go
404errordeveloper 2fa8f2435f Initial commit: Null DRM Official
Capture, decrypt, and restream toolkit with compiled-in app modules
(RTE, TG4, BBC), on-device MITM proxy, streamd control plane, and www.
BBC module.yaml is published (clear streams); other module values stay local.
2026-10-06 00:25:35 +02:00

35 lines
816 B
Go

//go:build windows
package supervisor
import (
"os"
"os/exec"
"syscall"
)
func hideWindow(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{
HideWindow: true,
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
}
}
func processDead(pid int) bool {
p, err := os.FindProcess(pid)
if err != nil {
return true
}
// On Windows, FindProcess always succeeds; OpenProcess is needed.
// tasklist-style: try duplicate handle via Signal is unsupported.
// Use Windows API indirectly: if Wait with timeout 0 isn't available,
// check via tasklist is heavy — use syscall OpenProcess.
const PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
h, err := syscall.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, false, uint32(pid))
if err != nil {
return true
}
_ = p
syscall.CloseHandle(h)
return false
}