+ Reply to Thread
Results 1 to 2 of 2

Thread: Uninstalling services

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Uninstalling services

    Hi,
    I've got what looks like a race condition or something like it and I'm sure its down to the way that the SCM (Service control manager works). I install a service using the following code within an sbi :

    ! Stop and remove service to cope with case where service is still installed from a failed uninstall.
    Stop Service "IncaCfgBackup"
    Remove Service "IncaCfgBackup"

    Install File "[SB_PROJECT]\..\CfgBackup\x64\Release\CfgBackupGUI.exe" to "%_SB_INSTALLDIR%\CfgBackupGUI.exe" (Always Install)
    Install File "[SB_PROJECT]\..\CfgBackup\x64\Release\CfgBackup.exe" to "%_SB_INSTALLDIR%\CfgBackup.exe" (Always Install)

    Create Service "IncaCfgBackup" (Always Install)
    Start Service "IncaCfgBackup"


    When the user removes the installation using Add/Remove programs they receive the message "The following file is in use and cannot be updated". If you hit retry it continues without any issue. This leads me to believe that a request to the SCM to stop the service is issued followed by the uninstall attempting to remove the file. The uninstall request into the SCM must be asynchronous and hasn't completed by the time we try to remove the binary.

    Has anyone any advice with regards to working around this. If I unistall silently the user will always have to reboot which isn't ideal.

    Thanks,

    Mike

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Uninstalling services

    Mike,

    I would suggest to develop a custom uninstall that tries to stop and remove the service before the uninstall application removes the service file(s).

    Does this help?

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •