msi: Store the media type and set the last used source type accordingly.
This commit is contained in:
parent
6e2048bbc7
commit
7d10d1d2d0
|
@ -3468,16 +3468,6 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
buffer = msi_dup_property( package, cszSourceDir );
|
|
||||||
|
|
||||||
rc = MsiSourceListSetInfoW( package->ProductCode, NULL,
|
|
||||||
MSIINSTALLCONTEXT_USERUNMANAGED,
|
|
||||||
MSICODE_PRODUCT | MSISOURCETYPE_NETWORK,
|
|
||||||
INSTALLPROPERTY_LASTUSEDSOURCEW, buffer );
|
|
||||||
msi_free(buffer);
|
|
||||||
if (rc != ERROR_SUCCESS)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
/* FIXME: Need to write more keys to the user registry */
|
/* FIXME: Need to write more keys to the user registry */
|
||||||
|
|
||||||
hDb= alloc_msihandle( &package->db->hdr );
|
hDb= alloc_msihandle( &package->db->hdr );
|
||||||
|
|
|
@ -59,6 +59,7 @@ static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
|
||||||
|
|
||||||
struct media_info {
|
struct media_info {
|
||||||
UINT disk_id;
|
UINT disk_id;
|
||||||
|
UINT type;
|
||||||
UINT last_sequence;
|
UINT last_sequence;
|
||||||
LPWSTR disk_prompt;
|
LPWSTR disk_prompt;
|
||||||
LPWSTR cabinet;
|
LPWSTR cabinet;
|
||||||
|
@ -504,6 +505,8 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
|
||||||
{
|
{
|
||||||
MSIRECORD *row;
|
MSIRECORD *row;
|
||||||
LPWSTR source_dir;
|
LPWSTR source_dir;
|
||||||
|
LPWSTR source;
|
||||||
|
DWORD options;
|
||||||
UINT r;
|
UINT r;
|
||||||
|
|
||||||
static const WCHAR query[] = {
|
static const WCHAR query[] = {
|
||||||
|
@ -539,6 +542,9 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
|
||||||
source_dir = msi_dup_property(package, cszSourceDir);
|
source_dir = msi_dup_property(package, cszSourceDir);
|
||||||
lstrcpyW(mi->source, source_dir);
|
lstrcpyW(mi->source, source_dir);
|
||||||
|
|
||||||
|
PathStripToRootW(source_dir);
|
||||||
|
mi->type = GetDriveTypeW(source_dir);
|
||||||
|
|
||||||
if (file->IsCompressed && mi->cabinet)
|
if (file->IsCompressed && mi->cabinet)
|
||||||
{
|
{
|
||||||
if (mi->cabinet[0] == '#')
|
if (mi->cabinet[0] == '#')
|
||||||
|
@ -554,12 +560,30 @@ static UINT load_media_info(MSIPACKAGE *package, MSIFILE *file, struct media_inf
|
||||||
lstrcatW(mi->source, mi->cabinet);
|
lstrcatW(mi->source, mi->cabinet);
|
||||||
}
|
}
|
||||||
|
|
||||||
msi_package_add_media_disk(package, MSIINSTALLCONTEXT_USERUNMANAGED, MSICODE_PRODUCT,
|
options = MSICODE_PRODUCT;
|
||||||
mi->disk_id, mi->volume_label, mi->disk_prompt);
|
if (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)
|
||||||
|
{
|
||||||
|
source = source_dir;
|
||||||
|
options |= MSISOURCETYPE_MEDIA;
|
||||||
|
}
|
||||||
|
else if (package->BaseURL && UrlIsW(package->BaseURL, URLIS_URL))
|
||||||
|
{
|
||||||
|
source = package->BaseURL;
|
||||||
|
options |= MSISOURCETYPE_URL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
source = mi->source;
|
||||||
|
options |= MSISOURCETYPE_NETWORK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE)
|
||||||
|
msi_package_add_media_disk(package, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||||
|
MSICODE_PRODUCT, mi->disk_id,
|
||||||
|
mi->volume_label, mi->disk_prompt);
|
||||||
|
|
||||||
msi_package_add_info(package, MSIINSTALLCONTEXT_USERUNMANAGED,
|
msi_package_add_info(package, MSIINSTALLCONTEXT_USERUNMANAGED,
|
||||||
MSICODE_PRODUCT | MSISOURCETYPE_MEDIA,
|
options, INSTALLPROPERTY_LASTUSEDSOURCEW, source);
|
||||||
INSTALLPROPERTY_LASTUSEDSOURCEW, mi->source);
|
|
||||||
|
|
||||||
msi_free(source_dir);
|
msi_free(source_dir);
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -602,14 +626,11 @@ static UINT ready_media(MSIPACKAGE *package, MSIFILE *file, struct media_info *m
|
||||||
{
|
{
|
||||||
LPWSTR source = msi_dup_property(package, cszSourceDir);
|
LPWSTR source = msi_dup_property(package, cszSourceDir);
|
||||||
BOOL matches;
|
BOOL matches;
|
||||||
UINT type;
|
|
||||||
|
|
||||||
PathStripToRootW(source);
|
|
||||||
type = GetDriveTypeW(source);
|
|
||||||
matches = source_matches_volume(mi, source);
|
matches = source_matches_volume(mi, source);
|
||||||
msi_free(source);
|
msi_free(source);
|
||||||
|
|
||||||
if ((type == DRIVE_CDROM || type == DRIVE_REMOVABLE) && !matches)
|
if ((mi->type == DRIVE_CDROM || mi->type == DRIVE_REMOVABLE) && !matches)
|
||||||
{
|
{
|
||||||
rc = msi_change_media(package, mi);
|
rc = msi_change_media(package, mi);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
|
|
Loading…
Reference in New Issue