Gijs Vermeulen : wbemprox: Support retrieving more than one object in IEnumWbemClassObject::Next().
Module: wine Branch: master Commit: 84d85adeea578cac37bded97984409f44c7985ba URL: https://source.winehq.org/git/wine.git/?a=commit;h=84d85adeea578cac37bded979... Author: Gijs Vermeulen <gijsvrm(a)gmail.com> Date: Tue Jul 28 11:35:08 2020 +0200 wbemprox: Support retrieving more than one object in IEnumWbemClassObject::Next(). Patch by GitHub user pnevmoslon with some modifications. Fixes gamepad support in Mortal Kombat 11. Signed-off-by: Gijs Vermeulen <gijsvrm(a)gmail.com> Signed-off-by: Hans Leidekker <hans(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wbemprox/class.c | 23 ++++++++++++++--------- dlls/wbemprox/tests/query.c | 12 ++++++------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index ba7720b098..db6017e0c9 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -116,24 +116,29 @@ static HRESULT WINAPI enum_class_object_Next( struct table *table; static int once = 0; HRESULT hr; + ULONG i, j; TRACE("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned); - if (!uCount) return WBEM_S_FALSE; if (!apObjects || !puReturned) return WBEM_E_INVALID_PARAMETER; if (lTimeout != WBEM_INFINITE && !once++) FIXME("timeout not supported\n"); *puReturned = 0; - if (ec->index >= view->result_count) return WBEM_S_FALSE; - table = get_view_table( view, ec->index ); - hr = create_class_object( table->name, iface, ec->index, NULL, apObjects ); - if (hr != S_OK) return hr; + for (i = 0; i < uCount; i++) + { + if (ec->index >= view->result_count) return WBEM_S_FALSE; + table = get_view_table( view, ec->index ); + hr = create_class_object( table->name, iface, ec->index, NULL, &apObjects[i] ); + if (hr != S_OK) + { + for (j = 0; j < i; j++) IWbemClassObject_Release( apObjects[j] ); + return hr; + } + ec->index++; + (*puReturned)++; + } - ec->index++; - *puReturned = 1; - if (ec->index == view->result_count && uCount > 1) return WBEM_S_FALSE; - if (uCount > 1) return WBEM_S_TIMEDOUT; return WBEM_S_NO_ERROR; } diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index e99e221c30..e48722f3bc 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -181,8 +181,8 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) count = 2; hr = IEnumWbemClassObject_Next( result, 10000, 0, &obj1, &count ); - todo_wine ok( hr == S_OK, "got %08x\n", hr ); - todo_wine ok( count == 0, "expected 0, got %u\n", count ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( count == 0, "expected 0, got %u\n", count ); for (;;) { @@ -199,8 +199,8 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) count = 0; hr = IEnumWbemClassObject_Next( result, 10000, num_objects, obj, &count ); - todo_wine ok( hr == S_OK, "got %08x\n", hr ); - todo_wine ok( count == num_objects, "expected %u, got %u\n", num_objects, count ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( count == num_objects, "expected %u, got %u\n", num_objects, count ); for (i = 0; i < count; i++) IWbemClassObject_Release( obj[i] ); @@ -210,8 +210,8 @@ static void test_IEnumWbemClassObject_Next( IWbemServices *services ) count = 0; hr = IEnumWbemClassObject_Next( result, 10000, num_objects + 1, obj, &count ); - todo_wine ok( hr == S_FALSE, "got %08x\n", hr ); - todo_wine ok( count == num_objects, "expected %u, got %u\n", num_objects, count ); + ok( hr == S_FALSE, "got %08x\n", hr ); + ok( count == num_objects, "expected %u, got %u\n", num_objects, count ); for (i = 0; i < count; i++) IWbemClassObject_Release( obj[i] );
participants (1)
-
Alexandre Julliard