Commit 6395ff6a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Create macro functions to set feature and component states.

parent 62aedea8
......@@ -1702,6 +1702,18 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
return TRUE;
}
static void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
{
feature->ActionRequest = state;
feature->Action = state;
}
static void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE state )
{
comp->ActionRequest = state;
comp->Action = state;
}
UINT MSI_SetFeatureStates(MSIPACKAGE *package)
{
int install_level;
......@@ -1760,20 +1772,11 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN))
{
if (feature->Attributes & msidbFeatureAttributesFavorSource)
{
feature->ActionRequest = INSTALLSTATE_SOURCE;
feature->Action = INSTALLSTATE_SOURCE;
}
msi_feature_set_state( feature, INSTALLSTATE_SOURCE );
else if (feature->Attributes & msidbFeatureAttributesFavorAdvertise)
{
feature->ActionRequest = INSTALLSTATE_ADVERTISED;
feature->Action = INSTALLSTATE_ADVERTISED;
}
msi_feature_set_state( feature, INSTALLSTATE_ADVERTISED );
else
{
feature->ActionRequest = INSTALLSTATE_LOCAL;
feature->Action = INSTALLSTATE_LOCAL;
}
msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
}
}
......@@ -1786,10 +1789,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
continue;
LIST_FOR_EACH_ENTRY( fl, &feature->Children, FeatureList, entry )
{
fl->feature->ActionRequest = INSTALLSTATE_UNKNOWN;
fl->feature->Action = INSTALLSTATE_UNKNOWN;
}
msi_feature_set_state( fl->feature, INSTALLSTATE_UNKNOWN );
}
}
else
......@@ -1820,42 +1820,27 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
switch (component->Attributes)
{
case msidbComponentAttributesLocalOnly:
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
msi_component_set_state( component, INSTALLSTATE_LOCAL );
break;
case msidbComponentAttributesSourceOnly:
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
msi_component_set_state( component, INSTALLSTATE_SOURCE );
break;
case msidbComponentAttributesOptional:
component->Action = INSTALLSTATE_DEFAULT;
component->ActionRequest = INSTALLSTATE_DEFAULT;
msi_component_set_state( component, INSTALLSTATE_DEFAULT );
break;
default:
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
msi_component_set_state( component, INSTALLSTATE_LOCAL );
}
if (component->ForceLocalState)
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
msi_component_set_state( component, INSTALLSTATE_LOCAL );
if (!component->Enabled)
{
component->Action = INSTALLSTATE_UNKNOWN;
component->ActionRequest = INSTALLSTATE_UNKNOWN;
}
else
{
if (feature->Attributes == msidbFeatureAttributesFavorLocal)
msi_component_set_state( component, INSTALLSTATE_UNKNOWN );
else if (feature->Attributes == msidbFeatureAttributesFavorLocal)
{
if (!(component->Attributes & msidbComponentAttributesSourceOnly))
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
msi_component_set_state( component, INSTALLSTATE_LOCAL );
}
else if (feature->Attributes == msidbFeatureAttributesFavorSource)
{
......@@ -1863,42 +1848,24 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
(component->Action == INSTALLSTATE_ABSENT) ||
(component->Action == INSTALLSTATE_ADVERTISED) ||
(component->Action == INSTALLSTATE_DEFAULT))
{
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
}
msi_component_set_state( component, INSTALLSTATE_SOURCE );
}
else if (feature->ActionRequest == INSTALLSTATE_ADVERTISED)
{
if ((component->Action == INSTALLSTATE_UNKNOWN) ||
(component->Action == INSTALLSTATE_ABSENT))
{
component->Action = INSTALLSTATE_ADVERTISED;
component->ActionRequest = INSTALLSTATE_ADVERTISED;
}
msi_component_set_state( component, INSTALLSTATE_ADVERTISED );
}
else if (feature->ActionRequest == INSTALLSTATE_ABSENT)
{
if (component->Action == INSTALLSTATE_UNKNOWN)
{
component->Action = INSTALLSTATE_ABSENT;
component->ActionRequest = INSTALLSTATE_ABSENT;
}
msi_component_set_state( component, INSTALLSTATE_ABSENT );
}
else if (feature->ActionRequest == INSTALLSTATE_UNKNOWN)
{
component->Action = INSTALLSTATE_UNKNOWN;
component->ActionRequest = INSTALLSTATE_UNKNOWN;
}
}
msi_component_set_state( component, INSTALLSTATE_UNKNOWN );
if (component->ForceLocalState && feature->Action == INSTALLSTATE_SOURCE)
{
feature->Action = INSTALLSTATE_LOCAL;
feature->ActionRequest = INSTALLSTATE_LOCAL;
}
msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment