I've already gone through:
Check if the application is already installed
Detecting if a program is already installed with NSIS
http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
My questions are little more in depth and little more general.
So, as you understood my problem is that I want to check if "Certain Applications" are already installed on the user's machine? I'm generating the installer using Advanced Installer.
First few questions:
Upgrade Code
? Advanced installer has option, Product Version (identify by Upgrade Code)Product Code
? Advanced installer Product Version (identify by Product Code)GUID
. What is GUID?All the above three has values like this:
{49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3} I don't know what these values are but it seems that computer is recognizing software using this kind of strange ID.
My required applications are
One fact that I discovered is Upgrade Code & Product Code can be extracted from its "msi installer". So, I extracted these values from the installers & registry.
MySQL Server
Installer = mysql-5.1.43-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {0ECED7D8-FF53-4DC9-958E-C2177F528DE4}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{0ECED7D8-FF53-4DC9-958E-C2177F528DE4}
Installer = mysql-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA8FDE5A-2B33-4EDD-B7E7-8D179DF731A5}
Installer = mysql-essential-5.1.46-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {AD33AF2C-6485-4106-B012-1D9CDC88A454}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AD33AF2C-6485-4106-B012-1D9CDC88A454}
Installer = mysql-essential-5.0.89-win32.msi
Upgrade Code = {49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3}
Product Code = {9A4DA7EF-A7B9-4282-90AD-10976AA24E69}
GUID (for component Installed) = ????
Uninstall Path = HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A4DA7EF-A7B9-4282-90AD-10976AA24E69}
Observation from above data:
UpgradeCode
of a software is constant & is irrespective of its version. But surprisingly there is no single entry in the registry with the value of UpgradeCode
ProductCode
is version specific & it is used by the MSI internally which is actually reasonable because. MSI allows applications of different versions to be installed side by side.MySQL ADO .NET Driver
Installer = mysql.data.5.2.5.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????
Installer = mysql.data.6.2.2.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????
UninstallPath =HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5FD88490-011C-4DF1-B886-F298D955171B}
Installer = mysql.data.6.2.3.msi
Upgrade Code = ---
Product Code = {5FD88490-011C-4DF1-B886-F298D955171B}
GUID (for component Installed) = ????
Observations from above data:
ProductCode
for all different versions is same here. This again contradicts my above observations.Now,
ProductCode
& UpgradeCode
& GUID
. The product code is a GUID that is the principal identification of an application or product. For more information, see the ProductCode property. If significant changes are made to a product then the product code should also be changed to reflect this.
A manufacturing code is a code that is used to identify a product that has been manufactured. This code can be used to track the product throughout the manufacturing process, and can also be used to identify the product when it is sold.
The easiest way to determine the product code is to become familiar with the product itself, including the label, the processing information, intended use of product, the container type, who will use or consume the product, etc.
A uniform product code (UPC) is a unique barcode used to identify and track retail products. Nearly every retail product in the United States has a UPC code making it one of the most easy-to-recognize symbols. A UPC barcode is typically made up of multiple vertical black lines and accompanying numbers.
UpgradeCode denotes a product with different versions.
ProductCode denotes a version of a product.
For example, theoretically there is one ProductCode for Microsoft Word 2003 and a different one for Word 2007. However both Word 2003 and 2007 would share the same UpgradeCode since you can upgrade from one to the other.
GUID simply means Globally Unique Identifier. It's a large string of numbers and letters that should be unique on the planet.
UpgradeCodes and ProductCodes are kept in the Registry, but they're hidden and encrypted and you'll need to use a tool to query them. For example:
MsiGetProductInfo(ProductCode, INSTALLPROPERTY_VERSIONSTRING, lpVerName, &cchVerName);
MsiEnumRelatedProducts(UpgradeCode, 0, 0, ProductCode);
To check and see if a product is already installed on a user's machine you might use MsiEnumRelatedProducts() as above. I think you're asking more than what can be answered in a StackOverflow answer. Consider studying more about MSI:
MSDN section on Windows Installer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With