Module: wine Branch: master Commit: 937b9b2bbc0c2a264f124ddb5bd5e921e9eded02 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=937b9b2bbc0c2a264f124ddb...
Author: James Hawkins truiken@gmail.com Date: Wed Sep 20 19:53:07 2006 -0700
msi: Only override a feature whose action state is INSTALLSTATE_SOURCE.
---
dlls/msi/action.c | 2 + dlls/msi/tests/package.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 1 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index a1b7155..defc9ce 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1774,7 +1774,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *pa } }
- if (component->ForceLocalState) + if (component->ForceLocalState && feature->Action == INSTALLSTATE_SOURCE) { feature->Action = INSTALLSTATE_LOCAL; feature->ActionRequest = INSTALLSTATE_LOCAL; diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index e07f86a..a39ea77 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -1608,6 +1608,14 @@ static void test_states(void) r = add_feature_entry( hdb, "'three', '', '', '', 2, 1, '', 1" ); ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r );
+ /* msidbFeatureAttributesFavorLocal */ + r = add_feature_entry( hdb, "'four', '', '', '', 2, 1, '', 0" ); + ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r ); + + /* disabled */ + r = add_feature_entry( hdb, "'five', '', '', '', 2, 0, '', 1" ); + ok( r == ERROR_SUCCESS, "cannot add feature: %d\n", r ); + /* msidbFeatureAttributesFavorSource:msidbComponentAttributesSourceOnly */ r = add_component_entry( hdb, "'eta', '{DD89003F-0DD4-41B8-81C0-3411A7DA2695}', 'TARGETDIR', 1, '', 'eta_file'" ); ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); @@ -1642,6 +1650,12 @@ static void test_states(void) r = add_feature_components_entry( hdb, "'three', 'eta'" ); ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r );
+ r = add_feature_components_entry( hdb, "'four', 'eta'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + + r = add_feature_components_entry( hdb, "'five', 'eta'" ); + ok( r == ERROR_SUCCESS, "cannot add feature components: %d\n", r ); + r = create_file_table( hdb ); ok( r == ERROR_SUCCESS, "cannot create File table: %d\n", r );
@@ -1699,6 +1713,20 @@ static void test_states(void)
state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_UNKNOWN_FEATURE, "Expected ERROR_UNKNOWN_FEATURE, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); @@ -1795,6 +1823,26 @@ static void test_states(void)
state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + } + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + } + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); todo_wine @@ -1918,6 +1966,26 @@ static void test_states(void)
state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + } + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + todo_wine + { + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + } + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); todo_wine @@ -2032,6 +2100,20 @@ static void test_states(void)
state = 0xdeadbee; action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "four", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; + r = MsiGetFeatureState(hpkg, "five", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + + state = 0xdeadbee; + action = 0xdeadbee; r = MsiGetComponentState(hpkg, "alpha", &state, &action); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);