msado15: Implement _Command get/putref ActiveConnection.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2020-10-09 18:57:15 +11:00 committed by Alexandre Julliard
parent 4a987b30e7
commit aff5938965
2 changed files with 25 additions and 4 deletions

View file

@ -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;

View file

@ -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 );
}