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: CreateService ignores ErrorControl type #43094

maja42 opened this issue Dec 9, 2020 · 3 comments

x/sys/windows/svc/mgr: CreateService ignores ErrorControl type #43094

maja42 opened this issue Dec 9, 2020 · 3 comments


Copy link

@maja42 maja42 commented Dec 9, 2020


What did you do?

I created a new windows service using CreateService. You can pass a service configuration which includes the filed ErrorControl. It supports the following values:

	ErrorCritical = windows.SERVICE_ERROR_CRITICAL
	ErrorIgnore   = windows.SERVICE_ERROR_IGNORE
	ErrorNormal   = windows.SERVICE_ERROR_NORMAL
	ErrorSevere   = windows.SERVICE_ERROR_SEVERE

I tried to create a windows service with ErrorIgnore, which has the underlying uint32-value 0 - which is also go's zero-value.
CreateService sees that value, assumes that it's not populated, and replaces it with ErrorNormal (1).

There is no workaround (that I can see) to configure ErrorIgnore with the go API.
The only option is to install the service and then edit the registry-key at r\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<service> with the name ErrorControl.

What did you expect to see?

I expect the service to have the correct ErrorControl type.
If this can't be fixed due to backwards compatibility reasons, at least the goDoc should mention the issue and provide an alternative way of configuring this.

@gopherbot gopherbot added this to the Unreleased milestone Dec 9, 2020
Copy link

@mengzhuo mengzhuo commented Dec 9, 2020

It seems to be no other way to pass ServiceIgnore into CreateService right?

Kindly CC @zx2c4

Copy link

@gopherbot gopherbot commented Dec 9, 2020

Change mentions this issue: windows: check ErrorControl while CreateService

Copy link

@zx2c4 zx2c4 commented Dec 9, 2020

Thanks for the patch. I've followed up on gerrit.

@golang golang locked and limited conversation to collaborators Dec 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

4 participants