Archive: Upgrade busy dll by UnInstallLib and then InstallLib


Upgrade busy dll by UnInstallLib and then InstallLib (doesn't work)
 


nsh

>!define LIBRARY_IGNORE_VERSION
>!define LIBRARY_COM

OutFile ".\TestUpgrade.exe"

>Section
SetOutPath "C:\Test"

!insertmacro UnInstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED "$OutDir\test.dll"
!insertmacro InstallLib REGDLL NOTSHARED REBOOT_NOTPROTECTED ".\newTest.dll" "$OutDir\test.dll" $TEMP
SectionEnd
>
I have an installer for an Internet Explorer toolbar, and the objective here is to make its upgrade visible on new IE tabs and windows instead of waiting for restart in case IE is open.

I saw that UnInstallLib of Library.nsh moves the busy dll somewhere else, so I thought a call to InstallLib will re-register the toolbar's new dll. It's not. Instead it will register the new dll on reboot.

A second run of the installer will register the new dll.

- Does this have to do with the UNIQUE id of the installer-run, used by Library.nsh?
- Is there a workaround?

If you want to avoid a reboot, you'll have to code the move-and-switch code yourself by renaming the file, installing the new one and deleting the old one.


I came back to this problem after a while. I can rename the busy dll manually from windows explorer, but when using the Rename NSIS command it sets the error flag. I have admin permissions. OS is Vista.
Anyone knows what's that difference and how to rename the busy dll with NSIS script?


Sorry, what I'm trying is to GetTempFileName and then rename the dll to that name. When I use a hardcoded name of non-existent file it works.

So now I just need to figure how to get a temp name and rename the dll to it without failure.


My solution now is to GetTempFileName and then Delete it, and only then rename to it. Other then creating a temp folder name (I can't find anything that does that already) it's the simplest solution i can think of and it will work most of the time.
In the reeeeealy rare case it won't work, everything will happen on reboot. Ok by me :).