Commit 0d289208 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Add support for uncommitted instances in IWbemClassObject::Put.

parent d25450c8
...@@ -335,6 +335,34 @@ static HRESULT WINAPI class_object_Get( ...@@ -335,6 +335,34 @@ static HRESULT WINAPI class_object_Get(
return get_propval( view, co->index, wszName, pVal, pType, plFlavor ); return get_propval( view, co->index, wszName, pVal, pType, plFlavor );
} }
static HRESULT record_set_value( struct record *record, UINT index, VARIANT *var )
{
LONGLONG val;
CIMTYPE type;
HRESULT hr;
if ((hr = variant_to_longlong( var, &val, &type )) != S_OK) return hr;
if (type != record->fields[index].type) return WBEM_E_TYPE_MISMATCH;
switch (type)
{
case CIM_STRING:
case CIM_DATETIME:
record->fields[index].u.sval = (WCHAR *)(INT_PTR)val;
return S_OK;
case CIM_SINT16:
case CIM_UINT16:
case CIM_SINT32:
case CIM_UINT32:
record->fields[index].u.ival = val;
return S_OK;
default:
FIXME("unhandled type %u\n", type);
break;
}
return WBEM_E_INVALID_PARAMETER;
}
static HRESULT WINAPI class_object_Put( static HRESULT WINAPI class_object_Put(
IWbemClassObject *iface, IWbemClassObject *iface,
LPCWSTR wszName, LPCWSTR wszName,
...@@ -344,11 +372,19 @@ static HRESULT WINAPI class_object_Put( ...@@ -344,11 +372,19 @@ static HRESULT WINAPI class_object_Put(
{ {
struct class_object *co = impl_from_IWbemClassObject( iface ); struct class_object *co = impl_from_IWbemClassObject( iface );
struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter );
struct view *view = ec->query->view;
TRACE("%p, %s, %08x, %p, %u\n", iface, debugstr_w(wszName), lFlags, pVal, Type); TRACE("%p, %s, %08x, %p, %u\n", iface, debugstr_w(wszName), lFlags, pVal, Type);
return put_propval( view, co->index, wszName, pVal, Type ); if (co->record)
{
struct table *table = get_table( co->name );
UINT index;
HRESULT hr;
if ((hr = get_column_index( table, wszName, &index )) != S_OK) return hr;
return record_set_value( co->record, index, pVal );
}
return put_propval( ec->query->view, co->index, wszName, pVal, Type );
} }
static HRESULT WINAPI class_object_Delete( static HRESULT WINAPI class_object_Delete(
......
...@@ -648,7 +648,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR ...@@ -648,7 +648,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
return S_OK; return S_OK;
} }
static HRESULT variant_to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type ) HRESULT variant_to_longlong( VARIANT *var, LONGLONG *val, CIMTYPE *type )
{ {
if (!var) if (!var)
{ {
......
...@@ -165,6 +165,7 @@ HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPE ...@@ -165,6 +165,7 @@ HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPE
HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
CIMTYPE *, LONG * ) DECLSPEC_HIDDEN; CIMTYPE *, LONG * ) DECLSPEC_HIDDEN;
HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN; HRESULT put_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE ) DECLSPEC_HIDDEN;
HRESULT variant_to_longlong( VARIANT *, LONGLONG *, CIMTYPE * ) DECLSPEC_HIDDEN;
HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN; HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN;
HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN; HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN;
const WCHAR *get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; const WCHAR *get_method_name( const WCHAR *, UINT ) 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