Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-14260

"sc delete" should not immediately delete a running service

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.8
    • Services
    • None

    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

      DeleteService function

      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 */
      ...

      Attachments

        1. CORE-14260_Sc-Delete.cmd
          0.2 kB
          Serge Gautherie
        2. ROS-048-867_DeleteAsIs.txt
          2 kB
          Serge Gautherie
        3. WXP_DeleteLater.txt
          2 kB
          Serge Gautherie

        Activity

          People

            ekohl ekohl
            Serge Gautherie Serge Gautherie
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: