Module: wine Branch: master Commit: 929395c0f0b7dbd1978adfea5079445228b6b7e8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=929395c0f0b7dbd1978adfea50...
Author: James Hawkins truiken@gmail.com Date: Thu Oct 19 15:51:33 2006 -0700
msi: Only initialize a component's state if it is linked with a feature.
---
dlls/msi/action.c | 58 +++++++++++++++++++-------------------------- dlls/msi/tests/install.c | 11 +++++--- dlls/msi/tests/package.c | 35 +++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 37 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index e81fcb7..8d79028 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -1792,6 +1792,31 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *pa { component = cl->component;
+ switch (component->Attributes) + { + case msidbComponentAttributesLocalOnly: + component->Action = INSTALLSTATE_LOCAL; + component->ActionRequest = INSTALLSTATE_LOCAL; + break; + case msidbComponentAttributesSourceOnly: + component->Action = INSTALLSTATE_SOURCE; + component->ActionRequest = INSTALLSTATE_SOURCE; + break; + case msidbComponentAttributesOptional: + component->Action = INSTALLSTATE_DEFAULT; + component->ActionRequest = INSTALLSTATE_DEFAULT; + break; + default: + component->Action = INSTALLSTATE_LOCAL; + component->ActionRequest = INSTALLSTATE_LOCAL; + } + + if (component->ForceLocalState) + { + component->Action = INSTALLSTATE_LOCAL; + component->ActionRequest = INSTALLSTATE_LOCAL; + } + if (!component->Enabled) { component->Action = INSTALLSTATE_UNKNOWN; @@ -1907,33 +1932,6 @@ static UINT ITERATE_CostFinalizeConditio return ERROR_SUCCESS; }
-static void load_all_component_states(MSIPACKAGE *package) -{ - MSICOMPONENT *comp; - - LIST_FOR_EACH_ENTRY(comp, &package->components, MSICOMPONENT, entry) - { - switch (comp->Attributes) - { - case msidbComponentAttributesLocalOnly: - comp->Action = INSTALLSTATE_LOCAL; - comp->ActionRequest = INSTALLSTATE_LOCAL; - break; - case msidbComponentAttributesSourceOnly: - comp->Action = INSTALLSTATE_SOURCE; - comp->ActionRequest = INSTALLSTATE_SOURCE; - break; - case msidbComponentAttributesOptional: - comp->Action = INSTALLSTATE_DEFAULT; - comp->ActionRequest = INSTALLSTATE_DEFAULT; - break; - default: - comp->Action = INSTALLSTATE_LOCAL; - comp->ActionRequest = INSTALLSTATE_LOCAL; - } - } -} - /* * A lot is done in this function aside from just the costing. * The costing needs to be implemented at some point but for now I am going @@ -1972,8 +1970,6 @@ static UINT ACTION_CostFinalize(MSIPACKA msiobj_release(&view->hdr); }
- load_all_component_states(package); - TRACE("File calculations\n");
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry ) @@ -1985,11 +1981,7 @@ static UINT ACTION_CostFinalize(MSIPACKA continue;
if (file->IsCompressed) - { comp->ForceLocalState = TRUE; - comp->Action = INSTALLSTATE_LOCAL; - comp->ActionRequest = INSTALLSTATE_LOCAL; - }
/* calculate target */ p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL); diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 3696537..fe856f7 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -664,10 +664,7 @@ static void test_MsiInstallProduct(void) size = MAX_PATH; type = REG_SZ; res = RegQueryValueExA(hkey, "blah", NULL, &type, (LPBYTE)path, &size); - todo_wine - { - ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); - } + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res);
size = sizeof(num); type = REG_DWORD; @@ -690,6 +687,7 @@ static void test_MsiInstallProduct(void)
static void test_MsiSetComponentState(void) { + INSTALLSTATE installed, action; MSIHANDLE package; char path[MAX_PATH]; UINT r; @@ -714,6 +712,11 @@ static void test_MsiSetComponentState(vo r = MsiDoAction(package, "CostFinalize"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
+ r = MsiGetComponentState(package, "dangler", &installed, &action); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + ok(installed == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", installed); + ok(action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index f507451..feac142 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -1585,6 +1585,10 @@ static void test_states(void) 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 );
+ /* no feature parent:msidbComponentAttributesLocalOnly */ + r = add_component_entry( hdb, "'kappa', '{D6B93DC3-8DA5-4769-9888-42BFE156BB8B}', 'TARGETDIR', 1, '', 'kappa_file'" ); + ok( r == ERROR_SUCCESS, "cannot add component: %d\n", r ); + r = create_feature_components_table( hdb ); ok( r == ERROR_SUCCESS, "cannot create FeatureComponents table: %d\n", r );
@@ -1652,6 +1656,9 @@ static void test_states(void) r = add_file_entry( hdb, "'eta_file', 'eta', 'eta.txt', 0, '', '1033', 16384, 1" ); ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r);
+ r = add_file_entry( hdb, "'kappa_file', 'kappa', 'kappa.txt', 0, '', '1033', 8192, 1" ); + ok( r == ERROR_SUCCESS, "cannot add file: %d\n", r); + hpkg = package_from_db( hdb ); ok( hpkg, "failed to create package\n");
@@ -1755,6 +1762,13 @@ 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 = MsiGetComponentState(hpkg, "kappa", &state, &action); + ok( r == ERROR_UNKNOWN_COMPONENT, "Expected ERROR_UNKNOWN_COMPONENT, got %d\n", r ); + ok( state == 0xdeadbee, "Expected 0xdeadbee, got %d\n", state); + ok( action == 0xdeadbee, "Expected 0xdeadbee, got %d\n", action); + r = MsiDoAction( hpkg, "CostInitialize"); ok( r == ERROR_SUCCESS, "cost init failed\n");
@@ -1856,6 +1870,13 @@ static void test_states(void) 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, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + r = MsiDoAction( hpkg, "FileCost"); ok( r == ERROR_SUCCESS, "file cost failed\n");
@@ -1957,6 +1978,13 @@ static void test_states(void) 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, "kappa", &state, &action); + ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r ); + ok( state == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", state); + ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action); + r = MsiDoAction( hpkg, "CostFinalize"); ok( r == ERROR_SUCCESS, "cost finalize failed: %d\n", r);
@@ -2057,6 +2085,13 @@ static void test_states(void) 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 = MsiGetComponentState(hpkg, "kappa", &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);
MsiCloseHandle( hpkg ); DeleteFileA( msifile );