Skip to content

x/sys/windows/svc/mgr: Add EnumDependentServices method to Service struct #56766

Closed
@sebsoto

Description

@sebsoto

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:

  1. 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
  2. A new struct ENUM_SERVICE_STATUSW is added to service.go, this enables the use of the data returned by EnumDependentServicesW.
  3. A new type is added:
type Activity uint32
const (
	Active       = Activity(windows.SERVICE_ACTIVE)
	Inactive     = Activity(windows.SERVICE_INACTIVE)
	All          = Activity(windows.SERVICE_ALL)
)
  1. 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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions