Module: wine Branch: master Commit: 42115638c8096e1238da435824e5554648b9e073 URL: http://source.winehq.org/git/wine.git/?a=commit;h=42115638c8096e1238da435824...
Author: James Hawkins jhawkins@codeweavers.com Date: Mon Aug 18 23:14:19 2008 -0500
msi: Use MsiQueryComponent state to determine the component's state.
---
dlls/msi/action.c | 23 +++++++++++++++-------- dlls/msi/tests/package.c | 9 ++++++--- 2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index a375000..b2fdbea 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1693,19 +1693,26 @@ static UINT ACTION_FileCost(MSIPACKAGE *package) static void ACTION_GetComponentInstallStates(MSIPACKAGE *package) { MSICOMPONENT *comp; + INSTALLSTATE state; + UINT r;
- LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry ) - { - INSTALLSTATE res; + state = MsiQueryProductStateW(package->ProductCode);
+ LIST_FOR_EACH_ENTRY(comp, &package->components, MSICOMPONENT, entry) + { if (!comp->ComponentId) continue;
- res = MsiGetComponentPathW( package->ProductCode, - comp->ComponentId, NULL, NULL); - if (res < 0) - res = INSTALLSTATE_ABSENT; - comp->Installed = res; + if (state != INSTALLSTATE_LOCAL && state != INSTALLSTATE_DEFAULT) + comp->Installed = INSTALLSTATE_ABSENT; + else + { + r = MsiQueryComponentStateW(package->ProductCode, NULL, + package->Context, comp->ComponentId, + &comp->Installed); + if (r != ERROR_SUCCESS) + comp->Installed = INSTALLSTATE_ABSENT; + } } }
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index f3f75ad..c27e2fe 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -3794,7 +3794,10 @@ static void test_states(void) 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); + todo_wine + { + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); + } ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
state = 0xdeadbee; @@ -4592,9 +4595,9 @@ static void test_states(void) 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); todo_wine { + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); }
@@ -5393,9 +5396,9 @@ static void test_states(void) 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); todo_wine { + ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state); ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); }