Author: greatlrd
Date: Sun Mar 11 19:28:22 2007
New Revision: 26065
URL:
http://svn.reactos.org/svn/reactos?rev=26065&view=rev
Log:
NtGdiDdWaitForVerticalBlank
copy user mode pointer to kmode memory
and copy back some data to user mode pointer
using seh
NtGdiDdCanCreateSurface, NtGdiDdGetScanLine
fixing a stupied bug do not crash if look
fail of hDD handler. but this should never
happen. either way
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 19:28:22 2007
@@ -92,32 +92,54 @@
DWORD STDCALL NtGdiDdWaitForVerticalBlank(
HANDLE hDirectDrawLocal,
- PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData
-)
-{
- DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
- PDD_DIRECTDRAW_GLOBAL lgpl;
- PDD_DIRECTDRAW pDirectDraw;
-
- DPRINT1("NtGdiDdWaitForVerticalBlank\n");
-
- pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
-
- if (pDirectDraw != NULL)
- {
- if (pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)
- {
- lgpl = puWaitForVerticalBlankData->lpDD;
- puWaitForVerticalBlankData->lpDD = &pDirectDraw->Global;
-
- ddRVal = pDirectDraw->DD.WaitForVerticalBlank(puWaitForVerticalBlankData);
-
- puWaitForVerticalBlankData->lpDD = lgpl;
- }
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- }
-
- return ddRVal;
+ PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData)
+{
+ DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
+ PDD_DIRECTDRAW pDirectDraw = NULL;
+ NTSTATUS Status = FALSE;
+ DD_WAITFORVERTICALBLANKDATA WaitForVerticalBlankData;
+
+ DPRINT1("NtGdiDdWaitForVerticalBlank\n");
+
+ _SEH_TRY
+ {
+ ProbeForRead(puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA),
1);
+ RtlCopyMemory(&WaitForVerticalBlankData,puWaitForVerticalBlankData,
sizeof(DD_WAITFORVERTICALBLANKDATA));
+ }
+ _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_WAITFORVERTICALBLANK)
+ {
+ WaitForVerticalBlankData.ddRVal = DDERR_GENERIC;
+ WaitForVerticalBlankData.lpDD = &pDirectDraw->Global;;
+ ddRVal =
pDirectDraw->DD.WaitForVerticalBlank(&WaitForVerticalBlankData);
+ }
+ _SEH_TRY
+ {
+ ProbeForWrite(puWaitForVerticalBlankData,
sizeof(DD_WAITFORVERTICALBLANKDATA), 1);
+ puWaitForVerticalBlankData->ddRVal =
WaitForVerticalBlankData.ddRVal;
+ puWaitForVerticalBlankData->bIsInVB =
WaitForVerticalBlankData.bIsInVB;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
+ }
+ }
+ return ddRVal;
}
@@ -182,8 +204,8 @@
}
_SEH_END;
}
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
return ddRVal;
@@ -220,6 +242,7 @@
{
if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)
{
+ GetScanLineData.ddRVal = DDERR_GENERIC;
GetScanLineData.lpDD = &pDirectDraw->Global;
ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData);
@@ -235,8 +258,8 @@
}
_SEH_END;
}
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
return ddRVal;