prepare the rest of directdraw syscall using cache info, that will make our ddraw.dll work evently in reactos. 
left todo implemet the rest stub.
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 18:03:57 UTC (rev 18756)
+++ trunk/reactos/subsys/win32k/ntddraw/ddraw.c	2005-10-24 18:47:33 UTC (rev 18757)
@@ -442,16 +442,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 = puUnlockData->lpDD;
+
+	/* use our cache version instead */
+	puUnlockData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_UNLOCK))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.Unlock(puUnlockData);
 
+	/* But back the orignal PDev */
+	puUnlockData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);    
 	return ddRVal;
 }
@@ -463,16 +474,27 @@
 )
 {
     DWORD  ddRVal;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
     PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDest, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 		return DDHAL_DRIVER_NOTHANDLED;
 
+	/* backup the orignal PDev and info */
+	lgpl = puBltData->lpDD;
+
+	/* use our cache version instead */
+	puBltData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_BLT))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.Blt(puBltData);
 
+	/* But back the orignal PDev */
+	puBltData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;
    }
@@ -483,16 +505,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 = puSetColorKeyData->lpDD;
+
+	/* use our cache version instead */
+	puSetColorKeyData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_SETCOLORKEY))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.SetColorKey(puSetColorKeyData);
 
+	/* But back the orignal PDev */
+	puSetColorKeyData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;	
 }
@@ -505,16 +538,27 @@
 )
 {
 	DWORD  ddRVal;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
 	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceAttached, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 		return DDHAL_DRIVER_NOTHANDLED;
 
+	/* backup the orignal PDev and info */
+	lgpl = puAddAttachedSurfaceData->lpDD;
+
+	/* use our cache version instead */
+	puAddAttachedSurfaceData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_ADDATTACHEDSURFACE))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.AddAttachedSurface(puAddAttachedSurfaceData);
 
+	/* But back the orignal PDev */
+	puAddAttachedSurfaceData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;	
 }
@@ -525,16 +569,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 = puGetBltStatusData->lpDD;
+
+	/* use our cache version instead */
+	puGetBltStatusData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_GETBLTSTATUS))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.GetBltStatus(puGetBltStatusData);
 
+	/* But back the orignal PDev */
+	puGetBltStatusData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;		
 }
@@ -545,16 +600,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 = puGetFlipStatusData->lpDD;
+
+	/* use our cache version instead */
+	puGetFlipStatusData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_GETFLIPSTATUS))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.GetFlipStatus(puGetFlipStatusData);
 
+	/* But back the orignal PDev */
+	puGetFlipStatusData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;		
 }
@@ -566,16 +632,27 @@
 )
 {
 	DWORD  ddRVal;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
     PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 		return DDHAL_DRIVER_NOTHANDLED;
 
+	/* backup the orignal PDev and info */
+	lgpl = puUpdateOverlayData->lpDD;
+
+	/* use our cache version instead */
+	puUpdateOverlayData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_UPDATEOVERLAY))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.UpdateOverlay(puUpdateOverlayData);
 
+	/* But back the orignal PDev */
+	puUpdateOverlayData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;
 }
@@ -587,16 +664,27 @@
 )
 {
 	DWORD  ddRVal;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
     PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hSurfaceDestination, GDI_OBJECT_TYPE_DIRECTDRAW);
 	if (pDirectDraw == NULL) 
 		return DDHAL_DRIVER_NOTHANDLED;
 
+	/* backup the orignal PDev and info */
+	lgpl = puSetOverlayPositionData->lpDD;
+
+	/* use our cache version instead */
+	puSetOverlayPositionData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
 	if (!(pDirectDraw->Surf.dwFlags & DDHAL_SURFCB32_SETOVERLAYPOSITION))
 		ddRVal = DDHAL_DRIVER_NOTHANDLED;
 	else
         ddRVal = pDirectDraw->Surf.SetOverlayPosition(puSetOverlayPositionData);
 
+	/* But back the orignal PDev */
+	puSetOverlayPositionData->lpDD = lgpl;
+
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
     return ddRVal;
 }
@@ -698,13 +786,25 @@
 )
 {
 	DWORD  ddRVal = DDHAL_DRIVER_NOTHANDLED;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
 	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
 
+	/* backup the orignal PDev and info */
+	lgpl = puGetAvailDriverMemoryData->lpDD;
+
+	/* use our cache version instead */
+	puGetAvailDriverMemoryData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
    // ddRVal = pDirectDraw->DdGetAvailDriverMemory(puGetAvailDriverMemoryData); 
  
 	GDIOBJ_UnlockObjByPtr(pDirectDraw);
 
+
+	/* But back the orignal PDev */
+	puGetAvailDriverMemoryData->lpDD = lgpl;
+
 	return ddRVal;
 }
 
@@ -717,12 +817,23 @@
 )
 {
 	DWORD  ddRVal;
+	PDD_DIRECTDRAW_GLOBAL lgpl;
 
 	PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW);
 
+	/* backup the orignal PDev and info */
+	lgpl = puSetExclusiveModeData->lpDD;
+
+	/* use our cache version instead */
+	puSetExclusiveModeData->lpDD = &pDirectDraw->Global;
+
+	/* make the call */
     ddRVal = pDirectDraw->DdSetExclusiveMode(puSetExclusiveModeData);
 
     GDIOBJ_UnlockObjByPtr(pDirectDraw);
+
+	/* But back the orignal PDev */
+	puSetExclusiveModeData->lpDD = lgpl;
     
 	return ddRVal;	
 }