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: Ability to enumerate services #20596

Closed
mappu opened this issue Jun 7, 2017 · 6 comments
Closed

x/sys/windows/svc/mgr: Ability to enumerate services #20596

mappu opened this issue Jun 7, 2017 · 6 comments

Comments

@mappu
Copy link

@mappu mappu commented Jun 7, 2017

Feature request.

The x/sys/windows/svc/mgr package can create a new service, and delete or perform other operations on existing services. But there's no function to list the existing installed services.

I know it's only an /x/ package. But i think it's a functionality gap.

It can be implemented via the EnumServicesStatusEx function.

@gopherbot gopherbot added this to the Unreleased milestone Jun 7, 2017
@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 10, 2017

Sounds reasonable.

How are you planing to use it? I am asking because EnumServicesStatusEx has some parameters to filter the list. I am trying to decide what new API will look like?

Thank you

Alex

@mappu
Copy link
Author

@mappu mappu commented Jun 11, 2017

Ideally, as little filtering as possible should be done by the package, then the application developer can do it themselves.

In normal Windows services.msc or Task Manager you can see all services of type SERVICE_WIN32, so i think this is the expected enumeration filter type.

The existing CreateService function in this package does use the SERVICE_WIN32_OWN_PROCESS type, which is a subset of SERVICE_WIN32, so, the round-trip behavior will work as expected.

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 14, 2017

CL https://golang.org/cl/45711 mentions this issue.

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 14, 2017

@mappu what do you think about https://golang.org/cl/45711 ?

Alex

@mappu
Copy link
Author

@mappu mappu commented Jun 14, 2017

I think it looks good, a nice simple API.

In the line t.Errorf("ListServices failed to find $q service", name) should $q instead be %q?

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Jun 14, 2017

I think it looks good, a nice simple API.

Cool. Thank you.

In the line t.Errorf("ListServices failed to find $q service", name) should $q instead be %q?

Fixed. You can actually review code at https://golang.org/cl/45711 if you like.

Alex

micanzhang pushed a commit to micanzhang/sys that referenced this issue Sep 12, 2017
Add API to list services installed on the system.

Fixes golang/go#20596

Change-Id: Ifa2f20ef15ccb962bd21d03788ce931dd45f2630
Reviewed-on: https://go-review.googlesource.com/45711
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Jun 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants