Module: wine Branch: master Commit: a1610861ff3fe215470ac48e6e3cbbf9873e197b URL: https://gitlab.winehq.org/wine/wine/-/commit/a1610861ff3fe215470ac48e6e3cbbf...
Author: Alistair Leslie-Hughes leslie_alistair@hotmail.com Date: Wed Sep 27 17:57:38 2023 +1000
msado15: Implement _Recordset::get_ActiveConnection.
---
dlls/msado15/recordset.c | 8 ++++++-- dlls/msado15/tests/msado15.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/msado15/recordset.c b/dlls/msado15/recordset.c index 9107aca26e7..272131a0d31 100644 --- a/dlls/msado15/recordset.c +++ b/dlls/msado15/recordset.c @@ -39,6 +39,7 @@ struct recordset ADORecordsetConstruction ADORecordsetConstruction_iface; ISupportErrorInfo ISupportErrorInfo_iface; LONG refs; + VARIANT active_connection; LONG state; struct fields *fields; LONG count; @@ -1401,8 +1402,9 @@ static HRESULT WINAPI recordset_put_ActiveConnection( _Recordset *iface, VARIANT
static HRESULT WINAPI recordset_get_ActiveConnection( _Recordset *iface, VARIANT *connection ) { - FIXME( "%p, %p\n", iface, connection ); - return E_NOTIMPL; + struct recordset *recordset = impl_from_Recordset( iface ); + TRACE( "%p, %p\n", iface, connection ); + return VariantCopy(connection, &recordset->active_connection); }
static HRESULT WINAPI recordset_get_BOF( _Recordset *iface, VARIANT_BOOL *bof ) @@ -2737,6 +2739,8 @@ HRESULT Recordset_create( void **obj ) recordset->Recordset_iface.lpVtbl = &recordset_vtbl; recordset->ISupportErrorInfo_iface.lpVtbl = &recordset_supporterrorinfo_vtbl; recordset->ADORecordsetConstruction_iface.lpVtbl = &rsconstruction_vtbl; + V_VT(&recordset->active_connection) = VT_DISPATCH; + V_DISPATCH(&recordset->active_connection) = NULL; 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 724787870e0..c60ea69227c 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -59,7 +59,7 @@ static void test_Recordset(void) CursorTypeEnum cursor; BSTR name; HRESULT hr; - VARIANT bookmark, filter; + VARIANT bookmark, filter, active; EditModeEnum editmode;
hr = CoCreateInstance( &CLSID_Recordset, NULL, CLSCTX_INPROC_SERVER, &IID__Recordset, (void **)&recordset ); @@ -222,6 +222,18 @@ static void test_Recordset(void) ok( is_eof( recordset ), "not eof\n" ); ok( is_bof( recordset ), "not bof\n" );
+if (0) +{ /* Causes a crash */ + hr = _Recordset_get_ActiveConnection( recordset, NULL ); +} + + VariantInit(&active); + hr = _Recordset_get_ActiveConnection( recordset, &active ); + ok( hr == S_OK, "got %08lx\n", hr ); + ok( V_VT(&active) == VT_DISPATCH, "got %d\n", V_VT(&active) ); + ok( V_DISPATCH(&active) == NULL, "got %p\n", V_DISPATCH(&active) ); + VariantClear(&active); + editmode = -1; hr = _Recordset_get_EditMode( recordset, &editmode ); ok( hr == MAKE_ADO_HRESULT( adErrNoCurrentRecord ), "got %08lx\n", hr );