From: Alistair Leslie-Hughes Subject: [PATCH 3/3] msado15: Add ISupportErrorInfo support to _Recordset. Message-Id: Date: Fri, 13 Dec 2019 03:30:46 +0000 In-Reply-To: <20191213033031.14629-1-leslie_alistair@hotmail.com> References: <20191213033031.14629-1-leslie_alistair@hotmail.com> Signed-off-by: Alistair Leslie-Hughes --- dlls/msado15/recordset.c | 61 +++++++++++++++++++++++++++++++----- dlls/msado15/tests/msado15.c | 5 +++ 2 files changed, 58 insertions(+), 8 deletions(-) diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 8a5f7aad41..0dc8a496c0 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -34,14 +34,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15); struct fields; struct recordset { - _Recordset Recordset_iface; - LONG refs; - LONG state; - struct fields *fields; - LONG count; - LONG allocated; - LONG index; - VARIANT *data; + _Recordset Recordset_iface; + ISupportErrorInfo ISupportErrorInfo_iface; + LONG refs; + LONG state; + struct fields *fields; + LONG count; + LONG allocated; + LONG index; + VARIANT *data; }; struct fields @@ -646,6 +647,11 @@ static inline struct recordset *impl_from_Recordset( _Recordset *iface ) return CONTAINING_RECORD( iface, struct recordset, Recordset_iface ); } +static inline struct recordset *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface ) +{ + return CONTAINING_RECORD( iface, struct recordset, ISupportErrorInfo_iface ); +} + static ULONG WINAPI recordset_AddRef( _Recordset *iface ) { struct recordset *recordset = impl_from_Recordset( iface ); @@ -690,6 +696,7 @@ static ULONG WINAPI recordset_Release( _Recordset *iface ) static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, void **obj ) { + struct recordset *recordset = impl_from_Recordset( iface ); TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj ); if (IsEqualIID(riid, &IID_IUnknown) || @@ -702,6 +709,10 @@ static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, { *obj = iface; } + else if(IsEqualGUID( riid, &IID_ISupportErrorInfo )) + { + *obj = &recordset->ISupportErrorInfo_iface; + } else { FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); @@ -1242,6 +1253,39 @@ static HRESULT WINAPI recordset_Save( _Recordset *iface, VARIANT destination, Pe return E_NOTIMPL; } +static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj ) +{ + struct recordset *recordset = impl_from_ISupportErrorInfo( iface ); + return recordset_QueryInterface( &recordset->Recordset_iface, riid, obj ); +} + +static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface ) +{ + struct recordset *recordset = impl_from_ISupportErrorInfo( iface ); + return recordset_AddRef( &recordset->Recordset_iface ); +} + +static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface ) +{ + struct recordset *recordset = impl_from_ISupportErrorInfo( iface ); + return recordset_Release( &recordset->Recordset_iface ); +} + +static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid ) +{ + struct recordset *recordset = impl_from_ISupportErrorInfo( iface ); + FIXME( "%p, %s\n", recordset, debugstr_guid(riid) ); + return S_FALSE; +} + +static const struct ISupportErrorInfoVtbl support_error_vtbl = +{ + supporterror_QueryInterface, + supporterror_AddRef, + supporterror_Release, + supporterror_InterfaceSupportsErrorInfo +}; + static const struct _RecordsetVtbl recordset_vtbl = { recordset_QueryInterface, @@ -1337,6 +1381,7 @@ HRESULT Recordset_create( void **obj ) if (!(recordset = heap_alloc_zero( sizeof(*recordset) ))) return E_OUTOFMEMORY; recordset->Recordset_iface.lpVtbl = &recordset_vtbl; + recordset->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl; recordset->refs = 1; recordset->index = -1; recordset->state = adStateClosed; diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index d3c1f30f6d..c25c7fc3cb 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -46,6 +46,7 @@ static LONG get_refs_recordset( _Recordset *recordset ) static void test_Recordset(void) { _Recordset *recordset; + ISupportErrorInfo *errorinfo; Fields *fields, *fields2; LONG refs, count, state; HRESULT hr; @@ -93,6 +94,10 @@ static void test_Recordset(void) hr = _Recordset_Close( recordset ); ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr ); + + hr = _Recordset_QueryInterface(recordset, &IID_ISupportErrorInfo, (void**)&errorinfo); + ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n"); + ISupportErrorInfo_Release(errorinfo); refs = _Recordset_Release( recordset ); ok( !refs, "got %d\n", refs ); -- 2.17.1