Closed
Description
The mgr package does not provide a way to interact with the EnumDependentServicesW Windows API call. Usage of this call allows a user to list all Windows services which are dependent upon a given service. Without this API call, a user would have to iterate through each service on the system, and check if the given service is listed in each service's dependencies list.
This functionality being missing is called out in a TODO within the code.
I propose:
- EnumDependentServicesW is added to the list of syscalls in https://github.com/golang/sys/blob/master/windows/service.go, causing it to be generated and added to https://github.com/golang/sys/blob/master/windows/zsyscall_windows.go
- A new struct ENUM_SERVICE_STATUSW is added to service.go, this enables the use of the data returned by EnumDependentServicesW.
- A new type is added:
type Activity uint32
const (
Active = Activity(windows.SERVICE_ACTIVE)
Inactive = Activity(windows.SERVICE_INACTIVE)
All = Activity(windows.SERVICE_ALL)
)
- Service is given a new method
ListDependentServices
which will return a slice of strings, listing all services dependent on the service.func (s *Service) ListDependentServices(serviceState Activity) ([]string, error)