msado15: Implement _Connection get/put Mode.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2020-10-08 14:00:36 +02:00 committed by Alexandre Julliard
parent 2262e04827
commit f350849039
2 changed files with 31 additions and 4 deletions

View File

@ -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;

View File

@ -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);