Module: wine Branch: master Commit: 8a9fdb567ed5a2a76cef0e7ba47d3e9bfa04f9e5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a9fdb567ed5a2a76cef0e7ba4...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Dec 2 12:07:36 2013 +0100
ddraw: Get rid of the DDSCAPS_BACKBUFFER validation in ddraw_surface_create().
All callers except ddraw1_CreateSurface() already have a stricter check themselves.
---
dlls/ddraw/ddraw.c | 8 ++++++++ dlls/ddraw/surface.c | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index d2d762d..7fca84c 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2924,6 +2924,14 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, /* Remove front buffer flag, this causes failure in v7, and its added to normal * primaries anyway. */ surface_desc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; + if ((surface_desc->ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER)) + == (DDSCAPS_PRIMARYSURFACE | DDSCAPS_BACKBUFFER)) + { + WARN("Application tried to create an explicit front or back buffer.\n"); + wined3d_mutex_unlock(); + return DDERR_INVALIDCAPS; + } + DDSD_to_DDSD2(surface_desc, &surface_desc2); hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 1); wined3d_mutex_unlock(); diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 29385b7..37fd096 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5640,14 +5640,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ return DDERR_NOEXCLUSIVEMODE; }
- if ((desc->ddsCaps.dwCaps & (DDSCAPS_BACKBUFFER | DDSCAPS_PRIMARYSURFACE)) - == (DDSCAPS_BACKBUFFER | DDSCAPS_PRIMARYSURFACE)) - { - WARN("Tried to create a back buffer surface.\n"); - HeapFree(GetProcessHeap(), 0, texture); - return DDERR_INVALIDCAPS; - } - /* This is a special case in ddrawex, but not allowed in ddraw. */ if ((desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY)) == (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))