Archive: What is this NSIS.Library.RegTool file?


What is this NSIS.Library.RegTool file?
I'm developing a few new installers, and I noticed that in the InstallDir, there's this file generated by NSIS installer:

NSIS.Library.RegTool.v2.{Some GUID}.exe.

At first I thought may be if i reboot my machine, this file will go away (this particular installer requires a reboot each time user installs the product).

Even after a reboot this file remains in the InstallDir. What's the function of this file? Is it safe to use? I tried searching for this file online, but didn't find much help. Thanks!


It's a tool used to register DLL files after they have been replaced at reboot. It deletes itself after two reboots. One for the actual replacement and one for deleting itself.


Got it, thanks Kichik.


I noticed that if I do not reboot, but uninstall the product. Next time when the machine is rebooted, Windows throws an error that "Cannot find NSIS.Library.RegTool.v2.{GUID}.exe. Make sure you typed the name correctly, and then try again.

How can this error be prevented on a reboot? any help will be appreciated.


Which NSIS version?


It's version 2.38, I don't want to jump to conclusion, but could it be a bug in NSIS?


Attach a short example script. I'll check later.


I'm not exactly sure which part of script you'd want to see but here's how the install section starts:

Section

SetRebootFlag true ; I want user to reboot the machine each time the product is installed.
.
.
.
;Install to InstallDir
File ${SOURCE_DIR}\myDLL1.dll
File ${SOURCE_DIR}\myDLL2.dll
File ${SOURCE_DIR}\${_LANG}\myFile.txt

!insertmacro InstallOnReboot ${SOURCE_DIR}\MyDLL3.dll $INSTDIR\MyDLL3.dll

!insertmacro InstallOnReboot ${SOURCE_DIR}\MyDLL4.dll $INSTDIR\MyDLL4.dll
.
.
.

!insertmacro InstallLib REGDLL SHARED REBOOT_NOTPROTECTED "${SOURCE_DIR}\myDLL3.dll" "$INSTDIR\myDLL3.dll" "$INSTDIR"

!insertmacro InstallLib REGDLL SHARED REBOOT_NOTPROTECTED "${SOURCE_DIR}\myDLL4.dll" "$INSTDIR\myDLL4.dll" "$INSTDIR"

;Install service
;Create registry keys/entries

the install section ends there. On uninstall, I just use UnRegDLL to unregister these DLLs except one of my DLLs where I use UnInstallLib to unregister a shared DLL


Why are you using $INSTDIR as temporary folder?


aww, I wasn't too clear after reading the documentation. Changing to TEMP folder instead of INSTDIR resolved the problem. I thought I had to use the INSTDIR (after reading the docs).
Thanks so much Joost and kichik for your prompt help!