mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
x/sys/windows/svc/mgr: allow other ServiceType values in CreateService
Preserves SERVICE_WIN32_OWN_PROCESS as the default. Fixes golang/go#14019 Change-Id: I764016c1b5ec5e1fe88ed39b9803754af966b2f3 Reviewed-on: https://go-review.googlesource.com/18760 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
committed by
Alex Brainman
parent
442cd60086
commit
20457ee8ea
@@ -85,12 +85,15 @@ func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Se
|
|||||||
if c.ErrorControl == 0 {
|
if c.ErrorControl == 0 {
|
||||||
c.ErrorControl = ErrorNormal
|
c.ErrorControl = ErrorNormal
|
||||||
}
|
}
|
||||||
|
if c.ServiceType == 0 {
|
||||||
|
c.ServiceType = windows.SERVICE_WIN32_OWN_PROCESS
|
||||||
|
}
|
||||||
s := syscall.EscapeArg(exepath)
|
s := syscall.EscapeArg(exepath)
|
||||||
for _, v := range args {
|
for _, v := range args {
|
||||||
s += " " + syscall.EscapeArg(v)
|
s += " " + syscall.EscapeArg(v)
|
||||||
}
|
}
|
||||||
h, err := windows.CreateService(m.Handle, toPtr(name), toPtr(c.DisplayName),
|
h, err := windows.CreateService(m.Handle, toPtr(name), toPtr(c.DisplayName),
|
||||||
windows.SERVICE_ALL_ACCESS, windows.SERVICE_WIN32_OWN_PROCESS,
|
windows.SERVICE_ALL_ACCESS, c.ServiceType,
|
||||||
c.StartType, c.ErrorControl, toPtr(s), toPtr(c.LoadOrderGroup),
|
c.StartType, c.ErrorControl, toPtr(s), toPtr(c.LoadOrderGroup),
|
||||||
nil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName), toPtr(c.Password))
|
nil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName), toPtr(c.Password))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user