[1/4] msxml3: Added common ISupportErrorInfo implementation

Nikolay Sivov nsivov at codeweavers.com
Mon Nov 21 08:16:54 CST 2011


On 11/21/2011 16:09, Jacek Caban wrote:
> Hi Nikolay,
>
> On 11/21/11 08:24, Nikolay Sivov wrote:
>>   Added common ISupportErrorInfo implementation
>
> +/* common ISupportErrorInfo implementation */
> +typedef struct {
> +   ISupportErrorInfo ISupportErrorInfo_iface;
> +   LONG ref;
> +
> +   const tid_t* iids;
> +} SupportErrorInfo;
> +
> +static inline SupportErrorInfo 
> *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
> +{
> +    return CONTAINING_RECORD(iface, SupportErrorInfo, 
> ISupportErrorInfo_iface);
> +}
> +
> +static HRESULT WINAPI 
> SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, 
> void **obj)
> +{
> +    SupportErrorInfo *This = impl_from_ISupportErrorInfo(iface);
> +    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
> +
> +    *obj = NULL;
> +
> +    if (IsEqualGUID(riid,&IID_IUnknown) || 
> IsEqualGUID(riid,&IID_ISupportErrorInfo)) {
> +        *obj = iface;
> +        ISupportErrorInfo_AddRef(iface);
> +        return S_OK;
> +    }
> +
> +    return E_NOINTERFACE;
> +}
>
>
>
> This doesn't seem to be the right approach. You need to return here 
> interfaces of an object that inherits your ISupportErrorInfo 
> implementation - that's the COM rule.
I know but that's not how native works. ISupportErrorInfo reference 
counting is completely separated from object your queried it from.
> Also you probably don't want to create new SupportErrorInfo instance 
> on each QI call.
I do. Tests shows that two consecutive QI calls return different pointers.

> I'd suggest DispatchEx-like approach in this case (or even abuse 
> DispatchEx object and add ISupportErrorInfo there).
>
> Jacek
>
>




More information about the wine-devel mailing list