wbemprox: Return selected properties only from IWbemClassObject::Next.

This commit is contained in:
Hans Leidekker 2014-04-30 10:19:30 +02:00 committed by Alexandre Julliard
parent c9abb27d89
commit 8343aed4c2
4 changed files with 22 additions and 39 deletions

View File

@ -511,23 +511,30 @@ static HRESULT WINAPI class_object_Next(
CIMTYPE *pType,
LONG *plFlavor )
{
struct class_object *co = impl_from_IWbemClassObject( iface );
struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter );
struct view *view = ec->query->view;
BSTR property;
struct class_object *obj = impl_from_IWbemClassObject( iface );
struct enum_class_object *iter = impl_from_IEnumWbemClassObject( obj->iter );
struct view *view = iter->query->view;
BSTR prop;
HRESULT hr;
UINT i;
TRACE("%p, %08x, %p, %p, %p, %p\n", iface, lFlags, strName, pVal, pType, plFlavor);
if (!(property = get_property_name( co->name, co->index_property ))) return WBEM_S_NO_MORE_DATA;
if ((hr = get_propval( view, co->index, property, pVal, pType, plFlavor ) != S_OK))
for (i = obj->index_property; i < view->table->num_cols; i++)
{
SysFreeString( property );
return hr;
if (is_method( view->table, i )) continue;
if (!is_selected_prop( view, view->table->columns[i].name )) continue;
if (!(prop = SysAllocString( view->table->columns[i].name ))) return E_OUTOFMEMORY;
if ((hr = get_propval( view, obj->index, prop, pVal, pType, plFlavor )) != S_OK)
{
SysFreeString( prop );
return hr;
}
obj->index_property = i + 1;
*strName = prop;
return S_OK;
}
*strName = property;
co->index_property++;
return S_OK;
return WBEM_S_NO_MORE_DATA;
}
static HRESULT WINAPI class_object_EndEnumeration(

View File

@ -424,7 +424,7 @@ done:
return hr;
}
static BOOL is_selected_prop( const struct view *view, const WCHAR *name )
BOOL is_selected_prop( const struct view *view, const WCHAR *name )
{
const struct property *prop = view->proplist;
@ -563,7 +563,7 @@ done:
return ret;
}
static inline BOOL is_method( const struct table *table, UINT column )
BOOL is_method( const struct table *table, UINT column )
{
return table->columns[column].type & COL_FLAG_METHOD;
}

View File

@ -406,28 +406,3 @@ BSTR get_method_name( const WCHAR *class, UINT index )
release_table( table );
return NULL;
}
BSTR get_property_name( const WCHAR *class, UINT index )
{
struct table *table;
UINT i, count = 0;
BSTR ret;
if (!(table = grab_table( class ))) return NULL;
for (i = 0; i < table->num_cols; i++)
{
if (!(table->columns[i].type & COL_FLAG_METHOD))
{
if (index == count)
{
ret = SysAllocString( table->columns[i].name );
release_table( table );
return ret;
}
count++;
}
}
release_table( table );
return NULL;
}

View File

@ -192,6 +192,7 @@ HRESULT get_column_index( const struct table *, const WCHAR *, UINT * ) DECLSPEC
HRESULT get_value( const struct table *, UINT, UINT, LONGLONG * ) DECLSPEC_HIDDEN;
BSTR get_value_bstr( const struct table *, UINT, UINT ) DECLSPEC_HIDDEN;
HRESULT set_value( const struct table *, UINT, UINT, LONGLONG, CIMTYPE ) DECLSPEC_HIDDEN;
BOOL is_method( const struct table *, UINT ) DECLSPEC_HIDDEN;
HRESULT get_method( const struct table *, const WCHAR *, class_method ** ) DECLSPEC_HIDDEN;
HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *,
CIMTYPE *, LONG * ) DECLSPEC_HIDDEN;
@ -200,10 +201,10 @@ HRESULT to_longlong( VARIANT *, LONGLONG *, CIMTYPE * ) DECLSPEC_HIDDEN;
SAFEARRAY *to_safearray( const struct array *, CIMTYPE ) DECLSPEC_HIDDEN;
VARTYPE to_vartype( CIMTYPE ) DECLSPEC_HIDDEN;
void destroy_array( struct array *, CIMTYPE ) DECLSPEC_HIDDEN;
BOOL is_selected_prop( const struct view *, const WCHAR * ) DECLSPEC_HIDDEN;
HRESULT get_properties( const struct view *, LONG, SAFEARRAY ** ) DECLSPEC_HIDDEN;
HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN;
BSTR get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN;
BSTR get_property_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN;
void set_variant( VARTYPE, LONGLONG, void *, VARIANT * ) DECLSPEC_HIDDEN;
HRESULT create_signature( const WCHAR *, const WCHAR *, enum param_direction,
IWbemClassObject ** ) DECLSPEC_HIDDEN;