Best practice for removing an installed, registered DLL
I have DLLs that were installed with version 1.0.0 of my application. I enabled these Installation/Uninstallation Properties:
Register as Shared File
Register as OCX/DLL/EXE/TLB
Remove on Uninstall
I also have implemented Web Updates. My "Full Installer" installs some required drivers, installs VC++ Redistributable Package. My "Update Installer" doesn't include the larger files that are required to run my application that were installed in the "Full Installer" which is an effort to reduce download size & bandwidth usage from the web.
Now I want to release version 1.0.1 of my application (both Full and Update). This time around, I removed some of the aforementioned DLLs that aren't needed any longer.
What is the best way to remove those files completely?
My idea was: check if the file/DLL exists; if it does, "uninstall" the file. I'm assuming I would have to "undo" the installation properties manually in the script, for each file.
The idea I personally shot down was uninstall the application, then re-install the update--that would defeat the purpose of a small sized Update Installer.
My main objective is to have no files (my application requires) remaining on the machine or registry entries in the registry, after running the uninstaller that was installed with the Update Installer.
Re: Best practice for removing an installed, registered DLL
Hello,
Yes, your idea is correct! Just "undo" the installation properties manually in the script, for each file, during the 1.0.1 installation process.
Friedrich
Re: Best practice for removing an installed, registered DLL
Thanks for the response!
1. How do I properly undo the "Register as Shared File" manually?
2. To unregister, is it a simple "regsvr32 /s /u [file path]?"
3. Do I need to check if a file exists before trying to delete it, or is there a silent remove?
Re: Best practice for removing an installed, registered DLL
Hello,
To handle the Shared File feature in Windows, you have to decrement the counter for you file in the following registry key:
HKLM\Software\Microsoft\Windows\CurrentVersion\Sha redDlls\c:\yada\yourfile.dll
You can use the "Get Registry Key Value..." (to read) and the Edit Registry..." (to write) script functions to handle this.
If the counter is 0 (after decrementation), you have to:
1. Unregister the OCX file (you can use the "Unregister File Operations" -> "Unregister OCXs/DLLs/EXEs/TLBs file immediately" script function.
2. Remove the above mentioned key value name (Shared File counter).
3. Delete the file (using the Delete File(s)...) script function. No need to check if the file exists before trying to delete it.
Does this help?
Friedrich
Re: Best practice for removing an installed, registered DLL
BTW, I think we'll add a new "Delete Shared File..." function to the next SetupBuilder update to automate this process.
Friedrich
Re: Best practice for removing an installed, registered DLL
Great information!
I was going to suggest a feature request after I asked the question, which would automate everything because, why not, right?!
It sounds like it should go pretty smoothly; if not, I'll update the post :)
Thanks again!
Lastly, we have been 100% satisfied with the capabilities of SetupBuilder 8 and the timely, helpful support Lindersoft provides! Keep up the good work!
Re: Best practice for removing an installed, registered DLL
Thank you SO MUCH for you kind words :)
If there is any problem (or if you have more suggestions), just let me know. And the new function will definitely be available in the next SB update.
Friedrich
Re: Best practice for removing an installed, registered DLL
I installed my application on x64 Win 8 machine. After the .DLLs (32-bit application) are registered as shared, they show up in:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\ Windows\CurrentVersion\SharedDlls
How should I handle that in the case this could be installed on a x86 or x64; the problem being the Wow6432Node in the key. I assume that wouldn't be there on a x86 machine.
1 Attachment(s)
Re: Best practice for removing an installed, registered DLL
Hello,
You always specify HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ Windows\CurrentVersion\SharedDlls and never hard-code the "Wow6432Node" item. Redirection is handled for you behind-the-scenes.
Friedrich
Re: Best practice for removing an installed, registered DLL
That seemed to have worked great.
What I did notice is that if the reference count in the SharedDll key is >1, and I uninstall the application--remember Register as Shared File and Remove on Uninstall were both checked--the files still get removed from the INSTALLDIR.
Do I need to uncheck "Remove on Uninstall" and manually check the reference count in the script to see if its safe to delete the files? It would be nice if that automatically happened because adding cases for 120 files would get ugly.