Commit 9ce8592b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msi: Add error handling when retriving component/feature state/action in condition.

parent dcd92a16
...@@ -321,9 +321,16 @@ value: ...@@ -321,9 +321,16 @@ value:
COND_input* cond = (COND_input*) info; COND_input* cond = (COND_input*) info;
INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
MSI_GetComponentStateW(cond->package, $2, &install, &action ); if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
$$.type = VALUE_INTEGER; {
$$.u.integer = action; $$.type = VALUE_LITERAL;
$$.u.string = NULL;
}
else
{
$$.type = VALUE_INTEGER;
$$.u.integer = action;
}
cond_free( $2 ); cond_free( $2 );
} }
| COND_QUESTION identifier | COND_QUESTION identifier
...@@ -331,9 +338,16 @@ value: ...@@ -331,9 +338,16 @@ value:
COND_input* cond = (COND_input*) info; COND_input* cond = (COND_input*) info;
INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
MSI_GetComponentStateW(cond->package, $2, &install, &action );\ if(MSI_GetComponentStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
$$.type = VALUE_INTEGER; {
$$.u.integer = install; $$.type = VALUE_LITERAL;
$$.u.string = NULL;
}
else
{
$$.type = VALUE_INTEGER;
$$.u.integer = install;
}
cond_free( $2 ); cond_free( $2 );
} }
| COND_AMPER identifier | COND_AMPER identifier
...@@ -343,17 +357,14 @@ value: ...@@ -343,17 +357,14 @@ value:
if (MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS) if (MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
{ {
FIXME("condition may be evaluated incorrectly\n"); $$.type = VALUE_LITERAL;
/* we should return empty string in this case */ $$.u.string = NULL;
$$.type = VALUE_INTEGER;
$$.u.integer = MSICONDITION_FALSE;
} }
else else
{ {
$$.type = VALUE_INTEGER; $$.type = VALUE_INTEGER;
$$.u.integer = action; $$.u.integer = action;
} }
cond_free( $2 ); cond_free( $2 );
} }
| COND_EXCLAM identifier | COND_EXCLAM identifier
...@@ -361,9 +372,16 @@ value: ...@@ -361,9 +372,16 @@ value:
COND_input* cond = (COND_input*) info; COND_input* cond = (COND_input*) info;
INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN; INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
MSI_GetFeatureStateW(cond->package, $2, &install, &action ); if(MSI_GetFeatureStateW(cond->package, $2, &install, &action ) != ERROR_SUCCESS)
$$.type = VALUE_INTEGER; {
$$.u.integer = install; $$.type = VALUE_LITERAL;
$$.u.string = NULL;
}
else
{
$$.type = VALUE_INTEGER;
$$.u.integer = install;
}
cond_free( $2 ); cond_free( $2 );
} }
; ;
......
...@@ -2070,7 +2070,13 @@ static void test_condition(void) ...@@ -2070,7 +2070,13 @@ static void test_condition(void)
r = MsiEvaluateConditionA(hpkg, "&nofeature"); r = MsiEvaluateConditionA(hpkg, "&nofeature");
ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r); ok( r == MSICONDITION_FALSE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionA(hpkg, "&nofeature=\"\""); r = MsiEvaluateConditionA(hpkg, "&nofeature=\"\"");
todo_wine ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r); ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
r = MsiEvaluateConditionA(hpkg, "!nofeature=\"\"");
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
MsiEvaluateConditionA(hpkg, "$nocomponent=\"\"");
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
MsiEvaluateConditionA(hpkg, "?nocomponent=\"\"");
ok( r == MSICONDITION_TRUE, "wrong return val (%d)\n", r);
MsiSetPropertyA(hpkg, "A", "2"); MsiSetPropertyA(hpkg, "A", "2");
MsiSetPropertyA(hpkg, "X", "50"); MsiSetPropertyA(hpkg, "X", "50");
......
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