winservices

package
v3.21.11+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Name   string
	Config mgr.Config
	Status ServiceStatus
	// contains filtered or unexported fields
}

Service represent a windows service.

func ListServices

func ListServices() ([]Service, error)

ListServices return all windows service reference to golang.org/x/sys/windows/svc/mgr#ListServices()

func NewService

func NewService(name string) (*Service, error)

NewService create and return a windows Service

func (*Service) GetServiceDetail

func (s *Service) GetServiceDetail() error

GetServiceDetail get a windows service by name

func (*Service) GetServiceDetailWithContext

func (s *Service) GetServiceDetailWithContext(ctx context.Context) error

GetServiceDetailWithContext get a windows service by name

func (*Service) QueryServiceConfig

func (s *Service) QueryServiceConfig() (mgr.Config, error)

QueryServiceConfig return the specified service config

func (*Service) QueryServiceConfigWithContext

func (s *Service) QueryServiceConfigWithContext(ctx context.Context) (mgr.Config, error)

QueryServiceConfigWithContext call QueryServiceConfig() and QueryServiceConfig2() implement windows https://msdn.microsoft.com/en-us/library/windows/desktop/ms684932(v=vs.85).aspx

func (*Service) QueryStatus

func (s *Service) QueryStatus() (ServiceStatus, error)

QueryStatus return the specified name service currentState and ControlsAccepted

func (*Service) QueryStatusWithContext

func (s *Service) QueryStatusWithContext(ctx context.Context) (ServiceStatus, error)

QueryStatusWithContext return the specified name service currentState and ControlsAccepted

type ServiceStatus

type ServiceStatus struct {
	State         svc.State
	Accepts       svc.Accepted
	Pid           uint32
	Win32ExitCode uint32
}

ServiceStatus combines State and Accepted commands to fully describe running service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL