diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c index bf367c70c9c..59b6da88566 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -579,8 +579,24 @@ static HRESULT WINAPI wbem_services_ExecMethod( IWbemClassObject **ppOutParams, IWbemCallResult **ppCallResult ) { - FIXME("\n"); - return WBEM_E_FAILED; + const struct table *table; + class_method *func; + struct path *path; + HRESULT hr; + + TRACE("%p, %s, %s, %08x, %p, %p, %p, %p\n", iface, debugstr_w(strObjectPath), + debugstr_w(strMethodName), lFlags, pCtx, pInParams, ppOutParams, ppCallResult); + + if (lFlags) FIXME("flags %08x not supported\n", lFlags); + + if ((hr = parse_path( strObjectPath, &path )) != S_OK) return hr; + + table = get_table( path->class ); + free_path( path ); + if (!table) return WBEM_E_NOT_FOUND; + + if ((hr = get_method( table, strMethodName, &func )) != S_OK) return hr; + return func( pInParams, ppOutParams ); } static HRESULT WINAPI wbem_services_ExecMethodAsync( diff --git a/dlls/wbemprox/table.c b/dlls/wbemprox/table.c index c6dc8450dd4..c0e3eefb870 100644 --- a/dlls/wbemprox/table.c +++ b/dlls/wbemprox/table.c @@ -239,6 +239,29 @@ HRESULT set_value( const struct table *table, UINT row, UINT column, LONGLONG va return S_OK; } +HRESULT get_method( const struct table *table, const WCHAR *name, class_method **func ) +{ + UINT i, j; + + for (i = 0; i < table->num_rows; i++) + { + for (j = 0; j < table->num_cols; j++) + { + if (table->columns[j].type & COL_FLAG_METHOD && !strcmpW( table->columns[j].name, name )) + { + HRESULT hr; + LONGLONG val; + + if ((hr = get_value( table, i, j, &val )) != S_OK) return hr; + *func = (class_method *)(INT_PTR)val; + return S_OK; + } + } + } + return WBEM_E_INVALID_METHOD; + +} + static void clear_table( struct table *table ) { UINT i, j, type; diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 2467a760f4d..b99897e61fa 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -162,6 +162,7 @@ HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN; BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN; HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN; +HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN; HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE *, LONG * ) DECLSPEC_HIDDEN; HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN;