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

msado15: Implement _Command get/putref ActiveConnection.

parent 4a987b30
......@@ -35,6 +35,7 @@ struct command
LONG ref;
CommandTypeEnum type;
BSTR text;
_Connection *connection;
};
static inline struct command *impl_from_Command( _Command *iface )
......@@ -80,6 +81,7 @@ static ULONG WINAPI command_Release( _Command *iface )
if (!ref)
{
TRACE( "destroying %p\n", command );
if (command->connection) _Connection_Release(command->connection);
heap_free( command->text );
heap_free( command );
}
......@@ -121,14 +123,23 @@ static HRESULT WINAPI command_get_Properties( _Command *iface, Properties **prop
static HRESULT WINAPI command_get_ActiveConnection( _Command *iface, _Connection **connection )
{
FIXME( "%p, %p\n", iface, connection );
return E_NOTIMPL;
struct command *command = impl_from_Command( iface );
TRACE( "%p, %p\n", iface, connection );
*connection = command->connection;
if (command->connection) _Connection_AddRef(command->connection);
return S_OK;
}
static HRESULT WINAPI command_putref_ActiveConnection( _Command *iface, _Connection *connection )
{
FIXME( "%p, %p\n", iface, connection );
return E_NOTIMPL;
struct command *command = impl_from_Command( iface );
TRACE( "%p, %p\n", iface, connection );
if (command->connection) _Connection_Release(command->connection);
command->connection = connection;
if (command->connection) _Connection_AddRef(command->connection);
return S_OK;
}
static HRESULT WINAPI command_put_ActiveConnection( _Command *iface, VARIANT connection )
......@@ -343,6 +354,7 @@ HRESULT Command_create( void **obj )
command->Command_iface.lpVtbl = &command_vtbl;
command->type = adCmdUnknown;
command->text = NULL;
command->connection = NULL;
command->ref = 1;
*obj = &command->Command_iface;
......
......@@ -850,6 +850,7 @@ static void test_Command(void)
Command25 *command25;
CommandTypeEnum cmd_type = adCmdUnspecified;
BSTR cmd_text = (BSTR)"test";
_Connection *connection;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -903,6 +904,14 @@ static void test_Command(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !wcscmp( L"test", cmd_text ), "got %p\n", wine_dbgstr_w( cmd_text ) );
connection = (_Connection*)0xdeadbeef;
hr = _Command_get_ActiveConnection( command, &connection );
ok( hr == S_OK, "got %08x\n", hr );
ok( connection == NULL, "got %p\n", connection );
hr = _Command_putref_ActiveConnection( command, NULL );
ok( hr == S_OK, "got %08x\n", hr );
_Command_Release( command );
}
......
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