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

msado15: Implement _Connection_get_State.

parent 7f498f46
......@@ -34,6 +34,8 @@ struct connection
{
_Connection Connection_iface;
LONG refs;
ObjectStateEnum state;
};
static inline struct connection *impl_from_Connection( _Connection *iface )
......@@ -271,8 +273,10 @@ static HRESULT WINAPI connection_put_Provider( _Connection *iface, BSTR str )
static HRESULT WINAPI connection_get_State( _Connection *iface, LONG *state )
{
FIXME( "%p, %p\n", iface, state );
return E_NOTIMPL;
struct connection *connection = impl_from_Connection( iface );
TRACE( "%p, %p\n", connection, state );
*state = connection->state;
return S_OK;
}
static HRESULT WINAPI connection_OpenSchema( _Connection *iface, SchemaEnum schema, VARIANT restrictions,
......@@ -337,6 +341,7 @@ HRESULT Connection_create( void **obj )
if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY;
connection->Connection_iface.lpVtbl = &connection_vtbl;
connection->refs = 1;
connection->state = adStateClosed;
*obj = &connection->Connection_iface;
TRACE( "returning iface %p\n", *obj );
......
......@@ -280,9 +280,43 @@ static void test_Stream(void)
ok( !refs, "got %d\n", refs );
}
static void test_Connection(void)
{
HRESULT hr;
_Connection *connection;
IRunnableObject *runtime;
ISupportErrorInfo *errorinfo;
LONG state;
hr = CoCreateInstance(&CLSID_Connection, NULL, CLSCTX_INPROC_SERVER, &IID__Connection, (void**)&connection);
ok( hr == S_OK, "got %08x\n", hr );
hr = _Connection_QueryInterface(connection, &IID_IRunnableObject, (void**)&runtime);
ok(hr == E_NOINTERFACE, "Unexpected IRunnableObject interface\n");
hr = _Connection_QueryInterface(connection, &IID_ISupportErrorInfo, (void**)&errorinfo);
todo_wine ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
if (hr == S_OK)
ISupportErrorInfo_Release(errorinfo);
if (0) /* Crashes on windows */
{
hr = _Connection_get_State(connection, NULL);
ok(hr == E_INVALIDARG, "Unexpected hr 0x%08x\n", hr);
}
state = -1;
hr = _Connection_get_State(connection, &state);
ok(hr == S_OK, "Failed to get state, hr 0x%08x\n", hr);
ok(state == adStateClosed, "Unexpected state value 0x%08x\n", state);
_Connection_Release(connection);
}
START_TEST(msado15)
{
CoInitialize( NULL );
test_Stream();
test_Connection();
CoUninitialize();
}
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