msi: Make MsiConfigureFeature a bit more robust.

This commit is contained in:
Mike McCormack 2006-07-24 20:34:14 +09:00 committed by Alexandre Julliard
parent 0bfb9c3e3d
commit bc673bff01
2 changed files with 27 additions and 4 deletions

View File

@ -1715,6 +1715,21 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
if (!szProduct || !szFeature)
return ERROR_INVALID_PARAMETER;
switch (eInstallState)
{
case INSTALLSTATE_DEFAULT:
/* FIXME: how do we figure out the default location? */
eInstallState = INSTALLSTATE_LOCAL;
break;
case INSTALLSTATE_LOCAL:
case INSTALLSTATE_SOURCE:
case INSTALLSTATE_ABSENT:
case INSTALLSTATE_ADVERTISED:
break;
default:
return ERROR_INVALID_PARAMETER;
}
r = MSI_OpenProductW( szProduct, &package );
if (r != ERROR_SUCCESS)
return r;
@ -1731,10 +1746,6 @@ UINT WINAPI MsiConfigureFeatureW(LPCWSTR szProduct, LPCWSTR szFeature, INSTALLST
MsiSetInternalUI( INSTALLUILEVEL_BASIC, NULL );
/* FIXME: how do we figure out the default location? */
if (eInstallState == INSTALLSTATE_DEFAULT)
eInstallState = INSTALLSTATE_LOCAL;
r = ACTION_PerformUIAction( package, szCostInit );
if (r != ERROR_SUCCESS)
goto end;

View File

@ -90,6 +90,18 @@ static void test_null(void)
r = MsiEnumFeaturesW(NULL,0,NULL,NULL);
ok( r == ERROR_INVALID_PARAMETER,"wrong error\n");
r = MsiConfigureFeatureW(NULL, NULL, 0);
ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", NULL, 0);
ok( r == ERROR_INVALID_PARAMETER, "wrong error\n");
r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", 0);
ok( r == ERROR_INVALID_PARAMETER, "wrong error %d\n", r);
r = MsiConfigureFeatureA("{00000000-0000-0000-0000-000000000000}", "foo", INSTALLSTATE_DEFAULT);
ok( r == ERROR_UNKNOWN_PRODUCT, "wrong error %d\n", r);
}
static void test_getcomponentpath(void)