Archive: InstallLib RunOnce fails on reboot if RegTool was deleted


InstallLib RunOnce fails on reboot if RegTool was deleted
  I'm using InstallLib to register some dlls.

On XP, while upgrading, if the dll is in-use I can't rename it and install a new one (in Vista it works), so InstallLib automatically adds an entry in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce so RegTool will register the dll on startup.

If user now uninstalls before rebooting, the RegTool application will be deleted since it's in the install folder. On next startup user will see an error message "Windows cannot find blablabla".

Can I make it silent in a way other than searching the RunOnce key for values with the path i'm deleting and remove it?


Meanwhile I deleted from registry everything that I found relevant, with this code:

;Delete pending dll upgrades which are no longer relevant, so no error message on XP reboot.

StrCpy $0 "NSIS.Library.RegTool.v2"
ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" $0
${StrContains} $R2 $OutDir $1 ;Check if pending RegTool is in the folder we've just deleted.
${If} $R2 != ""
DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" $0
${EndIf}
;Delete RegTool values.
StrCpy $R0 0
${Do}
EnumRegKey $0 HKLM "SOFTWARE\NSIS.Library.RegTool.v2" $R0
${If} $0 != ""
ReadRegStr $1 HKLM "SOFTWARE\NSIS.Library.RegTool.v2\$0" "1.file"
${StrContains} $R1 $OutDir $1 ;Check for anything that's in the folder weve just deleted
${If} $R1 != ""
DeleteRegKey HKLM "SOFTWARE\NSIS.Library.RegTool.v2\$0"
StrCpy $R0 0
${Continue}
${EndIf}
${EndIf}
IntOp $R0 $R0 + 1
${LoopUntil} $0 == ""
DeleteRegKey /ifempty HKLM "SOFTWARE\NSIS.Library.RegTool.v2"

your issue seems very similar to mine. Read this thread: http://forums.winamp.com/showthread....hreadid=296139


Yes, I saw it. I don't want everything to go to $TEMP. What happens if destination is in a different drive than $TEMP?

Unfortunately, I think there's only one RegTool entry in RunOnce for all pending registrations, even those not related to your product, so by deleting this reg value I'm ruining other installations.

Maybe I should copy the regtool i'm about to delete into temp and modify the RunOnce value? Anyone?


Do you need support for Win9x?


- I support XP onwards.
- I checked, and the different drive issue is only for whole folders, so no problem there.
- If I let it use $TEMP, wouldn't dlls reappear after reboot even if the product was uninstalled?