msi: Only initialize a component's state if it is linked with a feature.
This commit is contained in:
parent
7330a03200
commit
929395c0f0
|
@ -1792,6 +1792,31 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
|||
{
|
||||
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_CostFinalizeConditions(MSIRECORD *row, LPVOID param)
|
|||
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(MSIPACKAGE *package)
|
|||
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(MSIPACKAGE *package)
|
|||
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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
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(void)
|
|||
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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -2058,6 +2086,13 @@ 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 = 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 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue