Hans Leidekker : wbemprox: Implement IWbemClassObject::Get.

Alexandre Julliard julliard at winehq.org
Mon Jun 18 15:00:25 CDT 2012


Module: wine
Branch: master
Commit: 92e99866282925e07cda24de3e28a7aa4f17cf74
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=92e99866282925e07cda24de3e28a7aa4f17cf74

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Jun 18 09:31:29 2012 +0200

wbemprox: Implement IWbemClassObject::Get.

---

 dlls/wbemprox/Makefile.in        |    2 +-
 dlls/wbemprox/class.c            |   14 ++++++++++-
 dlls/wbemprox/query.c            |   42 ++++++++++++++++++++++++++++++++++++++
 dlls/wbemprox/wbemprox_private.h |    2 +
 4 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/dlls/wbemprox/Makefile.in b/dlls/wbemprox/Makefile.in
index 3a4d9f3..f973c2f 100644
--- a/dlls/wbemprox/Makefile.in
+++ b/dlls/wbemprox/Makefile.in
@@ -1,5 +1,5 @@
 MODULE    = wbemprox.dll
-IMPORTS   = ole32 advapi32
+IMPORTS   = oleaut32 ole32 advapi32
 
 C_SRCS = \
 	builtin.c \
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index b31dcbb..a1fbb70 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -274,8 +274,18 @@ static HRESULT WINAPI class_object_Get(
     CIMTYPE *pType,
     LONG *plFlavor )
 {
-    FIXME("%p, %s, %08x, %p, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, pType, plFlavor);
-    return E_NOTIMPL;
+    struct class_object *co = impl_from_IWbemClassObject( iface );
+    struct enum_class_object *ec = impl_from_IEnumWbemClassObject( co->iter );
+    struct view *view = ec->query->view;
+
+    TRACE("%p, %s, %08x, %p, %p, %p\n", iface, debugstr_w(wszName), lFlags, pVal, pType, plFlavor);
+
+    if (plFlavor)
+    {
+        FIXME("flavor parameter not supported\n");
+        *plFlavor = 0;
+    }
+    return get_propval( view, co->index, wszName, pVal, pType );
 }
 
 static HRESULT WINAPI class_object_Put(
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index 701d656..7b228ae 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -347,3 +347,45 @@ done:
     if (hr != S_OK) free_query( query );
     return hr;
 }
+
+static BOOL is_selected_prop( const struct view *view, const WCHAR *name )
+{
+    const struct property *prop = view->proplist;
+
+    if (!prop) return TRUE;
+    while (prop)
+    {
+        if (!strcmpiW( prop->name, name )) return TRUE;
+        prop = prop->next;
+    }
+    return FALSE;
+}
+
+HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VARIANT *ret, CIMTYPE *type )
+{
+    HRESULT hr;
+    UINT column, row = view->result[index];
+    INT_PTR val;
+
+    if (!is_selected_prop( view, name )) return WBEM_E_NOT_FOUND;
+
+    hr = get_column_index( view->table, name, &column );
+    if (hr != S_OK) return WBEM_E_NOT_FOUND;
+
+    hr = get_value( view->table, row, column, &val );
+    if (hr != S_OK) return hr;
+
+    switch (view->table->columns[column].type)
+    {
+    case CIM_STRING:
+    case CIM_DATETIME:
+        V_VT( ret ) = VT_BSTR;
+        V_BSTR( ret ) = SysAllocString( (const WCHAR *)val );
+        break;
+    default:
+        ERR("unhandled column type %u\n", view->table->columns[column].type);
+        return WBEM_E_FAILED;
+    }
+    if (type) *type = view->table->columns[column].type;
+    return S_OK;
+}
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index 3b4af0d..1e3ca0c 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -111,6 +111,8 @@ HRESULT create_view( const struct property *, const WCHAR *, const struct expr *
                      struct view ** ) DECLSPEC_HIDDEN;
 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 WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
 HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list