Commit 575cc67d authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Use msi_feature_set_state and msi_component_set_state where possible.

parent 6395ff6a
......@@ -1150,8 +1150,7 @@ static UINT load_component( MSIRECORD *row, LPVOID param )
comp->KeyPath = msi_dup_record_field( row, 6 );
comp->Installed = INSTALLSTATE_UNKNOWN;
comp->Action = INSTALLSTATE_UNKNOWN;
comp->ActionRequest = INSTALLSTATE_UNKNOWN;
msi_component_set_state( comp, INSTALLSTATE_UNKNOWN );
return ERROR_SUCCESS;
}
......@@ -1282,8 +1281,7 @@ static UINT load_feature(MSIRECORD * row, LPVOID param)
feature->Attributes = MSI_RecordGetInteger(row,8);
feature->Installed = INSTALLSTATE_UNKNOWN;
feature->Action = INSTALLSTATE_UNKNOWN;
feature->ActionRequest = INSTALLSTATE_UNKNOWN;
msi_feature_set_state( feature, INSTALLSTATE_UNKNOWN );
list_add_tail( &package->features, &feature->entry );
......@@ -1669,10 +1667,7 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{
if (strcmpiW(override,all)==0)
{
feature->ActionRequest= state;
feature->Action = state;
}
msi_feature_set_state( feature, state );
else
{
LPWSTR ptr = override;
......@@ -1683,8 +1678,7 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
if ((ptr2 && strncmpW(ptr,feature->Feature, ptr2-ptr)==0)
|| (!ptr2 && strcmpW(ptr,feature->Feature)==0))
{
feature->ActionRequest= state;
feature->Action = state;
msi_feature_set_state( feature, state );
break;
}
if (ptr2)
......@@ -1702,18 +1696,6 @@ 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;
......
......@@ -1766,8 +1766,7 @@ msi_seltree_menu( HWND hwnd, HTREEITEM hItem )
case INSTALLSTATE_LOCAL:
case INSTALLSTATE_ADVERTISED:
case INSTALLSTATE_ABSENT:
feature->ActionRequest = r;
feature->Action = r;
msi_feature_set_state( feature, r );
break;
default:
FIXME("select feature and all children\n");
......
......@@ -185,10 +185,8 @@ static UINT ControlEvent_AddLocal(MSIPACKAGE* package, LPCWSTR argument,
else
{
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{
feature->ActionRequest = INSTALLSTATE_LOCAL;
feature->Action = INSTALLSTATE_LOCAL;
}
msi_feature_set_state( feature, INSTALLSTATE_LOCAL );
ACTION_UpdateComponentStates(package,argument);
}
return ERROR_SUCCESS;
......@@ -207,10 +205,8 @@ static UINT ControlEvent_Remove(MSIPACKAGE* package, LPCWSTR argument,
else
{
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{
feature->ActionRequest = INSTALLSTATE_ABSENT;
feature->Action= INSTALLSTATE_ABSENT;
}
msi_feature_set_state( feature, INSTALLSTATE_ABSENT );
ACTION_UpdateComponentStates(package,argument);
}
return ERROR_SUCCESS;
......@@ -229,10 +225,7 @@ static UINT ControlEvent_AddSource(MSIPACKAGE* package, LPCWSTR argument,
else
{
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
{
feature->ActionRequest = INSTALLSTATE_SOURCE;
feature->Action = INSTALLSTATE_SOURCE;
}
msi_feature_set_state( feature, INSTALLSTATE_SOURCE );
ACTION_UpdateComponentStates(package,argument);
}
return ERROR_SUCCESS;
......
......@@ -865,17 +865,13 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
continue;
if (newstate == INSTALLSTATE_LOCAL)
{
component->ActionRequest = INSTALLSTATE_LOCAL;
component->Action = INSTALLSTATE_LOCAL;
}
msi_component_set_state( component, INSTALLSTATE_LOCAL );
else
{
ComponentList *clist;
MSIFEATURE *f;
component->ActionRequest = newstate;
component->Action = newstate;
msi_component_set_state( component, newstate );
/*if any other feature wants is local we need to set it local*/
LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
......@@ -897,26 +893,14 @@ void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
if (component->Attributes & msidbComponentAttributesOptional)
{
if (f->Attributes & msidbFeatureAttributesFavorSource)
{
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
}
msi_component_set_state( component, INSTALLSTATE_SOURCE );
else
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
msi_component_set_state( component, INSTALLSTATE_LOCAL );
}
else if (component->Attributes & msidbComponentAttributesSourceOnly)
{
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
}
msi_component_set_state( component, INSTALLSTATE_SOURCE );
else
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
msi_component_set_state( component, INSTALLSTATE_LOCAL );
}
}
}
......
......@@ -539,8 +539,7 @@ UINT WINAPI MSI_SetFeatureStateW(MSIPACKAGE* package, LPCWSTR szFeature,
feature->Attributes & msidbFeatureAttributesDisallowAdvertise)
return ERROR_FUNCTION_FAILED;
feature->ActionRequest = iState;
feature->Action = iState;
msi_feature_set_state( feature, iState );
ACTION_UpdateComponentStates(package,szFeature);
......
......@@ -713,6 +713,18 @@ extern UINT ACTION_PerformUIAction(MSIPACKAGE *package, const WCHAR *action);
extern void ACTION_FinishCustomActions( MSIPACKAGE* package);
extern UINT ACTION_CustomAction(MSIPACKAGE *package,const WCHAR *action, BOOL execute);
static inline void msi_feature_set_state( MSIFEATURE *feature, INSTALLSTATE state )
{
feature->ActionRequest = state;
feature->Action = state;
}
static inline void msi_component_set_state( MSICOMPONENT *comp, INSTALLSTATE state )
{
comp->ActionRequest = state;
comp->Action = state;
}
/* actions in other modules */
extern UINT ACTION_AppSearch(MSIPACKAGE *package);
extern UINT ACTION_FindRelatedProducts(MSIPACKAGE *package);
......
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