Commit 20457ee8 authored by Nick Petroni's avatar Nick Petroni Committed by Alex Brainman

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/18760Reviewed-by: 's avatarAlex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
parent 442cd600
......@@ -85,12 +85,15 @@ func (m *Mgr) CreateService(name, exepath string, c Config, args ...string) (*Se
if c.ErrorControl == 0 {
c.ErrorControl = ErrorNormal
}
if c.ServiceType == 0 {
c.ServiceType = windows.SERVICE_WIN32_OWN_PROCESS
}
s := syscall.EscapeArg(exepath)
for _, v := range args {
s += " " + syscall.EscapeArg(v)
}
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),
nil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName), toPtr(c.Password))
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment