Commit dd305c37 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Set the SourceDir property to the registered source if the product is installed.

parent 41a7f025
......@@ -688,31 +688,41 @@ static BOOL ui_sequence_exists( MSIPACKAGE *package )
static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
{
LPWSTR p, db;
LPWSTR source, check;
DWORD len;
static const WCHAR szOriginalDatabase[] =
{'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
db = msi_dup_property( package->db, szOriginalDatabase );
if (!db)
return ERROR_OUTOFMEMORY;
if (msi_get_property_int( package->db, szInstalled, 0 ))
{
HKEY hkey;
p = strrchrW( db, '\\' );
if (!p)
MSIREG_OpenInstallProps( package->ProductCode, package->Context, NULL, &hkey, FALSE );
source = msi_reg_get_val_str( hkey, INSTALLPROPERTY_INSTALLSOURCEW );
RegCloseKey( hkey );
}
else
{
p = strrchrW( db, '/' );
LPWSTR p, db;
DWORD len;
db = msi_dup_property( package->db, szOriginalDatabase );
if (!db)
return ERROR_OUTOFMEMORY;
p = strrchrW( db, '\\' );
if (!p)
{
msi_free(db);
return ERROR_SUCCESS;
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 );
len = p - db + 2;
source = msi_alloc( len * sizeof(WCHAR) );
lstrcpynW( source, db, len );
msi_free( db );
}
check = msi_dup_property( package->db, cszSourceDir );
if (!check || replace)
......@@ -729,7 +739,6 @@ static UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace)
msi_free( check );
msi_free( source );
msi_free( db );
return ERROR_SUCCESS;
}
......
......@@ -1113,6 +1113,7 @@ static const WCHAR szInprocHandler[] = {'I','n','p','r','o','c','H','a','n','d',
static const WCHAR szInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0};
static const WCHAR szMIMEDatabase[] = {'M','I','M','E','\\','D','a','t','a','b','a','s','e','\\','C','o','n','t','e','n','t',' ','T','y','p','e','\\',0};
static const WCHAR szLocalPackage[] = {'L','o','c','a','l','P','a','c','k','a','g','e',0};
static const WCHAR szOriginalDatabase[] = {'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
/* memory allocation macro functions */
static void *msi_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
......
......@@ -1225,8 +1225,6 @@ static UINT apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code )
UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
{
static const WCHAR OriginalDatabase[] =
{'O','r','i','g','i','n','a','l','D','a','t','a','b','a','s','e',0};
static const WCHAR Database[] = {'D','A','T','A','B','A','S','E',0};
static const WCHAR dotmsi[] = {'.','m','s','i',0};
MSIDATABASE *db = NULL;
......@@ -1339,15 +1337,15 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
msi_set_property( package->db, Database, db->path );
if( UrlIsW( szPackage, URLIS_URL ) )
msi_set_property( package->db, OriginalDatabase, szPackage );
msi_set_property( package->db, szOriginalDatabase, szPackage );
else if( szPackage[0] == '#' )
msi_set_property( package->db, OriginalDatabase, db->path );
msi_set_property( package->db, szOriginalDatabase, db->path );
else
{
WCHAR fullpath[MAX_PATH];
GetFullPathNameW( szPackage, MAX_PATH, fullpath, NULL );
msi_set_property( package->db, OriginalDatabase, fullpath );
msi_set_property( package->db, szOriginalDatabase, fullpath );
}
msi_set_context( package );
......
......@@ -775,7 +775,7 @@ static void test_simple_patch( void )
r = MsiGetProductInfoA( "{913B8D18-FBB6-4CAC-A239-C74C11E3FA74}",
"InstallSource", path, &size );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
todo_wine ok( !strcasecmp( path, install_source ), "wrong path %s\n", path );
ok( !strcasecmp( path, install_source ), "wrong path %s\n", path );
r = MsiInstallProductA( msifile, "REMOVE=ALL" );
ok( r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment