wbemdisp: Add SWbemNamedValueSet stub.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-02-24 09:40:23 +03:00 committed by Alexandre Julliard
parent 0eaccbb15e
commit 1922298fe3
5 changed files with 263 additions and 1 deletions

View File

@ -47,6 +47,7 @@ enum type_id
ISWbemPropertySet_tid,
ISWbemServices_tid,
ISWbemSecurity_tid,
ISWbemNamedValueSet_tid,
last_tid
};
@ -61,7 +62,8 @@ static REFIID wbemdisp_tid_id[] =
&IID_ISWbemProperty,
&IID_ISWbemPropertySet,
&IID_ISWbemServices,
&IID_ISWbemSecurity
&IID_ISWbemSecurity,
&IID_ISWbemNamedValueSet,
};
static HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
@ -2456,3 +2458,236 @@ static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
TRACE( "returning iface %p\n", *obj );
return S_OK;
}
struct namedvalueset
{
ISWbemNamedValueSet ISWbemNamedValueSet_iface;
LONG refs;
};
static struct namedvalueset *impl_from_ISWbemNamedValueSet( ISWbemNamedValueSet *iface )
{
return CONTAINING_RECORD( iface, struct namedvalueset, ISWbemNamedValueSet_iface );
}
static HRESULT WINAPI namedvalueset_QueryInterface(
ISWbemNamedValueSet *iface,
REFIID riid,
void **ppvObject )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
TRACE( "%p, %s, %p\n", set, debugstr_guid( riid ), ppvObject );
if (IsEqualGUID( riid, &IID_ISWbemNamedValueSet ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ))
{
*ppvObject = iface;
}
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
return E_NOINTERFACE;
}
ISWbemNamedValueSet_AddRef( iface );
return S_OK;
}
static ULONG WINAPI namedvalueset_AddRef(
ISWbemNamedValueSet *iface )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
return InterlockedIncrement( &set->refs );
}
static ULONG WINAPI namedvalueset_Release(
ISWbemNamedValueSet *iface )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
LONG refs = InterlockedDecrement( &set->refs );
if (!refs)
{
TRACE( "destroying %p\n", set );
heap_free( set );
}
return refs;
}
static HRESULT WINAPI namedvalueset_GetTypeInfoCount(
ISWbemNamedValueSet *iface,
UINT *count )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
TRACE( "%p, %p\n", set, count );
*count = 1;
return S_OK;
}
static HRESULT WINAPI namedvalueset_GetTypeInfo(
ISWbemNamedValueSet *iface,
UINT index,
LCID lcid,
ITypeInfo **info )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
TRACE( "%p, %u, %u, %p\n", set, index, lcid, info );
return get_typeinfo( ISWbemNamedValueSet_tid, info );
}
static HRESULT WINAPI namedvalueset_GetIDsOfNames(
ISWbemNamedValueSet *iface,
REFIID riid,
LPOLESTR *names,
UINT count,
LCID lcid,
DISPID *dispid )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE( "%p, %s, %p, %u, %u, %p\n", set, debugstr_guid(riid), names, count, lcid, dispid );
if (!names || !count || !dispid) return E_INVALIDARG;
hr = get_typeinfo( ISWbemNamedValueSet_tid, &typeinfo );
if (SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames( typeinfo, names, count, dispid );
ITypeInfo_Release( typeinfo );
}
return hr;
}
static HRESULT WINAPI namedvalueset_Invoke(
ISWbemNamedValueSet *iface,
DISPID member,
REFIID riid,
LCID lcid,
WORD flags,
DISPPARAMS *params,
VARIANT *result,
EXCEPINFO *excep_info,
UINT *arg_err )
{
struct namedvalueset *set = impl_from_ISWbemNamedValueSet( iface );
ITypeInfo *typeinfo;
HRESULT hr;
TRACE( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", set, member, debugstr_guid(riid),
lcid, flags, params, result, excep_info, arg_err );
hr = get_typeinfo( ISWbemNamedValueSet_tid, &typeinfo );
if (SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke( typeinfo, &set->ISWbemNamedValueSet_iface, member, flags,
params, result, excep_info, arg_err );
ITypeInfo_Release( typeinfo );
}
return hr;
}
static HRESULT WINAPI namedvalueset_get__NewEnum(
ISWbemNamedValueSet *iface,
IUnknown **unk )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_Item(
ISWbemNamedValueSet *iface,
BSTR name,
LONG flags,
ISWbemNamedValue **value )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_Count(
ISWbemNamedValueSet *iface,
LONG *count )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_Add(
ISWbemNamedValueSet *iface,
BSTR name,
VARIANT *value,
LONG flags,
ISWbemNamedValue **namedvalue )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_Remove(
ISWbemNamedValueSet *iface,
BSTR name,
LONG flags )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_Clone(
ISWbemNamedValueSet *iface,
ISWbemNamedValueSet **valueset )
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI namedvalueset_DeleteAll(
ISWbemNamedValueSet *iface )
{
FIXME("\n");
return E_NOTIMPL;
}
static const ISWbemNamedValueSetVtbl namedvalueset_vtbl =
{
namedvalueset_QueryInterface,
namedvalueset_AddRef,
namedvalueset_Release,
namedvalueset_GetTypeInfoCount,
namedvalueset_GetTypeInfo,
namedvalueset_GetIDsOfNames,
namedvalueset_Invoke,
namedvalueset_get__NewEnum,
namedvalueset_Item,
namedvalueset_Count,
namedvalueset_Add,
namedvalueset_Remove,
namedvalueset_Clone,
namedvalueset_DeleteAll,
};
HRESULT SWbemNamedValueSet_create( void **obj )
{
struct namedvalueset *set;
TRACE( "%p\n", obj );
if (!(set = heap_alloc_zero( sizeof(*set) ))) return E_OUTOFMEMORY;
set->ISWbemNamedValueSet_iface.lpVtbl = &namedvalueset_vtbl;
set->refs = 1;
*obj = &set->ISWbemNamedValueSet_iface;
TRACE( "returning iface %p\n", *obj );
return S_OK;
}

View File

@ -262,6 +262,7 @@ static const struct IClassFactoryVtbl factory_vtbl =
};
static struct factory swbem_locator_cf = { { &factory_vtbl }, SWbemLocator_create };
static struct factory swbem_namedvalueset_cf = { { &factory_vtbl }, SWbemNamedValueSet_create };
static struct factory winmgmts_cf = { { &factory_vtbl }, WinMGMTS_create };
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
@ -289,6 +290,8 @@ HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *obj )
cf = &swbem_locator_cf.IClassFactory_iface;
else if (IsEqualGUID( rclsid, &CLSID_WinMGMTS ))
cf = &winmgmts_cf.IClassFactory_iface;
else if (IsEqualGUID( rclsid, &CLSID_SWbemNamedValueSet ))
cf = &swbem_namedvalueset_cf.IClassFactory_iface;
else
return CLASS_E_CLASSNOTAVAILABLE;

View File

@ -402,12 +402,24 @@ static void test_locator(void)
ISWbemLocator_Release( locator );
}
static void test_namedvalueset(void)
{
ISWbemNamedValueSet *set;
HRESULT hr;
hr = CoCreateInstance( &CLSID_SWbemNamedValueSet, NULL, CLSCTX_INPROC_SERVER, &IID_ISWbemNamedValueSet, (void **)&set );
ok( hr == S_OK, "got %x\n", hr );
ISWbemNamedValueSet_Release(set);
}
START_TEST(wbemdisp)
{
CoInitialize( NULL );
test_ParseDisplayName();
test_locator();
test_namedvalueset();
CoUninitialize();
}

View File

@ -17,3 +17,4 @@
*/
HRESULT SWbemLocator_create(LPVOID *) DECLSPEC_HIDDEN;
HRESULT SWbemNamedValueSet_create(void **) DECLSPEC_HIDDEN;

View File

@ -1196,4 +1196,15 @@ coclass SWbemLocator
interface ISWbemLocator;
}
[
threading(apartment),
uuid(9aed384e-ce8b-11d1-8b05-00600806d9b6),
progid("WbemScripting.SWbemNamedValueSet.1"),
vi_progid("WbemScripting.SWbemNamedValueSet")
]
coclass SWbemNamedValueSet
{
interface ISWbemNamedValueSet;
}
} /* WbemScripting */