Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/msdasql/msdasql_main.c | 2 +- dlls/msdasql/msdasql_private.h | 2 +- dlls/msdasql/session.c | 15 ++++++++++++--- dlls/msdasql/tests/provider.c | 7 ++++++- 4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/msdasql/msdasql_main.c b/dlls/msdasql/msdasql_main.c index e98945b9777..bc208a74cc5 100644 --- a/dlls/msdasql/msdasql_main.c +++ b/dlls/msdasql/msdasql_main.c @@ -559,7 +559,7 @@ static HRESULT WINAPI dbsess_CreateSession(IDBCreateSession *iface, IUnknown *ou if (outer) FIXME("outer currently not supported.\n");
- hr = create_db_session(riid, (void**)session); + hr = create_db_session(riid, &provider->MSDASQL_iface, (void**)session);
return hr; } diff --git a/dlls/msdasql/msdasql_private.h b/dlls/msdasql/msdasql_private.h index a3d73498fe9..7d7f67c2c78 100644 --- a/dlls/msdasql/msdasql_private.h +++ b/dlls/msdasql/msdasql_private.h @@ -16,4 +16,4 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-HRESULT create_db_session(REFIID riid, void **unk) DECLSPEC_HIDDEN; +HRESULT create_db_session(REFIID riid, IUnknown *datasource, void **unk) DECLSPEC_HIDDEN; diff --git a/dlls/msdasql/session.c b/dlls/msdasql/session.c index 44f36f0e591..b4239c59037 100644 --- a/dlls/msdasql/session.c +++ b/dlls/msdasql/session.c @@ -43,6 +43,8 @@ struct msdasql_session ISessionProperties ISessionProperties_iface; IDBCreateCommand IDBCreateCommand_iface; LONG refs; + + IUnknown *datasource; };
static inline struct msdasql_session *impl_from_IUnknown( IUnknown *iface ) @@ -139,6 +141,8 @@ static ULONG WINAPI session_Release(IUnknown *iface) if (!refs) { TRACE( "destroying %p\n", session ); + + IUnknown_Release(session->datasource); heap_free( session ); } return refs; @@ -173,9 +177,13 @@ ULONG WINAPI datasource_Release(IGetDataSource *iface) HRESULT WINAPI datasource_GetDataSource(IGetDataSource *iface, REFIID riid, IUnknown **datasource) { struct msdasql_session *session = impl_from_IGetDataSource( iface ); - FIXME("%p, %s, %p stub\n", session, debugstr_guid(riid), datasource);
- return E_NOTIMPL; + TRACE("%p, %s, %p stub\n", session, debugstr_guid(riid), datasource); + + if (!datasource) + return E_INVALIDARG; + + return IUnknown_QueryInterface(session->datasource, riid, (void**)datasource); }
static const IGetDataSourceVtbl datasourceVtbl = @@ -1155,7 +1163,7 @@ static const IDBCreateCommandVtbl createcommandVtbl = createcommand_CreateCommand };
-HRESULT create_db_session(REFIID riid, void **unk) +HRESULT create_db_session(REFIID riid, IUnknown *datasource, void **unk) { struct msdasql_session *session; HRESULT hr; @@ -1169,6 +1177,7 @@ HRESULT create_db_session(REFIID riid, void **unk) session->IOpenRowset_iface.lpVtbl = &openrowsetVtbl; session->ISessionProperties_iface.lpVtbl = &propertiesVtbl; session->IDBCreateCommand_iface.lpVtbl = &createcommandVtbl; + IUnknown_QueryInterface(datasource, &IID_IUnknown, (void**)&session->datasource); session->refs = 1;
hr = IUnknown_QueryInterface(&session->session_iface, riid, unk); diff --git a/dlls/msdasql/tests/provider.c b/dlls/msdasql/tests/provider.c index a0b11194f2b..f385f499b84 100644 --- a/dlls/msdasql/tests/provider.c +++ b/dlls/msdasql/tests/provider.c @@ -399,7 +399,7 @@ static void test_command_rowset(IUnknown *cmd)
static void test_sessions(void) { - IDBProperties *props; + IDBProperties *props, *dsource = NULL; IDBInitialize *dbinit = NULL; IDataInitialize *datainit; IDBCreateSession *dbsession = NULL; @@ -456,6 +456,11 @@ static void test_sessions(void)
hr = IUnknown_QueryInterface(session, &IID_IGetDataSource, (void**)&datasource); ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IGetDataSource_GetDataSource(datasource, &IID_IDBProperties, (IUnknown**)&dsource); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(dsource != props, "different pointers\n"); + IDBProperties_Release(dsource); IGetDataSource_Release(datasource);
hr = IUnknown_QueryInterface(session, &IID_ITransactionJoin, (void**)&join);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=102092
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w7u_adm (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w7u_el (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w8 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w8adm (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w864 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w1064v1507 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w1064v1809 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w1064 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w1064_tsign (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== w10pro64 (32 bit report) ===
msdasql: provider.c:462: Test failed: different pointers
=== debiant2 (build log) ===
0050:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0050:err:winediag:nodrv_CreateWindow Unknown error (998). 0040:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0040:err:winediag:nodrv_CreateWindow Unknown error (998). 0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 0048:err:winediag:nodrv_CreateWindow Unknown error (998). 002c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 002c:err:winediag:nodrv_CreateWindow Unknown error (998). 007c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 007c:err:winediag:nodrv_CreateWindow Unknown error (998). 00c0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 00c0:err:winediag:nodrv_CreateWindow Unknown error (998). 006c:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded. 006c:err:winediag:nodrv_CreateWindow Unknown error (998). Error: Mount manager not running, most likely your WINEPREFIX wasn't created correctly. Task: WineTest did not produce the wow32 report