From 8049e4dbc94469b345a7ffa25edd567f2a75d341 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Fri, 20 Nov 2020 19:16:25 +1100 Subject: [PATCH] msado15: Support ADORecordsetConstruction in _Recordset. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msado15/recordset.c | 123 +++++++++++++++++++++++++++++++++++ dlls/msado15/tests/msado15.c | 10 +-- 2 files changed, 128 insertions(+), 5 deletions(-) diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index e3dd83a4309..79679e455af 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -35,6 +35,7 @@ struct fields; struct recordset { _Recordset Recordset_iface; + ADORecordsetConstruction ADORecordsetConstruction_iface; ISupportErrorInfo ISupportErrorInfo_iface; LONG refs; LONG state; @@ -739,6 +740,11 @@ static inline struct recordset *impl_from_Recordset( _Recordset *iface ) return CONTAINING_RECORD( iface, struct recordset, Recordset_iface ); } +static inline struct recordset *impl_from_ADORecordsetConstruction( ADORecordsetConstruction *iface ) +{ + return CONTAINING_RECORD( iface, struct recordset, ADORecordsetConstruction_iface ); +} + static ULONG WINAPI recordset_AddRef( _Recordset *iface ) { struct recordset *recordset = impl_from_Recordset( iface ); @@ -798,6 +804,10 @@ static HRESULT WINAPI recordset_QueryInterface( _Recordset *iface, REFIID riid, { *obj = &recordset->ISupportErrorInfo_iface; } + else if (IsEqualGUID( riid, &IID_ADORecordsetConstruction )) + { + *obj = &recordset->ADORecordsetConstruction_iface; + } else if (IsEqualGUID( riid, &IID_IRunnableObject )) { TRACE("IID_IRunnableObject not supported returning NULL\n"); @@ -1545,6 +1555,118 @@ static const ISupportErrorInfoVtbl recordset_supporterrorinfo_vtbl = recordset_supporterrorinfo_InterfaceSupportsErrorInfo }; +static HRESULT WINAPI rsconstruction_QueryInterface(ADORecordsetConstruction *iface, + REFIID riid, void **obj) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + return _Recordset_QueryInterface( &recordset->Recordset_iface, riid, obj ); +} + +static ULONG WINAPI rsconstruction_AddRef(ADORecordsetConstruction *iface) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + return _Recordset_AddRef( &recordset->Recordset_iface ); +} + +static ULONG WINAPI rsconstruction_Release(ADORecordsetConstruction *iface) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + return _Recordset_Release( &recordset->Recordset_iface ); +} + +static HRESULT WINAPI rsconstruction_GetTypeInfoCount(ADORecordsetConstruction *iface, UINT *pctinfo) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + TRACE( "%p, %p\n", recordset, pctinfo ); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI rsconstruction_GetTypeInfo(ADORecordsetConstruction *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p %u %u %p\n", recordset, iTInfo, lcid, ppTInfo ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_GetIDsOfNames(ADORecordsetConstruction *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p %s %p %u %u %p\n", recordset, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_Invoke(ADORecordsetConstruction *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p %d %s %d %d %p %p %p %p\n", recordset, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_get_Rowset(ADORecordsetConstruction *iface, IUnknown **row_set) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %p\n", recordset, row_set ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_put_Rowset(ADORecordsetConstruction *iface, IUnknown *row_set) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %p\n", recordset, row_set ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_get_Chapter(ADORecordsetConstruction *iface, LONG *chapter) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %p\n", recordset, chapter ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_put_Chapter(ADORecordsetConstruction *iface, LONG chapter) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %d\n", recordset, chapter ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_get_RowPosition(ADORecordsetConstruction *iface, IUnknown **row_pos) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %p\n", recordset, row_pos ); + return E_NOTIMPL; +} + +static HRESULT WINAPI rsconstruction_put_RowPosition(ADORecordsetConstruction *iface, IUnknown *row_pos) +{ + struct recordset *recordset = impl_from_ADORecordsetConstruction( iface ); + FIXME( "%p, %p\n", recordset, row_pos ); + return E_NOTIMPL; +} + +static const ADORecordsetConstructionVtbl rsconstruction_vtbl = +{ + rsconstruction_QueryInterface, + rsconstruction_AddRef, + rsconstruction_Release, + rsconstruction_GetTypeInfoCount, + rsconstruction_GetTypeInfo, + rsconstruction_GetIDsOfNames, + rsconstruction_Invoke, + rsconstruction_get_Rowset, + rsconstruction_put_Rowset, + rsconstruction_get_Chapter, + rsconstruction_put_Chapter, + rsconstruction_get_RowPosition, + rsconstruction_put_RowPosition +}; + HRESULT Recordset_create( void **obj ) { struct recordset *recordset; @@ -1552,6 +1674,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 = &recordset_supporterrorinfo_vtbl; + recordset->ADORecordsetConstruction_iface.lpVtbl = &rsconstruction_vtbl; recordset->refs = 1; recordset->index = -1; recordset->cursor_location = adUseServer; diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index 70c2db7a62d..288e579f10c 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -566,7 +566,7 @@ static void test_ADORecordsetConstruction(void) ok( hr == S_OK, "got %08x\n", hr ); hr = _Recordset_QueryInterface( recordset, &IID_ADORecordsetConstruction, (void**)&construct ); - todo_wine ok( hr == S_OK, "got %08x\n", hr ); + ok( hr == S_OK, "got %08x\n", hr ); if (FAILED(hr)) { goto done; @@ -585,18 +585,18 @@ static void test_ADORecordsetConstruction(void) todo_wine ok( hr == S_OK, "got %08x\n", hr ); ref = get_refcount( rowset ); - ok( ref == 2, "got %d\n", ref ); + todo_wine ok( ref == 2, "got %d\n", ref ); hr = _Recordset_get_Fields( recordset, &fields ); ok( hr == S_OK, "got %08x\n", hr ); ok( fields != NULL, "NULL value\n"); ref = get_refcount( rowset ); - ok( ref == 2, "got %d\n", ref ); + todo_wine ok( ref == 2, "got %d\n", ref ); count = -1; hr = Fields_get_Count( fields, &count ); - ok( count == 1, "got %d\n", count ); + todo_wine ok( count == 1, "got %d\n", count ); if (count > 0) { VARIANT index; @@ -623,7 +623,7 @@ static void test_ADORecordsetConstruction(void) } ref = get_refcount(rowset); - ok( ref == 2, "got %d\n", ref ); + todo_wine ok( ref == 2, "got %d\n", ref ); Fields_Release(fields);