From f3508490390adc5c4b9b0bb9d67ec69f90c572d4 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 8 Oct 2020 14:00:36 +0200 Subject: [PATCH] msado15: Implement _Connection get/put Mode. Signed-off-by: Alistair Leslie-Hughes Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/msado15/connection.c | 18 ++++++++++++++---- dlls/msado15/tests/msado15.c | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c index 499f8b22563..357834a95fe 100644 --- a/dlls/msado15/connection.c +++ b/dlls/msado15/connection.c @@ -54,6 +54,7 @@ struct connection LONG timeout; WCHAR *datasource; WCHAR *provider; + ConnectModeEnum mode; struct connection_point cp_connev; }; @@ -336,14 +337,22 @@ static HRESULT WINAPI connection_put_CursorLocation( _Connection *iface, CursorL static HRESULT WINAPI connection_get_Mode( _Connection *iface, ConnectModeEnum *mode ) { - FIXME( "%p, %p\n", iface, mode ); - return E_NOTIMPL; + struct connection *connection = impl_from_Connection( iface ); + + TRACE( "%p, %p\n", iface, mode ); + + *mode = connection->mode; + return S_OK; } static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum mode ) { - FIXME( "%p, %u\n", iface, mode ); - return E_NOTIMPL; + struct connection *connection = impl_from_Connection( iface ); + + TRACE( "%p, %u\n", iface, mode ); + + connection->mode = mode; + return S_OK; } static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str ) @@ -664,6 +673,7 @@ HRESULT Connection_create( void **obj ) connection->timeout = 30; connection->datasource = NULL; connection->provider = SysAllocString(L"MSDASQL"); + connection->mode = adModeUnknown; connection->cp_connev.conn = connection; connection->cp_connev.riid = &DIID_ConnectionEvents; diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index bedca96368d..8e8553c3b8d 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -675,6 +675,7 @@ static void test_Connection(void) IConnectionPointContainer *pointcontainer; LONG state, timeout; BSTR str, str2, str3; + ConnectModeEnum mode; hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection); ok( hr == S_OK, "got %08x\n", hr ); @@ -718,6 +719,22 @@ if (0) /* Crashes on windows */ ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); ok(timeout == 300, "Unexpected timeout value %d\n", timeout); + mode = 0xdeadbeef; + hr = _Connection_get_Mode(connection, &mode); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + ok(mode == adModeUnknown, "Unexpected mode value %d\n", mode); + + hr = _Connection_put_Mode(connection, adModeShareDenyNone); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + + mode = adModeUnknown; + hr = _Connection_get_Mode(connection, &mode); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + ok(mode == adModeShareDenyNone, "Unexpected mode value %d\n", mode); + + hr = _Connection_put_Mode(connection, adModeUnknown); + ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); + /* Default */ str = (BSTR)0xdeadbeef; hr = _Connection_get_Provider(connection, &str);