Commit ba9f1f77 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Get rid of msi_component_set_state and msi_feature_set_state.

parent ef05072e
......@@ -2125,7 +2125,7 @@ static void
msi_seltree_update_feature_installstate( HWND hwnd, HTREEITEM hItem,
MSIPACKAGE *package, MSIFEATURE *feature, INSTALLSTATE state )
{
msi_feature_set_state( package, feature, state );
feature->ActionRequest = state;
msi_seltree_sync_item_state( hwnd, feature, hItem );
ACTION_UpdateComponentStates( package, feature );
}
......
......@@ -888,25 +888,25 @@ static BOOL verify_comp_for_removal(MSICOMPONENT *comp, UINT install_mode)
{
INSTALLSTATE request = comp->ActionRequest;
if (request == INSTALLSTATE_UNKNOWN)
return FALSE;
if (install_mode == msidbRemoveFileInstallModeOnInstall &&
(request == INSTALLSTATE_LOCAL || request == INSTALLSTATE_SOURCE))
return TRUE;
if (request == INSTALLSTATE_ABSENT)
{
if (!comp->ComponentId)
return FALSE;
if (install_mode == msidbRemoveFileInstallModeOnRemove)
return TRUE;
/* special case */
if (request != INSTALLSTATE_SOURCE &&
comp->Attributes & msidbComponentAttributesSourceOnly &&
(install_mode == msidbRemoveFileInstallModeOnRemove ||
install_mode == msidbRemoveFileInstallModeOnBoth)) return TRUE;
switch (request)
{
case INSTALLSTATE_LOCAL:
case INSTALLSTATE_SOURCE:
if (install_mode == msidbRemoveFileInstallModeOnInstall ||
install_mode == msidbRemoveFileInstallModeOnBoth) return TRUE;
break;
case INSTALLSTATE_ABSENT:
if (install_mode == msidbRemoveFileInstallModeOnRemove ||
install_mode == msidbRemoveFileInstallModeOnBoth) return TRUE;
break;
default: break;
}
if (install_mode == msidbRemoveFileInstallModeOnBoth)
return TRUE;
return FALSE;
}
......@@ -935,7 +935,7 @@ static UINT ITERATE_RemoveFiles(MSIRECORD *row, LPVOID param)
if (!verify_comp_for_removal(comp, install_mode))
{
TRACE("Skipping removal due to missing conditions\n");
TRACE("Skipping removal due to install mode\n");
comp->Action = comp->Installed;
return ERROR_SUCCESS;
}
......
......@@ -675,7 +675,10 @@ void ACTION_UpdateComponentStates( MSIPACKAGE *package, MSIFEATURE *feature )
component->Action, component->ActionRequest);
if (newstate == INSTALLSTATE_LOCAL)
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
else
{
ComponentList *clist;
......@@ -683,9 +686,10 @@ void ACTION_UpdateComponentStates( MSIPACKAGE *package, MSIFEATURE *feature )
component->hasLocalFeature = FALSE;
msi_component_set_state(package, component, newstate);
component->Action = newstate;
component->ActionRequest = newstate;
/*if any other feature wants is local we need to set it local*/
/* if any other feature wants it local we need to set it local */
LIST_FOR_EACH_ENTRY( f, &package->features, MSIFEATURE, entry )
{
if ( f->ActionRequest != INSTALLSTATE_LOCAL &&
......@@ -706,14 +710,26 @@ void ACTION_UpdateComponentStates( MSIPACKAGE *package, MSIFEATURE *feature )
if (component->Attributes & msidbComponentAttributesOptional)
{
if (f->Attributes & msidbFeatureAttributesFavorSource)
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
{
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
}
else
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
}
else if (component->Attributes & msidbComponentAttributesSourceOnly)
msi_component_set_state(package, component, INSTALLSTATE_SOURCE);
{
component->Action = INSTALLSTATE_SOURCE;
component->ActionRequest = INSTALLSTATE_SOURCE;
}
else
msi_component_set_state(package, component, INSTALLSTATE_LOCAL);
{
component->Action = INSTALLSTATE_LOCAL;
component->ActionRequest = INSTALLSTATE_LOCAL;
}
}
}
}
......
......@@ -1163,7 +1163,7 @@ static UINT MSI_SetComponentStateW(MSIPACKAGE *package, LPCWSTR szComponent,
return ERROR_UNKNOWN_COMPONENT;
if (comp->Enabled)
comp->Installed = iState;
comp->Action = iState;
return ERROR_SUCCESS;
}
......
......@@ -955,8 +955,6 @@ extern UINT msi_set_last_used_source(LPCWSTR product, LPCWSTR usersid,
MSIINSTALLCONTEXT context, DWORD options, LPCWSTR value);
extern UINT msi_get_local_package_name(LPWSTR path, LPCWSTR suffix);
extern UINT msi_set_sourcedir_props(MSIPACKAGE *package, BOOL replace);
extern void msi_component_set_state(MSIPACKAGE *, MSICOMPONENT *, INSTALLSTATE);
extern void msi_feature_set_state(MSIPACKAGE *, MSIFEATURE *, INSTALLSTATE);
extern MSIASSEMBLY *load_assembly(MSIPACKAGE *, MSICOMPONENT *);
extern UINT install_assembly(MSIPACKAGE *, MSICOMPONENT *);
extern WCHAR *font_version_from_file(const WCHAR *);
......
......@@ -7860,10 +7860,8 @@ static void test_removefiles(void)
installed = action = 0xdeadbeef;
r = MsiGetComponentState( hpkg, "hydrogen", &installed, &action );
ok( r == ERROR_SUCCESS, "failed to get component state %u\n", r );
todo_wine {
ok( installed == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", installed );
ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
}
todo_wine ok( action == INSTALLSTATE_UNKNOWN, "expected INSTALLSTATE_UNKNOWN, got %d\n", action );
r = MsiSetComponentState( hpkg, "helium", INSTALLSTATE_LOCAL );
ok( r == ERROR_SUCCESS, "failed to set component state: %d\n", r);
......
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