From 393d729ca156976c8aad1de85de58eb16d3f646f Mon Sep 17 00:00:00 2001
From: Magnus Olsen <magnus@greatlord.com>
Date: Sun, 13 May 2007 12:43:51 +0000
Subject: [PATCH] fixing two return code thx Ventron for the info for one of
 the return code

svn path=/trunk/; revision=26752
---
 .../dll/directx/ddraw/Surface/createsurface.c | 26 +++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/reactos/dll/directx/ddraw/Surface/createsurface.c b/reactos/dll/directx/ddraw/Surface/createsurface.c
index 33a76551731..d883d44c0ae 100644
--- a/reactos/dll/directx/ddraw/Surface/createsurface.c
+++ b/reactos/dll/directx/ddraw/Surface/createsurface.c
@@ -28,8 +28,30 @@ Internal_CreateSurface( LPDDRAWI_DIRECTDRAW_INT pDDraw, LPDDSURFACEDESC2 pDDSD,
     if ( (pDDSD->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) && 
          (pDDSD->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
     {
-        /* translate the error code I got back to a name */
-        return 0x88760064;
+        return DDERR_INVALIDCAPS;
+    }
+
+    /* check if pDDSD.dwFlags DDSD_LPSURFACE is set or not */
+    if (pDDSD->dwFlags & DDSD_LPSURFACE)
+    {
+        /*
+         *  DDSD_LPSURFACE flag is set now we start vaildate see if
+         *  pDDSD->lpSurface are a pointer or not 
+         */
+        if (IsBadReadPtr(pDDSD->lpSurface,sizeof(LPVOID)))
+        {
+            return DDERR_INVALIDPARAMS;
+        }
+
+        /* more code will follow */
+    }
+    else
+    {
+        /*
+         *  DDSD_LPSURFACE flag is not set we do not handler this case yet
+         */
+
+        /* more code will follow */
     }
 
     return DDERR_GENERIC;