Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 2nd May 2012, 08:51   #1
pocruadhlaoich
Junior Member
 
Join Date: Jul 2010
Posts: 11
Patch an uninstaller

Hi,
can anyone tell me if it is possible to patch an uninstaller already existing on customer computers?
I have an automatic software update system, and when the new installer gets downloaded by the customer and is run, it will check for a previous installation and if found, will call the existing uninstaller on the computer and uninstall the application prior to the new installer continuing its work.
A bug has been found in the existing uninstaller that is already on customer machines. Since the uninstaller has a bug, I do not want to run it but instead want to replace it with a correct uninstaller. Is it possible for me to have my new installer contain an "Uninstall.exe" such that when the new installer is downloaded and run, that one of the first things it will do in a certain scenario is find and replace the existing bugged uninstaller on the customer's computer with a new bug free uninstaller that has been packaged into the new installer?
Any help would be greatly appreciated.
Thanks,
Patrick
pocruadhlaoich is offline   Reply With Quote
Old 2nd May 2012, 09:32   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,841
Yes, this is possible. Simply compile an nsi with the fixed uninstaller code, run the compiled exe, and keep the "installed" uninstall.exe. Then do File "Path\NewUninstaller.exe" in your actual installer.
MSG is offline   Reply With Quote
Old 2nd May 2012, 10:35   #3
pocruadhlaoich
Junior Member
 
Join Date: Jul 2010
Posts: 11
Hi MSG,
thanks for your quick reply! I am trying to understand what it is that you are suggesting:
- if I compile the .nsi then run the compiled .exe, then I will have the bug free "Uninstall.exe" I want on my computer that I wish to put onto the customer's computer
- I then add this uninstaller to my new installer
- my customer downloads the new installer and runs it

At this point, how do I get "Uninstall.exe" onto the customer's machine at an early stage?
Perhaps if I provide some code it might be better.

PHP Code:
Function .onInit
    Call UninstallPreviousSoftware
    
    InitPluginsDir
    
    
#display the language selection dialog
    
    
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd 
During .onInit of my installer, I call UninstallPreviousSoftware, a function I created to check for a previous installation and to call its uninstaller. Is is possible for me to put code in .onInit before UninstallPreviousSoftware has been called that will allow me to replace the file?
Thanks,
Patrick
pocruadhlaoich is offline   Reply With Quote
Old 2nd May 2012, 10:48   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,841
Function UninstallPreviousSoftware
${If} ${FileExists} "Some\path\baduninstaller.exe"
SetOutPath "Some\path"
File "NewUninstaller.exe"
${EndIf}
FunctionEnd

That's all.
MSG is offline   Reply With Quote
Old 2nd May 2012, 10:57   #5
pocruadhlaoich
Junior Member
 
Join Date: Jul 2010
Posts: 11
Oh my goodness, that is fantastic! I'm off to test if this will work now! Thank you!
pocruadhlaoich is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump