JoderCoder
Level 8

Major upgrade

How does MSI detects the version of the previous package? In other words, when preventing the downgrade, how does it exactly work? How does MSI determines the version?

Thanks.
Labels (1)
0 Kudos
3 Replies
RobertDickau
Flexera Alumni

I'm not sure what level of detail you're looking for, but the short version is, Windows Installer stores information---product code, upgrade code, version, and more---about every installed product. When your installer runs, the FindRelatedProducts action finds the product codes of installed products with the target upgrade code, and looks up their versions to see if they're within the range specified in the Upgrade table.
0 Kudos
JoderCoder
Level 8

I am wondering where these information are stored/read from by Windows Installer. I would think somewhere visible at the registry? Perhaps one location like HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall ?
0 Kudos
RobertDickau
Flexera Alumni

Beyond that uninstaller information, there's cached product information under HLKM\Software\Microsoft\Windows\CurrentVersion\Installer and in the cached MSI database. I don't know from memory which set of data the Windows Installer engine uses for comparisons (presumably it would be the same everywhere), but in any case I'm pretty sure it's undocumented, so doing anything directly with it is probably a bad idea.

The good news is, there are MSI API functions to get information about installed products, too.
0 Kudos