wbemprox: Add support for WBEM_FLAG_NONSYSTEM_ONLY and WBEM_FLAG_SYSTEM_ONLY in IWbemClassObject::GetNames.
Hans Leidekker
hans at codeweavers.com
Mon Mar 24 05:42:00 CDT 2014
---
dlls/wbemprox/class.c | 14 +++++++-------
dlls/wbemprox/query.c | 8 +++++++-
dlls/wbemprox/tests/query.c | 35 +++++++++++++++++++++++++++++++++++
dlls/wbemprox/wbemprox_private.h | 2 +-
4 files changed, 50 insertions(+), 9 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index 58fbbf8..1abf2a4 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -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(
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 921c3cd..fdfcc16 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -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)
{
diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index 9b77b4c..e99e4ea 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -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 );
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index da4f84f..c047ac1 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -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;
--
1.9.0
More information about the wine-patches
mailing list