[ros-diffs] [greatlrd] 21574: Bugfix : hal lock surface so it does not crash any longer

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Thu Apr 13 08:38:52 CEST 2006


Author: greatlrd
Date: Thu Apr 13 10:38:52 2006
New Revision: 21574

URL: http://svn.reactos.ru/svn/reactos?rev=21574&view=rev
Log:
Bugfix : hal lock surface so it does not crash any longer

Modified:
    trunk/reactos/dll/directx/ddraw/hal/surface_hal.c

Modified: trunk/reactos/dll/directx/ddraw/hal/surface_hal.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/hal/surface_hal.c?rev=21574&r1=21573&r2=21574&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/hal/surface_hal.c (original)
+++ trunk/reactos/dll/directx/ddraw/hal/surface_hal.c Thu Apr 13 10:38:52 2006
@@ -130,13 +130,26 @@
       OutputDebugStringA("Here ddRVal lock");
       return Lock.ddRVal;
    }
-
+   
    // FIXME ??? is this right ?? 
-   RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
-   memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
-   pDDSD->dwSize = sizeof(DDSURFACEDESC2);
-       
-   pDDSD->lpSurface = (LPVOID)  Lock.lpSurfData;
+   if (pDDSD != NULL)
+   {
+        if (pDDSD->dwSize == sizeof(DDSURFACEDESC2))
+        {
+            RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC2));
+            // FIXME the interanl mddsdPrimary shall be DDSURFACEDESC2
+            memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
+            pDDSD->dwSize = sizeof(DDSURFACEDESC2);
+        }
+        if (pDDSD->dwSize == sizeof(DDSURFACEDESC))
+        {
+            RtlZeroMemory(pDDSD,sizeof(DDSURFACEDESC));
+            memcpy(pDDSD,&This->Surf->mddsdPrimary,sizeof(DDSURFACEDESC));
+            pDDSD->dwSize = sizeof(DDSURFACEDESC);
+        }
+
+        pDDSD->lpSurface = (LPVOID)  Lock.lpSurfData;
+   }
       
    return DD_OK;   
 }




More information about the Ros-diffs mailing list