diff options
Diffstat (limited to 'vendor/golang.org/x/sys/windows/svc/mgr/recovery.go')
-rw-r--r-- | vendor/golang.org/x/sys/windows/svc/mgr/recovery.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go b/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go index 71ce2b8..e465cbb 100644 --- a/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go +++ b/vendor/golang.org/x/sys/windows/svc/mgr/recovery.go @@ -12,6 +12,7 @@ import ( "time" "unsafe" + "golang.org/x/sys/internal/unsafeheader" "golang.org/x/sys/windows" ) @@ -68,8 +69,13 @@ func (s *Service) RecoveryActions() ([]RecoveryAction, error) { return nil, err } + var actions []windows.SC_ACTION + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&actions)) + hdr.Data = unsafe.Pointer(p.Actions) + hdr.Len = int(p.ActionsCount) + hdr.Cap = int(p.ActionsCount) + var recoveryActions []RecoveryAction - actions := (*[1024]windows.SC_ACTION)(unsafe.Pointer(p.Actions))[:p.ActionsCount] for _, action := range actions { recoveryActions = append(recoveryActions, RecoveryAction{Type: int(action.Type), Delay: time.Duration(action.Delay) * time.Millisecond}) } @@ -112,7 +118,7 @@ func (s *Service) RebootMessage() (string, error) { return "", err } p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0])) - return toString(p.RebootMsg), nil + return windows.UTF16PtrToString(p.RebootMsg), nil } // SetRecoveryCommand sets the command line of the process to execute in response to the RunCommand service controller action. @@ -131,5 +137,5 @@ func (s *Service) RecoveryCommand() (string, error) { return "", err } p := (*windows.SERVICE_FAILURE_ACTIONS)(unsafe.Pointer(&b[0])) - return toString(p.Command), nil + return windows.UTF16PtrToString(p.Command), nil } |