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@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2cc89668fe
commit
84d85adeea
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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] );
|
||||
|
|
Loading…
Reference in New Issue