prepare some directdraw syscall using cache info, that will make our ddraw.dll work evently in reactos.

svn path=/trunk/; revision=18747
This commit is contained in:
Magnus Olsen 2005-10-24 17:32:47 +00:00
parent d4f5019aa8
commit ccae733920

View file

@ -208,12 +208,19 @@ DWORD STDCALL NtGdiDdCreateSurface(
) )
{ {
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED; DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puCreateSurfaceData->lpDD;
/* use our cache version instead */
puCreateSurfaceData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE)) if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
@ -221,6 +228,9 @@ DWORD STDCALL NtGdiDdCreateSurface(
ddRVal = pDirectDraw->DD.CreateSurface(puCreateSurfaceData); ddRVal = pDirectDraw->DD.CreateSurface(puCreateSurfaceData);
} }
/* But back the orignal PDev */
puCreateSurfaceData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -231,15 +241,27 @@ DWORD STDCALL NtGdiDdWaitForVerticalBlank(
) )
{ {
DWORD ddRVal; DWORD ddRVal;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puWaitForVerticalBlankData->lpDD;
/* use our cache version instead */
puWaitForVerticalBlankData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK)) if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_WAITFORVERTICALBLANK))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
ddRVal = pDirectDraw->DD.WaitForVerticalBlank(puWaitForVerticalBlankData); ddRVal = pDirectDraw->DD.WaitForVerticalBlank(puWaitForVerticalBlankData);
/* But back the orignal PDev */
puWaitForVerticalBlankData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -250,16 +272,27 @@ DWORD STDCALL NtGdiDdCanCreateSurface(
) )
{ {
DWORD ddRVal; DWORD ddRVal;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puCanCreateSurfaceData->lpDD;
/* use our cache version instead */
puCanCreateSurfaceData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE)) if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
ddRVal = pDirectDraw->DD.CanCreateSurface(puCanCreateSurfaceData); ddRVal = pDirectDraw->DD.CanCreateSurface(puCanCreateSurfaceData);
/* But back the orignal PDev */
puCanCreateSurfaceData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -270,16 +303,27 @@ DWORD STDCALL NtGdiDdGetScanLine(
) )
{ {
DWORD ddRVal; DWORD ddRVal;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puGetScanLineData->lpDD;
/* use our cache version instead */
puGetScanLineData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)) if (!(pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
ddRVal = pDirectDraw->DD.GetScanLine(puGetScanLineData); ddRVal = pDirectDraw->DD.GetScanLine(puGetScanLineData);
/* But back the orignal PDev */
puGetScanLineData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -321,6 +365,7 @@ DWORD STDCALL NtGdiDdDestroySurface(
ddRVal = pDirectDraw->Surf.DestroySurface(&DestroySurf); ddRVal = pDirectDraw->Surf.DestroySurface(&DestroySurf);
} }
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -334,16 +379,27 @@ DWORD STDCALL NtGdiDdFlip(
) )
{ {
DWORD ddRVal; DWORD ddRVal;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceTarget, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceTarget, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puFlipData->lpDD;
/* use our cache version instead */
puFlipData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_FLIP)) if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_FLIP))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
ddRVal = pDirectDraw->Surf.Flip(puFlipData); ddRVal = pDirectDraw->Surf.Flip(puFlipData);
/* But back the orignal PDev */
puFlipData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }
@ -355,16 +411,27 @@ DWORD STDCALL NtGdiDdLock(
) )
{ {
DWORD ddRVal; DWORD ddRVal;
PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW); PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface, GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL) if (pDirectDraw == NULL)
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
/* backup the orignal PDev and info */
lgpl = puLockData->lpDD;
/* use our cache version instead */
puLockData->lpDD = &pDirectDraw->Global;
/* make the call */
if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_LOCK)) if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_LOCK))
ddRVal = DDHAL_DRIVER_NOTHANDLED; ddRVal = DDHAL_DRIVER_NOTHANDLED;
else else
ddRVal = pDirectDraw->Surf.Lock(puLockData); ddRVal = pDirectDraw->Surf.Lock(puLockData);
/* But back the orignal PDev */
puLockData->lpDD = lgpl;
GDIOBJ_UnlockObjByPtr(pDirectDraw); GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal; return ddRVal;
} }