PDA

View Full Version : DLL Usage Count


jassing
05-12-2003, 04:42 PM
when a dll is "registered" with SetupFactory; it knows hte count of how many times it's "used"

however, due to "runtime" files; we cannot register a file until after all other files have been installed & registered.

This isn't a problem, we run regsvr32 "after install"

however, UNINSTALL is the problem. How can we determine the usage count, decrement it; and if needed, delete the file if the usage count is now zero?

Thanks
-josh

Brett
05-12-2003, 05:12 PM
You could write a set of actions that get executed during uninstall that does the usage count manually using the Registry actions. The key that you want to poke around in is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\SharedDLLs

Basically, just get the value of your DLL by it's filename, decrement the number and determine if it is <= 0. IF so, unregister the DLL ("regsvr32.exe /u yourfile.dll"), delete the registry value, and delete the file. If it is still greater than 1, just leave everything as-is.