diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index 47fc2fb7367..1a98b16b22c 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -394,6 +394,7 @@ static const struct column col_stdregprov[] = { L"EnumValues", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { L"GetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, { L"SetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, + { L"SetDWORDValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD }, }; static const struct column col_systemenclosure[] = { @@ -804,6 +805,7 @@ struct record_stdregprov class_method *enumvalues; class_method *getstringvalue; class_method *setstringvalue; + class_method *setdwordvalue; }; struct record_sysrestore { @@ -905,6 +907,11 @@ static const struct record_param data_param[] = { L"StdRegProv", L"SetStringValue", 1, L"sValueName", CIM_STRING }, { L"StdRegProv", L"SetStringValue", 1, L"sValue", CIM_STRING }, { L"StdRegProv", L"SetStringValue", -1, L"ReturnValue", CIM_UINT32 }, + { L"StdRegProv", L"SetDWORDValue", 1, L"hDefKey", CIM_SINT32, 0x80000002 }, + { L"StdRegProv", L"SetDWORDValue", 1, L"sSubKeyName", CIM_STRING }, + { L"StdRegProv", L"SetDWORDValue", 1, L"sValueName", CIM_STRING }, + { L"StdRegProv", L"SetDWORDValue", 1, L"uValue", CIM_UINT32 }, + { L"StdRegProv", L"SetDWORDValue", -1, L"ReturnValue", CIM_UINT32 }, { L"SystemRestore", L"Disable", 1, L"Drive", CIM_STRING }, { L"SystemRestore", L"Disable", -1, L"ReturnValue", CIM_UINT32 }, { L"SystemRestore", L"Enable", 1, L"Drive", CIM_STRING }, @@ -943,6 +950,7 @@ static const struct record_stdregprov data_stdregprov[] = reg_enum_values, reg_get_stringvalue, reg_set_stringvalue, + reg_set_dwordvalue, } }; diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c index 46b089ca8e8..2fb12d9c28c 100644 --- a/dlls/wbemprox/reg.c +++ b/dlls/wbemprox/reg.c @@ -507,3 +507,64 @@ HRESULT reg_set_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemC if (out_params) IWbemClassObject_Release( out_params ); return hr; } + +static void set_dwordvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, DWORD value, VARIANT *retval ) +{ + LONG res; + + TRACE("%p, %s, %s, %#x\n", root, debugstr_w(subkey), debugstr_w(name), value); + + res = RegSetKeyValueW( root, subkey, name, REG_DWORD, &value, sizeof(value) ); + set_variant( VT_UI4, res, NULL, retval ); +} + +HRESULT reg_set_dwordvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) +{ + VARIANT defkey, subkey, name, value, retval; + IWbemClassObject *sig, *out_params = NULL; + HRESULT hr; + + TRACE("%p, %p\n", in, out); + + hr = IWbemClassObject_Get( in, L"hDefKey", 0, &defkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, L"sSubKeyName", 0, &subkey, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, L"sValueName", 0, &name, NULL, NULL ); + if (hr != S_OK) return hr; + hr = IWbemClassObject_Get( in, L"uValue", 0, &value, NULL, NULL ); + if (hr != S_OK) return hr; + + hr = create_signature( L"StdRegProv", L"SetDWORDValue", PARAM_OUT, &sig ); + if (hr != S_OK) + { + VariantClear( &name ); + VariantClear( &subkey ); + return hr; + } + if (out) + { + hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params ); + if (hr != S_OK) + { + VariantClear( &name ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + return hr; + } + } + set_dwordvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), V_UI4(&value), &retval ); + if (out_params) + hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 ); + + VariantClear( &name ); + VariantClear( &subkey ); + IWbemClassObject_Release( sig ); + if (hr == S_OK && out) + { + *out = out_params; + IWbemClassObject_AddRef( out_params ); + } + if (out_params) IWbemClassObject_Release( out_params ); + return hr; +} diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 31f41e9fc81..76ef479c3ef 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -249,6 +249,7 @@ HRESULT reg_enum_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject ** HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT reg_get_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; HRESULT reg_set_stringvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; +HRESULT reg_set_dwordvalue(IWbemClassObject *, IWbemClassObject *, IWbemClassObject **) DECLSPEC_HIDDEN; 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;