From 755e01bc986b786770a2700296c577f1c0526d0b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 15 Oct 2012 16:18:59 +0200 Subject: [PATCH] wbemprox: Pass an object instance to class methods. --- dlls/wbemprox/reg.c | 6 +++--- dlls/wbemprox/services.c | 26 ++++++++++++++++++++------ dlls/wbemprox/wbemprox_private.h | 8 ++++---- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c index 151ab4b5b4a..b4731fed57b 100644 --- a/dlls/wbemprox/reg.c +++ b/dlls/wbemprox/reg.c @@ -121,7 +121,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT return hr; } -HRESULT reg_enum_key( IWbemClassObject *in, IWbemClassObject **out ) +HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) { VARIANT defkey, subkey, names, retval; IWbemClassObject *sig; @@ -219,7 +219,7 @@ done: return hr; } -HRESULT reg_enum_values( IWbemClassObject *in, IWbemClassObject **out ) +HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) { VARIANT defkey, subkey, names, types, retval; IWbemClassObject *sig; @@ -291,7 +291,7 @@ done: return hr; } -HRESULT reg_get_stringvalue( IWbemClassObject *in, IWbemClassObject **out ) +HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) { VARIANT defkey, subkey, name, value, retval; IWbemClassObject *sig; diff --git a/dlls/wbemprox/services.c b/dlls/wbemprox/services.c index 3f87d5b1a88..663d2d0550a 100644 --- a/dlls/wbemprox/services.c +++ b/dlls/wbemprox/services.c @@ -578,6 +578,7 @@ static HRESULT WINAPI wbem_services_ExecMethod( IWbemClassObject **ppOutParams, IWbemCallResult **ppCallResult ) { + IWbemClassObject *obj; struct table *table; class_method *func; struct path *path; @@ -588,16 +589,29 @@ static HRESULT WINAPI wbem_services_ExecMethod( if (lFlags) FIXME("flags %08x not supported\n", lFlags); - if ((hr = parse_path( strObjectPath, &path )) != S_OK) return hr; - + if ((hr = get_object( strObjectPath, &obj ))) return hr; + if ((hr = parse_path( strObjectPath, &path )) != S_OK) + { + IWbemClassObject_Release( obj ); + return hr; + } table = grab_table( path->class ); free_path( path ); - if (!table) return WBEM_E_NOT_FOUND; - + if (!table) + { + IWbemClassObject_Release( obj ); + return WBEM_E_NOT_FOUND; + } hr = get_method( table, strMethodName, &func ); release_table( table ); - if (hr != S_OK) return hr; - return func( pInParams, ppOutParams ); + if (hr != S_OK) + { + IWbemClassObject_Release( obj ); + return hr; + } + hr = func( obj, pInParams, ppOutParams ); + IWbemClassObject_Release( obj ); + return hr; } static HRESULT WINAPI wbem_services_ExecMethodAsync( diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 2c57ad7e72c..02fc9193394 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -38,7 +38,7 @@ enum param_direction #define COL_FLAG_KEY 0x00020000 #define COL_FLAG_METHOD 0x00040000 -typedef HRESULT (class_method)(IWbemClassObject *, IWbemClassObject **); +typedef HRESULT (class_method)(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **); struct column { @@ -196,9 +196,9 @@ HRESULT create_class_object(const WCHAR *, IEnumWbemClassObject *, UINT, struct record *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN; -HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; -HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; -HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *heap_alloc( size_t len )