James Hawkins : msi: Use MsiQueryFeatureState to determine the feature' s state.
Alexandre Julliard
julliard at winehq.org
Tue Aug 19 08:46:52 CDT 2008
Module: wine
Branch: master
Commit: 5a3c3b6a12ba15821667e4d4d25caee28f2cf9bf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5a3c3b6a12ba15821667e4d4d25caee28f2cf9bf
Author: James Hawkins <jhawkins at codeweavers.com>
Date: Mon Aug 18 23:14:53 2008 -0500
msi: Use MsiQueryFeatureState to determine the feature's state.
---
dlls/msi/action.c | 41 ++++++++++-------------------------------
dlls/msi/tests/package.c | 37 ++++++++-----------------------------
2 files changed, 18 insertions(+), 60 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index b2fdbea..4eb266c 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -1716,42 +1716,22 @@ static void ACTION_GetComponentInstallStates(MSIPACKAGE *package)
}
}
-/* scan for and update current install states */
-static void ACTION_UpdateFeatureInstallStates(MSIPACKAGE *package)
+static void ACTION_GetFeatureInstallStates(MSIPACKAGE *package)
{
- MSICOMPONENT *comp;
MSIFEATURE *feature;
+ INSTALLSTATE state;
+
+ state = MsiQueryProductStateW(package->ProductCode);
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{
- ComponentList *cl;
- INSTALLSTATE res = INSTALLSTATE_ABSENT;
-
- LIST_FOR_EACH_ENTRY( cl, &feature->Components, ComponentList, entry )
+ if (state != INSTALLSTATE_LOCAL && state != INSTALLSTATE_DEFAULT)
+ feature->Installed = INSTALLSTATE_ABSENT;
+ else
{
- comp= cl->component;
-
- if (!comp->ComponentId)
- {
- res = INSTALLSTATE_ABSENT;
- break;
- }
-
- if (res == INSTALLSTATE_ABSENT)
- res = comp->Installed;
- else
- {
- if (res == comp->Installed)
- continue;
-
- if (res != INSTALLSTATE_DEFAULT && res != INSTALLSTATE_LOCAL &&
- res != INSTALLSTATE_SOURCE)
- {
- res = INSTALLSTATE_INCOMPLETE;
- }
- }
+ feature->Installed = MsiQueryFeatureStateW(package->ProductCode,
+ feature->Feature);
}
- feature->Installed = res;
}
}
@@ -2202,6 +2182,7 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* read components states from the registry */
ACTION_GetComponentInstallStates(package);
+ ACTION_GetFeatureInstallStates(package);
TRACE("File calculations\n");
msi_check_file_install_states( package );
@@ -2238,8 +2219,6 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
/* FIXME: check volume disk space */
MSI_SetPropertyW(package, szOutOfDiskSpace, szZero);
- ACTION_UpdateFeatureInstallStates(package);
-
return MSI_SetFeatureStates(package);
}
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c
index c27e2fe..8611bf6 100644
--- a/dlls/msi/tests/package.c
+++ b/dlls/msi/tests/package.c
@@ -3774,30 +3774,21 @@ static void test_states(void)
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action);
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);
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_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);
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_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);
state = 0xdeadbee;
@@ -4575,20 +4566,14 @@ static void test_states(void)
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action);
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);
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_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);
state = 0xdeadbee;
@@ -5376,21 +5361,15 @@ static void test_states(void)
action = 0xdeadbee;
r = MsiGetFeatureState(hpkg, "three", &state, &action);
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);
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_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;
action = 0xdeadbee;
More information about the wine-cvs
mailing list