From 1dc24aa360d5b705cc9e12501706bb7834d3ae8d Mon Sep 17 00:00:00 2001 From: Sergey Guralnik Date: Fri, 29 Nov 2013 15:56:00 +0200 Subject: msi: Use registered SourceDir only for the same product version. (eterbug #8884) --- dlls/msi/action.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 742f8c1..3a4cbe9 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -425,17 +425,35 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package ) UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace) { - LPWSTR source, check; + LPWSTR source = NULL, check; if (msi_get_property_int( package->db, szInstalled, 0 )) { - HKEY hkey; + LPWSTR ver; - MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE ); - source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW ); - RegCloseKey( hkey ); + /* We have registered SourceDir. Use this value if package version and + * installed version are match */ + ver = msi_dup_property( package->db, szProductVersion ); + if(ver) + { + HKEY hkey; + DWORD ms1, ms2, ls1, ls2; + + msi_parse_version_string( ver, &ms1, &ls1 ); + msi_free( ver ); + MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE ); + ver = msi_reg_get_val_str( hkey, INSTALLPROPERTY_VERSIONSTRINGW ); + if(ver) + { + msi_parse_version_string(ver, &ms2, &ls2); + if( ms1 == ms2 && ls1 == ls2 ) + source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW ); + } + RegCloseKey( hkey ); + } } - else + + if(!source) { LPWSTR p, db; DWORD len; -- 1.7.9.5