Find the Product

Heath Stewart

The Windows SDK Team instructs users how to uninstall older Platform SDK installations without the original source installation media. As part of their instructions, they write,

RemoveProgram FilesMicrosoft SDK folder
This is the painful part:
Find all .msi that are releated to the February 2003 release in
from the cmd line you can run msiexec.exe -x nameofmsi.msi

There are a few ways of doing this. You could navigate to %WINDIR%Installer in Windows Explorer – a hidden folder for good reason – and add both the Title and Comments columns to the detail view (since some package misuse the Title Summary Property for a description of what their package installs). You could then scan the descriptions to find the right package.

Take note, however, that %WINDIR%Installer is a hidden folder because it is not meant for general access, and is maintained by Windows Installer and could change without warning since it is not officially documented. In general you should not be in this folder, and even if you’re simply curious be very careful about what you do.

The Windows Installer programming interfaces provide you with everything you need to access the product. If you know the ProductCode you could call the MsiOpenProduct function to get a handle to the product, then call the MsiGetActiveDatabase function to get a handle to the database without knowing the path, and from that query tables or do anything else. Using these functions, patches are even brought into view unless you call the MsiOpenPackageEx function with dwOptions set to include MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE (1).

You can also pass the ProductCode to “msiexec -x {ProductCode}” instead of using the package path.

Without accessing the %WINDIR%Installer directory then, or assuming that some package comments are not easily identifiable, how can you find the ProductCode or even the locally cached product package? You can use the MsiEnumProducts function, and for each result call the MsiGetProductInfo function to fetch common properties like the ProductCode, ProductName, ProductVersion, and more – even the local cache location if you just want to, for example, view the .msi file in Orca.

I have posted a simple example showing how to do this, as well as the binary since this could be a useful tool for those not interested in the source. This sample is not supported by Microsoft so use it at your own risk, but feel free to post comments or questions here.


Discussion is closed.

Feedback usabilla icon