wbemprox: Add support for WBEM_FLAG_NONSYSTEM_ONLY and WBEM_FLAG_SYSTEM_ONLY in IWbemClassObject::GetNames.

This commit is contained in:
Hans Leidekker 2014-03-24 11:42:00 +01:00 committed by Alexandre Julliard
parent 7aaf597db1
commit c3566b088d
4 changed files with 50 additions and 9 deletions

View File

@ -476,17 +476,17 @@ static HRESULT WINAPI class_object_GetNames(
TRACE("%p, %s, %08x, %s, %p\n", iface, debugstr_w(wszQualifierName), lFlags,
debugstr_variant(pQualifierVal), pNames);
if (wszQualifierName || pQualifierVal)
{
FIXME("qualifier not supported\n");
return E_NOTIMPL;
}
if (lFlags != WBEM_FLAG_ALWAYS)
if (lFlags != WBEM_FLAG_ALWAYS &&
lFlags != WBEM_FLAG_NONSYSTEM_ONLY &&
lFlags != WBEM_FLAG_SYSTEM_ONLY)
{
FIXME("flags %08x not supported\n", lFlags);
return E_NOTIMPL;
}
return get_properties( ec->query->view, pNames );
if (wszQualifierName || pQualifierVal)
FIXME("qualifier not supported\n");
return get_properties( ec->query->view, lFlags, pNames );
}
static HRESULT WINAPI class_object_BeginEnumeration(

View File

@ -959,7 +959,7 @@ HRESULT put_propval( const struct view *view, UINT index, const WCHAR *name, VAR
return set_value( view->table, row, column, val, type );
}
HRESULT get_properties( const struct view *view, SAFEARRAY **props )
HRESULT get_properties( const struct view *view, LONG flags, SAFEARRAY **props )
{
SAFEARRAY *sa;
BSTR str;
@ -970,8 +970,14 @@ HRESULT get_properties( const struct view *view, SAFEARRAY **props )
for (i = 0; i < view->table->num_cols; i++)
{
BOOL is_system;
if (is_method( view->table, i )) continue;
is_system = is_system_prop( view->table->columns[i].name );
if ((flags & WBEM_FLAG_NONSYSTEM_ONLY) && is_system) continue;
else if ((flags & WBEM_FLAG_SYSTEM_ONLY) && !is_system) continue;
str = SysAllocString( view->table->columns[i].name );
if (!str || SafeArrayPutElement( sa, &i, str ) != S_OK)
{

View File

@ -616,6 +616,40 @@ static void test_query_async( IWbemServices *services )
SysFreeString( query );
}
void test_GetNames( IWbemServices *services )
{
static const WCHAR queryW[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
HRESULT hr;
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
ok( hr == S_OK, "got %08x\n", hr );
for (;;)
{
IWbemClassObject *obj;
SAFEARRAY *names;
ULONG count;
VARIANT val;
IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (!count) break;
VariantInit( &val );
hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_NONSYSTEM_ONLY, &val, &names );
ok( hr == S_OK, "got %08x\n", hr );
SafeArrayDestroy( names );
IWbemClassObject_Release( obj );
}
IEnumWbemClassObject_Release( result );
SysFreeString( query );
SysFreeString( wql );
}
START_TEST(query)
{
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
@ -647,6 +681,7 @@ START_TEST(query)
test_StdRegProv( services );
test_notification_query_async( services );
test_query_async( services );
test_GetNames( services );
SysFreeString( path );
IWbemServices_Release( services );

View File

@ -200,7 +200,7 @@ 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;
HRESULT get_properties( const struct view *, SAFEARRAY ** ) 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;