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

View File

@ -745,6 +745,7 @@ VARTYPE to_vartype( CIMTYPE type )
{ {
case CIM_BOOLEAN: return VT_BOOL; case CIM_BOOLEAN: return VT_BOOL;
case CIM_STRING: case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME: return VT_BSTR; case CIM_DATETIME: return VT_BSTR;
case CIM_SINT8: return VT_I1; case CIM_SINT8: return VT_I1;
case CIM_UINT8: return VT_UI1; 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; if (!vartype) vartype = VT_BOOL;
break; break;
case CIM_STRING: case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME: case CIM_DATETIME:
if (val) if (val)
{ {

View File

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