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