Description
Noticed while testing ROSTESTS-263.
Immediate delete means the service can't be stopped (properly) anymore...
—
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682562%28v=vs.85%29.aspx
The DeleteService function marks a service for deletion from the service control manager database. The database entry is not removed until all open handles to the service have been closed by calls to the CloseServiceHandle function, and the service is not running. A running service is stopped by a call to the ControlService function with the SERVICE_CONTROL_STOP control code. If the service cannot be stopped, the database entry is removed when the system is restarted.
—
Possible clue: RCloseServiceHandle() seems to miss to check the service itself is stopped.
933 RCloseServiceHandle(
|
...
|
994 /* If this service has been marked for deletion */ |
995 if (lpService->bDeleted) |
...
|
1027 /* There are no references and no running dependencies, |
1028 it is now safe to delete the service */
|
...
|