Commit 5a3c3b6a authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Use MsiQueryFeatureState to determine the feature's state.

parent 42115638
...@@ -1716,43 +1716,23 @@ static void ACTION_GetComponentInstallStates(MSIPACKAGE *package) ...@@ -1716,43 +1716,23 @@ static void ACTION_GetComponentInstallStates(MSIPACKAGE *package)
} }
} }
/* scan for and update current install states */ static void ACTION_GetFeatureInstallStates(MSIPACKAGE *package)
static void ACTION_UpdateFeatureInstallStates(MSIPACKAGE *package)
{ {
MSICOMPONENT *comp;
MSIFEATURE *feature; MSIFEATURE *feature;
INSTALLSTATE state;
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry ) state = MsiQueryProductStateW(package->ProductCode);
{
ComponentList *cl;
INSTALLSTATE res = INSTALLSTATE_ABSENT;
LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
{
comp= cl->component;
if (!comp->ComponentId) LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{ {
res = INSTALLSTATE_ABSENT; if (state != INSTALLSTATE_LOCAL && state != INSTALLSTATE_DEFAULT)
break; feature->Installed = INSTALLSTATE_ABSENT;
}
if (res == INSTALLSTATE_ABSENT)
res = comp->Installed;
else else
{ {
if (res == comp->Installed) feature->Installed = MsiQueryFeatureStateW(package->ProductCode,
continue; feature->Feature);
if (res != INSTALLSTATE_DEFAULT && res != INSTALLSTATE_LOCAL &&
res != INSTALLSTATE_SOURCE)
{
res = INSTALLSTATE_INCOMPLETE;
}
} }
} }
feature->Installed = res;
}
} }
static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property, static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
...@@ -2202,6 +2182,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ...@@ -2202,6 +2182,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* read components states from the registry */ /* read components states from the registry */
ACTION_GetComponentInstallStates(package); ACTION_GetComponentInstallStates(package);
ACTION_GetFeatureInstallStates(package);
TRACE("File calculations\n"); TRACE("File calculations\n");
msi_check_file_install_states( package ); msi_check_file_install_states( package );
...@@ -2238,8 +2219,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package) ...@@ -2238,8 +2219,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* FIXME: check volume disk space */ /* FIXME: check volume disk space */
MSI_SetPropertyW(package, szOutOfDiskSpace, szZero); MSI_SetPropertyW(package, szOutOfDiskSpace, szZero);
ACTION_UpdateFeatureInstallStates(package);
return MSI_SetFeatureStates(package); return MSI_SetFeatureStates(package);
} }
......
...@@ -3774,30 +3774,21 @@ static void test_states(void) ...@@ -3774,30 +3774,21 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action); r = MsiGetFeatureState(hpkg, "three", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "four", &state, &action); r = MsiGetFeatureState(hpkg, "four", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "five", &state, &action); r = MsiGetFeatureState(hpkg, "five", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
}
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
...@@ -4575,20 +4566,14 @@ static void test_states(void) ...@@ -4575,20 +4566,14 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action); r = MsiGetFeatureState(hpkg, "three", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "four", &state, &action); r = MsiGetFeatureState(hpkg, "four", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
...@@ -5376,21 +5361,15 @@ static void test_states(void) ...@@ -5376,21 +5361,15 @@ static void test_states(void)
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action); r = MsiGetFeatureState(hpkg, "three", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action); ok( action == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", action);
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "four", &state, &action); r = MsiGetFeatureState(hpkg, "four", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
todo_wine
{
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state); ok( state == INSTALLSTATE_LOCAL, "Expected INSTALLSTATE_LOCAL, got %d\n", state);
}
state = 0xdeadbee; state = 0xdeadbee;
action = 0xdeadbee; action = 0xdeadbee;
......
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