Alistair Leslie-Hughes : msado15: Implement _Connection_get_State.
Alexandre Julliard
julliard at winehq.org
Wed Dec 11 16:35:01 CST 2019
Module: wine
Branch: master
Commit: 131cfe0b65f7149c79915fb0f74b1e4d6fafa438
URL: https://source.winehq.org/git/wine.git/?a=commit;h=131cfe0b65f7149c79915fb0f74b1e4d6fafa438
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Wed Dec 11 17:16:52 2019 +0100
msado15: Implement _Connection_get_State.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 43497636a8..c9799862bf 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 079da0a103..8249a398ba 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -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();
}
More information about the wine-cvs
mailing list