BPeters
Posts: 17
Joined: Tue Aug 30, 2005 4:58 pm

Uninstall leaves behind reference counted files

I created an msi for my application. When I ran the installation there was some error that caused the installation to stop unexpectedly (error was my fault). Add/Remove Programs would not allow me to uninstall so I used msizap to clear my machine so I could reinstall. All now works fine except any reference counted files installed are not removed by the uninstall.

I'm thinking some how the reference count for these files is still stored on my machine somewhere. I search the registry and can't find it anywhere.

I'm not sure if there is anything you guys could do to help my out since I guess this is a windows installer issue, but if you have any ideas or any information that could point me in the right direction it would be greatly appreciated.

Thanks
Brad
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Brad,

Windows Installer supports 2 sharing mechanisms:

1. The original Windows reference counting scheme based on the following registry key:

Code: Select all

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs
When an installation program copies a shared file (usually a DLL COM server) to a well known location, it determines whether the file's path already exists under the above registry key. If it does not exist, it is created with an initial count of 1. If it does exist, then the reference count is incremented.

When the program is uninstalled, the reference count is decremented. If it reaches 0, then the shared file is deleted from the system. In the particular case of a COM server, its registration entries are also removed.

By default, Windows Installer increments the "SharedDLLs" reference count for a path if the registry entry already exists. However, if a special bit is set in the "Attributes" column of the "Component" table (in AI: by selecting "Shared Dll Reference Count" attribute for a Component in the Organization page) the Installer will create a new SharedDLLs entry if it does not already exist.


2. The Windows Installer sharing mechanism which works at the Component level.

Each Component has an unique code (GUID) and Windows Installer keeps track of each GUID. As for the above scheme, this reference counting mechanism is meaningful only when it counts multiple references to a single location. This information is stored under the following registry key:

Code: Select all

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\[SID]\Components
All now works fine except any reference counted files installed are not removed by the uninstall.
Note that "MsiZap" removes all the Windows Installer registry entries related to a product. It automatically decrements the SharedDLLs reference count and deletes the Component registry entries if those Components are not shared with other installed packages.

The reference counted files may be required by other applications. Or there are other packages that were not successfully removed from your machine.

Microsoft provides a front-end for the "MsiZap" utility. Basically, this tool enumerates all the Windows Installer products available on the system and can remove a program's Windows Installer configuration information. You can download it from:
http://support.microsoft.com/default.as ... -us;290301

However, you should be very careful when using this utility or manually editing the registry.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”