wbemprox: Add support for CIM_REFERENCE.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2019-07-05 11:14:50 +02:00 committed by Alexandre Julliard
parent 691fcebf3d
commit b37eb06ba3
3 changed files with 13 additions and 4 deletions

View File

@ -238,7 +238,7 @@ void destroy_array( struct array *array, CIMTYPE type )
UINT i, size;
if (!array) return;
if (type == CIM_STRING || type == CIM_DATETIME)
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE)
{
size = get_type_size( type );
for (i = 0; i < array->count; i++) heap_free( *(WCHAR **)((char *)array->ptr + i * size) );
@ -255,8 +255,9 @@ static void destroy_record( struct record *record )
release_table( record->table );
for (i = 0; i < record->count; i++)
{
if (record->fields[i].type == CIM_STRING || record->fields[i].type == CIM_DATETIME)
heap_free( record->fields[i].u.sval );
if (record->fields[i].type == CIM_STRING ||
record->fields[i].type == CIM_DATETIME ||
record->fields[i].type == CIM_REFERENCE) heap_free( record->fields[i].u.sval );
else if (record->fields[i].type & CIM_FLAG_ARRAY)
destroy_array( record->fields[i].u.aval, record->fields[i].type & CIM_TYPE_MASK );
}
@ -357,6 +358,7 @@ static HRESULT record_get_value( const struct record *record, UINT index, VARIAN
{
case CIM_STRING:
case CIM_DATETIME:
case CIM_REFERENCE:
if (!vartype) vartype = VT_BSTR;
V_BSTR( var ) = SysAllocString( record->fields[index].u.sval );
break;
@ -418,6 +420,7 @@ static HRESULT record_set_value( struct record *record, UINT index, VARIANT *var
{
case CIM_STRING:
case CIM_DATETIME:
case CIM_REFERENCE:
record->fields[index].u.sval = (WCHAR *)(INT_PTR)val;
return S_OK;
case CIM_SINT16:

View File

@ -745,6 +745,7 @@ VARTYPE to_vartype( CIMTYPE type )
{
case CIM_BOOLEAN: return VT_BOOL;
case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME: return VT_BSTR;
case CIM_SINT8: return VT_I1;
case CIM_UINT8: return VT_UI1;
@ -878,6 +879,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
if (!vartype) vartype = VT_BOOL;
break;
case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME:
if (val)
{

View File

@ -64,6 +64,7 @@ UINT get_type_size( CIMTYPE type )
case CIM_UINT64:
return sizeof(INT64);
case CIM_DATETIME:
case CIM_REFERENCE:
case CIM_STRING:
return sizeof(WCHAR *);
default:
@ -110,6 +111,7 @@ HRESULT get_value( const struct table *table, UINT row, UINT column, LONGLONG *v
*val = *(const int *)ptr;
break;
case CIM_DATETIME:
case CIM_REFERENCE:
case CIM_STRING:
*val = (INT_PTR)*(const WCHAR **)ptr;
break;
@ -173,6 +175,7 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column )
else return SysAllocString( falseW );
case CIM_DATETIME:
case CIM_REFERENCE:
case CIM_STRING:
if (!val) return NULL;
len = lstrlenW( (const WCHAR *)(INT_PTR)val ) + 2;
@ -220,6 +223,7 @@ HRESULT set_value( const struct table *table, UINT row, UINT column, LONGLONG va
switch (table->columns[column].type & COL_TYPE_MASK)
{
case CIM_DATETIME:
case CIM_REFERENCE:
case CIM_STRING:
*(WCHAR **)ptr = (WCHAR *)(INT_PTR)val;
break;
@ -287,7 +291,7 @@ void free_row_values( const struct table *table, UINT row )
if (!(table->columns[i].type & COL_FLAG_DYNAMIC)) continue;
type = table->columns[i].type & COL_TYPE_MASK;
if (type == CIM_STRING || type == CIM_DATETIME)
if (type == CIM_STRING || type == CIM_DATETIME || type == CIM_REFERENCE)
{
if (get_value( table, row, i, &val ) == S_OK) heap_free( (void *)(INT_PTR)val );
}