From f18b24ad397dc55445e47535ed36dcc2f5898ae0 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Tue, 19 Jun 2012 10:19:38 +0200 Subject: [PATCH] wbemprox: Implement IWbemClassObject::GetNames. --- dlls/wbemprox/class.c | 18 ++++++++++++++++-- dlls/wbemprox/query.c | 22 ++++++++++++++++++++++ dlls/wbemprox/wbemprox_private.h | 1 + include/wbemcli.idl | 19 +++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c index 423e75428ad..524ba094322 100644 --- a/dlls/wbemprox/class.c +++ b/dlls/wbemprox/class.c @@ -314,8 +314,22 @@ static HRESULT WINAPI class_object_GetNames( VARIANT *pQualifierVal, SAFEARRAY **pNames ) { - FIXME("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszQualifierName), lFlags, pQualifierVal, pNames); - return E_NOTIMPL; + struct class_object *co = impl_from_IWbemClassObject( iface ); + struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter ); + + TRACE("%p, %s, %08x, %p, %p\n", iface, debugstr_w(wszQualifierName), lFlags, pQualifierVal, pNames); + + if (wszQualifierName || pQualifierVal) + { + FIXME("qualifier not supported\n"); + return E_NOTIMPL; + } + if (lFlags != WBEM_FLAG_ALWAYS) + { + FIXME("flags %08x not supported\n", lFlags); + return E_NOTIMPL; + } + return get_properties( ec->query->view, pNames ); } static HRESULT WINAPI class_object_BeginEnumeration( diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index 1d17a2866a9..5ed4d07487d 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -413,3 +413,25 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR if (type) *type = view->table->columns[column].type; return S_OK; } + +HRESULT get_properties( const struct view *view, SAFEARRAY **props ) +{ + SAFEARRAY *sa; + BSTR str; + LONG i; + + if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, view->table->num_cols ))) return E_OUTOFMEMORY; + + for (i = 0; i < view->table->num_cols; i++) + { + str = SysAllocString( view->table->columns[i].name ); + if (!str || SafeArrayPutElement( sa, &i, str ) != S_OK) + { + SysFreeString( str ); + SafeArrayDestroy( sa ); + return E_OUTOFMEMORY; + } + } + *props = sa; + return S_OK; +} diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h index 15a7146b031..c7edbb0a6e1 100644 --- a/dlls/wbemprox/wbemprox_private.h +++ b/dlls/wbemprox/wbemprox_private.h @@ -114,6 +114,7 @@ void destroy_view( struct view * ) DECLSPEC_HIDDEN; struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN; HRESULT get_propval( const struct view *, UINT, const WCHAR *, VARIANT *, CIMTYPE * ) DECLSPEC_HIDDEN; +HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN; HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; diff --git a/include/wbemcli.idl b/include/wbemcli.idl index a02349181c8..b2d756b33bb 100644 --- a/include/wbemcli.idl +++ b/include/wbemcli.idl @@ -182,6 +182,25 @@ typedef [v1_enum] enum tag_WBEM_TIMEOUT_TYPE WBEM_INFINITE = 0xffffffff } WBEM_TIMEOUT_TYPE; +typedef [v1_enum] enum tag_WBEM_CONDITION_FLAG_TYPE +{ + WBEM_FLAG_ALWAYS = 0, + WBEM_FLAG_ONLY_IF_TRUE = 0x1, + WBEM_FLAG_ONLY_IF_FALSE = 0x2, + WBEM_FLAG_ONLY_IF_IDENTICAL = 0x3, + WBEM_MASK_PRIMARY_CONDITION = 0x3, + WBEM_FLAG_KEYS_ONLY = 0x4, + WBEM_FLAG_REFS_ONLY = 0x8, + WBEM_FLAG_LOCAL_ONLY = 0x10, + WBEM_FLAG_PROPAGATED_ONLY = 0x20, + WBEM_FLAG_SYSTEM_ONLY = 0x30, + WBEM_FLAG_NONSYSTEM_ONLY = 0x40, + WBEM_MASK_CONDITION_ORIGIN = 0x70, + WBEM_FLAG_CLASS_OVERRIDES_ONLY = 0x100, + WBEM_FLAG_CLASS_LOCAL_AND_OVERRIDES = 0x200, + WBEM_MASK_CLASS_CONDITION = 0x300 +} WBEM_CONDITION_FLAG_TYPE; + typedef [v1_enum] enum tag_CIMTYPE_ENUMERATION { CIM_ILLEGAL = 0xfff,