[PATCH v3 2/2] msado15: Implement _Connection get/put ConnectionString

Hans Leidekker hans at codeweavers.com
Mon Jan 27 03:49:21 CST 2020


On Sat, 2020-01-25 at 07:19 +0000, Alistair Leslie-Hughes wrote:
> diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
> index 73b225628c..e74fcd6c02 100644
> --- a/dlls/msado15/connection.c
> +++ b/dlls/msado15/connection.c
> @@ -37,6 +37,7 @@ struct connection
>      LONG              refs;
>      ObjectStateEnum   state;
>      LONG              timeout;
> +    BSTR              datasource;
>  };

Please store strings as WCHAR. You need to initialize this field in Connection_create.
 
> @@ -125,14 +127,18 @@ static HRESULT WINAPI connection_get_Properties( _Connection *iface, Properties
>  
>  static HRESULT WINAPI connection_get_ConnectionString( _Connection *iface, BSTR *str )
>  {
> -    FIXME( "%p, %p\n", iface, str );
> -    return E_NOTIMPL;
> +    struct connection *connection = impl_from_Connection( iface );
> +    TRACE( "%p, %p\n", connection, str );
> +    *str = SysAllocString(connection->datasource);
> +    return S_OK;
>  }

A check for allocation failure would be nice.
 
>  static HRESULT WINAPI connection_put_ConnectionString( _Connection *iface, BSTR str )
>  {
> -    FIXME( "%p, %s\n", iface, debugstr_w(str) );
> -    return E_NOTIMPL;
> +    struct connection *connection = impl_from_Connection( iface );
> +    TRACE( "%p, %s\n", connection, debugstr_w(str) );
> +    connection->datasource = SysAllocString(str);
> +    return S_OK;
>  }

You need to free any previously allocated string, and please check for allocation failure.





More information about the wine-devel mailing list