[PATCH] wbemprox: Return WBEM_E_ACCESS_DENIED from IEnumWbemClassObject::Next() if the object is empty.

Dmitry Timoshkov dmitry at baikal.ru
Mon Jul 8 00:07:18 CDT 2019


I have an installer that goes into an infinite loop if IEnumWbemClassObject::Next()
returns either WBEM_S_FALSE or WBEM_S_TIMEDOUT for an empty object when the installer
queries for a missing KB update.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/wbemprox/class.c       |  1 +
 dlls/wbemprox/tests/query.c | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 042ebebdcd..e4ab2624fe 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -123,6 +123,7 @@ static HRESULT WINAPI enum_class_object_Next(
     if (lTimeout != WBEM_INFINITE && !once++) FIXME("timeout not supported\n");
 
     *puReturned = 0;
+    if (!view->count) return WBEM_E_ACCESS_DENIED;
     if (ec->index >= view->count) return WBEM_S_FALSE;
 
     hr = create_class_object( view->table->name, iface, ec->index, NULL, apObjects );
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 2c1ca7f91d..a03c75f9d1 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -1566,6 +1566,31 @@ static void test_Win32_PnPEntity( IWbemServices *services )
     IEnumWbemClassObject_Release( enm );
 }
 
+static void test_Win32_QuickFixEngineering( IWbemServices *services )
+{
+    static const WCHAR queryW[] =
+        {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
+         'W','i','n','3','2','_','Q','u','i','c','k','F','i','x','E','n','g','i','n','e','e','r','i','n','g',' ',
+         'W','H','E','R','E',' ','H','o','t','F','i','x','I','D','=','\"','0','x','d','e','a','d','b','e','e','f','\"',0};
+    BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
+    HRESULT hr;
+    IEnumWbemClassObject *result;
+    IWbemClassObject *obj;
+    ULONG count;
+
+    hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    count = 0xdeadbeef;
+    hr = IEnumWbemClassObject_Next( result, 1000, 1, &obj, &count );
+    ok( hr == WBEM_E_ACCESS_DENIED || broken(hr == WBEM_S_FALSE || hr == WBEM_S_TIMEDOUT) /* before Win7 SP1 */, "got %08x\n", hr );
+    ok( !count, "got %u\n", count );
+
+    IEnumWbemClassObject_Release( result );
+    SysFreeString( wql );
+    SysFreeString( query );
+}
+
 START_TEST(query)
 {
     static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@@ -1613,6 +1638,7 @@ START_TEST(query)
     test_Win32_VideoController( services );
     test_Win32_Printer( services );
     test_Win32_PnPEntity( services );
+    test_Win32_QuickFixEngineering( services );
 
     SysFreeString( path );
     IWbemServices_Release( services );
-- 
2.20.1




More information about the wine-devel mailing list