wbemprox: Implement SetStringValue() method.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
25ec9d4c34
commit
1e01c4f657
|
@ -393,6 +393,7 @@ static const struct column col_stdregprov[] =
|
|||
{ L"EnumKey", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
||||
{ L"EnumValues", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
||||
{ L"GetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
||||
{ L"SetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
|
||||
};
|
||||
static const struct column col_systemenclosure[] =
|
||||
{
|
||||
|
@ -802,6 +803,7 @@ struct record_stdregprov
|
|||
class_method *enumkey;
|
||||
class_method *enumvalues;
|
||||
class_method *getstringvalue;
|
||||
class_method *setstringvalue;
|
||||
};
|
||||
struct record_sysrestore
|
||||
{
|
||||
|
@ -898,6 +900,11 @@ static const struct record_param data_param[] =
|
|||
{ L"StdRegProv", L"GetStringValue", 1, L"sValueName", CIM_STRING },
|
||||
{ L"StdRegProv", L"GetStringValue", -1, L"ReturnValue", CIM_UINT32 },
|
||||
{ L"StdRegProv", L"GetStringValue", -1, L"sValue", CIM_STRING },
|
||||
{ L"StdRegProv", L"SetStringValue", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
|
||||
{ L"StdRegProv", L"SetStringValue", 1, L"sSubKeyName", CIM_STRING },
|
||||
{ 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"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 },
|
||||
|
@ -930,7 +937,13 @@ static const struct record_quickfixengineering data_quickfixengineering[] =
|
|||
|
||||
static const struct record_stdregprov data_stdregprov[] =
|
||||
{
|
||||
{ reg_create_key, reg_enum_key, reg_enum_values, reg_get_stringvalue }
|
||||
{
|
||||
reg_create_key,
|
||||
reg_enum_key,
|
||||
reg_enum_values,
|
||||
reg_get_stringvalue,
|
||||
reg_set_stringvalue,
|
||||
}
|
||||
};
|
||||
|
||||
static const struct record_sysrestore data_sysrestore[] =
|
||||
|
|
|
@ -442,3 +442,68 @@ done:
|
|||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
static void set_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, const WCHAR *value, VARIANT *retval )
|
||||
{
|
||||
LONG res;
|
||||
|
||||
TRACE("%p, %s, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name), debugstr_w(value));
|
||||
|
||||
res = RegSetKeyValueW( root, subkey, name, REG_SZ, value, (lstrlenW( value ) + 1) * sizeof(*value) );
|
||||
set_variant( VT_UI4, res, NULL, retval );
|
||||
}
|
||||
|
||||
HRESULT reg_set_stringvalue( 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"sValue", 0, &value, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( L"StdRegProv", L"SetStringValue", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
VariantClear( &value );
|
||||
return hr;
|
||||
}
|
||||
if (out)
|
||||
{
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
VariantClear( &value );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
set_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), V_BSTR(&value), &retval );
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
VariantClear( &value );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -248,6 +248,7 @@ HRESULT reg_create_key(IWbemClassObject *, IWbemClassObject *, IWbemClassObject
|
|||
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;
|
||||
HRESULT reg_set_stringvalue(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;
|
||||
|
|
Loading…
Reference in New Issue