more redirect from win32k to dxg.sys

btw no old code exists in current file. 

svn path=/branches/reactx/; revision=29572
This commit is contained in:
Magnus Olsen 2007-10-14 19:45:13 +00:00
parent 8d3e67ab96
commit f3c20ee1cc
4 changed files with 132 additions and 153 deletions

View file

@ -18,15 +18,11 @@
extern PDRVFN gpDxFuncs; extern PDRVFN gpDxFuncs;
/* is not longer in use PDD_DESTROYDRIVER DestroyDriver */
typedef DWORD (NTAPI *PGD_DDCREATESURFACE)(HANDLE, HANDLE *, DDSURFACEDESC *, DD_SURFACE_GLOBAL *, DD_SURFACE_LOCAL *, DD_SURFACE_MORE *, PDD_CREATESURFACEDATA , HANDLE *); typedef DWORD (NTAPI *PGD_DDCREATESURFACE)(HANDLE, HANDLE *, DDSURFACEDESC *, DD_SURFACE_GLOBAL *, DD_SURFACE_LOCAL *, DD_SURFACE_MORE *, PDD_CREATESURFACEDATA , HANDLE *);
/* see ddsurf.c for PDD_SETCOLORKEY SetColorKey; */
/* is not longer in use PDD_SETMODE SetMode; */
typedef DWORD (NTAPI *PGD_DXDDWAITFORVERTICALBLANK)(HANDLE, PDD_WAITFORVERTICALBLANKDATA); typedef DWORD (NTAPI *PGD_DXDDWAITFORVERTICALBLANK)(HANDLE, PDD_WAITFORVERTICALBLANKDATA);
typedef DWORD (NTAPI *PGD_DDCANCREATESURFACE)(HANDLE hDirectDrawLocal, PDD_CANCREATESURFACEDATA puCanCreateSurfaceData); typedef DWORD (NTAPI *PGD_DDCANCREATESURFACE)(HANDLE hDirectDrawLocal, PDD_CANCREATESURFACEDATA puCanCreateSurfaceData);
/* is not longer in use PDD_CREATEPALETTE CreatePalette; */
typedef DWORD (NTAPI *PGD_DXDDGETSCANLINE)(HANDLE, PDD_GETSCANLINEDATA); typedef DWORD (NTAPI *PGD_DXDDGETSCANLINE)(HANDLE, PDD_GETSCANLINEDATA);
/* is not longer in use PDD_MAPMEMORY MapMemory; */ typedef DWORD (NTAPI *PGD_DXDDCREATESURFACEEX)(HANDLE,HANDLE,DWORD);
#define DXG_GET_INDEX_FUNCTION(INDEX, FUNCTION) \ #define DXG_GET_INDEX_FUNCTION(INDEX, FUNCTION) \
if (gpDxFuncs) \ if (gpDxFuncs) \
@ -142,3 +138,34 @@ NtGdiDdGetScanLine(HANDLE hDirectDrawLocal,
} }
/************************************************************************/
/* This is not part of the ddsurface interface but it have */
/* deal with the surface */
/************************************************************************/
/************************************************************************/
/* NtGdiDdCreateSurfaceEx */
/************************************************************************/
DWORD
STDCALL
NtGdiDdCreateSurfaceEx(HANDLE hDirectDraw,
HANDLE hSurface,
DWORD dwSurfaceHandle)
{
PGD_DXDDCREATESURFACEEX pfnDdCreateSurfaceEx = NULL;
INT i;
DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdCreateSurfaceEx, pfnDdCreateSurfaceEx);
if (pfnDdCreateSurfaceEx == NULL)
{
DPRINT1("Warring no pfnDdCreateSurfaceEx");
return DDHAL_DRIVER_NOTHANDLED;
}
DPRINT1("Calling on dxg.sys pfnDdCreateSurfaceEx");
return pfnDdCreateSurfaceEx(hDirectDrawLocal,puGetScanLineData);
}

View file

@ -22,6 +22,10 @@
typedef DWORD (NTAPI *PGD_DXDDREENABLEDIRECTDRAWOBJECT)(HANDLE, BOOL);
typedef DWORD (NTAPI *PGD_DXDDGETDRIVERINFO)(HANDLE, PDD_GETDRIVERINFODATA);
typedef DWORD (NTAPI *PGD_DXDDGETAVAILDRIVERMEMORY(HANDLE, PDD_GETAVAILDRIVERMEMORYDATA);
typedef DWORD (NTAPI *PGD_DXDDSETEXCLUSIVEMODE)(HANDLE, PDD_SETEXCLUSIVEMODEDATA);
typedef NTSTATUS (NTAPI *PGD_DXDDSTARTUPDXGRAPHICS) (ULONG, PDRVENABLEDATA, ULONG, PDRVENABLEDATA, PULONG, PEPROCESS); typedef NTSTATUS (NTAPI *PGD_DXDDSTARTUPDXGRAPHICS) (ULONG, PDRVENABLEDATA, ULONG, PDRVENABLEDATA, PULONG, PEPROCESS);
typedef NTSTATUS (NTAPI *PGD_DXDDCLEANUPDXGRAPHICS) (VOID); typedef NTSTATUS (NTAPI *PGD_DXDDCLEANUPDXGRAPHICS) (VOID);
typedef HANDLE (NTAPI *PGD_DDCREATEDIRECTDRAWOBJECT) (HDC hdc); typedef HANDLE (NTAPI *PGD_DDCREATEDIRECTDRAWOBJECT) (HDC hdc);
@ -354,169 +358,107 @@ NtGdiDdQueryDirectDrawObject(HANDLE hDirectDrawLocal,
} }
/************************************************************************/
/* NtGdiDdReenableDirectDrawObject */
/************************************************************************/
BOOL BOOL
STDCALL NtGdiDdReenableDirectDrawObject( STDCALL
HANDLE hDirectDrawLocal, NtGdiDdReenableDirectDrawObject(HANDLE hDirectDrawLocal,
BOOL *pubNewMode BOOL *pubNewMode)
)
{ {
BOOL Ret=FALSE; PGD_DXDDREENABLEDIRECTDRAWOBJECT pfnDdReenableDirectDrawObject = NULL;
NTSTATUS Status = FALSE; INT i;
PDD_DIRECTDRAW pDirectDraw;
if (hDirectDrawLocal == NULL) DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdReenableDirectDrawObject, pfnDdReenableDirectDrawObject);
{
return Ret; if (pfnDdReenableDirectDrawObject == NULL)
}
pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
if (!pDirectDraw)
{
return Ret;
}
/*
* FIXME detect mode change thic code maybe are not correct
* if we call on intEnableDriver it will cause some memory leak
* we need free the alloc memory before we call on it
*/
Ret = intEnableDriver(pDirectDraw);
_SEH_TRY
{
ProbeForWrite(pubNewMode, sizeof(BOOL), 1);
*pubNewMode = Ret;
}
_SEH_HANDLE
{
Status = _SEH_GetExceptionCode();
}
_SEH_END;
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
return Ret;
}
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return Ret;
}
DWORD STDCALL NtGdiDdGetDriverInfo(
HANDLE hDirectDrawLocal,
PDD_GETDRIVERINFODATA puGetDriverInfoData)
{
DWORD ddRVal = 0;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
DPRINT1("NtGdiDdGetDriverInfo\n");
if (pDirectDraw == NULL)
{ {
DPRINT1("Warring no pfnDdReenableDirectDrawObject");
return DDHAL_DRIVER_NOTHANDLED; return DDHAL_DRIVER_NOTHANDLED;
} }
/* it exsist two version of NtGdiDdGetDriverInfo we need check for both flags */ DPRINT1("Calling on dxg.sys pfnDdReenableDirectDrawObject");
if (!(pDirectDraw->Hal.dwFlags & DDHALINFO_GETDRIVERINFOSET)) return pfnDdReenableDirectDrawObject(hDirectDrawLocal, pubNewMode);
ddRVal++;
if (!(pDirectDraw->Hal.dwFlags & DDHALINFO_GETDRIVERINFO2))
ddRVal++;
/* Now we are doing the call to drv DrvGetDriverInfo */
if (ddRVal == 2)
{
DPRINT1("NtGdiDdGetDriverInfo DDHAL_DRIVER_NOTHANDLED");
ddRVal = DDHAL_DRIVER_NOTHANDLED;
}
else
{
ddRVal = pDirectDraw->Hal.GetDriverInfo(puGetDriverInfoData);
}
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
return ddRVal;
} }
/************************************************************************/
/* NtGdiDdGetDriverInfo */
/************************************************************************/
DWORD
STDCALL
NtGdiDdGetDriverInfo(HANDLE hDirectDrawLocal,
PDD_GETDRIVERINFODATA puGetDriverInfoData)
DWORD STDCALL NtGdiDdGetAvailDriverMemory(
HANDLE hDirectDrawLocal,
PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData
)
{ {
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED; PGD_DXDDGETDRIVERINFO pfnDdGetDriverInfo = NULL;
PDD_DIRECTDRAW_GLOBAL lgpl; INT i;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW); DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdGetDriverInfo, pfnDdGetDriverInfo);
#ifdef DX_DEBUG
DPRINT1("NtGdiDdGetAvailDriverMemory\n");
#endif
/* backup the orignal PDev and info */ if (pfnDdGetDriverInfo == NULL)
lgpl = puGetAvailDriverMemoryData->lpDD; {
DPRINT1("Warring no pfnDdGetDriverInfo");
return DDHAL_DRIVER_NOTHANDLED;
}
/* use our cache version instead */ DPRINT1("Calling on dxg.sys pfnDdGetDriverInfo");
puGetAvailDriverMemoryData->lpDD = &pDirectDraw->Global; return pfnDdGetDriverInfo(hDirectDrawLocal, puGetDriverInfoData);
/* make the call */
// ddRVal = pDirectDraw->DdGetAvailDriverMemory(puGetAvailDriverMemoryData);
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
/* But back the orignal PDev */
puGetAvailDriverMemoryData->lpDD = lgpl;
return ddRVal;
} }
/************************************************************************/
/* NtGdiDdGetAvailDriverMemory */
DWORD STDCALL NtGdiDdSetExclusiveMode( /************************************************************************/
HANDLE hDirectDraw, DWORD
PDD_SETEXCLUSIVEMODEDATA puSetExclusiveModeData STDCALL
) NtGdiDdGetAvailDriverMemory(HANDLE hDirectDrawLocal,
PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData)
{ {
DWORD ddRVal; PGD_DXDDGETAVAILDRIVERMEMORY pfnDdGetAvailDriverMemory = NULL;
PDD_DIRECTDRAW_GLOBAL lgpl; INT i;
PDD_DIRECTDRAW pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDraw, GDI_OBJECT_TYPE_DIRECTDRAW); DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdGetAvailDriverMemory, pfnDdGetAvailDriverMemory);
#ifdef DX_DEBUG if (pfnDdGetAvailDriverMemory == NULL)
DPRINT1("NtGdiDdSetExclusiveMode\n"); {
#endif DPRINT1("Warring no pfnDdGetAvailDriverMemory");
return DDHAL_DRIVER_NOTHANDLED;
}
/* backup the orignal PDev and info */ DPRINT1("Calling on dxg.sys pfnDdGetAvailDriverMemory");
lgpl = puSetExclusiveModeData->lpDD; return pfnDdGetAvailDriverMemory(hDirectDrawLocal, puGetAvailDriverMemoryData);
}
/* use our cache version instead */
puSetExclusiveModeData->lpDD = &pDirectDraw->Global;
/* make the call */ /************************************************************************/
ddRVal = pDirectDraw->DdSetExclusiveMode(puSetExclusiveModeData); /* NtGdiDdSetExclusiveMode */
/************************************************************************/
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw); DWORD
STDCALL
NtGdiDdSetExclusiveMode(HANDLE hDirectDraw,
PDD_SETEXCLUSIVEMODEDATA puSetExclusiveModeData)
{
PGD_DXDDSETEXCLUSIVEMODE pfnDdSetExclusiveMode = NULL;
INT i;
/* But back the orignal PDev */ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdSetExclusiveMode, pfnDdSetExclusiveMode);
puSetExclusiveModeData->lpDD = lgpl;
if (pfnDdSetExclusiveMode == NULL)
{
DPRINT1("Warring no pfnDdSetExclusiveMode");
return DDHAL_DRIVER_NOTHANDLED;
}
DPRINT1("Calling on dxg.sys pfnDdSetExclusiveMode");
return pfnDdSetExclusiveMode(hDirectDrawLocal, puGetAvailDriverMemoryData);
return ddRVal;
} }

View file

@ -16,6 +16,7 @@
extern PDRVFN gpDxFuncs; extern PDRVFN gpDxFuncs;
typedef DWORD (NTAPI *PGD_DXDDUNATTACHSURFACE)(HANDLE, HANDLE);
typedef DWORD (NTAPI *PGD_DXDDDESTROYSURFACE)(HANDLE, BOOL); typedef DWORD (NTAPI *PGD_DXDDDESTROYSURFACE)(HANDLE, BOOL);
typedef DWORD (NTAPI *PGD_DXDDFLIP)(HANDLE, HANDLE, HANDLE, HANDLE, PDD_FLIPDATA); typedef DWORD (NTAPI *PGD_DXDDFLIP)(HANDLE, HANDLE, HANDLE, HANDLE, PDD_FLIPDATA);
/* Does not exists in win32k or dxg.sys PDD_SURFCB_SETCLIPLIST SetClipList; */ /* Does not exists in win32k or dxg.sys PDD_SURFCB_SETCLIPLIST SetClipList; */
@ -361,3 +362,27 @@ NtGdiDdAttachSurface(HANDLE hSurfaceFrom,
return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo); return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo);
} }
/************************************************************************/
/* NtGdiDdUnattachSurface */
/************************************************************************/
VOID
STDCALL
NtGdiDdUnattachSurface(HANDLE hSurface,
HANDLE hSurfaceAttached)
{
PGD_DXDDUNATTACHSURFACE pfnDdUnattachSurface = NULL;
INT i;
DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdUnattachSurface, pfnDdUnattachSurface);
if (pfnDdUnattachSurface == NULL)
{
DPRINT1("Warring no pfnDdUnattachSurface");
return DDHAL_DRIVER_NOTHANDLED;
}
DPRINT1("Calling on dxg.sys pfnDdUnattachSurface");
return pfnDdUnattachSurface(hSurface,hSurfaceAttached);
}

View file

@ -13,16 +13,7 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
DWORD STDCALL NtGdiDdCreateSurfaceEx(
HANDLE hDirectDraw,
HANDLE hSurface,
DWORD dwSurfaceHandle
)
{
UNIMPLEMENTED
return 0;
}
DWORD STDCALL NtGdiDdFlipToGDISurface( DWORD STDCALL NtGdiDdFlipToGDISurface(
HANDLE hDirectDraw, HANDLE hDirectDraw,
@ -86,13 +77,7 @@ BOOL STDCALL NtGdiDdSetGammaRamp(
return 0; return 0;
} }
VOID STDCALL NtGdiDdUnattachSurface(
HANDLE hSurface,
HANDLE hSurfaceAttached
)
{
UNIMPLEMENTED
}