Author: greatlrd
Date: Sun Mar 11 18:18:12 2007
New Revision: 26063
URL:
http://svn.reactos.org/svn/reactos?rev=26063&view=rev
Log:
fixing smaller bug in NtGdiDdCanCreateSurface
Modified:
trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c Sun Mar 11 18:18:12 2007
@@ -131,28 +131,44 @@
PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
)
{
- DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
- PDD_DIRECTDRAW_GLOBAL lgpl;
-
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
-
- DPRINT1("NtGdiDdCanCreateSurface\n");
-
- if (pDirectDraw != NULL)
- {
-
- if (pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
- {
- lgpl = puCanCreateSurfaceData->lpDD;
- puCanCreateSurfaceData->lpDD = &pDirectDraw->Global;
-
- ddRVal = pDirectDraw->DD.CanCreateSurface(puCanCreateSurfaceData);
-
- puCanCreateSurfaceData->lpDD = lgpl;
- }
-
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- }
+ DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
+ DD_CANCREATESURFACEDATA CanCreateSurfaceData;
+ DDSURFACEDESC desc;
+ NTSTATUS Status = FALSE;
+ PDD_DIRECTDRAW pDirectDraw = NULL;
+
+ DPRINT1("NtGdiDdCanCreateSurface\n");
+
+ _SEH_TRY
+ {
+ ProbeForRead(puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA), 1);
+ RtlCopyMemory(&CanCreateSurfaceData,puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA));
+
+ /* FIXME can be version 2 of DDSURFACEDESC */
+ ProbeForRead(&CanCreateSurfaceData.lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
+ RtlCopyMemory(&desc,&CanCreateSurfaceData.lpDDSurfaceDesc,
sizeof(DD_CANCREATESURFACEDATA));
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if(NT_SUCCESS(Status))
+ {
+ pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
+ if (pDirectDraw != NULL)
+ {
+ if (pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
+ {
+ CanCreateSurfaceData.ddRVal = DDERR_GENERIC;
+ CanCreateSurfaceData.lpDD = &pDirectDraw->Global;
+ CanCreateSurfaceData.lpDDSurfaceDesc = &desc;
+ ddRVal = pDirectDraw->DD.CanCreateSurface(&CanCreateSurfaceData);
+ }
+ }
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
+ }
return ddRVal;
}