wbemprox: Fix evaluation of LIKE queries.

This commit is contained in:
Hans Leidekker 2015-08-14 14:58:13 +02:00 committed by Alexandre Julliard
parent 8d690e7ef9
commit 725c7aec8c
2 changed files with 8 additions and 4 deletions

View File

@ -63,10 +63,10 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr )
{ {
while (*q == '%') q++; while (*q == '%') q++;
if (!*q) return TRUE; if (!*q) return TRUE;
while (*p && toupperW( p[1] ) != toupperW( q[1] )) p++; while (*p && *q && toupperW( *p ) == toupperW( *q )) { p++; q++; };
if (!*p) return TRUE; if (!*p && !*q) return TRUE;
} }
if (toupperW( *p++ ) != toupperW( *q++ )) return FALSE; if (*q != '%' && toupperW( *p++ ) != toupperW( *q++ )) return FALSE;
} }
return TRUE; return TRUE;
} }

View File

@ -98,7 +98,11 @@ static void test_select( IWbemServices *services )
'\"','\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0','\"',0}; '\"','\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0','\"',0};
static const WCHAR query9[] = static const WCHAR query9[] =
{'S','E','L','E','C','T','\n','a','\r','F','R','O','M','\t','b',0}; {'S','E','L','E','C','T','\n','a','\r','F','R','O','M','\t','b',0};
static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8, query9 }; static const WCHAR query10[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'P','r','o','c','e','s','s',' ','W','H','E','R','E',' ','C','a','p','t','i','o','n',' ',
'L','I','K','E',' ','"','%','f','i','r','e','f','o','x','.','e','x','e','"',0};
static const WCHAR *test[] = { query1, query2, query3, query4, query5, query6, query7, query8, query9, query10 };
HRESULT hr; HRESULT hr;
IEnumWbemClassObject *result; IEnumWbemClassObject *result;
BSTR wql = SysAllocString( wqlW ); BSTR wql = SysAllocString( wqlW );