Page 1 of 1

Shared files

Posted: Wed Oct 04, 2006 12:20 pm
by khalprin
My company has applications that share a few files. One of the shared files is a service with COM interfaces. During an install, I use the Run Program command to run the service with a "/service" command line to install it as a servce (in the scm) and to register the COM interfaces.

How can I determine when it is OK to remove this file? I don't want to uninstall (use a Run Program command with "/ungregserver", or stop/remove the service from the scm) until the last program sharing the file is being uninstalled?

Thanks

Posted: Wed Oct 04, 2006 6:42 pm
by MichaelNesmith
I would install the file as a shared file. That way, Windows keeps in its registry a reference count for each time the file has been installed (the location where it keeps this should be easy to find with a quick Google search).

Then, you may easily go ahead and check that count, and if it indicates that you are the last copy installed, unregister the file using Run Program as you have described.

Posted: Wed Oct 04, 2006 7:45 pm
by khalprin
Thanks for the response. Do I install the file as shared by checking the option that says 'Shared DLL file' (even though it's an exe)?

Thanks.

Posted: Thu Oct 05, 2006 12:29 pm
by MichaelNesmith
Yes, exactly. That option is not limited just to DLLs even though it certainly sounds like it is :D