Commit 09b0154a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

wbemprox: Check for method existence in class_object_GetMethod().

parent f47a09b9
......@@ -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;
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment