Module: wine Branch: master Commit: 808f3158bbcf229d6eb935a7afe7291e9152ce1a URL: http://source.winehq.org/git/wine.git/?a=commit;h=808f3158bbcf229d6eb935a7af...
Author: Piotr Caban piotr@codeweavers.com Date: Fri Oct 20 22:18:41 2017 +0200
msi: Improve installation with no argument of already installed product.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msi/action.c | 61 +++++++++++++++++++++++------------------------- dlls/msi/msipriv.h | 1 - dlls/msi/tests/package.c | 4 ++-- 3 files changed, 31 insertions(+), 35 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 217d1dc..2f065da 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1740,7 +1740,7 @@ static BOOL process_overrides( MSIPACKAGE *package, int level ) ret |= process_state_property( package, level, szReinstall, INSTALLSTATE_UNKNOWN ); ret |= process_state_property( package, level, szAdvertise, INSTALLSTATE_ADVERTISED );
- if (ret && !package->full_reinstall) + if (ret) msi_set_property( package->db, szPreselected, szOne, -1 );
return ret; @@ -1795,7 +1795,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
level = msi_get_property_int(package->db, szInstallLevel, 1);
- if (!msi_get_property_int( package->db, szPreselected, 0 )) + if (msi_get_property_int( package->db, szPreselected, 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -1803,24 +1803,18 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if (feature->ActionRequest == INSTALLSTATE_UNKNOWN) { - if (feature->Attributes & msidbFeatureAttributesFavorSource) - { - feature->Action = INSTALLSTATE_SOURCE; - feature->ActionRequest = INSTALLSTATE_SOURCE; - } - else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) + if (feature->Installed == INSTALLSTATE_ABSENT) { - feature->Action = INSTALLSTATE_ADVERTISED; - feature->ActionRequest = INSTALLSTATE_ADVERTISED; + feature->Action = INSTALLSTATE_UNKNOWN; + feature->ActionRequest = INSTALLSTATE_UNKNOWN; } else { - feature->Action = INSTALLSTATE_LOCAL; - feature->ActionRequest = INSTALLSTATE_LOCAL; + feature->Action = feature->Installed; + feature->ActionRequest = feature->Installed; } } } - /* disable child features of unselected parent or follow parent */ LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { if (feature->Feature_Parent) continue; @@ -1828,7 +1822,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) follow_parent( feature ); } } - else /* preselected */ + else if (!msi_get_property_int( package->db, szInstalled, 0 )) { LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { @@ -1836,18 +1830,24 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if (feature->ActionRequest == INSTALLSTATE_UNKNOWN) { - if (feature->Installed == INSTALLSTATE_ABSENT) + if (feature->Attributes & msidbFeatureAttributesFavorSource) { - feature->Action = INSTALLSTATE_UNKNOWN; - feature->ActionRequest = INSTALLSTATE_UNKNOWN; + feature->Action = INSTALLSTATE_SOURCE; + feature->ActionRequest = INSTALLSTATE_SOURCE; + } + else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise) + { + feature->Action = INSTALLSTATE_ADVERTISED; + feature->ActionRequest = INSTALLSTATE_ADVERTISED; } else { - feature->Action = feature->Installed; - feature->ActionRequest = feature->Installed; + feature->Action = INSTALLSTATE_LOCAL; + feature->ActionRequest = INSTALLSTATE_LOCAL; } } } + /* disable child features of unselected parent or follow parent */ LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) { if (feature->Feature_Parent) continue; @@ -1903,6 +1903,14 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package) else component->hasLocalFeature = 1; break; + case INSTALLSTATE_UNKNOWN: + if (feature->Installed == INSTALLSTATE_ADVERTISED) + component->hasAdvertisedFeature = 1; + if (feature->Installed == INSTALLSTATE_SOURCE) + component->hasSourceFeature = 1; + if (feature->Installed == INSTALLSTATE_LOCAL) + component->hasLocalFeature = 1; + break; default: break; } @@ -7965,7 +7973,7 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, { static const WCHAR szDisableRollback[] = {'D','I','S','A','B','L','E','R','O','L','L','B','A','C','K',0}; static const WCHAR szAction[] = {'A','C','T','I','O','N',0}; - WCHAR *reinstall, *remove, *patch, *productcode, *action; + WCHAR *reinstall = NULL, *productcode, *action; UINT rc; DWORD len = 0;
@@ -8012,15 +8020,6 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, msi_apply_transforms( package ); msi_apply_patches( package );
- patch = msi_dup_property( package->db, szPatch ); - remove = msi_dup_property( package->db, szRemove ); - reinstall = msi_dup_property( package->db, szReinstall ); - if (msi_get_property_int( package->db, szInstalled, 0 ) && !remove && !reinstall && !patch) - { - TRACE("setting REINSTALL property to ALL\n"); - msi_set_property( package->db, szReinstall, szAll, -1 ); - package->full_reinstall = 1; - } if (msi_get_property( package->db, szAction, NULL, &len )) msi_set_property( package->db, szAction, szINSTALL, -1 ); action = msi_dup_property( package->db, szAction ); @@ -8067,14 +8066,12 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, /* finish up running custom actions */ ACTION_FinishCustomActions(package);
- if (package->need_rollback && !reinstall) + if (package->need_rollback && !(reinstall = msi_dup_property( package->db, szReinstall ))) { WARN("installation failed, running rollback script\n"); execute_script( package, SCRIPT_ROLLBACK ); } msi_free( reinstall ); - msi_free( remove ); - msi_free( patch ); msi_free( action );
if (rc == ERROR_SUCCESS && package->need_reboot_at_end) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 3f7387b..25c346b 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -445,7 +445,6 @@ typedef struct tagMSIPACKAGE unsigned char need_reboot_at_end : 1; unsigned char need_reboot_now : 1; unsigned char need_rollback : 1; - unsigned char full_reinstall : 1; } MSIPACKAGE;
typedef struct tagMSIPREVIEW diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 0dafd7c..ab3bb15 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -3576,7 +3576,7 @@ static void test_states(void) test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); - test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, TRUE ); + test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
MsiCloseHandle(hpkg);
@@ -3652,7 +3652,7 @@ static void test_states(void) test_component_states( __LINE__, hpkg, "phi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); test_component_states( __LINE__, hpkg, "chi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); test_component_states( __LINE__, hpkg, "psi", ERROR_SUCCESS, INSTALLSTATE_SOURCE, INSTALLSTATE_UNKNOWN, FALSE ); - test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, TRUE ); + test_component_states( __LINE__, hpkg, "upsilon", ERROR_SUCCESS, INSTALLSTATE_LOCAL, INSTALLSTATE_LOCAL, FALSE );
MsiCloseHandle(hpkg);