Hans Leidekker : wbemprox: Add support for uncommitted instances in IWbemClassObject::Put.
Alexandre Julliard
julliard at winehq.org
Thu Sep 6 13:37:23 CDT 2012
Module: wine
Branch: master
Commit: 0d28920804e714a577a7b3a150066e58dc35bde7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0d28920804e714a577a7b3a150066e58dc35bde7
Author: Hans Leidekker <hans at codeweavers.com>
Date: Thu Sep 6 14:04:03 2012 +0200
wbemprox: Add support for uncommitted instances in IWbemClassObject::Put.
---
dlls/wbemprox/class.c | 40 ++++++++++++++++++++++++++++++++++++-
dlls/wbemprox/query.c | 2 +-
dlls/wbemprox/wbemprox_private.h | 1 +
3 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index cc37b57..1ec1f51 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 d2b0e76..3525be9 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 e1f4d45..2467a76 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;
More information about the wine-cvs
mailing list