[PATCH 3/5] ddraw: Verify that the surface is a render target in d3d_device_create().

Henri Verbeet hverbeet at codeweavers.com
Tue Sep 17 02:22:38 CDT 2013


---
 dlls/ddraw/device.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 66e0b7f..7510ed8 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -6745,6 +6745,13 @@ HRESULT d3d_device_create(struct ddraw *ddraw, struct ddraw_surface *target, IUn
     TRACE("ddraw %p, target %p, version %u, device %p, outer_unknown %p.\n",
             ddraw, target, version, device, outer_unknown);
 
+    if (!(target->surface_desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
+            || (target->surface_desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER))
+    {
+        WARN("Surface %p is not a render target.\n", target);
+        return DDERR_INVALIDCAPS;
+    }
+
     if (ddraw->flags & DDRAW_NO3D)
     {
         ERR_(winediag)("The application wants to create a Direct3D device, "
-- 
1.7.10.4




More information about the wine-patches mailing list