Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Reference couting mechanism in windows installer


5 replies to this topic

kirann_hegde

kirann_hegde
  • Full Members
  • 93 posts

Posted 09 August 2006 - 13:36

Hi All,

I am facing a problem in windows installer based projects using Install Shield professional 11.5. The problem is because of the reference counting mechanism of windows installer.

As per my knowledge reference counting mechanism is used to prevent applications from removing shared dlls during the course of uninstallation.

I have the following doubts:

1)The same file belongs to different components in different projects(i.e we have 3 projects and each project has a component which contains the same file and each component has a different GUID). Now if we install the file to the same location multiple times by running all the 3 installations, i see that the reference count gets incremented for this file in the windows registry. The component property has been set to shared in the Install Shield IDE. Now as per the windows installer rules, the reference count should not have gone up as all the 3 components have different GUIDs since windows installer reference count mechanism works on the basis of component GUIDs.

Can anyone please explain as to what the issue is in the above mentioned scenario?

2)This is leading to a problem as because of this a shortcut is not getting removed even though the product with which the shortcut is installed is uninstalled. We have a product suite and an executable has been set to shared in all the different projects(this executable is included in several different projects) which make up the product suite and in one of these projects, the shortcut is associated with this executable as part of the component. All the components which contain this executable in the different projects have different component GUIDs. How is the windows installer maintaining reference counting mechanism inspite of different component GUIDs.

Is there a problem with install shield itself.

Does anyone has a solution as to how this executable can be left on the installed location even though one of the products in the suite of products is uninstalled with the shortcut also being removed(i.e the product which installs the shortcut being uninstalled).

Any help would be greatly appreciated.

Thanks in advance.







Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 09 August 2006 - 15:33

First off: installing the same file to the same location in multiple components with different component codes is a vialoation of Windows Installer's component rules, so it's expected to cause problems. Make sure you use the same GUID.

Now to your question: there are actually two "reference counting" machanisms.
For each component it installs Windows Installer records information about the product that installed it - the component clients. And it only removes a component if there are no more clients registered. So this is actually more than just a count.

In addition Windows Installer supports the old mechanism of the SharedDLL ref count for backward compatibility with non-Windodws-installer setups. It will create and increment this count if any of the following is true:
- the component is makred as shared ("legacy-shared")
- the file already exists on the target disk
- a SharedDLL count for the file already exists in registry

kirann_hegde

kirann_hegde
  • Full Members
  • 93 posts

Posted 10 August 2006 - 13:20

Stefan thanks a lot for your guidance. I still have some more doubts.

[QUOTE]For each component it installs Windows Installer records information about the product that installed it - the component clients. And it only removes a component if there are no more clients registered. So this is actually more than just a count.

Is this count kept at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs ? even in the case which has been mentioned above.

1)Also lets say if i have a file installed in two different locations with the same component code using different installers and the components are marked as shared , how will the reference counting mechanism work. I have read several posts which say that the windows reference counting mechanism is based on component GUIDs.

2)If the component GUID is same but the component is not marked as shared, will the reference count go up in case the file is installed to the same location in one trial and to different location in another trial(I mean using both the installers).

I apologize if i am asking a lot of questions but i want to be clear on this.

Thanks,
Kiran

Edited by kirann_hegde, 10 August 2006 - 13:34.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 10 August 2006 - 16:44

QUOTE
For each component it installs Windows Installer records information about the product that installed it - the component clients. And it only removes a component if there are no more clients registered. So this is actually more than just a count.

Is this count kept at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs ? even in the case which has been mentioned above.

No. That registry location is the place for backward compatibility with legacy installers.

kirann_hegde

kirann_hegde
  • Full Members
  • 93 posts

Posted 11 August 2006 - 05:23

[QUOTE]For each component it installs Windows Installer records information about the product that installed it - the component clients. And it only removes a component if there are no more clients registered. So this is actually more than just a count.

Where is the reference count in this case maintained? Is it some where in the registry? Also please clarify if the reference counting in this case is based on the component GUID?


Also in one of the postings on this forum (URL:http://forum.installsite.net/index.php?showtopic=6632&hl=) it has been
mentioned that if the target of a shortcut is a shared component(legacy shared),
then upon uninstallation of this product, the shortcut will still be left on the user system as the component with which this shortcut is associated is marked as shared. What i mean is that i have 5 products installing a shared component into the same location and one of those products has a shortcut associated with the shared component. When i install all of them one after the other with the shared component being installed into the same location and then uninstall the product which installs the shortcut, the shortcut is still left on the system as the component with which the shortcut is associated is shared.

The possible resolution i have in mind is :
1)Associate the shortcut with a completely different component which is not shared amond products.
2)Have a simple VB scrip custom action to remove the shortcut during uninstallation.
Is there any other way to get rid of the problem i am facing.

I tried reproducing the above issue by creating two simple basic msi projects but i was not able to. However such a thing is happening in the product suite for which i am working. The behaviour appears strange to me.

Thanks



Thanks in advance

Edited by kirann_hegde, 11 August 2006 - 13:10.


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 11 August 2006 - 13:21

QUOTE
What i mean is that i have 5 products installing a shared component into the same location and one of those products has a shortcut associated with the shared component.
Usually you would have the shortcut in the same component as the file that it points to. If you have the shortcut in a different component it should be removed when that component is removed.