prepare some directdraw syscall using cache info, that will make our
ddraw.dll work evently in reactos.
Modified: trunk/reactos/subsys/win32k/ntddraw/ddraw.c
_____
Modified: trunk/reactos/subsys/win32k/ntddraw/ddraw.c
--- trunk/reactos/subsys/win32k/ntddraw/ddraw.c 2005-10-24 17:27:41 UTC
(rev 18746)
+++ trunk/reactos/subsys/win32k/ntddraw/ddraw.c 2005-10-24 17:32:47 UTC
(rev 18747)
@@ -208,12 +208,19 @@
)
{
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
-
+ PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
@@ -221,6 +228,9 @@
ddRVal = pDirectDraw->DD.CreateSurface(puCreateSurfaceData);
}
+ /* But back the orignal PDev */
+ puCreateSurfaceData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -231,15 +241,27 @@
)
{
DWORD ddRVal;
+ PDD_DIRECTDRAW_GLOBAL lgpl;
+
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
ddRVal =
pDirectDraw->DD.WaitForVerticalBlank(puWaitForVerticalBlankData);
+ /* But back the orignal PDev */
+ puWaitForVerticalBlankData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -250,16 +272,27 @@
)
{
DWORD ddRVal;
+ PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
ddRVal =
pDirectDraw->DD.CanCreateSurface(puCanCreateSurfaceData);
+ /* But back the orignal PDev */
+ puCanCreateSurfaceData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -270,16 +303,27 @@
)
{
DWORD ddRVal;
+ PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
ddRVal = pDirectDraw->DD.GetScanLine(puGetScanLineData);
+ /* But back the orignal PDev */
+ puGetScanLineData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -321,6 +365,7 @@
ddRVal = pDirectDraw->Surf.DestroySurface(&DestroySurf);
}
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -334,16 +379,27 @@
)
{
DWORD ddRVal;
+ PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceTarget,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
ddRVal = pDirectDraw->Surf.Flip(puFlipData);
+ /* But back the orignal PDev */
+ puFlipData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}
@@ -355,16 +411,27 @@
)
{
DWORD ddRVal;
+ PDD_DIRECTDRAW_GLOBAL lgpl;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurface,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (pDirectDraw == NULL)
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))
ddRVal = DDHAL_DRIVER_NOTHANDLED;
else
ddRVal = pDirectDraw->Surf.Lock(puLockData);
+ /* But back the orignal PDev */
+ puLockData->lpDD = lgpl;
+
GDIOBJ_UnlockObjByPtr(pDirectDraw);
return ddRVal;
}