Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sebsoto opened this issue Nov 16, 2022 · 6 comments
Closed

Comments

@sebsoto
Copy link

sebsoto commented Nov 16, 2022

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)
@gopherbot gopherbot added this to the Proposal milestone Nov 16, 2022
@ianlancetaylor
Copy link
Contributor

CC @golang/windows

@gopherbot
Copy link

Change https://go.dev/cl/451363 mentions this issue: windows: add Service.ListDependentServices

@alexbrainman
Copy link
Member

@sebsoto

I just reviewed your https://go.dev/cl/451363 CL. Let's continue our conversation there.

Thank you.

Alex

@rsc
Copy link
Contributor

rsc commented Aug 9, 2023

Seems to have landed without a proposal acceptance but too late to do anything about that now.

@rsc
Copy link
Contributor

rsc commented Aug 9, 2023

No change in consensus, so accepted. 🎉
This issue now tracks the work of implementing the proposal.
— rsc for the proposal review group

@rsc rsc changed the title proposal: x/sys/windows/svc/mgr: Add EnumDependentServices method to Service struct x/sys/windows/svc/mgr: Add EnumDependentServices method to Service struct Aug 9, 2023
@rsc rsc modified the milestones: Proposal, Backlog Aug 9, 2023
@alexbrainman
Copy link
Member

Seems to have landed without a proposal acceptance but too late to do anything about that now.

Sorry about that. I did not know that changes like this one require proposal.

Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants