Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Uninstaller does not reboot if run from installer (http://forums.winamp.com/showthread.php?t=340966)

cowwoc 20th January 2012 19:31

Uninstaller does not reboot if run from installer
 
My installer code runs the uninstaller (in .onInit) if it detects the software is already installed. Once the software finishes uninstalling, it continues with the installation.

I am using "Delete /REBOOTOK" to delete files in my uninstaller. If one of the files cannot be deleted, it asks the user to reboot the system.

1. If I intentionally lock a file, run the uninstaller directly, and the user agrees to reboot the system *does* reboot.

2. If I do the same, but launch the uninstaller from inside the installer, it does *not* reboot.

The installer is invoking the uninstaller using this code:

code:
ExecWait '$0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file


Why isn't the uninstaller rebooting?

Thanks,
Gili

demiller9 20th January 2012 19:56

Windows 'knows' that the installer is running and prevents the reboot. I had a similar problem and solved it by making the uninstaller terminate the installer.

cowwoc 20th January 2012 20:09

Quote:

Originally Posted by demiller9 (Post 2837287)
Windows 'knows' that the installer is running and prevents the reboot. I had a similar problem and solved it by making the uninstaller terminate the installer.

Seems hackish, but just in case... how do you do that? :)
Is there a cleaner solution?

Thanks,
Gili

Anders 20th January 2012 22:02

The installer is blocking the reboot IIRC, I think there is a plugin that prevents it from doing that...

cowwoc 23rd January 2012 16:44

Quote:

Originally Posted by Anders (Post 2837297)
The installer is blocking the reboot IIRC, I think there is a plugin that prevents it from doing that...

Where can I find this plugin?

Afrow UK 23rd January 2012 18:34

http://nsis.sourceforge.net/ShutdownAllow_plug-in

Stu

cowwoc 23rd January 2012 19:13

Excellent. Thanks Stu! :)

Gili

cowwoc 23rd January 2012 20:01

Okay, now I've got one more problem... The uninstaller is causing the system to reboot, but in the meantime it returns control back to the installer which allows the user to begin installation.

I noticed that the uninstaller is returning exit code 164 (or -164, I forget). Where does this number come from? Is it documented somewhere? Can I rely on it not changing?

Thanks,
Gili

cowwoc 23rd January 2012 20:10

Hmm, it seems I jumped the gun. I get an exit code of 164 whether the uninstaller reboots or not. Any ideas on how to tell the installer to abort when the uninstaller tries to reboot?

Afrow UK 23rd January 2012 20:12

Looking at the source it just returns the current error level (SetErrorLevel) so perhaps something in your script is setting it to 164. You can try setting your own error level just before rebooting.

Stu

cowwoc 23rd January 2012 20:16

I stand corrected. I'm getting error code 0 (not 164) whether it reboots or not.

cowwoc 23rd January 2012 20:17

Stu,

Which function gets executed if the user chooses to reboot (I'd like to SetErrorLevel there)? I believe the reboot flag is being set by "Delete /REBOOTOK". I never explicitly set it.

Afrow UK 23rd January 2012 20:20

code:
IfRebootFlag 0 +2
SetErrorLevel 99

Stu

cowwoc 23rd January 2012 20:56

Quote:

Originally Posted by Afrow UK (Post 2838545)
code:
IfRebootFlag 0 +2
SetErrorLevel 99

Stu

I added this to the end of:

Section "Uninstall"

Thanks again,
Gili


All times are GMT. The time now is 17:43.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.