From: Alistair Leslie-Hughes Subject: [PATCH 2/3] msado15: Implement _Connection Open Message-Id: Date: Fri, 13 Dec 2019 03:30:45 +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/Makefile.in | 2 +- dlls/msado15/connection.c | 38 ++++++++++++++++++++++++++++++++++++-- dlls/msado15/main.c | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/dlls/msado15/Makefile.in b/dlls/msado15/Makefile.in index 9852e0863d..e64da60547 100644 --- a/dlls/msado15/Makefile.in +++ b/dlls/msado15/Makefile.in @@ -1,5 +1,5 @@ MODULE = msado15.dll -IMPORTS = oleaut32 +IMPORTS = oleaut32 ole32 EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c index 73b225628c..2408000abc 100644 --- a/dlls/msado15/connection.c +++ b/dlls/msado15/connection.c @@ -21,6 +21,7 @@ #include "winbase.h" #define COBJMACROS #include "objbase.h" +#include "msdasc.h" #include "msado15_backcompat.h" #include "wine/debug.h" @@ -34,6 +35,8 @@ struct connection { _Connection Connection_iface; ISupportErrorInfo ISupportErrorInfo_iface; + IDataInitialize *datainit; + IDBInitialize *dbinit; LONG refs; ObjectStateEnum state; LONG timeout; @@ -61,6 +64,11 @@ static ULONG WINAPI connection_Release( _Connection *iface ) LONG refs = InterlockedDecrement( &connection->refs ); if (!refs) { + if (connection->dbinit) + IDBInitialize_Release(connection->dbinit); + if (connection->datainit) + IDataInitialize_Release(connection->datainit); + TRACE( "destroying %p\n", connection ); heap_free( connection ); } @@ -203,9 +211,33 @@ static HRESULT WINAPI connection_RollbackTrans( _Connection *iface ) static HRESULT WINAPI connection_Open( _Connection *iface, BSTR connect_str, BSTR userid, BSTR password, LONG options ) { - FIXME( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid), + struct connection *connection = impl_from_Connection( iface ); + HRESULT hr; + + TRACE( "%p, %s, %s, %p, %08x\n", iface, debugstr_w(connect_str), debugstr_w(userid), password, options ); - return E_NOTIMPL; + + hr = CoCreateInstance(&CLSID_MSDAINITIALIZE, NULL, CLSCTX_INPROC_SERVER, &IID_IDataInitialize,(void**)&connection->datainit); + if (FAILED(hr)) + { + WARN("Failed to create IDataInitialize object\n"); + return hr; + } + + hr = IDataInitialize_GetDataSource(connection->datainit, NULL, CLSCTX_INPROC_SERVER, connect_str, + &IID_IDBInitialize, (IUnknown**)&connection->dbinit); + if (FAILED(hr)) + { + WARN("Failed to create IDBInitialize object\n"); + + IDataInitialize_Release(connection->datainit); + connection->datainit = NULL; + return hr; + } + + connection->state = adStateOpen; + + return hr; } static HRESULT WINAPI connection_get_Errors( _Connection *iface, Errors **obj ) @@ -392,6 +424,8 @@ HRESULT Connection_create( void **obj ) connection->refs = 1; connection->state = adStateClosed; connection->timeout = 30; + connection->datainit = NULL; + connection->dbinit = NULL; *obj = &connection->Connection_iface; TRACE( "returning iface %p\n", *obj ); diff --git a/dlls/msado15/main.c b/dlls/msado15/main.c index 3115474b84..83c4a20566 100644 --- a/dlls/msado15/main.c +++ b/dlls/msado15/main.c @@ -21,6 +21,7 @@ #include "winbase.h" #include "initguid.h" #define COBJMACROS +#include "msdasc.h" #include "objbase.h" #include "rpcproxy.h" #include "msado15_backcompat.h" -- 2.17.1