Hans Leidekker : wbemprox: Handle escaped backslashes in LIKE queries.

Alexandre Julliard julliard at winehq.org
Mon Jun 7 15:02:03 CDT 2021


Module: wine
Branch: stable
Commit: feed1f0efbefb154ed14b76442b0e1f1025bc1ba
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=feed1f0efbefb154ed14b76442b0e1f1025bc1ba

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Jan 21 12:36:41 2021 +0100

wbemprox: Handle escaped backslashes in LIKE queries.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50256
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit d4032d69f6fe4290217cb21a05dc33b9add868b4)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/wbemprox/query.c       |  1 +
 dlls/wbemprox/tests/query.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 3d60825f24e..ec2a43c3f5f 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -93,6 +93,7 @@ static BOOL eval_like( const WCHAR *lstr, const WCHAR *rstr )
 
     while (*p && *q)
     {
+        if (q[0] == '\\' && q[1] == '\\') q++;
         if (*q == '%')
         {
             while (*q == '%') q++;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 572920c7702..5d7559afe56 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1171,6 +1171,16 @@ static void test_Win32_NetworkAdapter( IWbemServices *services )
 
     IEnumWbemClassObject_Release( result );
     SysFreeString( query );
+
+    query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapter WHERE PNPDeviceID LIKE \"PCI\\\\%\"" );
+    hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+    ok( hr == S_OK, "got %08x\n", hr );
+    SysFreeString( query );
+
+    query = SysAllocString( L"SELECT * FROM Win32_NetworkAdapter WHERE PNPDeviceID LIKE \"PCI\\%\"" );
+    hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+    todo_wine ok( hr == WBEM_E_INVALID_QUERY, "got %08x\n", hr );
+    SysFreeString( query );
     SysFreeString( wql );
 }
 




More information about the wine-cvs mailing list