Archive: Patch an uninstaller


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


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.


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.


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

Function UninstallPreviousSoftware
${If} ${FileExists} "Some\path\baduninstaller.exe"
SetOutPath "Some\path"
File "NewUninstaller.exe"
${EndIf}
FunctionEnd

That's all.


Oh my goodness, that is fantastic! I'm off to test if this will work now! Thank you! :)