From a9c6ff232733a8378508f2fe2d63c8d49bac04aa Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 9 Oct 2018 15:25:02 +0200 Subject: [PATCH] wbemprox: Don't return an error from IWbemClassObject::BeginMethodEnumeration if the object has an iterator. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wbemprox/class.c | 5 ----- dlls/wbemprox/tests/query.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index 92c110f5f47..3f299ead5e5 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -907,11 +907,6 @@ static HRESULT WINAPI class_object_BeginMethodEnumeration( if (lEnumFlags) FIXME("flags 0x%08x not supported\n", lEnumFlags); - if (co->iter) - { - WARN("not allowed on instance\n"); - return WBEM_E_ILLEGAL_OPERATION; - } co->index_method = 0; return S_OK; } diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index 26e2dfa30d3..b2f5d68d8ea 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -722,8 +722,8 @@ static void test_StdRegProv( IWbemServices *services ) 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n',0}; static const WCHAR regtestW[] = {'S','o','f','t','w','a','r','e','\\','S','t','d','R','e','g','P','r','o','v','T','e','s','t',0}; - BSTR class = SysAllocString( stdregprovW ), method; - IWbemClassObject *reg, *sig_in, *in, *out; + BSTR class = SysAllocString( stdregprovW ), method, name; + IWbemClassObject *reg, *sig_in, *sig_out, *in, *out; VARIANT defkey, subkey, retval, names, types, value, valuename; CIMTYPE type; HRESULT hr; @@ -735,6 +735,29 @@ static void test_StdRegProv( IWbemServices *services ) win_skip( "StdRegProv not available\n" ); return; } + + hr = IWbemClassObject_BeginMethodEnumeration( reg, 0 ); + ok( hr == S_OK, "got %08x\n", hr ); + + while (IWbemClassObject_NextMethod( reg, 0, &name, &sig_in, &sig_out ) == S_OK) + { + SysFreeString( name ); + IWbemClassObject_Release( sig_in ); + IWbemClassObject_Release( sig_out ); + } + + hr = IWbemClassObject_EndMethodEnumeration( reg ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = IWbemClassObject_BeginEnumeration( reg, 0 ); + ok( hr == S_OK, "got %08x\n", hr ); + + while (IWbemClassObject_Next( reg, 0, &name, NULL, NULL, NULL ) == S_OK) + SysFreeString( name ); + + hr = IWbemClassObject_EndEnumeration( reg ); + ok( hr == S_OK, "got %08x\n", hr ); + hr = IWbemClassObject_GetMethod( reg, createkeyW, 0, &sig_in, NULL ); ok( hr == S_OK, "failed to get CreateKey method %08x\n", hr ); @@ -1168,6 +1191,12 @@ static void test_Win32_OperatingSystem( IWbemServices *services ) hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); ok( hr == S_OK, "IEnumWbemClassObject_Next failed %08x\n", hr ); + hr = IWbemClassObject_BeginEnumeration( obj, 0 ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = IWbemClassObject_EndEnumeration( obj ); + ok( hr == S_OK, "got %08x\n", hr ); + type = 0xdeadbeef; VariantInit( &val ); hr = IWbemClassObject_Get( obj, buildnumberW, 0, &val, &type, NULL );