Commit f3508490 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

msado15: Implement _Connection get/put Mode.

parent 2262e048
...@@ -54,6 +54,7 @@ struct connection ...@@ -54,6 +54,7 @@ struct connection
LONG timeout; LONG timeout;
WCHAR *datasource; WCHAR *datasource;
WCHAR *provider; WCHAR *provider;
ConnectModeEnum mode;
struct connection_point cp_connev; struct connection_point cp_connev;
}; };
...@@ -336,14 +337,22 @@ static HRESULT WINAPI connection_put_CursorLocation( _Connection *iface, CursorL ...@@ -336,14 +337,22 @@ static HRESULT WINAPI connection_put_CursorLocation( _Connection *iface, CursorL
static HRESULT WINAPI connection_get_Mode( _Connection *iface, ConnectModeEnum *mode ) static HRESULT WINAPI connection_get_Mode( _Connection *iface, ConnectModeEnum *mode )
{ {
FIXME( "%p, %p\n", iface, mode ); struct connection *connection = impl_from_Connection( iface );
return E_NOTIMPL;
TRACE( "%p, %p\n", iface, mode );
*mode = connection->mode;
return S_OK;
} }
static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum mode ) static HRESULT WINAPI connection_put_Mode( _Connection *iface, ConnectModeEnum mode )
{ {
FIXME( "%p, %u\n", iface, mode ); struct connection *connection = impl_from_Connection( iface );
return E_NOTIMPL;
TRACE( "%p, %u\n", iface, mode );
connection->mode = mode;
return S_OK;
} }
static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str ) static HRESULT WINAPI connection_get_Provider( _Connection *iface, BSTR *str )
...@@ -664,6 +673,7 @@ HRESULT Connection_create( void **obj ) ...@@ -664,6 +673,7 @@ HRESULT Connection_create( void **obj )
connection->timeout = 30; connection->timeout = 30;
connection->datasource = NULL; connection->datasource = NULL;
connection->provider = SysAllocString(L"MSDASQL"); connection->provider = SysAllocString(L"MSDASQL");
connection->mode = adModeUnknown;
connection->cp_connev.conn = connection; connection->cp_connev.conn = connection;
connection->cp_connev.riid = &DIID_ConnectionEvents; connection->cp_connev.riid = &DIID_ConnectionEvents;
......
...@@ -675,6 +675,7 @@ static void test_Connection(void) ...@@ -675,6 +675,7 @@ static void test_Connection(void)
IConnectionPointContainer *pointcontainer; IConnectionPointContainer *pointcontainer;
LONG state, timeout; LONG state, timeout;
BSTR str, str2, str3; BSTR str, str2, str3;
ConnectModeEnum mode;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection); hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection);
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -718,6 +719,22 @@ if (0) /* Crashes on windows */ ...@@ -718,6 +719,22 @@ if (0) /* Crashes on windows */
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr); ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(timeout == 300, "Unexpected timeout value %d\n", timeout); 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 */ /* Default */
str = (BSTR)0xdeadbeef; str = (BSTR)0xdeadbeef;
hr = _Connection_get_Provider(connection, &str); hr = _Connection_get_Provider(connection, &str);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment