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

msi: Set the OriginalDatabase property after applying transforms, not before.

parent f6bdaf36
......@@ -7790,6 +7790,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath,
/* properties may have been added by a transform */
msi_clone_properties( package );
msi_set_original_database_property( package->db, szPackagePath );
msi_parse_command_line( package, szCommandLine, FALSE );
msi_adjust_privilege_properties( package );
......
......@@ -1041,6 +1041,7 @@ extern BOOL msi_init_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
extern void msi_destroy_assembly_caches(MSIPACKAGE *) DECLSPEC_HIDDEN;
extern WCHAR *msi_font_version_from_file(const WCHAR *) DECLSPEC_HIDDEN;
extern WCHAR **msi_split_string(const WCHAR *, WCHAR) DECLSPEC_HIDDEN;
extern UINT msi_set_original_database_property(MSIDATABASE *, const WCHAR *) DECLSPEC_HIDDEN;
/* media */
......
......@@ -1510,6 +1510,28 @@ static UINT get_local_package( const WCHAR *filename, WCHAR *localfile )
return r;
}
UINT msi_set_original_database_property( MSIDATABASE *db, const WCHAR *package )
{
UINT r;
if (UrlIsW( package, URLIS_URL ))
r = msi_set_property( db, szOriginalDatabase, package, -1 );
else if (package[0] == '#')
r = msi_set_property( db, szOriginalDatabase, db->path, -1 );
else
{
DWORD len;
WCHAR *path;
if (!(len = GetFullPathNameW( package, 0, NULL, NULL ))) return GetLastError();
if (!(path = msi_alloc( len * sizeof(WCHAR) ))) return ERROR_OUTOFMEMORY;
len = GetFullPathNameW( package, len, path, NULL );
r = msi_set_property( db, szOriginalDatabase, path, len );
msi_free( path );
}
return r;
}
UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
{
static const WCHAR dotmsi[] = {'.','m','s','i',0};
......@@ -1619,17 +1641,6 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
return r;
}
msi_set_property( package->db, szDatabase, db->path, -1 );
if( UrlIsW( szPackage, URLIS_URL ) )
msi_set_property( package->db, szOriginalDatabase, szPackage, -1 );
else if( szPackage[0] == '#' )
msi_set_property( package->db, szOriginalDatabase, db->path, -1 );
else
{
WCHAR fullpath[MAX_PATH];
DWORD len = GetFullPathNameW( szPackage, MAX_PATH, fullpath, NULL );
msi_set_property( package->db, szOriginalDatabase, fullpath, len );
}
msi_set_context( package );
while (1)
......@@ -1656,6 +1667,12 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
msi_clone_properties( package );
msi_adjust_privilege_properties( package );
}
r = msi_set_original_database_property( package->db, szPackage );
if (r != ERROR_SUCCESS)
{
msiobj_release( &package->hdr );
return r;
}
if (gszLogFile)
package->log_file = CreateFileW( gszLogFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
......
......@@ -2250,7 +2250,7 @@ static void test_property_table(void)
sprintf(package, "#%i", hdb);
r = MsiOpenPackage(package, &hpkg);
todo_wine ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
ok(r != ERROR_SUCCESS, "MsiOpenPackage succeeded\n");
if (r == ERROR_SUCCESS)
MsiCloseHandle(hpkg);
......
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