testing and generate

This commit is contained in:
redanthrax 2022-06-23 15:07:18 -07:00
parent 9743d7ee22
commit 3841aee4b2
24 changed files with 1087 additions and 610 deletions

View file

@ -297,3 +297,19 @@ func EditService(name, startupType string) WinSvcResp {
return WinSvcResp{Success: true, ErrorMsg: ""}
}
func ServiceExists(name string) (bool, error) {
conn, err := mgr.Connect()
if err != nil {
return false, err
}
defer conn.Disconnect()
srv, err := conn.OpenService(name)
if err != nil {
return false, err
}
defer srv.Close()
return true, nil
}