wbemprox: Handle NULL out parameter to object methods.
This commit is contained in:
parent
9f17544bc9
commit
464c884542
|
@ -66,7 +66,7 @@ done:
|
|||
HRESULT process_get_owner( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT user, domain, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
@ -74,29 +74,40 @@ HRESULT process_get_owner( IWbemClassObject *obj, IWbemClassObject *in, IWbemCla
|
|||
hr = create_signature( class_processW, method_getownerW, PARAM_OUT, &sig );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
VariantInit( &user );
|
||||
VariantInit( &domain );
|
||||
hr = get_owner( &user, &domain, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
if (out_params)
|
||||
{
|
||||
hr = IWbemClassObject_Put( *out, param_userW, 0, &user, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( *out, param_domainW, 0, &domain, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_userW, 0, &user, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( out_params, param_domainW, 0, &domain, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &user );
|
||||
VariantClear( &domain );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ static HRESULT enum_key( HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT
|
|||
HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT defkey, subkey, names, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
@ -140,28 +140,39 @@ HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObj
|
|||
VariantClear( &subkey );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
VariantInit( &names );
|
||||
hr = enum_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
if (out_params)
|
||||
{
|
||||
hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &names );
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -222,7 +233,7 @@ done:
|
|||
HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT defkey, subkey, names, types, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
@ -238,32 +249,43 @@ HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
VariantClear( &subkey );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
VariantInit( &names );
|
||||
VariantInit( &types );
|
||||
hr = enum_values( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &types, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
if (out_params)
|
||||
{
|
||||
hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( *out, param_typesW, 0, &types, CIM_SINT32|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( out_params, param_typesW, 0, &types, CIM_SINT32|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &types );
|
||||
VariantClear( &names );
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -294,7 +316,7 @@ done:
|
|||
HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT defkey, subkey, name, value, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
@ -313,28 +335,39 @@ HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemC
|
|||
VariantClear( &subkey );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
VariantInit( &value );
|
||||
hr = get_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), &value, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
if (out_params)
|
||||
{
|
||||
hr = IWbemClassObject_Put( *out, param_valueW, 0, &value, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_valueW, 0, &value, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ done:
|
|||
HRESULT service_pause_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT name, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
@ -94,28 +94,38 @@ HRESULT service_pause_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
VariantClear( &name );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
hr = control_service( V_BSTR(&name), SERVICE_CONTROL_PAUSE, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT service_resume_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT name, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
@ -129,21 +139,31 @@ HRESULT service_resume_service( IWbemClassObject *obj, IWbemClassObject *in, IWb
|
|||
VariantClear( &name );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
hr = control_service( V_BSTR(&name), SERVICE_CONTROL_CONTINUE, &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -174,7 +194,7 @@ done:
|
|||
HRESULT service_start_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT name, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
@ -188,28 +208,38 @@ HRESULT service_start_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
VariantClear( &name );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
hr = start_service( V_BSTR(&name), &retval );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out )
|
||||
{
|
||||
VARIANT name, retval;
|
||||
IWbemClassObject *sig;
|
||||
IWbemClassObject *sig, *out_params = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
@ -223,20 +253,30 @@ HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbem
|
|||
VariantClear( &name );
|
||||
return hr;
|
||||
}
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, out );
|
||||
if (hr != S_OK)
|
||||
if (out)
|
||||
{
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
return hr;
|
||||
hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
|
||||
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 );
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
IWbemClassObject_Release( sig );
|
||||
if (hr != S_OK) IWbemClassObject_Release( *out );
|
||||
if (hr == S_OK && out)
|
||||
{
|
||||
*out = out_params;
|
||||
IWbemClassObject_AddRef( out_params );
|
||||
}
|
||||
if (out_params) IWbemClassObject_Release( out_params );
|
||||
return hr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue