mscoree: Add support for ICLRMetaHostPolicy interface

Dmitry Timoshkov dmitry at baikal.ru
Sat Oct 12 23:19:35 CDT 2013


Alistair Leslie-Hughes <leslie_alistair at hotmail.com> wrote:

> +static HRESULT WINAPI metahostpolicy_QueryInterface(ICLRMetaHostPolicy *iface, REFIID riid, void **ppvObject)
> +{
> +    TRACE("%s %p\n", debugstr_guid(riid), ppvObject);
> +
> +    if ( IsEqualGUID( riid, &IID_ICLRMetaHostPolicy ) ||
> +         IsEqualGUID( riid, &IID_IUnknown ) )
> +    {
> +        *ppvObject = iface;
> +    }
> +    else
> +    {
> +        FIXME("Unsupported interface %s\n", debugstr_guid(riid));
> +        return E_NOINTERFACE;
> +    }
> +
> +    ICLRMetaHostPolicy_AddRef( iface );
> +
> +    return S_OK;
> +}

I think that a common COM convention is to set the object pointer to NULL
in case of an unsupported interface.

Also you're doing pretty good job in avoiding hungarian notation except for
ppvObject.

Another nitpick is the choice for if/else construct (although I understand
that other places also use this sub-optimal one). A more elegant way of
implementing QueryInterface would be IMHO:

static HRESULT WINAPI xxx_QueryInterface(IFace *iface, REFIID riid, void **object)
{
    if (IsEqualGUID(riid, &IID_IUnknown) ||
        IsEqualGUID(riid, &IID_IAnotherSupported)
    {
        xxx_AddRef(iface);
        *object = iface;
        return S_OK;
    }

    *object = NULL;
    return E_NOINTERFACE;
}

-- 
Dmitry.



More information about the wine-devel mailing list