Archive: Installling/Deleting DLL files?


Installling/Deleting DLL files?
What is the normal method to handle the situation where you have installed a DLL file, lets say into the \Windows\System32 folder. As this could be already be there, then there is no need to re-copy it. So far no problem. Now when you run your product's uninstaller, it will try to delete the DLL file from this folder. But it is required by some other software package, and should not be deleted. How do you handle this with NSIS?

I assume this is a normal thing that must have already been dealt with..

Thanks
Lane


Your best bet is to write a registry key that stores 0 or 1. 1 being that the DLL already existed and it should not be uninstalled. Optionally you could include an uninstall.ini file inside your program's directory and store this information in that using WriteINIStr and ReadINIStr.

-Stu


Ok, good idea...
What about the "InstallLib" macro. Is this for this purpose?

Lane


Microsoft addressed this issue with the concept of shared DLLs. Take a look at appendix B of the NSIS docs for info about how to use InstallLib and UnInstallLib with shared DLLs.


If we are talking about shared dlls, MSDN says following about 'Usage counting': When a component is first installed, the setup program or installer DLL creates a value under the following key for each file in that component that is not already on the system:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDlls
And 'Removing an Application': An uninstall program should complete the following steps:
Remove all information used by the application from the registry. If decrementing a DLL's usage count results in a usage count of zero, the uninstall program should display a message offering to delete the DLL or save it in case it may be needed later...


Ok, That seems to make sense (about the registry entries for shared DLL's). I havn't looked, but would this be what the InstallLib macro might be doing???

Lane


Yes, Lane. That's what InstallLib and UnInstallLib are for.