1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

msado15: Implement _Command::get_Parameters.

This commit is contained in:
Alistair Leslie-Hughes 2024-06-28 20:57:30 +10:00 committed by Alexandre Julliard
parent 5fbe49f5ae
commit 090f2c6007
4 changed files with 178 additions and 2 deletions

View File

@ -33,6 +33,7 @@ struct command
{
_Command Command_iface;
ADOCommandConstruction ADOCommandConstruction_iface;
Parameters Parameters_iface;
LONG ref;
CommandTypeEnum type;
BSTR text;
@ -49,6 +50,156 @@ static inline struct command *impl_from_ADOCommandConstruction( ADOCommandConstr
return CONTAINING_RECORD( iface, struct command, ADOCommandConstruction_iface );
}
static inline struct command *impl_from_Parameters( Parameters *iface )
{
return CONTAINING_RECORD( iface, struct command, Parameters_iface );
}
static HRESULT WINAPI parameters_QueryInterface(Parameters *iface, REFIID riid, void **obj)
{
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
*obj = NULL;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDispatch) ||
IsEqualIID(riid, &IID__Collection) ||
IsEqualIID(riid, &IID__DynaCollection) ||
IsEqualIID(riid, &IID_Parameters))
{
*obj = iface;
}
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
return E_NOINTERFACE;
}
Parameters_AddRef( iface );
return S_OK;
}
static ULONG WINAPI parameters_AddRef(Parameters *iface)
{
struct command *command = impl_from_Parameters( iface );
return _Command_AddRef(&command->Command_iface);
}
static ULONG WINAPI parameters_Release(Parameters *iface)
{
struct command *command = impl_from_Parameters( iface );
return _Command_Release(&command->Command_iface);
}
static HRESULT WINAPI parameters_GetTypeInfoCount(Parameters *iface, UINT *count)
{
struct command *command = impl_from_Parameters( iface );
TRACE( "%p, %p\n", command, count );
*count = 1;
return S_OK;
}
static HRESULT WINAPI parameters_GetTypeInfo(Parameters *iface, UINT index, LCID lcid, ITypeInfo **info)
{
struct command *command = impl_from_Parameters( iface );
TRACE( "%p, %u, %lu, %p\n", command, index, lcid, info );
return get_typeinfo(Parameters_tid, info);
}
static HRESULT WINAPI parameters_GetIDsOfNames(Parameters *iface, REFIID riid, LPOLESTR *names, UINT count,
LCID lcid, DISPID *dispid)
{
struct command *command = impl_from_Parameters( iface );
HRESULT hr;
ITypeInfo *typeinfo;
TRACE( "%p, %s, %p, %u, %lu, %p\n", command, debugstr_guid(riid), names, count, lcid, dispid );
hr = get_typeinfo(Parameters_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, dispid);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI parameters_Invoke(Parameters *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep_info, UINT *arg_err)
{
struct command *command = impl_from_Parameters( iface );
HRESULT hr;
ITypeInfo *typeinfo;
TRACE( "%p, %ld, %s, %ld, %d, %p, %p, %p, %p\n", command, member, debugstr_guid(riid), lcid, flags, params,
result, excep_info, arg_err );
hr = get_typeinfo(Parameters_tid, &typeinfo);
if(SUCCEEDED(hr))
{
hr = ITypeInfo_Invoke(typeinfo, &command->Parameters_iface, member, flags, params,
result, excep_info, arg_err);
ITypeInfo_Release(typeinfo);
}
return hr;
}
static HRESULT WINAPI parameters_get_Count(Parameters *iface, LONG *count)
{
FIXME( "%p, %p\n", iface, count);
*count = 0;
return S_OK;
}
static HRESULT WINAPI parameters__NewEnum(Parameters *iface, IUnknown **object)
{
FIXME( "%p, %p\n", iface, object);
return E_NOTIMPL;
}
static HRESULT WINAPI parameters_Refresh(Parameters *iface)
{
FIXME( "%p\n", iface);
return E_NOTIMPL;
}
static HRESULT WINAPI parameters_Append(Parameters *iface, IDispatch *object)
{
FIXME( "%p, %p\n", iface, object);
return E_NOTIMPL;
}
static HRESULT WINAPI parameters_Delete(Parameters *iface, VARIANT index)
{
FIXME( "%p, %s\n", iface, debugstr_variant(&index));
return E_NOTIMPL;
}
static HRESULT WINAPI parameters_get_Item(Parameters *iface, VARIANT index, _Parameter **object)
{
FIXME( "%p, %s, %p\n", iface, debugstr_variant(&index), object);
return E_NOTIMPL;
}
static const struct ParametersVtbl parameters_vtbl =
{
parameters_QueryInterface,
parameters_AddRef,
parameters_Release,
parameters_GetTypeInfoCount,
parameters_GetTypeInfo,
parameters_GetIDsOfNames,
parameters_Invoke,
parameters_get_Count,
parameters__NewEnum,
parameters_Refresh,
parameters_Append,
parameters_Delete,
parameters_get_Item
};
static HRESULT WINAPI command_QueryInterface( _Command *iface, REFIID riid, void **obj )
{
struct command *command = impl_from_Command( iface );
@ -253,8 +404,17 @@ static HRESULT WINAPI command_CreateParameter( _Command *iface, BSTR name, DataT
static HRESULT WINAPI command_get_Parameters( _Command *iface, Parameters **parameters )
{
FIXME( "%p, %p\n", iface, parameters );
return E_NOTIMPL;
struct command *command = impl_from_Command( iface );
TRACE( "%p, %p\n", iface, parameters );
if (!parameters)
return E_INVALIDARG;
*parameters = &command->Parameters_iface;
Parameters_AddRef(*parameters);
return S_OK;
}
static HRESULT WINAPI command_put_CommandType( _Command *iface, CommandTypeEnum type )
@ -446,6 +606,7 @@ HRESULT Command_create( void **obj )
if (!(command = malloc( sizeof(*command) ))) return E_OUTOFMEMORY;
command->Command_iface.lpVtbl = &command_vtbl;
command->ADOCommandConstruction_iface.lpVtbl = &construct_vtbl;
command->Parameters_iface.lpVtbl = &parameters_vtbl;
command->type = adCmdUnknown;
command->text = NULL;
command->connection = NULL;

View File

@ -145,6 +145,7 @@ static REFIID tid_ids[] = {
&IID__Connection,
&IID_Field,
&IID_Fields,
&IID_Parameters,
&IID_Properties,
&IID_Property,
&IID__Recordset,

View File

@ -32,6 +32,7 @@ typedef enum tid_t {
Connection_tid,
Field_tid,
Fields_tid,
Parameters_tid,
Properties_tid,
Property_tid,
Recordset_tid,

View File

@ -1332,6 +1332,7 @@ static void test_Command(void)
BSTR cmd_text = (BSTR)"test";
_Connection *connection;
ADOCommandConstruction *adocommand;
Parameters *parameters, *parameters2;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command );
ok( hr == S_OK, "got %08lx\n", hr );
@ -1352,6 +1353,9 @@ static void test_Command(void)
ok( hr == S_OK, "got %08lx\n", hr );
ADOCommandConstruction_Release( adocommand );
hr = _Command_QueryInterface( command, &IID_Parameters, (void **)&parameters );
ok( hr == E_NOINTERFACE, "got %08lx\n", hr );
hr = _Command_get_CommandType( command, &cmd_type );
ok( hr == S_OK, "got %08lx\n", hr );
ok( cmd_type == adCmdUnknown, "got %08x\n", cmd_type );
@ -1397,6 +1401,15 @@ static void test_Command(void)
hr = _Command_putref_ActiveConnection( command, NULL );
ok( hr == S_OK, "got %08lx\n", hr );
hr = _Command_get_Parameters( command, &parameters );
ok( hr == S_OK, "got %08lx\n", hr );
hr = _Command_get_Parameters( command, &parameters2 );
ok( hr == S_OK, "got %08lx\n", hr );
ok( parameters == parameters2, "got %08lx\n", hr );
Parameters_Release(parameters);
Parameters_Release(parameters2);
_Command_Release( command );
}