Author: greatlrd
Date: Sun Mar 11 18:47:49 2007
New Revision: 26064
URL:
http://svn.reactos.org/svn/reactos?rev=26064&view=rev
Log:
fixing smaller bug in NtGdiDdCanCreateSurface
and NtGdiDdGetScanLine
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:47:49 2007
@@ -145,8 +145,8 @@
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));
+ ProbeForRead(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
+ RtlCopyMemory(&desc,puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC));
}
_SEH_HANDLE
{
@@ -165,6 +165,22 @@
CanCreateSurfaceData.lpDD = &pDirectDraw->Global;
CanCreateSurfaceData.lpDDSurfaceDesc = &desc;
ddRVal = pDirectDraw->DD.CanCreateSurface(&CanCreateSurfaceData);
+
+ _SEH_TRY
+ {
+ ProbeForWrite(puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA), 1);
+ puCanCreateSurfaceData->ddRVal = CanCreateSurfaceData.ddRVal;
+
+ /* FIXME can be version 2 of DDSURFACEDESC */
+ ProbeForWrite(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
+ RtlCopyMemory(puCanCreateSurfaceData->lpDDSurfaceDesc,&desc,
sizeof(DDSURFACEDESC));
+
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
}
}
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
@@ -180,28 +196,48 @@
DWORD STDCALL
NtGdiDdGetScanLine( HANDLE hDirectDrawLocal, PDD_GETSCANLINEDATA puGetScanLineData)
{
- DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
- PDD_DIRECTDRAW_GLOBAL lgpl;
-
- PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
-
- DPRINT1("NtGdiDdGetScanLine\n");
-
- if (pDirectDraw != NULL)
- {
-
- if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)
- {
- lgpl = puGetScanLineData->lpDD;
- puGetScanLineData->lpDD = &pDirectDraw->Global;
-
- ddRVal = pDirectDraw->DD.GetScanLine(puGetScanLineData);
-
- puGetScanLineData->lpDD = lgpl;
- }
-
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- }
+ DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
+ DD_GETSCANLINEDATA GetScanLineData;
+ PDD_DIRECTDRAW pDirectDraw;
+ NTSTATUS Status = FALSE;
+
+ DPRINT1("NtGdiDdGetScanLine\n");
+
+ _SEH_TRY
+ {
+ ProbeForRead(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1);
+ RtlCopyMemory(&GetScanLineData,puGetScanLineData,
sizeof(DD_GETSCANLINEDATA));
+ }
+ _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_GETSCANLINE)
+ {
+ GetScanLineData.lpDD = &pDirectDraw->Global;
+ ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData);
+
+ _SEH_TRY
+ {
+ ProbeForWrite(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1);
+ puGetScanLineData->dwScanLine = GetScanLineData.dwScanLine;
+ puGetScanLineData->ddRVal = GetScanLineData.ddRVal;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+ }
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
+ }
return ddRVal;
}