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

 

svn path=/trunk/; revision=26065
This commit is contained in:
Magnus Olsen 2007-03-11 16:28:22 +00:00
parent 4a26adf7ff
commit 4485db1f76

View file

@ -92,32 +92,54 @@ DWORD STDCALL NtGdiDdCreateSurface(
DWORD STDCALL NtGdiDdWaitForVerticalBlank( DWORD STDCALL NtGdiDdWaitForVerticalBlank(
HANDLE hDirectDrawLocal, HANDLE hDirectDrawLocal,
PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData PDD_WAITFORVERTICALBLANKDATA puWaitForVerticalBlankData)
)
{ {
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED; DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
PDD_DIRECTDRAW_GLOBAL lgpl; PDD_DIRECTDRAW pDirectDraw = NULL;
PDD_DIRECTDRAW pDirectDraw; NTSTATUS Status = FALSE;
DD_WAITFORVERTICALBLANKDATA WaitForVerticalBlankData;
DPRINT1("NtGdiDdWaitForVerticalBlank\n"); DPRINT1("NtGdiDdWaitForVerticalBlank\n");
pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); _SEH_TRY
{
if (pDirectDraw != NULL) ProbeForRead(puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA), 1);
{ RtlCopyMemory(&WaitForVerticalBlankData,puWaitForVerticalBlankData, sizeof(DD_WAITFORVERTICALBLANKDATA));
if (pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK) }
{ _SEH_HANDLE
lgpl = puWaitForVerticalBlankData->lpDD; {
puWaitForVerticalBlankData->lpDD = &pDirectDraw->Global; Status = _SEH_GetExceptionCode();
}
_SEH_END;
ddRVal = pDirectDraw->DD.WaitForVerticalBlank(puWaitForVerticalBlankData); if(NT_SUCCESS(Status))
{
puWaitForVerticalBlankData->lpDD = lgpl; pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
}
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
return ddRVal; 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 @@ DWORD STDCALL NtGdiDdCanCreateSurface(
} }
_SEH_END; _SEH_END;
} }
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
} }
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
} }
return ddRVal; return ddRVal;
@ -220,6 +242,7 @@ NtGdiDdGetScanLine( HANDLE hDirectDrawLocal, PDD_GETSCANLINEDATA puGetScanLineDa
{ {
if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE) if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)
{ {
GetScanLineData.ddRVal = DDERR_GENERIC;
GetScanLineData.lpDD = &pDirectDraw->Global; GetScanLineData.lpDD = &pDirectDraw->Global;
ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData); ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData);
@ -235,8 +258,8 @@ NtGdiDdGetScanLine( HANDLE hDirectDrawLocal, PDD_GETSCANLINEDATA puGetScanLineDa
} }
_SEH_END; _SEH_END;
} }
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
} }
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
} }
return ddRVal; return ddRVal;