[4/4] wbemprox: Implement IEnumWbemClassObject::Next.
Hans Leidekker
hans at codeweavers.com
Fri Jun 15 08:48:32 CDT 2012
---
dlls/wbemprox/class.c | 33 +++++++++++++++++++++++++++++----
dlls/wbemprox/query.c | 1 +
dlls/wbemprox/wbemprox_private.h | 2 ++
3 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/dlls/wbemprox/class.c b/dlls/wbemprox/class.c
index d405206..a950e41 100644
--- a/dlls/wbemprox/class.c
+++ b/dlls/wbemprox/class.c
@@ -102,8 +102,27 @@ static HRESULT WINAPI enum_class_object_Next(
IWbemClassObject **apObjects,
ULONG *puReturned )
{
- FIXME("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned);
- return E_NOTIMPL;
+ struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface );
+ struct view *view = ec->query->view;
+ HRESULT hr;
+
+ TRACE("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned);
+
+ if (!uCount) return WBEM_S_FALSE;
+ if (!apObjects || !puReturned) return WBEM_E_INVALID_PARAMETER;
+ if (lTimeout != WBEM_INFINITE) FIXME("timeout not supported\n");
+
+ *puReturned = 0;
+ if (view->index + uCount > view->count) return WBEM_S_FALSE;
+
+ hr = WbemClassObject_create( NULL, iface, view->index, (void **)apObjects );
+ if (hr != S_OK) return hr;
+
+ view->index++;
+ *puReturned = 1;
+ if (view->index == view->count) return WBEM_S_FALSE;
+ if (uCount > 1) return WBEM_S_TIMEDOUT;
+ return WBEM_S_NO_ERROR;
}
static HRESULT WINAPI enum_class_object_NextAsync(
@@ -168,6 +187,8 @@ struct class_object
{
IWbemClassObject IWbemClassObject_iface;
LONG refs;
+ IEnumWbemClassObject *iter;
+ UINT index;
};
static inline struct class_object *impl_from_IWbemClassObject(
@@ -191,6 +212,7 @@ static ULONG WINAPI class_object_Release(
if (!refs)
{
TRACE("destroying %p\n", co);
+ if (co->iter) IEnumWbemClassObject_Release( co->iter );
heap_free( co );
}
return refs;
@@ -472,7 +494,7 @@ static const IWbemClassObjectVtbl class_object_vtbl =
};
HRESULT WbemClassObject_create(
- IUnknown *pUnkOuter, LPVOID *ppObj )
+ IUnknown *pUnkOuter, IEnumWbemClassObject *iter, UINT index, LPVOID *ppObj )
{
struct class_object *co;
@@ -482,7 +504,10 @@ HRESULT WbemClassObject_create(
if (!co) return E_OUTOFMEMORY;
co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl;
- co->refs = 1;
+ co->refs = 1;
+ co->iter = iter;
+ co->index = index;
+ if (iter) IEnumWbemClassObject_AddRef( iter );
*ppObj = &co->IWbemClassObject_iface;
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c
index eb2f332..701d656 100644
--- a/dlls/wbemprox/query.c
+++ b/dlls/wbemprox/query.c
@@ -41,6 +41,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class,
view->cond = cond;
view->result = NULL;
view->count = 0;
+ view->index = 0;
*ret = view;
return S_OK;
}
diff --git a/dlls/wbemprox/wbemprox_private.h b/dlls/wbemprox/wbemprox_private.h
index bb29738..3b4af0d 100644
--- a/dlls/wbemprox/wbemprox_private.h
+++ b/dlls/wbemprox/wbemprox_private.h
@@ -95,6 +95,7 @@ struct view
const struct expr *cond;
UINT *result;
UINT count;
+ UINT index;
};
struct query
@@ -113,6 +114,7 @@ struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN;
HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT WbemServices_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
+HRESULT WbemClassObject_create(IUnknown *, IEnumWbemClassObject *, UINT, LPVOID *) DECLSPEC_HIDDEN;
HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN;
static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
--
1.7.10
More information about the wine-patches
mailing list