Ajit Medhekar
Ajit Medhekar

Reputation: 1078

Check whether the DLL is used by another application

I'm registering capicom.dll through my installer and unregistering it while uninstallation of my product. There is another third party software "ABC", also registers and uses this DLL.

But the problem is, when I uninstall my own product, I unregister capicom.dll. Because of this the another third party software "ABC" is not working properly. So how I can check if this DLL is used by another product/application while unregistering it?

Upvotes: 0

Views: 183

Answers (1)

Michael Urman
Michael Urman

Reputation: 15905

There is no great 100% answer to this problem. There are various conventions, depending on the underlying technology in play, that try to address a related problem. These include:

  • The SharedDLLs registry key, which tracks reference counts
  • Windows Installer component counts (if multiple .msi packages install the identical component, such as from a merge module)
  • Other package-level reference schemes
  • Never uninstalling from the System folder

However these only work when there's a single location for a given file. In your case, reading between the lines, I suspect there are multiple file locations for capicom.dll, but only a single registry location for its COM registration. Thus when you install your copy, you may be overwriting existing COM registration. While your copy is in place, all is well. But when you remove your copy, and/or unregister it, the COM registration does not revert to the previous copy.

Assuming you cannot ensure there's only a single file copy of capicom.dll, the best option I can think of is to use a registration-free COM manifest on your executables that references a private copy of capicom.dll, and skip registering your private copy of capicom.dll. InstallShield can help you create an external manifest, or you can instead create and embed the manifest in your executables yourself. Take additional care to verify that the activation context works if you are exposing inproc COM servers yourself that need to load capicom.

Upvotes: 1

Related Questions