[7/8] wbemprox: Support mixed dynamic and static table data.
Hans Leidekker
hans at codeweavers.com
Tue Jun 19 03:21:12 CDT 2012
---
dlls/wbemprox/builtin.c | 4 ++--
dlls/wbemprox/query.c | 21 +++++++++++----------
dlls/wbemprox/wbemprox_private.h | 5 ++++-
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index a85802f..8a6a74f 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -74,8 +74,8 @@ static const struct column col_compsys[] =
};
static const struct column col_process[] =
{
- { prop_captionW, CIM_STRING },
- { prop_descriptionW, CIM_STRING },
+ { prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
+ { prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_pprocessidW, CIM_UINT32 },
{ prop_processidW, CIM_UINT32 },
{ prop_threadcountW, CIM_UINT32 }
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 5ed4d07..9e03544 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -48,7 +48,7 @@ static UINT get_column_size( const struct table *table, UINT column )
{
if (table->columns[column].type & CIM_FLAG_ARRAY) return sizeof(void *);
- switch (table->columns[column].type)
+ switch (table->columns[column].type & COL_TYPE_MASK)
{
case CIM_SINT16:
case CIM_UINT16:
@@ -60,7 +60,7 @@ static UINT get_column_size( const struct table *table, UINT column )
case CIM_STRING:
return sizeof(WCHAR *);
default:
- ERR("unkown column type %u\n", table->columns[column].type);
+ ERR("unkown column type %u\n", table->columns[column].type & COL_TYPE_MASK);
break;
}
return sizeof(INT32);
@@ -92,7 +92,7 @@ static HRESULT get_value( const struct table *table, UINT row, UINT column, INT_
*val = (INT_PTR)*(const void **)ptr;
return S_OK;
}
- switch (table->columns[column].type)
+ switch (table->columns[column].type & COL_TYPE_MASK)
{
case CIM_DATETIME:
case CIM_STRING:
@@ -111,7 +111,7 @@ static HRESULT get_value( const struct table *table, UINT row, UINT column, INT_
*val = *(const UINT32 *)ptr;
break;
default:
- ERR("invalid column type %u\n", table->columns[column].type);
+ ERR("invalid column type %u\n", table->columns[column].type & COL_TYPE_MASK);
*val = 0;
break;
}
@@ -136,7 +136,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class,
static void clear_table( struct table *table )
{
- UINT i, j;
+ UINT i, j, type;
if (!table->fill || !table->data) return;
@@ -144,9 +144,10 @@ static void clear_table( struct table *table )
{
for (j = 0; j < table->num_cols; j++)
{
- if (table->columns[j].type == CIM_STRING ||
- table->columns[j].type == CIM_DATETIME ||
- (table->columns[j].type & CIM_FLAG_ARRAY))
+ if (!(table->columns[j].type & COL_FLAG_DYNAMIC)) continue;
+
+ type = table->columns[j].type & COL_TYPE_MASK;
+ if (type == CIM_STRING || type == CIM_DATETIME || (type & CIM_FLAG_ARRAY))
{
void *ptr;
if (get_value( table, i, j, (INT_PTR *)&ptr ) == S_OK) heap_free( ptr );
@@ -399,7 +400,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
hr = get_value( view->table, row, column, &val );
if (hr != S_OK) return hr;
- switch (view->table->columns[column].type)
+ switch (view->table->columns[column].type & COL_TYPE_MASK)
{
case CIM_STRING:
case CIM_DATETIME:
@@ -410,7 +411,7 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
ERR("unhandled column type %u\n", view->table->columns[column].type);
return WBEM_E_FAILED;
}
- if (type) *type = view->table->columns[column].type;
+ if (type) *type = view->table->columns[column].type & COL_TYPE_MASK;
return S_OK;
}
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index c7edbb0..30aecca 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -21,10 +21,13 @@
#define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
+#define COL_TYPE_MASK 0x0000ffff
+#define COL_FLAG_DYNAMIC 0x00010000
+
struct column
{
const WCHAR *name;
- CIMTYPE_ENUMERATION type;
+ UINT type;
};
struct table
--
1.7.10
More information about the wine-patches
mailing list