[PATCH 1/2] msado15: Implement Connection.get_state
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Tue Dec 10 04:30:53 CST 2019
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
dlls/msado15/connection.c | 9 +++++++--
dlls/msado15/tests/msado15.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index f33bc89a1a..dbf0b03149 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -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 );
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 1755a7f3da..f2c9789576 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -191,9 +191,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);
+}
+
+ 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();
}
--
2.24.0
More information about the wine-devel
mailing list