BUG: Service Startup Type Is Disabled


After a service has been deleted, the Startup Type of the service may be shown as "Disabled" within the Services snap-in for Microsoft Management Console (MMC). This will occur if the MMC Services snap-in was open prior to deletion of the service and was used to stop the service before it was deleted.


The Services snap-in does not close the service handle after it stops a service. When a service is deleted, the Service Control Manager marks the service for deletion, but the service will not actually be deleted until all handles to the service are closed. An attempt to query the service configuration will fail once the service has been marked for deletion. The Services snap-in shows the startup type for a service as "Disabled" when its configuration cannot be queried.


The service will successfully be removed once the Services snap-in is closed and all other handles to the service are closed.


Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

More Information

This problem will only occur if a service is stopped from the Services snap-in and an application thereafter programmatically deletes the service but the Services snap-in remains open.

A service can be deleted programmatically through use of the DeleteService() API or through the command-line utility SC.exe, which comes with the Windows 2000 Resource Kit. As long as the Services snap-in has an open handle to the service, all other service-related operations against the deleted service will fail with error 1072 (ERROR_SERVICE_MARKED_FOR_DELETE).

This problem will not occur if the service is stopped using command-line utilities like SC.exe or NET.exe or programmatically using the ControlService() API with the control code SERVICE_CONTROL_STOP.

ID do Artigo: 287516 - Última Revisão: 21 de nov de 2006 - Revisão: 1