msi: Don't install a feature that is disabled.
This commit is contained in:
parent
9288055beb
commit
c855fbfcd8
|
@ -1735,10 +1735,11 @@ static void ACTION_GetFeatureInstallStates(MSIPACKAGE *package)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
|
static BOOL process_state_property(MSIPACKAGE* package, int level,
|
||||||
INSTALLSTATE state)
|
LPCWSTR property, INSTALLSTATE state)
|
||||||
{
|
{
|
||||||
static const WCHAR all[]={'A','L','L',0};
|
static const WCHAR all[]={'A','L','L',0};
|
||||||
|
static const WCHAR remove[] = {'R','E','M','O','V','E',0};
|
||||||
LPWSTR override;
|
LPWSTR override;
|
||||||
MSIFEATURE *feature;
|
MSIFEATURE *feature;
|
||||||
|
|
||||||
|
@ -1748,6 +1749,10 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||||
{
|
{
|
||||||
|
if (lstrcmpW(property, remove) &&
|
||||||
|
(feature->Level <= 0 || feature->Level > level))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (strcmpiW(override,all)==0)
|
if (strcmpiW(override,all)==0)
|
||||||
msi_feature_set_state( feature, state );
|
msi_feature_set_state( feature, state );
|
||||||
else
|
else
|
||||||
|
@ -1760,7 +1765,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))
|
||||||
{
|
{
|
||||||
msi_feature_set_state( feature, state );
|
msi_feature_set_state(feature, state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ptr2)
|
if (ptr2)
|
||||||
|
@ -1780,7 +1785,7 @@ static BOOL process_state_property (MSIPACKAGE* package, LPCWSTR property,
|
||||||
|
|
||||||
UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
||||||
{
|
{
|
||||||
int install_level;
|
int level;
|
||||||
static const WCHAR szlevel[] =
|
static const WCHAR szlevel[] =
|
||||||
{'I','N','S','T','A','L','L','L','E','V','E','L',0};
|
{'I','N','S','T','A','L','L','L','E','V','E','L',0};
|
||||||
static const WCHAR szAddLocal[] =
|
static const WCHAR szAddLocal[] =
|
||||||
|
@ -1800,7 +1805,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
||||||
|
|
||||||
TRACE("Checking Install Level\n");
|
TRACE("Checking Install Level\n");
|
||||||
|
|
||||||
install_level = msi_get_property_int( package, szlevel, 1 );
|
level = msi_get_property_int(package, szlevel, 1);
|
||||||
|
|
||||||
/* ok here is the _real_ rub
|
/* ok here is the _real_ rub
|
||||||
* all these activation/deactivation things happen in order and things
|
* all these activation/deactivation things happen in order and things
|
||||||
|
@ -1821,17 +1826,17 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
||||||
* REMOVE are the big ones, since we don't handle administrative installs
|
* REMOVE are the big ones, since we don't handle administrative installs
|
||||||
* yet anyway.
|
* yet anyway.
|
||||||
*/
|
*/
|
||||||
override |= process_state_property(package,szAddLocal,INSTALLSTATE_LOCAL);
|
override |= process_state_property(package, level, szAddLocal, INSTALLSTATE_LOCAL);
|
||||||
override |= process_state_property(package,szRemove,INSTALLSTATE_ABSENT);
|
override |= process_state_property(package, level, szRemove, INSTALLSTATE_ABSENT);
|
||||||
override |= process_state_property(package,szAddSource,INSTALLSTATE_SOURCE);
|
override |= process_state_property(package, level, szAddSource, INSTALLSTATE_SOURCE);
|
||||||
override |= process_state_property(package,szReinstall,INSTALLSTATE_LOCAL);
|
override |= process_state_property(package, level, szReinstall, INSTALLSTATE_LOCAL);
|
||||||
|
|
||||||
if (!override)
|
if (!override)
|
||||||
{
|
{
|
||||||
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
LIST_FOR_EACH_ENTRY( feature, &package->features, MSIFEATURE, entry )
|
||||||
{
|
{
|
||||||
BOOL feature_state = ((feature->Level > 0) &&
|
BOOL feature_state = ((feature->Level > 0) &&
|
||||||
(feature->Level <= install_level));
|
(feature->Level <= level));
|
||||||
|
|
||||||
if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN))
|
if ((feature_state) && (feature->Action == INSTALLSTATE_UNKNOWN))
|
||||||
{
|
{
|
||||||
|
@ -1849,7 +1854,7 @@ UINT MSI_SetFeatureStates(MSIPACKAGE *package)
|
||||||
{
|
{
|
||||||
FeatureList *fl;
|
FeatureList *fl;
|
||||||
|
|
||||||
if (feature->Level > 0 && feature->Level <= install_level)
|
if (feature->Level > 0 && feature->Level <= level)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( fl, &feature->Children, FeatureList, entry )
|
LIST_FOR_EACH_ENTRY( fl, &feature->Children, FeatureList, entry )
|
||||||
|
|
|
@ -4481,11 +4481,8 @@ static void test_states(void)
|
||||||
action = 0xdeadbee;
|
action = 0xdeadbee;
|
||||||
r = MsiGetFeatureState(hpkg, "five", &state, &action);
|
r = MsiGetFeatureState(hpkg, "five", &state, &action);
|
||||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||||
todo_wine
|
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
||||||
{
|
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||||
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
|
||||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
|
||||||
}
|
|
||||||
|
|
||||||
state = 0xdeadbee;
|
state = 0xdeadbee;
|
||||||
action = 0xdeadbee;
|
action = 0xdeadbee;
|
||||||
|
@ -5213,11 +5210,8 @@ static void test_states(void)
|
||||||
action = 0xdeadbee;
|
action = 0xdeadbee;
|
||||||
r = MsiGetFeatureState(hpkg, "five", &state, &action);
|
r = MsiGetFeatureState(hpkg, "five", &state, &action);
|
||||||
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r );
|
||||||
todo_wine
|
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
||||||
{
|
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
||||||
ok( state == INSTALLSTATE_ABSENT, "Expected INSTALLSTATE_ABSENT, got %d\n", state);
|
|
||||||
ok( action == INSTALLSTATE_UNKNOWN, "Expected INSTALLSTATE_UNKNOWN, got %d\n", action);
|
|
||||||
}
|
|
||||||
|
|
||||||
state = 0xdeadbee;
|
state = 0xdeadbee;
|
||||||
action = 0xdeadbee;
|
action = 0xdeadbee;
|
||||||
|
|
Loading…
Reference in New Issue