Hans Leidekker : wbemprox: Fix evaluation of LIKE queries.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 17 09:01:11 CDT 2015


Module: wine
Branch: master
Commit: 725c7aec8c3596fa8d183c7b341d1dbadecc91f1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=725c7aec8c3596fa8d183c7b341d1dbadecc91f1

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Aug 14 14:58:13 2015 +0200

wbemprox: Fix evaluation of LIKE queries.

---

 dlls/wbemprox/query.c       | 6 +++---
 dlls/wbemprox/tests/query.c | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 6f66603..f01155a 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -63,10 +63,10 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr )
         {
             while (*q == '%') q++;
             if (!*q) return TRUE;
-            while (*p && toupperW( p[1] ) != toupperW( q[1] )) p++;
-            if (!*p) return TRUE;
+            while (*p && *q && toupperW( *p ) == toupperW( *q )) { p++; q++; };
+            if (!*p && !*q) return TRUE;
         }
-        if (toupperW( *p++ ) != toupperW( *q++ )) return FALSE;
+        if (*q != '%' && toupperW( *p++ ) != toupperW( *q++ )) return FALSE;
     }
     return TRUE;
 }
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index b46ff52..09c8734 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -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};
     static const WCHAR query9[] =
         {'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;
     IEnumWbemClassObject *result;
     BSTR wql = SysAllocString( wqlW );




More information about the wine-cvs mailing list