Commit 76f90ab6 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wbemprox: Implement DeleteKey() method.

parent 1e80402e
......@@ -395,6 +395,7 @@ static const struct column col_stdregprov[] =
{ L"GetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
{ L"SetStringValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
{ L"SetDWORDValue", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
{ L"DeleteKey", CIM_FLAG_ARRAY|COL_FLAG_METHOD },
};
static const struct column col_systemenclosure[] =
{
......@@ -806,6 +807,7 @@ struct record_stdregprov
class_method *getstringvalue;
class_method *setstringvalue;
class_method *setdwordvalue;
class_method *deletekey;
};
struct record_sysrestore
{
......@@ -912,6 +914,9 @@ static const struct record_param data_param[] =
{ 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"StdRegProv", L"DeleteKey", 1, L"hDefKey", CIM_SINT32, 0x80000002 },
{ L"StdRegProv", L"DeleteKey", 1, L"sSubKeyName", CIM_STRING },
{ L"StdRegProv", L"DeleteKey", -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 },
......@@ -951,6 +956,7 @@ static const struct record_stdregprov data_stdregprov[] =
reg_get_stringvalue,
reg_set_stringvalue,
reg_set_dwordvalue,
reg_delete_key,
}
};
......
......@@ -568,3 +568,57 @@ HRESULT reg_set_dwordvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemCl
if (out_params) IWbemClassObject_Release( out_params );
return hr;
}
static void delete_key( HKEY root, const WCHAR *subkey, VARIANT *retval )
{
LONG res;
TRACE("%p, %s\n", root, debugstr_w(subkey));
res = RegDeleteKeyExW( root, subkey, 0, 0 );
set_variant( VT_UI4, res, NULL, retval );
}
HRESULT reg_delete_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
{
VARIANT defkey, subkey, 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 = create_signature( L"StdRegProv", L"DeleteKey", PARAM_OUT, &sig );
if (hr != S_OK)
{
VariantClear( &subkey );
return hr;
}
if (out)
{
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
if (hr != S_OK)
{
VariantClear( &subkey );
IWbemClassObject_Release( sig );
return hr;
}
}
delete_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &retval );
if (out_params)
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
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;
}
......@@ -250,6 +250,7 @@ HRESULT reg_enum_values(IWbemClassObject *, IWbemClassObject *, IWbemClassObject
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 reg_delete_key(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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment