[PATCH 1/6] ddraw: Add validation to SetPriority / GetPriority.

Henri Verbeet hverbeet at gmail.com
Tue Jul 15 10:24:18 CDT 2014


On 15 July 2014 16:47, Stefan Dösinger <stefan at codeweavers.com> wrote:
> -static HRESULT WINAPI ddraw_surface7_SetPriority(IDirectDrawSurface7 *iface, DWORD Priority)
> +static HRESULT WINAPI ddraw_surface7_SetPriority(IDirectDrawSurface7 *iface, DWORD priority)
>  {
>      struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
> +    DWORD managed = DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE;
>      HRESULT hr;
>
> -    TRACE("iface %p, priority %u.\n", iface, Priority);
> +    TRACE("iface %p, priority %u.\n", iface, priority);
>
>      wined3d_mutex_lock();
> -    hr = wined3d_surface_set_priority(surface->wined3d_surface, Priority);
> +    /* No need to check for offscreen plain surfaces or mipmap sublevels. SetPriority
> +     * calls on such surfaces segfault on Windows. */
> +    if (!(surface->surface_desc.ddsCaps.dwCaps2 & managed))
> +    {
> +        WARN("Called on non-managed texture returning DDERR_INVALIDPARAMS.\n");
> +        hr = DDERR_INVALIDPARAMS;
> +    }
> +    else
> +        hr = wined3d_surface_set_priority(surface->wined3d_surface, priority);
>      wined3d_mutex_unlock();
>
>      return hr;
>  }
The existing code already had this of course, but note that
wined3d_surface_set_priority() returns the previous priority.



More information about the wine-devel mailing list