Commit 4cfd8189 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Implement IEnumWbemClassObject::Next.

parent 19f203c7
...@@ -102,8 +102,27 @@ static HRESULT WINAPI enum_class_object_Next( ...@@ -102,8 +102,27 @@ static HRESULT WINAPI enum_class_object_Next(
IWbemClassObject **apObjects, IWbemClassObject **apObjects,
ULONG *puReturned ) ULONG *puReturned )
{ {
FIXME("%p, %d, %u, %p, %p\n", iface, lTimeout, uCount, apObjects, puReturned); struct enum_class_object *ec = impl_from_IEnumWbemClassObject( iface );
return E_NOTIMPL; 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( static HRESULT WINAPI enum_class_object_NextAsync(
...@@ -168,6 +187,8 @@ struct class_object ...@@ -168,6 +187,8 @@ struct class_object
{ {
IWbemClassObject IWbemClassObject_iface; IWbemClassObject IWbemClassObject_iface;
LONG refs; LONG refs;
IEnumWbemClassObject *iter;
UINT index;
}; };
static inline struct class_object *impl_from_IWbemClassObject( static inline struct class_object *impl_from_IWbemClassObject(
...@@ -191,6 +212,7 @@ static ULONG WINAPI class_object_Release( ...@@ -191,6 +212,7 @@ static ULONG WINAPI class_object_Release(
if (!refs) if (!refs)
{ {
TRACE("destroying %p\n", co); TRACE("destroying %p\n", co);
if (co->iter) IEnumWbemClassObject_Release( co->iter );
heap_free( co ); heap_free( co );
} }
return refs; return refs;
...@@ -472,7 +494,7 @@ static const IWbemClassObjectVtbl class_object_vtbl = ...@@ -472,7 +494,7 @@ static const IWbemClassObjectVtbl class_object_vtbl =
}; };
HRESULT WbemClassObject_create( HRESULT WbemClassObject_create(
IUnknown *pUnkOuter, LPVOID *ppObj ) IUnknown *pUnkOuter, IEnumWbemClassObject *iter, UINT index, LPVOID *ppObj )
{ {
struct class_object *co; struct class_object *co;
...@@ -482,7 +504,10 @@ HRESULT WbemClassObject_create( ...@@ -482,7 +504,10 @@ HRESULT WbemClassObject_create(
if (!co) return E_OUTOFMEMORY; if (!co) return E_OUTOFMEMORY;
co->IWbemClassObject_iface.lpVtbl = &class_object_vtbl; 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; *ppObj = &co->IWbemClassObject_iface;
......
...@@ -41,6 +41,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class, ...@@ -41,6 +41,7 @@ HRESULT create_view( const struct property *proplist, const WCHAR *class,
view->cond = cond; view->cond = cond;
view->result = NULL; view->result = NULL;
view->count = 0; view->count = 0;
view->index = 0;
*ret = view; *ret = view;
return S_OK; return S_OK;
} }
......
...@@ -95,6 +95,7 @@ struct view ...@@ -95,6 +95,7 @@ struct view
const struct expr *cond; const struct expr *cond;
UINT *result; UINT *result;
UINT count; UINT count;
UINT index;
}; };
struct query struct query
...@@ -113,6 +114,7 @@ struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN; ...@@ -113,6 +114,7 @@ struct table *get_table( const WCHAR * ) DECLSPEC_HIDDEN;
HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN; HRESULT WbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
HRESULT WbemServices_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; HRESULT EnumWbemClassObject_create(IUnknown *, struct query *, LPVOID *) DECLSPEC_HIDDEN;
static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1); static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment