Commit ae18c2dc authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Store the base URL of the MSI package if it is downloaded.

parent 542101fc
......@@ -532,7 +532,7 @@ static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
/* only download the remote cabinet file if a local copy does not exist */
if (GetFileAttributesW(mi->source) == INVALID_FILE_ATTRIBUTES &&
UrlIsW(package->PackagePath, URLIS_URL))
UrlIsW(package->BaseURL, URLIS_URL))
{
rc = msi_extract_remote_cabinet(package, mi);
}
......
......@@ -591,6 +591,7 @@ void ACTION_free_package_structures( MSIPACKAGE* package)
msi_free(package->script);
}
msi_free(package->BaseURL);
msi_free(package->PackagePath);
msi_free(package->ProductCode);
msi_free(package->ActionFormat);
......
......@@ -228,6 +228,7 @@ typedef struct tagMSIPACKAGE
struct list RunningActions;
LPWSTR BaseURL;
LPWSTR PackagePath;
LPWSTR ProductCode;
......@@ -620,7 +621,7 @@ extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * );
extern UINT MSI_SetInstallLevel( MSIPACKAGE *package, int iInstallLevel );
/* package internals */
extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE * );
extern MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *, LPWSTR );
extern UINT MSI_OpenPackageW( LPCWSTR szPackage, MSIPACKAGE ** );
extern UINT MSI_SetTargetPathW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
extern UINT MSI_SetPropertyW( MSIPACKAGE *, LPCWSTR, LPCWSTR );
......
......@@ -428,7 +428,7 @@ static UINT msi_get_word_count( MSIPACKAGE *package )
return word_count;
}
MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db, LPWSTR base_url )
{
static const WCHAR szLevel[] = { 'U','I','L','e','v','e','l',0 };
static const WCHAR szpi[] = {'%','i',0};
......@@ -466,6 +466,7 @@ MSIPACKAGE *MSI_CreatePackage( MSIDATABASE *db )
package->WordCount = msi_get_word_count( package );
package->PackagePath = strdupW( db->path );
package->BaseURL = strdupW( base_url );
/* OK, here is where we do a slew of things to the database to
* prep for all that is to come as a package */
......@@ -550,6 +551,7 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
MSIDATABASE *db = NULL;
MSIPACKAGE *package;
MSIHANDLE handle;
LPWSTR ptr, base_url = NULL;
UINT r;
static const WCHAR OriginalDatabase[] =
......@@ -571,7 +573,16 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
LPCWSTR file;
if ( UrlIsW( szPackage, URLIS_URL ) )
{
file = msi_download_file( szPackage, temppath );
base_url = strdupW( szPackage );
if ( !base_url )
return ERROR_OUTOFMEMORY;
ptr = strrchrW( base_url, '/' );
if (ptr) *(ptr + 1) = '\0';
}
else
file = copy_package_to_temp( szPackage, temppath );
......@@ -589,7 +600,8 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
}
}
package = MSI_CreatePackage( db );
package = MSI_CreatePackage( db, base_url );
msi_free( base_url );
msiobj_release( &db->hdr );
if( !package )
return ERROR_FUNCTION_FAILED;
......
......@@ -43,7 +43,7 @@ MSIPREVIEW *MSI_EnableUIPreview( MSIDATABASE *db )
MSIPREVIEW *preview = NULL;
MSIPACKAGE *package;
package = MSI_CreatePackage( db );
package = MSI_CreatePackage( db, NULL );
if( package )
{
preview = alloc_msiobject( MSIHANDLETYPE_PREVIEW, sizeof (MSIPREVIEW),
......
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