diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 69fbc18c86c..3608a0ce697 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -295,7 +295,8 @@ static const struct column col_service[] = /* methods */ { method_pauseserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { method_resumeserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, - { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } + { method_startserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { method_stopserviceW, CIM_FLAG_ARRAY|COL_FLAG_METHOD } }; static const struct column col_sounddevice[] = { @@ -477,6 +478,7 @@ struct record_service class_method *pause_service; class_method *resume_service; class_method *start_service; + class_method *stop_service; }; struct record_sounddevice { @@ -521,6 +523,7 @@ static const struct record_params data_params[] = { class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, + { class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, { class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 }, { class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING }, { class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, @@ -1122,6 +1125,7 @@ static void fill_service( struct table *table ) rec->pause_service = service_pause_service; rec->resume_service = service_resume_service; rec->start_service = service_start_service; + rec->stop_service = service_stop_service; heap_free( config ); offset += sizeof(*rec); num_rows++; diff --git a/dlls/wbemprox/service.c b/dlls/wbemprox/service.c index cd377b9f79b..62ac69ba128 100644 --- a/dlls/wbemprox/service.c +++ b/dlls/wbemprox/service.c @@ -205,3 +205,38 @@ done: if (hr != S_OK) IWbemClassObject_Release( *out ); return hr; } + +HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT name, retval; + IWbemClassObject *sig; + HRESULT hr; + + TRACE("%p, %p, %p\n", obj, in, out); + + hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( class_serviceW, method_stopserviceW, PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + return hr; + } + hr = IWbemClassObject_SpawnInstance( sig, 0, out ); + if (hr != S_OK) + { + VariantClear( &name ); + IWbemClassObject_Release( sig ); + return hr; + } + hr = control_service( V_BSTR(&name), SERVICE_CONTROL_STOP, &retval ); + if (hr != S_OK) goto done; + hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); + +done: + VariantClear( &name ); + IWbemClassObject_Release( sig ); + if (hr != S_OK) IWbemClassObject_Release( *out ); + return hr; +} diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 39870bf5b4b..435173213e0 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -204,6 +204,7 @@ HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassOb HRESULT service_pause_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT service_resume_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT service_start_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT service_stop_service(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static inline void *heap_alloc( size_t len ) @@ -247,6 +248,7 @@ static const WCHAR method_getstringvalueW[] = {'G','e','t','S','t','r','i','n',' static const WCHAR method_pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0}; static const WCHAR method_resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0}; static const WCHAR method_startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0}; +static const WCHAR method_stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0}; static const WCHAR param_defkeyW[] = {'h','D','e','f','K','e','y',0}; static const WCHAR param_namesW[] = {'s','N','a','m','e','s',0};