Hans Leidekker : wbemprox: Implement IWbemServices::ExecMethod.

Alexandre Julliard julliard at winehq.org
Fri Sep 28 11:39:03 CDT 2012


Module: wine
Branch: master
Commit: 99a3ad06910b4badb519a542ca38ac7670fe2201
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=99a3ad06910b4badb519a542ca38ac7670fe2201

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Fri Sep 28 13:37:21 2012 +0200

wbemprox: Implement IWbemServices::ExecMethod.

---

 dlls/wbemprox/services.c         |   20 ++++++++++++++++++--
 dlls/wbemprox/table.c            |   23 +++++++++++++++++++++++
 dlls/wbemprox/wbemprox_private.h |    1 +
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c
index bf367c7..59b6da8 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 c6dc845..c0e3eef 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 2467a76..b99897e 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;




More information about the wine-cvs mailing list