msi: Only override a feature whose action state is INSTALLSTATE_SOURCE.

This commit is contained in:
James Hawkins 2006-09-20 19:53:07 -07:00 committed by Alexandre Julliard
parent 319cac4c1f
commit 937b9b2bbc
2 changed files with 83 additions and 1 deletions

View File

@ -1774,7 +1774,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
}
}
if (component->ForceLocalState)
if (component->ForceLocalState && feature->Action == INSTALLSTATE_SOURCE)
{
feature->Action = INSTALLSTATE_LOCAL;
feature->ActionRequest = INSTALLSTATE_LOCAL;

View File

@ -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 );
@ -1697,6 +1711,20 @@ static void test_states(void)
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, "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);
@ -1793,6 +1821,26 @@ static void test_states(void)
}
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
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);
@ -1916,6 +1964,26 @@ static void test_states(void)
}
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
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);
@ -2030,6 +2098,20 @@ static void test_states(void)
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, "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);