wintypes: Add stubs for IKeyValuePair<HSTRING, IInspectable *>.

This commit is contained in:
Vibhav Pant 2024-11-03 18:51:55 +05:30
parent 35e1a70897
commit ace97f7475
No known key found for this signature in database
GPG key ID: E3FB28CB6AB59598
2 changed files with 123 additions and 3 deletions

View file

@ -28,6 +28,126 @@
WINE_DEFAULT_DEBUG_CHANNEL( wintypes );
struct kvpair
{
IKeyValuePair_HSTRING_IInspectable IKeyValuePair_HSTRING_IInspectable_iface;
LONG ref;
};
static inline struct kvpair *
impl_from_IKeyValuePair_HSTRING_IInspectable( IKeyValuePair_HSTRING_IInspectable *iface )
{
return CONTAINING_RECORD( iface, struct kvpair, IKeyValuePair_HSTRING_IInspectable_iface );
}
static HRESULT STDMETHODCALLTYPE kvpair_QueryInterface( IKeyValuePair_HSTRING_IInspectable *iface,
REFIID iid, void **out )
{
TRACE( "(%p, %p, %p)\n", iface, debugstr_guid( iid ), out );
*out = NULL;
if (IsEqualGUID( iid, &IID_IUnknown ) ||
IsEqualGUID( iid, &IID_IInspectable ) ||
IsEqualGUID( iid, &IID_IKeyValuePair_HSTRING_IInspectable ))
{
*out = iface;
IUnknown_AddRef( (IUnknown *)(*out) );
return S_OK;
}
FIXME( "%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid( iid ) );
return E_NOINTERFACE;
}
static ULONG STDMETHODCALLTYPE kvpair_AddRef( IKeyValuePair_HSTRING_IInspectable *iface )
{
struct kvpair *impl;
TRACE( "(%p)\n", iface );
impl = impl_from_IKeyValuePair_HSTRING_IInspectable( iface );
return InterlockedIncrement( &impl->ref );
}
static ULONG STDMETHODCALLTYPE kvpair_Release( IKeyValuePair_HSTRING_IInspectable *iface )
{
struct kvpair *impl;
ULONG ref;
TRACE( "(%p)\n", iface );
impl = impl_from_IKeyValuePair_HSTRING_IInspectable( iface );
ref = InterlockedDecrement( &impl->ref );
if (!ref)
free( impl );
return ref;
}
static HRESULT STDMETHODCALLTYPE kvpair_GetIIDs( IKeyValuePair_HSTRING_IInspectable *iface,
ULONG *iid_count, IID **iids )
{
FIXME( "(%p, %p, %p) stub!\n", iface, iid_count, iids );
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE
kvpair_GetRuntimeClassName( IKeyValuePair_HSTRING_IInspectable *iface, HSTRING *class_name )
{
FIXME( "(%p, %p) stub!\n", iface, class_name );
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE kvpair_GetTrustLevel( IKeyValuePair_HSTRING_IInspectable *iface,
TrustLevel *trust_level )
{
FIXME( "(%p, %p) stub!\n", iface, trust_level );
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE kvpair_get_Key( IKeyValuePair_HSTRING_IInspectable *iface,
HSTRING *key )
{
FIXME( "(%p, %p) stub!\n", iface, key );
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE kvpair_get_Value( IKeyValuePair_HSTRING_IInspectable *iface,
IInspectable **value )
{
FIXME( "(%p, %p) stub!\n", iface, value );
return E_NOTIMPL;
}
const static IKeyValuePair_HSTRING_IInspectableVtbl kvpair_vtbl =
{
kvpair_QueryInterface,
kvpair_AddRef,
kvpair_Release,
kvpair_GetIIDs,
kvpair_GetRuntimeClassName,
kvpair_GetTrustLevel,
kvpair_get_Key,
kvpair_get_Value,
};
static HRESULT kvpair_create( IKeyValuePair_HSTRING_IInspectable **kvpair )
{
struct kvpair *impl;
TRACE( "(%p)\n", kvpair );
*kvpair = NULL;
impl = calloc( 1, sizeof( *impl ) );
if (!impl)
return E_OUTOFMEMORY;
impl->IKeyValuePair_HSTRING_IInspectable_iface.lpVtbl = &kvpair_vtbl;
impl->ref = 1;
*kvpair = &impl->IKeyValuePair_HSTRING_IInspectable_iface;
return S_OK;
}
struct iterator_kvpair_HSTRING_IInspectable
{
IIterator_IKeyValuePair_HSTRING_IInspectable IIterator_IKeyValuePair_HSTRING_IInspectable_iface;
@ -113,8 +233,8 @@ static HRESULT STDMETHODCALLTYPE
iterator_kvpair_HSTRING_IInspectable_get_Current( IIterator_IKeyValuePair_HSTRING_IInspectable *iface,
IKeyValuePair_HSTRING_IInspectable **kvpair )
{
FIXME( "(%p, %p) stub!\n", iface, kvpair );
return E_NOTIMPL;
FIXME( "(%p, %p) semi-stub!\n", iface, kvpair );
return kvpair_create( kvpair );
}
static HRESULT STDMETHODCALLTYPE iterator_kvpair_HSTRING_IInspectable_HasCurrent(

View file

@ -113,7 +113,7 @@ static void test_IPropertySet(void)
if (SUCCEEDED( hr ))
{
hr = IIterable_IKeyValuePair_HSTRING_IInspectable_First( iterable, &iterator );
todo_wine ok( SUCCEEDED( hr ), "got %#lx\n", hr );
ok( SUCCEEDED( hr ), "got %#lx\n", hr );
if (SUCCEEDED( hr ))
IIterator_IKeyValuePair_HSTRING_IInspectable_Release( iterator );
IIterable_IKeyValuePair_HSTRING_IInspectable_Release( iterable );