diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index cc37b575eb..1ec1f512b1 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -335,6 +335,34 @@ static HRESULT WINAPI class_object_Get( 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( IWbemClassObject *iface, LPCWSTR wszName, @@ -344,11 +372,19 @@ static HRESULT WINAPI class_object_Put( { struct class_object *co = impl_from_IWbemClassObject( iface ); 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); - 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( diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index d2b0e761b4..3525be9bdc 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -648,7 +648,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR 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) { diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index e1f4d45e92..2467a760f4 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -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 *, CIMTYPE *, LONG * ) 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_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN; const WCHAR *get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN;