|
@@ -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 {
|