msi: Load the component states in CostFinalize instead of CostInitialize.
This commit is contained in:
parent
ca5c11009d
commit
d893cb7d1e
|
@ -1118,26 +1118,9 @@ static UINT load_component( MSIRECORD *row, LPVOID param )
|
|||
comp->Condition = msi_dup_record_field( row, 5 );
|
||||
comp->KeyPath = msi_dup_record_field( row, 6 );
|
||||
|
||||
comp->Installed = INSTALLSTATE_ABSENT;
|
||||
|
||||
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;
|
||||
}
|
||||
comp->Installed = INSTALLSTATE_UNKNOWN;
|
||||
comp->Action = INSTALLSTATE_UNKNOWN;
|
||||
comp->ActionRequest = INSTALLSTATE_UNKNOWN;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -1343,13 +1326,6 @@ static UINT load_file(MSIRECORD *row, LPVOID param)
|
|||
file->IsCompressed = package->WordCount & MSIWORDCOUNT_COMPRESSED;
|
||||
}
|
||||
|
||||
if (file->IsCompressed)
|
||||
{
|
||||
file->Component->ForceLocalState = TRUE;
|
||||
file->Component->Action = INSTALLSTATE_LOCAL;
|
||||
file->Component->ActionRequest = INSTALLSTATE_LOCAL;
|
||||
}
|
||||
|
||||
TRACE("File Loaded (%s)\n",debugstr_w(file->File));
|
||||
|
||||
list_add_tail( &package->files, &file->entry );
|
||||
|
@ -1837,6 +1813,32 @@ 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.
|
||||
|
@ -1876,6 +1878,8 @@ 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 )
|
||||
|
@ -1886,6 +1890,13 @@ static UINT ACTION_CostFinalize(MSIPACKAGE *package)
|
|||
if (!comp)
|
||||
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);
|
||||
|
||||
|
|
|
@ -1830,91 +1830,64 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "beta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "gamma", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "theta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "delta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "epsilon", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "zeta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "iota", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "eta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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");
|
||||
|
@ -1958,91 +1931,64 @@ static void test_states(void)
|
|||
action = 0xdeadbee;
|
||||
r = MsiGetComponentState(hpkg, "alpha", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "beta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "gamma", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "theta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "delta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "epsilon", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "zeta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "iota", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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, "eta", &state, &action);
|
||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||
todo_wine
|
||||
{
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue