Reputation: 283
My setup project needs to detect already installed programs as prerequisites or for opting out certain components. The msi functions MsiGetProductInfo()
and MsiEnumRelatedProducts()
functions expose the required functionality.
But unfortunately, I can't find the required Microsoft software's product and upgrade codes to check for anywhere. Does anyone know where to look them up? Testwise installing these products to determine the codes is not an option due to inavailablity of most of the packages and/or serial codes.
I might try downloading each package and examining it with Orca, but due to our tiny internet connection, this would take days or even weeks, so I'd prefer an easier way.
Currently, the most important required data is the codes of the Microsoft Office 2010 family and its editions. But in future, the are certainly other products I'll need to check for.
Thanks in advance for your help, Hannes
Upvotes: 0
Views: 153
Reputation: 3674
It is not so easy to understand your question. If you want to be able to build a setup which detects requisiteINSTALLPROPERTY_INSTALLEDPRODUCTNAMEs you must have at least one machine where all prerequisite are installed- not?
For getting a list of all installed ProductCodes, you can use MsiEnumProducts() or MsiEnumProductsEx().
You just have given some correct API functions. Where is the Problem of "finding the required product/upgrade codes exactly? The product you expected was not in the list or you have not tried to generate the list of installed programs? One returning property of MsiGetProductInfo() will give you the INSTALLPROPERTY_INSTALLEDPRODUCTNAME info for example. Is this not sufficient for you?
Instead of programming on your own: There is a tool msiinv.exe available for getting such a list of installed programs with their codes, e.g. from here: https://skydrive.live.com/?cid=27e6a35d1a492af7&id=27E6A35D1A492AF7%21910&authkey=!ANs8Pr0aVhaT_qQ Usage example: c:\msiinv\msiinv.exe -p > c:\msiinv\msiinv_output.txt Follow Aaron Stebners blog here for more (e.g. when the download link is outdated): http://blogs.msdn.com/b/astebner/archive/2005/07/01/434814.aspx
You can do it with some scripting too.
First of all, using ProductCodes for recognizing foreign packages is not a good idea, because a simple update of that package would change that code. UpgradeCode is better, but..
But if you want to recognize bigger products like Office or SQL Server, it can be a PITA to really recognize all correct packages, and not the optional ones, to deal with language specific packages, to deal with the 32 or 64 bit packages. I would not recommend to rely on MSI Codes for complicated scenarios, even if you are an expert. It is very easy to fail. Try to find a registry key under HKLM\Software\Microsoft which is persistent between Versions or better even tells the Version, e.g. one key under HKLM\Software\Microsoft\Microsoft SQL Server for searching this product, similar for Office, etc.
Feel free to ask, if there is anything left.
Upvotes: 1
Reputation: 55581
Office products come in a variety of SKUs that have different ProductCode and UpgradeCode properties. For this reason I don't use them. Instead look at physical registry keys and DLL's to indicate required features (actual dependencies) are installed.
Upvotes: 2