msi: Always derive the SourceDir property from the database path.

This commit is contained in:
Hans Leidekker 2014-01-03 15:00:33 +01:00 committed by Alexandre Julliard
parent 2a8a1452ac
commit 41d2b53c5b
1 changed files with 12 additions and 32 deletions

View File

@ -424,41 +424,21 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package )
UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
{
LPWSTR source, check;
WCHAR *source, *check, *p, *db;
DWORD len;
if (msi_get_property_int( package->db, szInstalled, 0 ))
if (!(db = msi_dup_property( package->db, szOriginalDatabase )))
return ERROR_OUTOFMEMORY;
if (!(p = strrchrW( db, '\\' )) && !(p = strrchrW( db, '/' )))
{
HKEY hkey;
MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE );
source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW );
RegCloseKey( hkey );
}
else
{
LPWSTR p, db;
DWORD len;
db = msi_dup_property( package->db, szOriginalDatabase );
if (!db)
return ERROR_OUTOFMEMORY;
p = strrchrW( db, '\\' );
if (!p)
{
p = strrchrW( db, '/' );
if (!p)
{
msi_free(db);
return ERROR_SUCCESS;
}
}
len = p - db + 2;
source = msi_alloc( len * sizeof(WCHAR) );
lstrcpynW( source, db, len );
msi_free( db );
msi_free(db);
return ERROR_SUCCESS;
}
len = p - db + 2;
source = msi_alloc( len * sizeof(WCHAR) );
lstrcpynW( source, db, len );
msi_free( db );
check = msi_dup_property( package->db, szSourceDir );
if (!check || replace)