Severity: Critical
File: src/Servy.Core/Services/ServiceManager.cs
Lines: 443–474
Description:
When CreateService succeeds but subsequent configuration calls fail (EnablePreShutdown returns false at line 445, or ChangeServiceConfig2 for delayed auto-start fails at line 463), the method returns OperationResult.Failure. The finally block closes the handle, but the newly created service is left in the SCM database in an incomplete state — no pre-shutdown timeout configured, or missing the delayed-start flag. The SCM shows it as installed but it will behave incorrectly.
Suggested fix:
On any post-create configuration failure, call _windowsServiceApi.DeleteService(serviceHandle) before returning the failure result to roll back the partial installation.
Severity: Critical
File:
src/Servy.Core/Services/ServiceManager.csLines: 443–474
Description:
When
CreateServicesucceeds but subsequent configuration calls fail (EnablePreShutdownreturns false at line 445, orChangeServiceConfig2for delayed auto-start fails at line 463), the method returnsOperationResult.Failure. Thefinallyblock closes the handle, but the newly created service is left in the SCM database in an incomplete state — no pre-shutdown timeout configured, or missing the delayed-start flag. The SCM shows it as installed but it will behave incorrectly.Suggested fix:
On any post-create configuration failure, call
_windowsServiceApi.DeleteService(serviceHandle)before returning the failure result to roll back the partial installation.