NULL and empty strings are the same in conditions.
This commit is contained in:
parent
e607684604
commit
da20e4d9ca
|
@ -361,6 +361,10 @@ static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
|
|||
|
||||
static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
|
||||
{
|
||||
/* null and empty string are equivalent */
|
||||
if (!a) a = szEmpty;
|
||||
if (!b) b = szEmpty;
|
||||
|
||||
/* a or b may be NULL */
|
||||
switch (operator)
|
||||
{
|
||||
|
@ -377,7 +381,7 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
|
|||
case COND_LE:
|
||||
return 1 != lstrcmpW( a, b );
|
||||
case COND_SS: /* substring */
|
||||
return ( a && b && strstrW( a, b ) ) ? 1 : 0;
|
||||
return strstrW( a, b ) ? 1 : 0;
|
||||
case COND_ILT:
|
||||
return -1 == lstrcmpiW( a, b );
|
||||
case COND_IGT:
|
||||
|
@ -391,7 +395,7 @@ static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b )
|
|||
case COND_ILE:
|
||||
return 1 != lstrcmpiW( a, b );
|
||||
case COND_ISS:
|
||||
return ( a && b && strstriW( a, b ) ) ? 1 : 0;
|
||||
return strstriW( a, b ) ? 1 : 0;
|
||||
case COND_LHS:
|
||||
case COND_RHS:
|
||||
case COND_ILHS:
|
||||
|
|
|
@ -587,6 +587,12 @@ void test_condition(void)
|
|||
r = MsiEvaluateCondition(hpkg, "NOT ( 1 AND 1 )");
|
||||
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
||||
|
||||
r = MsiEvaluateCondition(hpkg, "NOT A AND (BBBBBBBBBB=2 OR CCC=1) AND Ddddddddd");
|
||||
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
||||
|
||||
r = MsiEvaluateCondition(hpkg, "Installed<>\"\"");
|
||||
ok( r == MSICONDITION_FALSE, "wrong return val\n");
|
||||
|
||||
MsiCloseHandle( hpkg );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue