Commit bc673bff authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Make MsiConfigureFeature a bit more robust.

parent 0bfb9c3e
......@@ -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;
......
......@@ -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)
......
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