I want to get the product code from an msi file before installing it. I need it to remove the other version of a product if it's already installed on my computer. I mean I want to prevent an error 1638 ("Another version of this product already exists...") and to delete it manually in my code. I'm using c++. So I want to get the product code from the msi file that is about to install and using this product code remove the existing version of the product and install a new one. But when I'm trying to open an msi file to get it's handle using
MsiOpenPackage(msiPackagePath, &d_handle);
I get an error 1638. So I can not open an msi file and can not get a product code from it. My question: is it possible to get a product code from msi file not opening it with MsiOpenPackage
? Thank you in advance!