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

msado15: Add ISupportErrorInfo support to _Connection.

parent cf7a432d
...@@ -33,8 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15); ...@@ -33,8 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct connection struct connection
{ {
_Connection Connection_iface; _Connection Connection_iface;
ISupportErrorInfo ISupportErrorInfo_iface;
LONG refs; LONG refs;
ObjectStateEnum state; ObjectStateEnum state;
LONG timeout; LONG timeout;
}; };
...@@ -44,6 +44,11 @@ static inline struct connection *impl_from_Connection( _Connection *iface ) ...@@ -44,6 +44,11 @@ static inline struct connection *impl_from_Connection( _Connection *iface )
return CONTAINING_RECORD( iface, struct connection, Connection_iface ); return CONTAINING_RECORD( iface, struct connection, Connection_iface );
} }
static inline struct connection *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
{
return CONTAINING_RECORD( iface, struct connection, ISupportErrorInfo_iface );
}
static ULONG WINAPI connection_AddRef( _Connection *iface ) static ULONG WINAPI connection_AddRef( _Connection *iface )
{ {
struct connection *connection = impl_from_Connection( iface ); struct connection *connection = impl_from_Connection( iface );
...@@ -64,13 +69,18 @@ static ULONG WINAPI connection_Release( _Connection *iface ) ...@@ -64,13 +69,18 @@ static ULONG WINAPI connection_Release( _Connection *iface )
static HRESULT WINAPI connection_QueryInterface( _Connection *iface, REFIID riid, void **obj ) static HRESULT WINAPI connection_QueryInterface( _Connection *iface, REFIID riid, void **obj )
{ {
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj ); struct connection *connection = impl_from_Connection( iface );
TRACE( "%p, %s, %p\n", connection, debugstr_guid(riid), obj );
if (IsEqualGUID( riid, &IID__Connection ) || IsEqualGUID( riid, &IID_IDispatch ) || if (IsEqualGUID( riid, &IID__Connection ) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown )) IsEqualGUID( riid, &IID_IUnknown ))
{ {
*obj = iface; *obj = iface;
} }
else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
{
*obj = &connection->ISupportErrorInfo_iface;
}
else else
{ {
FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
...@@ -339,12 +349,46 @@ static const struct _ConnectionVtbl connection_vtbl = ...@@ -339,12 +349,46 @@ static const struct _ConnectionVtbl connection_vtbl =
connection_Cancel connection_Cancel
}; };
static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_QueryInterface( &connection->Connection_iface, riid, obj );
}
static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_AddRef( &connection->Connection_iface );
}
static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_Release( &connection->Connection_iface );
}
static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
FIXME( "%p, %s\n", connection, debugstr_guid(riid) );
return S_FALSE;
}
static const struct ISupportErrorInfoVtbl support_error_vtbl =
{
supporterror_QueryInterface,
supporterror_AddRef,
supporterror_Release,
supporterror_InterfaceSupportsErrorInfo
};
HRESULT Connection_create( void **obj ) HRESULT Connection_create( void **obj )
{ {
struct connection *connection; struct connection *connection;
if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY; if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY;
connection->Connection_iface.lpVtbl = &connection_vtbl; connection->Connection_iface.lpVtbl = &connection_vtbl;
connection->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl;
connection->refs = 1; connection->refs = 1;
connection->state = adStateClosed; connection->state = adStateClosed;
connection->timeout = 30; connection->timeout = 30;
......
...@@ -414,8 +414,7 @@ static void test_Connection(void) ...@@ -414,8 +414,7 @@ static void test_Connection(void)
ok(hr == E_NOINTERFACE, "Unexpected IRunnableObject interface\n"); ok(hr == E_NOINTERFACE, "Unexpected IRunnableObject interface\n");
hr = _Connection_QueryInterface(connection, &IID_ISupportErrorInfo, (void**)&errorinfo); hr = _Connection_QueryInterface(connection, &IID_ISupportErrorInfo, (void**)&errorinfo);
todo_wine ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n"); ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
if (hr == S_OK)
ISupportErrorInfo_Release(errorinfo); ISupportErrorInfo_Release(errorinfo);
if (0) /* Crashes on windows */ if (0) /* Crashes on windows */
......
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