[PATCH v2 3/3] msado15: Add ISupportErrorInfo support to _Recordset.
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Thu Dec 12 22:49:35 CST 2019
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
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 4b61b552f0..9bf6b60df1 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 );
@@ -686,6 +692,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) ||
@@ -698,6 +705,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) );
@@ -1235,6 +1246,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,
@@ -1330,6 +1374,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 d6bb50f44e..1fae811d10 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;
@@ -91,6 +92,10 @@ static void test_Recordset(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !count, "got %d\n", count );
+ 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
More information about the wine-devel
mailing list