wbemdisp: Implement ISWbemObjectSet::ItemIndex.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2017-02-09 12:03:04 +00:00 committed by Alexandre Julliard
parent 572aa0e0ea
commit 61f0bda129
1 changed files with 33 additions and 2 deletions

View File

@ -538,8 +538,39 @@ static HRESULT WINAPI objectset_ItemIndex(
LONG lIndex,
ISWbemObject **objWbemObject )
{
FIXME( "\n" );
return E_NOTIMPL;
struct objectset *objectset = impl_from_ISWbemObjectSet( iface );
LONG count;
HRESULT hr;
IEnumVARIANT *enum_var;
VARIANT var;
TRACE( "%p, %d, %p\n", objectset, lIndex, objWbemObject );
*objWbemObject = NULL;
hr = ISWbemObjectSet_get_Count( iface, &count );
if (FAILED(hr)) return hr;
if (lIndex >= count) return WBEM_E_NOT_FOUND;
hr = ISWbemObjectSet_get__NewEnum( iface, (IUnknown **)&enum_var );
if (FAILED(hr)) return hr;
IEnumVARIANT_Reset( enum_var );
hr = IEnumVARIANT_Skip( enum_var, lIndex );
if (SUCCEEDED(hr))
hr = IEnumVARIANT_Next( enum_var, 1, &var, NULL );
IEnumVARIANT_Release( enum_var );
if (SUCCEEDED(hr))
{
if (V_VT( &var ) == VT_DISPATCH)
hr = IDispatch_QueryInterface( V_DISPATCH( &var ), &IID_ISWbemObject, (void **)objWbemObject );
else
hr = WBEM_E_NOT_FOUND;
VariantClear( &var );
}
return hr;
}
static const ISWbemObjectSetVtbl objectset_vtbl =