Paul Gofman : wbemprox: Return WBEM_E_INVALID_CLASS from create_view() if namespace is empty.

Alexandre Julliard julliard at winehq.org
Tue Sep 14 16:00:11 CDT 2021


Module: wine
Branch: master
Commit: 73aab21de686e8a6bf663fc05563a745574b1a85
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=73aab21de686e8a6bf663fc05563a745574b1a85

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Mon Sep 13 17:13:28 2021 +0300

wbemprox: Return WBEM_E_INVALID_CLASS from create_view() if namespace is empty.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 108e3b4ad81..77ed27e105d 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -62,6 +62,7 @@ HRESULT create_view( enum view_type type, enum wbm_namespace ns, const WCHAR *pa
             heap_free( view );
             return hr;
         }
+        else if (!table && ns == WBEMPROX_NAMESPACE_LAST) return WBEM_E_INVALID_CLASS;
         view->proplist = proplist;
         view->cond     = cond;
         break;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 784ebd3503d..69bb8e7977e 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -2061,6 +2061,33 @@ static void test_Win32_LogicalDisk( IWbemServices *services )
     SysFreeString( wql );
 }
 
+static void test_empty_namespace( IWbemLocator *locator )
+{
+    BSTR path = SysAllocString( L"ROOT" );
+    BSTR wql = SysAllocString( L"wql" );
+    IEnumWbemClassObject *result;
+    IWbemServices *services;
+    BSTR query;
+    HRESULT hr;
+
+    hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
+    ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr );
+
+    query = SysAllocString( L"SELECT * FROM __ASSOCIATORS" );
+    hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+    ok( hr == WBEM_E_INVALID_CLASS, "Query failed: %08x\n", hr );
+    SysFreeString( query );
+
+    query = SysAllocString( L"SELECT * FROM Win32_OperatingSystem" );
+    hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+    ok( hr == WBEM_E_INVALID_CLASS, "got %08x\n", hr );
+    SysFreeString( query );
+
+    SysFreeString( wql );
+    SysFreeString( path );
+    IWbemServices_Release( services );
+}
+
 START_TEST(query)
 {
     BSTR path = SysAllocString( L"ROOT\\CIMV2" );
@@ -2138,6 +2165,7 @@ START_TEST(query)
     test_Win32_VideoController( services );
     test_Win32_WinSAT( services );
     test_SystemRestore( services );
+    test_empty_namespace( locator );
 
     SysFreeString( path );
     IWbemServices_Release( services );




More information about the wine-cvs mailing list