msi: Skip the component action detection logic if there is no product code.

This commit is contained in:
James Hawkins 2008-08-25 00:07:52 -05:00 committed by Alexandre Julliard
parent d596ae29d8
commit 3bec162d51
5 changed files with 30 additions and 44 deletions

View File

@ -1193,7 +1193,7 @@ static UINT load_component( MSIRECORD *row, LPVOID param )
comp->KeyPath = msi_dup_record_field( row, 6 );
comp->Installed = INSTALLSTATE_UNKNOWN;
msi_component_set_state( comp, INSTALLSTATE_UNKNOWN );
msi_component_set_state(package, comp, INSTALLSTATE_UNKNOWN);
return ERROR_SUCCESS;
}
@ -1943,34 +1943,34 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
{
if ((component->Attributes & msidbComponentAttributesSourceOnly) &&
!component->ForceLocalState)
msi_component_set_state( component, INSTALLSTATE_SOURCE );
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
else
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
continue;
}
/* if any feature is local, the component must be local too */
if (component->hasLocalFeature)
{
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
continue;
}
if (component->hasSourceFeature)
{
msi_component_set_state( component, INSTALLSTATE_SOURCE );
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
continue;
}
if (component->hasAdvertiseFeature)
{
msi_component_set_state( component, INSTALLSTATE_ADVERTISED );
msi_component_set_state(package, component, INSTALLSTATE_ADVERTISED);
continue;
}
TRACE("nobody wants component %s\n", debugstr_w(component->Component));
if (component->anyAbsent)
msi_component_set_state(component, INSTALLSTATE_ABSENT);
msi_component_set_state(package, component, INSTALLSTATE_ABSENT);
}
LIST_FOR_EACH_ENTRY( component, &package->components, MSICOMPONENT, entry )
@ -1978,7 +1978,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if (component->Action == INSTALLSTATE_DEFAULT)
{
TRACE("%s was default, setting to local\n", debugstr_w(component->Component));
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
}
TRACE("Result: Component %s (Installed %i, Action %i)\n",

View File

@ -891,7 +891,7 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
continue;
if (newstate == INSTALLSTATE_LOCAL)
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
else
{
ComponentList *clist;
@ -899,7 +899,7 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
component->hasLocalFeature = FALSE;
msi_component_set_state( component, newstate );
msi_component_set_state(package, component, newstate);
/*if any other feature wants is local we need to set it local*/
LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
@ -922,14 +922,14 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
if (component->Attributes & msidbComponentAttributesOptional)
{
if (f->Attributes & msidbFeatureAttributesFavorSource)
msi_component_set_state( component, INSTALLSTATE_SOURCE );
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
else
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
}
else if (component->Attributes & msidbComponentAttributesSourceOnly)
msi_component_set_state( component, INSTALLSTATE_SOURCE );
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
else
msi_component_set_state( component, INSTALLSTATE_LOCAL );
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
}
}
}

View File

@ -901,9 +901,16 @@ static inline void msi_feature_set_state(MSIPACKAGE *package,
}
}
static inline void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE state )
static inline void msi_component_set_state(MSIPACKAGE *package,
MSICOMPONENT *comp,
INSTALLSTATE state)
{
if (state == INSTALLSTATE_ABSENT)
if (!package->ProductCode)
{
comp->ActionRequest = state;
comp->Action = state;
}
else if (state == INSTALLSTATE_ABSENT)
{
switch (comp->Installed)
{

View File

@ -2417,10 +2417,7 @@ static void test_formatrecord_tables(void)
MsiRecordSetString( hrec, 1, "[$parietal]" );
r = MsiFormatRecord( hpkg, hrec, buf, &size );
ok( r == ERROR_SUCCESS, "format record failed: %d\n", r);
todo_wine
{
ok( !lstrcmp( buf, expected ), "Expected '%s', got %s\n", expected, buf);
}
ok( !lstrcmp( buf, expected ), "Expected '%s', got %s\n", expected, buf);
sprintf( buf, "%sI am a really long directory\\temporal.txt", root );
DeleteFile( buf );

View File

@ -5830,10 +5830,7 @@ static void test_featureparents(void)
r = MsiGetComponentState(hpkg, "virgo", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
@ -5854,10 +5851,7 @@ static void test_featureparents(void)
r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
@ -5878,10 +5872,7 @@ static void test_featureparents(void)
r = MsiGetComponentState(hpkg, "monoceros", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected monoceros INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected monoceros INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
@ -5940,10 +5931,7 @@ static void test_featureparents(void)
r = MsiGetComponentState(hpkg, "virgo", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected virgo INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected virgo INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
@ -5964,20 +5952,14 @@ static void test_featureparents(void)
r = MsiGetComponentState(hpkg, "cepheus", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected cepheus INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected cepheus INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;
r = MsiGetComponentState(hpkg, "andromeda", &state, &action);
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
ok( state == INSTALLSTATE_UNKNOWN, "Expected andromeda INSTALLSTATE_UNKNOWN, got %d\n", state);
todo_wine
{
ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
}
ok( action == INSTALLSTATE_SOURCE, "Expected andromeda INSTALLSTATE_SOURCE, got %d\n", action);
state = 0xdeadbee;
action = 0xdeadbee;