コード例 #1
0
ファイル: material.c プロジェクト: Barrell/wine
/*****************************************************************************
 * IDirect3DMaterial3::QueryInterface
 *
 * QueryInterface for IDirect3DMaterial. Can query all IDirect3DMaterial
 * versions.
 *
 * Params:
 *  riid: Interface id queried for
 *  obj: Address to pass the interface pointer back
 *
 * Returns:
 *  S_OK on success
 *  E_NOINTERFACE if the requested interface wasn't found
 *
 *****************************************************************************/
static HRESULT WINAPI d3d_material3_QueryInterface(IDirect3DMaterial3 *iface, REFIID riid, void **obp)
{
    struct d3d_material *material = impl_from_IDirect3DMaterial3(iface);

    TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obp);

    *obp = NULL;

    if (IsEqualGUID(&IID_IUnknown, riid))
    {
        IDirect3DMaterial3_AddRef(iface);
        *obp = iface;
        TRACE("  Creating IUnknown interface at %p.\n", *obp);
        return S_OK;
    }
    if (IsEqualGUID(&IID_IDirect3DMaterial, riid))
    {
        IDirect3DMaterial_AddRef(&material->IDirect3DMaterial_iface);
        *obp = &material->IDirect3DMaterial_iface;
        TRACE("  Creating IDirect3DMaterial interface %p\n", *obp);
        return S_OK;
    }
    if (IsEqualGUID(&IID_IDirect3DMaterial2, riid))
    {
        IDirect3DMaterial2_AddRef(&material->IDirect3DMaterial2_iface);
        *obp = &material->IDirect3DMaterial2_iface;
        TRACE("  Creating IDirect3DMaterial2 interface %p\n", *obp);
        return S_OK;
    }
    if (IsEqualGUID(&IID_IDirect3DMaterial3, riid))
    {
        IDirect3DMaterial3_AddRef(&material->IDirect3DMaterial3_iface);
        *obp = &material->IDirect3DMaterial3_iface;
        TRACE("  Creating IDirect3DMaterial3 interface %p\n", *obp);
        return S_OK;
    }

    WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));

    return E_NOINTERFACE;
}