Signed-off-by: Paul Gofman pgofman@codeweavers.com --- dlls/wbemprox/class.c | 17 +++++++++++++++++ dlls/wbemprox/tests/query.c | 11 +++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index f48c815ef8d..2f2d3ef2bfb 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -875,10 +875,27 @@ static HRESULT WINAPI class_object_GetMethod( { struct class_object *co = impl_from_IWbemClassObject( iface ); IWbemClassObject *in, *out; + struct table *table; + unsigned int i; HRESULT hr;
TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszName), lFlags, ppInSignature, ppOutSignature);
+ if (ppInSignature) *ppInSignature = NULL; + if (ppOutSignature) *ppOutSignature = NULL; + + table = get_view_table( impl_from_IEnumWbemClassObject( co->iter )->query->view, co->index ); + + for (i = 0; i < table->num_cols; ++i) + { + if (is_method( table, i ) && !lstrcmpiW( table->columns[i].name, wszName )) break; + } + if (i == table->num_cols) + { + FIXME("Method %s not found in class %s.\n", debugstr_w(wszName), debugstr_w(co->name)); + return WBEM_E_NOT_FOUND; + } + hr = create_signature( co->name, wszName, PARAM_IN, &in ); if (hr != S_OK) return hr;
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c index a79bc759bea..85b242aba6f 100644 --- a/dlls/wbemprox/tests/query.c +++ b/dlls/wbemprox/tests/query.c @@ -460,7 +460,7 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) WBEM_FLAVOR_ORIGIN_PROPAGATED; WCHAR full_path[MAX_COMPUTERNAME_LENGTH + ARRAY_SIZE( L"\\%s\ROOT\CIMV2:" )]; BSTR class, method; - IWbemClassObject *process, *sig_in, *out; + IWbemClassObject *process, *sig_in, *sig_out, *out; IWbemQualifierSet *qualifiers; VARIANT retval, val; SAFEARRAY *names; @@ -504,8 +504,15 @@ static void test_Win32_Process( IWbemServices *services, BOOL use_full_path ) } SafeArrayDestroy( names );
+ sig_in = (void *)0xdeadbeef; + sig_out = (void *)0xdeadbeef; + hr = IWbemClassObject_GetMethod( process, L"unknown", 0, &sig_in, &sig_out ); + ok( hr == WBEM_E_NOT_FOUND, "Got unexpected hr %#x\n", hr ); + ok( !sig_in, "Got unexpected sig_in %p.\n", sig_in ); + ok( !sig_out, "Got unexpected sig_out %p.\n", sig_out ); + sig_in = (void*)0xdeadbeef; - hr = IWbemClassObject_GetMethod( process, L"GetOwner", 0, &sig_in, NULL ); + hr = IWbemClassObject_GetMethod( process, L"getowner", 0, &sig_in, NULL ); ok( hr == S_OK, "failed to get GetOwner method %08x\n", hr ); ok( !sig_in, "sig_in != NULL\n"); IWbemClassObject_Release( process );