[PATCH] wbemprox: Add support for CIM_REFERENCE.

Hans Leidekker hans at codeweavers.com
Fri Jul 5 04:14:50 CDT 2019


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/wbemprox/class.c | 9 ++++++---
 dlls/wbemprox/query.c | 2 ++
 dlls/wbemprox/table.c | 6 +++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 6cb065b222..042ebebdcd 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -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:
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index f7b5163e0a..080329c14a 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -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)
         {
diff --git a/dlls/wbemprox/table.c b/dlls/wbemprox/table.c
index 261104b46e..79c7eb13a4 100644
--- a/dlls/wbemprox/table.c
+++ b/dlls/wbemprox/table.c
@@ -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 );
         }
-- 
2.11.0




More information about the wine-devel mailing list