Author: greatlrd
Date: Sun Oct 14 23:02:45 2007
New Revision: 29571
URL:
http://svn.reactos.org/svn/reactos?rev=29571&view=rev
Log:
start move out logic stuff that should have been move to ddsurf and d3d from ddraw.c
remove the old start up code for dx, it will be in in dxg.sys later.
win32k only redirect it to dxg.sys
Modified:
branches/reactx/reactos/subsystems/win32/win32k/ntddraw/d3d.c
branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c
Modified: branches/reactx/reactos/subsystems/win32/win32k/ntddraw/d3d.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/subsystems/win32…
==============================================================================
--- branches/reactx/reactos/subsystems/win32/win32k/ntddraw/d3d.c (original)
+++ branches/reactx/reactos/subsystems/win32/win32k/ntddraw/d3d.c Sun Oct 14 23:02:45
2007
@@ -25,7 +25,7 @@
extern PDRVFN gpDxFuncs;
-
+typedef DWORD (NTAPI *PGD_DDCANCREATED3DBUFFER)(HANDLE, PDD_CANCREATESURFACEDATA);
typedef DWORD (NTAPI *PGD_DXDDUNLOCKD3D)(HANDLE, PDD_UNLOCKDATA);
typedef DWORD (NTAPI *PGD_DXDDLOCKD3D)(HANDLE, PDD_LOCKDATA);
typedef DWORD (NTAPI
*PGD_D3DVALIDATETEXTURESTAGESTATE)(LPD3DNTHAL_VALIDATETEXTURESTAGESTATEDATA);
@@ -50,7 +50,29 @@
-
+/************************************************************************/
+/* NtGdiDdCanCreateD3DBuffer */
+/************************************************************************/
+DWORD
+STDCALL
+NtGdiDdCanCreateD3DBuffer(HANDLE hDirectDraw,
+ PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
+)
+{
+ PGD_DDCANCREATED3DBUFFER pfnDdCanCreateD3DBuffer = NULL;
+ INT i;
+
+ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdCanCreateD3DBuffer, pfnDdCanCreateD3DBuffer);
+
+ if (pfnDdCanCreateD3DBuffer == NULL)
+ {
+ DPRINT1("Warring no pfnDdCanCreateD3DBuffer");
+ return DDHAL_DRIVER_NOTHANDLED;
+ }
+
+ DPRINT1("Calling on dxg.sys DdCanCreateD3DBuffer");
+ return pfnDdCanCreateD3DBuffer(hDirectDraw,puCanCreateSurfaceData);
+}
/************************************************************************/
/* NtGdiD3dContextCreate */
@@ -154,6 +176,28 @@
}
/************************************************************************/
+/* NtGdiDdDestroyD3DBuffer */
+/************************************************************************/
+DWORD
+STDCALL
+NtGdiDdDestroyD3DBuffer(HANDLE hSurface)
+{
+ PGD_DXDDDESTROYD3DBUFFER pfnDdDestroyD3DBuffer = NULL;
+ INT i;
+
+ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdDestroyD3DBuffer, pfnDdDestroyD3DBuffer);
+
+ if (pfnDdDestroyD3DBuffer == NULL)
+ {
+ DPRINT1("Warring no pfnDdDestroyD3DBuffer");
+ return DDHAL_DRIVER_NOTHANDLED;
+ }
+
+ DPRINT1("Calling on dxg.sys pfnDdDestroyD3DBuffer");
+ return pfnDdDestroyD3DBuffer(hSurface);
+}
+
+/************************************************************************/
/* NtGdiD3dDrawPrimitives2 */
/************************************************************************/
DWORD
@@ -227,6 +271,9 @@
return pfnD3dValidateTextureStageState(pData);
}
+/************************************************************************/
+/* NtGdiDdUnlockD3D */
+/************************************************************************/
DWORD
STDCALL
NtGdiDdUnlockD3D(HANDLE hSurface,
Modified: branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/subsystems/win32…
==============================================================================
--- branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original)
+++ branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sun Oct 14 23:02:45
2007
@@ -3,10 +3,8 @@
* PROJECT: ReactOS kernel
* PURPOSE: Native DirectDraw implementation
* FILE: subsys/win32k/ntddraw/ddraw.c
- * PROGRAMER: Peter Bajusz (hyp-x(a)stormregion.com)
* PROGRAMER: Magnus olsen (magnus(a)greatlord.com)
* REVISION HISTORY:
- * 25-10-2003 PB Created
from 2003 to year 2007
* rewrote almost all code Peter did.
* only few line are left from him
@@ -21,7 +19,7 @@
/* swtich this off to get rid of all dx debug msg */
#define DX_DEBUG
-#define DdHandleTable GdiHandleTable
+
typedef NTSTATUS (NTAPI *PGD_DXDDSTARTUPDXGRAPHICS) (ULONG, PDRVENABLEDATA, ULONG,
PDRVENABLEDATA, PULONG, PEPROCESS);
@@ -30,37 +28,15 @@
typedef DWORD (NTAPI *PGD_DDGETDRIVERSTATE)(PDD_GETDRIVERSTATEDATA);
typedef DWORD (NTAPI *PGD_DDALPHABLT)(HANDLE, HANDLE, PDD_BLTDATA);
typedef BOOL (NTAPI *PGD_DDATTACHSURFACE)(HANDLE, HANDLE);
-typedef DWORD (NTAPI *PGD_DDCANCREATED3DBUFFER)(HANDLE, PDD_CANCREATESURFACEDATA);
typedef DWORD (NTAPI *PGD_DDCOLORCONTROL)(HANDLE hSurface,PDD_COLORCONTROLDATA
puColorControlData);
typedef HANDLE (NTAPI *PGD_DXDDCREATESURFACEOBJECT)(HANDLE, HANDLE, PDD_SURFACE_LOCAL,
PDD_SURFACE_MORE, PDD_SURFACE_GLOBAL, BOOL);
typedef BOOL (NTAPI *PGD_DXDDDELETEDIRECTDRAWOBJECT)(HANDLE);
typedef BOOL (NTAPI *PGD_DXDDDELETESURFACEOBJECT)(HANDLE);
-
typedef DWORD (NTAPI *PGD_DXDDDESTROYD3DBUFFER)(HANDLE);
typedef DWORD (NTAPI *PGD_DXDDFLIPTOGDISURFACE)(HANDLE, PDD_FLIPTOGDISURFACEDATA);
typedef DWORD (NTAPI *PGD_DXDDGETAVAILDRIVERMEMORY)(HANDLE ,
PDD_GETAVAILDRIVERMEMORYDATA);
-
-/*
-typedef DWORD (NTAPI *PGD_DXDDGETBLTSTATUS)(
-typedef DWORD (NTAPI *PGD_DXDDGETDC)(
-typedef DWORD (NTAPI *PGD_DXDDGETDRIVERINFO)(
-typedef DWORD (NTAPI *PGD_DXDDGETDXHANDLE)(
-typedef DWORD (NTAPI *PGD_DXDDGETFLIPSTATUS)(
-typedef DWORD (NTAPI *PGD_DXDDGETSCANLINE)(
-typedef DWORD (NTAPI *PGD_DXDDLOCK)(
-typedef DWORD (NTAPI *PGD_DXDDLOCKD3D)(
-typedef DWORD (NTAPI *PGD_DXDDQUERYDIRECTDRAWOBJECT)(
-typedef DWORD (NTAPI *PGD_DXDDREENABLEDIRECTDRAWOBJECT)(
-typedef DWORD (NTAPI *PGD_DXDDRELEASEDC)(
-typedef DWORD (NTAPI *PGD_DXDDRESETVISRGN)(
-typedef DWORD (NTAPI *PGD_DXDDSETCOLORKEY)(
-typedef DWORD (NTAPI *PGD_DXDDSETEXCLUSIVEMODE)(
-typedef DWORD (NTAPI *PGD_DXDDSETGAMMARAMP)(
-typedef DWORD (NTAPI *PGD_DXDDCREATESURFACEEX)(
-typedef DWORD (NTAPI *PGD_DXDDSETOVERLAYPOSITION)(
-typedef DWORD (NTAPI *PGD_DXDDUNATTACHSURFACE)(
-*/
-
+typedef BOOL (NTAPI *PGD_DXDDQUERYDIRECTDRAWOBJECT)(HANDLE, DD_HALINFO*, DWORD*,
LPD3DNTHAL_CALLBACKS, LPD3DNTHAL_GLOBALDRIVERDATA,
+ PDD_D3DBUFCALLBACKS, LPDDSURFACEDESC,
DWORD *, VIDEOMEMORY *, DWORD *, DWORD *);
PGD_DXDDSTARTUPDXGRAPHICS gpfnStartupDxGraphics = NULL;
@@ -88,7 +64,7 @@
/************************************************************************/
-/* DirectX graphic/video driver loading */
+/* DirectX graphic/video driver loading and cleanup start here */
/************************************************************************/
NTSTATUS
STDCALL
@@ -160,6 +136,38 @@
return Status;
}
+BOOL
+INTERNAL_CALL
+DD_Cleanup(PVOID ObjectBody)
+{
+ PDD_DIRECTDRAW pDirectDraw = (PDD_DIRECTDRAW) ObjectBody;
+
+ DPRINT1("DD_Cleanup\n");
+
+ /* Do not known what the new cleanup code should do at moment */
+ return TRUE;
+}
+
+BOOL
+INTERNAL_CALL
+DDSURF_Cleanup(PVOID pDDSurf)
+{
+ DPRINT1("DDSURF_Cleanup\n");
+ /* Do not known what the new cleanup code should do at moment */
+ return TRUE;
+}
+
+
+
+/************************************************************************/
+/* DirectX graphic/video driver loading cleanup ends here */
+/************************************************************************/
+
+
+
+/************************************************************************/
+/* NtGdiDdCreateDirectDrawObject */
+/************************************************************************/
HANDLE
STDCALL
NtGdiDdCreateDirectDrawObject(HDC hdc)
@@ -195,7 +203,9 @@
-
+/************************************************************************/
+/* NtGdiDdGetDriverState */
+/************************************************************************/
DWORD
STDCALL
NtGdiDdGetDriverState(PDD_GETDRIVERSTATEDATA pdata)
@@ -215,76 +225,9 @@
return pfnDdGetDriverState(pdata);
}
-
-
-
-DWORD
-STDCALL
-NtGdiDdAlphaBlt(HANDLE hSurfaceDest,
- HANDLE hSurfaceSrc,
- PDD_BLTDATA puBltData)
-{
- PGD_DDALPHABLT pfnDdAlphaBlt = NULL;
- INT i;
-
- DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdAlphaBlt, pfnDdAlphaBlt);
-
- if (pfnDdAlphaBlt == NULL)
- {
- DPRINT1("Warring no pfnDdAlphaBlt");
- return DDHAL_DRIVER_NOTHANDLED;
- }
-
- DPRINT1("Calling on dxg.sys DdAlphaBlt");
- return pfnDdAlphaBlt(hSurfaceDest,hSurfaceSrc,puBltData);
-}
-
-
-BOOL
-STDCALL
-NtGdiDdAttachSurface(HANDLE hSurfaceFrom,
- HANDLE hSurfaceTo
-)
-{
- PGD_DDATTACHSURFACE pfnDdAttachSurface = NULL;
- INT i;
-
- DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdAttachSurface, pfnDdAttachSurface);
-
- if (pfnDdAttachSurface == NULL)
- {
- DPRINT1("Warring no pfnDdAttachSurface");
- return DDHAL_DRIVER_NOTHANDLED;
- }
-
- DPRINT1("Calling on dxg.sys DdAttachSurface");
- return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo);
-}
-
-
-
-DWORD
-STDCALL
-NtGdiDdCanCreateD3DBuffer(HANDLE hDirectDraw,
- PDD_CANCREATESURFACEDATA puCanCreateSurfaceData
-)
-{
- PGD_DDCANCREATED3DBUFFER pfnDdCanCreateD3DBuffer = NULL;
- INT i;
-
- DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdCanCreateD3DBuffer, pfnDdCanCreateD3DBuffer);
-
- if (pfnDdCanCreateD3DBuffer == NULL)
- {
- DPRINT1("Warring no pfnDdCanCreateD3DBuffer");
- return DDHAL_DRIVER_NOTHANDLED;
- }
-
- DPRINT1("Calling on dxg.sys DdCanCreateD3DBuffer");
- return pfnDdCanCreateD3DBuffer(hDirectDraw,puCanCreateSurfaceData);
-}
-
-
+/************************************************************************/
+/* NtGdiDdColorControl */
+/************************************************************************/
DWORD
STDCALL
NtGdiDdColorControl(HANDLE hSurface,
@@ -305,6 +248,9 @@
return pfnDdColorControl(hSurface,puColorControlData);
}
+/************************************************************************/
+/* NtGdiDdCreateSurfaceObject */
+/************************************************************************/
HANDLE
STDCALL
NtGdiDdCreateSurfaceObject(HANDLE hDirectDrawLocal,
@@ -326,13 +272,16 @@
return DDHAL_DRIVER_NOTHANDLED;
}
- DPRINT1("Calling on dxg.sys DdCreateSurfaceObject");
+ DPRINT1("Calling on dxg.sys pfnDdCreateSurfaceObject");
return pfnDdCreateSurfaceObject(hDirectDrawLocal, hSurface, puSurfaceLocal,
puSurfaceMore, puSurfaceGlobal, bComplete);
}
+/************************************************************************/
+/* NtGdiDdDeleteDirectDrawObject */
+/************************************************************************/
BOOL
STDCALL
-NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal)
+NtGdiDdDeleteDirectDrawObject(HANDLE hDirectDrawLocal)
{
PGD_DXDDDELETEDIRECTDRAWOBJECT pfnDdDeleteDirectDrawObject = NULL;
INT i;
@@ -345,10 +294,13 @@
return DDHAL_DRIVER_NOTHANDLED;
}
- DPRINT1("Calling on dxg.sys DdDeleteDirectDrawObject");
+ DPRINT1("Calling on dxg.sys pfnDdDeleteDirectDrawObject");
return pfnDdDeleteDirectDrawObject(hDirectDrawLocal);
}
+/************************************************************************/
+/* NtGdiDdDeleteSurfaceObject */
+/************************************************************************/
BOOL
STDCALL
NtGdiDdDeleteSurfaceObject(HANDLE hSurface)
@@ -368,444 +320,45 @@
return pfnDdDeleteSurfaceObject(hSurface);
}
-
-
-
-
-
-DWORD
-STDCALL
-NtGdiDdDestroyD3DBuffer(HANDLE hSurface)
-{
- PGD_DXDDDESTROYD3DBUFFER pfnDdDestroyD3DBuffer = NULL;
+/************************************************************************/
+/* NtGdiDdDeleteSurfaceObject */
+/************************************************************************/
+BOOL
+STDCALL
+NtGdiDdQueryDirectDrawObject(HANDLE hDirectDrawLocal,
+ DD_HALINFO *pHalInfo,
+ DWORD *pCallBackFlags,
+ LPD3DNTHAL_CALLBACKS puD3dCallbacks,
+ LPD3DNTHAL_GLOBALDRIVERDATA puD3dDriverData,
+ PDD_D3DBUFCALLBACKS puD3dBufferCallbacks,
+ LPDDSURFACEDESC puD3dTextureFormats,
+ DWORD *puNumHeaps,
+ VIDEOMEMORY *puvmList,
+ DWORD *puNumFourCC,
+ DWORD *puFourCC)
+{
+ PGD_DXDDQUERYDIRECTDRAWOBJECT pfnDdQueryDirectDrawObject = NULL;
INT i;
- DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdDestroyD3DBuffer, pfnDdDestroyD3DBuffer);
-
- if (pfnDdDestroyD3DBuffer == NULL)
- {
- DPRINT1("Warring no pfnDdDestroyD3DBuffer");
- return DDHAL_DRIVER_NOTHANDLED;
- }
-
- DPRINT1("Calling on dxg.sys pfnDdDestroyD3DBuffer");
- return pfnDdDestroyD3DBuffer(hSurface);
-}
-
-/************************************************************************/
-/* DIRECT DRAW OBJECT */
-/************************************************************************/
-
-BOOL INTERNAL_CALL
-DD_Cleanup(PVOID ObjectBody)
-{
- PDD_DIRECTDRAW pDirectDraw = (PDD_DIRECTDRAW) ObjectBody;
-
- DPRINT1("DD_Cleanup\n");
-
- if (!pDirectDraw)
- {
- return FALSE;
- }
-
- if (pDirectDraw->Global.dhpdev == NULL)
- {
- return FALSE;
- }
-
- if (pDirectDraw->DrvDisableDirectDraw == NULL)
- {
- return FALSE;
- }
-
- pDirectDraw->DrvDisableDirectDraw(pDirectDraw->Global.dhpdev);
- return TRUE;
-}
-
-/* code for enable and reanble the drv */
+ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdQueryDirectDrawObject,
pfnDdQueryDirectDrawObject);
+
+ if (pfnDdQueryDirectDrawObject == NULL)
+ {
+ DPRINT1("Warring no pfnDdQueryDirectDrawObject");
+ return DDHAL_DRIVER_NOTHANDLED;
+ }
+
+ DPRINT1("Calling on dxg.sys pfnDdQueryDirectDrawObject");
+ return pfnDdQueryDirectDrawObject(hDirectDrawLocal, pHalInfo, pCallBackFlags,
puD3dCallbacks, puD3dDriverData,
+ puD3dBufferCallbacks, puD3dTextureFormats,
puNumHeaps, puvmList, puNumFourCC, puFourCC);
+}
+
+
+
+
+
BOOL
-intEnableDriver(PDD_DIRECTDRAW pDirectDraw)
-{
- BOOL success;
- DD_HALINFO HalInfo;
-
- /*clean up some of the cache entry */
- RtlZeroMemory(&pDirectDraw->DD, sizeof(DD_CALLBACKS));
- RtlZeroMemory(&pDirectDraw->Surf, sizeof(DD_SURFACECALLBACKS));
- RtlZeroMemory(&pDirectDraw->Pal, sizeof(DD_PALETTECALLBACKS));
- RtlZeroMemory(&pDirectDraw->Hal, sizeof(DD_HALINFO));
- RtlZeroMemory(&HalInfo, sizeof(DD_HALINFO));
- pDirectDraw->dwNumHeaps =0;
- pDirectDraw->dwNumFourCC = 0;
- pDirectDraw->pdwFourCC = NULL;
- pDirectDraw->pvmList = NULL;
-
- /* Get DirectDraw infomations form the driver
- * DDK say pvmList, pdwFourCC is always NULL in frist call here
- * but we get back how many pvmList it whant we should alloc, same
- * with pdwFourCC.
- */
- if (pDirectDraw->DrvGetDirectDrawInfo)
- {
- success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev,
- &HalInfo,
- &pDirectDraw->dwNumHeaps,
- NULL,
- &pDirectDraw->dwNumFourCC,
- NULL);
- if (!success)
- {
- DPRINT1("DrvGetDirectDrawInfo frist call fail\n");
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
-
- /* The driver are not respnose to alloc the memory for pvmList
- * but it is win32k responsible todo, Windows 9x it is gdi32.dll
- */
- if (pDirectDraw->dwNumHeaps != 0)
- {
- DPRINT1("Setup pvmList\n");
- pDirectDraw->pvmList = (PVIDEOMEMORY) ExAllocatePoolWithTag(PagedPool,
pDirectDraw->dwNumHeaps * sizeof(VIDEOMEMORY), TAG_DXPVMLIST);
- if (pDirectDraw->pvmList == NULL)
- {
- DPRINT1("pvmList memmery alloc fail\n");
- return FALSE;
- }
- }
-
- /* The driver are not respnose to alloc the memory for pdwFourCC
- * but it is win32k responsible todo, Windows 9x it is gdi32.dll
- */
-
- if (pDirectDraw->dwNumFourCC != 0)
- {
- DPRINT1("Setup pdwFourCC\n");
- pDirectDraw->pdwFourCC = (LPDWORD) ExAllocatePoolWithTag(PagedPool,
pDirectDraw->dwNumFourCC * sizeof(DWORD), TAG_DXFOURCC);
-
- if (pDirectDraw->pdwFourCC == NULL)
- {
- DPRINT1("pdwFourCC memmery alloc fail\n");
- return FALSE;
- }
- }
- success = pDirectDraw->DrvGetDirectDrawInfo( pDirectDraw->Global.dhpdev,
- &HalInfo,
- &pDirectDraw->dwNumHeaps,
- pDirectDraw->pvmList,
- &pDirectDraw->dwNumFourCC,
- pDirectDraw->pdwFourCC);
- if (!success)
- {
- DPRINT1("DrvGetDirectDrawInfo second call fail\n");
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
-
- /* We need now convert the DD_HALINFO we got, it can be NT4 driver we
- * loading ReactOS supporting NT4 and higher to be loading.so we make
- * the HALInfo compatible here so we can easy pass it to gdi32.dll
- * without converting it later
- */
-
- if ((HalInfo.dwSize != sizeof(DD_HALINFO)) &&
- (HalInfo.dwSize != sizeof(DD_HALINFO_V4)))
- {
- DPRINT1(" Fail not vaild driver DD_HALINFO struct found\n");
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- if (HalInfo.dwSize != sizeof(DD_HALINFO))
- {
- if (HalInfo.dwSize == sizeof(DD_HALINFO_V4))
- {
- /* NT4 Compatible */
- DPRINT1("Got DD_HALINFO_V4 sturct we convert it to DD_HALINFO
\n");
- HalInfo.dwSize = sizeof(DD_HALINFO);
- HalInfo.lpD3DGlobalDriverData = NULL;
- HalInfo.lpD3DHALCallbacks = NULL;
- HalInfo.lpD3DBufCallbacks = NULL;
- }
- else
- {
- /* Unknown version found */
- DPRINT1(" Fail : did not get DD_HALINFO size \n");
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- /* Copy it to user mode pointer the data */
- RtlCopyMemory(&pDirectDraw->Hal, &HalInfo, sizeof(DD_HALINFO));
- }
-
- DPRINT1("Trying EnableDirectDraw the driver\n");
-
- success = pDirectDraw->EnableDirectDraw( pDirectDraw->Global.dhpdev,
- &pDirectDraw->DD,
- &pDirectDraw->Surf,
- &pDirectDraw->Pal);
-
- if (!success)
- {
- DPRINT1("EnableDirectDraw call fail\n");
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-
-
-/* NtGdiDdCreateDirectDrawObject is finish and works as it should
- * it maybe have some memory leack or handler leack in this code
- * if you found any case you maybe think it leacks the handler
- * or memory please tell me, before you start fixing the code
- * Magnus Olsen
- */
-
-BOOL STDCALL
-NtGdiDdQueryDirectDrawObject(
- HANDLE hDirectDrawLocal,
- DD_HALINFO *pHalInfo,
- DWORD *pCallBackFlags,
- LPD3DNTHAL_CALLBACKS puD3dCallbacks,
- LPD3DNTHAL_GLOBALDRIVERDATA puD3dDriverData,
- PDD_D3DBUFCALLBACKS puD3dBufferCallbacks,
- LPDDSURFACEDESC puD3dTextureFormats,
- DWORD *puNumHeaps,
- VIDEOMEMORY *puvmList,
- DWORD *puNumFourCC,
- DWORD *puFourCC
-)
-{
- PDD_DIRECTDRAW pDirectDraw;
- NTSTATUS Status = FALSE;
- BOOL Ret=FALSE;
- LPD3DNTHAL_GLOBALDRIVERDATA pD3dDriverData;
-
- if (hDirectDrawLocal == NULL)
- {
- return FALSE;
- }
-
- pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
- GDI_OBJECT_TYPE_DIRECTDRAW);
- if (!pDirectDraw)
- {
- return FALSE;
- }
-
- /*
- * Get pHalInfo
- */
- if (pHalInfo != NULL)
- {
- _SEH_TRY
- {
- ProbeForWrite(pHalInfo, sizeof(DD_HALINFO), 1);
- RtlCopyMemory(pHalInfo,&pDirectDraw->Hal, sizeof(DD_HALINFO));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- else
- {
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /*
- * Get pCallBackFlags
- */
- if (pCallBackFlags != NULL)
- {
- _SEH_TRY
- {
- ProbeForWrite(pCallBackFlags, sizeof(DWORD)*3, 1);
- pCallBackFlags[0]=pDirectDraw->DD.dwFlags;
- pCallBackFlags[1]=pDirectDraw->Surf.dwFlags;
- pCallBackFlags[2]=pDirectDraw->Pal.dwFlags;
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- else
- {
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /*
- * Get puD3dCallbacks
- */
- if ((puD3dCallbacks) &&
- (pDirectDraw->Hal.lpD3DHALCallbacks))
- {
- _SEH_TRY
- {
- ProbeForWrite(puD3dCallbacks, sizeof(D3DNTHAL_CALLBACKS), 1);
- RtlCopyMemory( puD3dCallbacks, pDirectDraw->Hal.lpD3DHALCallbacks, sizeof(
D3DNTHAL_CALLBACKS ) );
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- else
- {
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /*
- * Get lpD3DGlobalDriverData
- */
- if ((puD3dDriverData) &&
- (pDirectDraw->Hal.lpD3DGlobalDriverData != NULL))
- {
- /* Get D3dDriverData */
- _SEH_TRY
- {
- ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1);
- RtlCopyMemory( puD3dDriverData, pDirectDraw->Hal.lpD3DGlobalDriverData,
sizeof(D3DNTHAL_GLOBALDRIVERDATA));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /* Get TextureFormats */
- pD3dDriverData =pDirectDraw->Hal.lpD3DGlobalDriverData;
- if ((puD3dTextureFormats) &&
- (pD3dDriverData->dwNumTextureFormats>0) &&
- (pD3dDriverData->lpTextureFormats))
- {
- DWORD Size = sizeof(DDSURFACEDESC) * pD3dDriverData->dwNumTextureFormats;
- _SEH_TRY
- {
- ProbeForWrite(puD3dTextureFormats, Size, 1);
- RtlCopyMemory( puD3dTextureFormats, pD3dDriverData->lpTextureFormats,
Size);
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- }
- else
- {
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /*Get D3dBufferCallbacks */
- if ( (puD3dBufferCallbacks) &&
- (pDirectDraw->Hal.lpD3DBufCallbacks))
- {
- _SEH_TRY
- {
- ProbeForWrite(puD3dBufferCallbacks, sizeof(DD_D3DBUFCALLBACKS), 1);
- RtlCopyMemory( puD3dBufferCallbacks, pDirectDraw->Hal.lpD3DBufCallbacks,
sizeof(DD_D3DBUFCALLBACKS));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
- }
- else
- {
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- return FALSE;
- }
-
- /* Get puNumFourCC and dwNumFourCC */
- _SEH_TRY
- {
- ProbeForWrite(puNumFourCC, sizeof(DWORD), 1);
- *puNumFourCC = pDirectDraw->dwNumFourCC;
-
- if ((pDirectDraw->pdwFourCC) &&
- (puFourCC))
- {
- ProbeForWrite(puFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC, 1);
- RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) *
pDirectDraw->dwNumFourCC);
- }
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- if(!NT_SUCCESS(Status))
- {
- SetLastNtError(Status);
- }
- else
- {
- Ret = TRUE;
- }
- return Ret;
-}
-
-
-
-
-
-BOOL STDCALL NtGdiDdReenableDirectDrawObject(
+STDCALL NtGdiDdReenableDirectDrawObject(
HANDLE hDirectDrawLocal,
BOOL *pubNewMode
)
@@ -901,36 +454,6 @@
-
-
-/************************************************************************/
-/* SURFACE OBJECT */
-/************************************************************************/
-
-BOOL INTERNAL_CALL
-DDSURF_Cleanup(PVOID pDDSurf)
-{
- /* FIXME: implement
- * PDD_SURFACE pDDSurf = PVOID pDDSurf
- */
-#ifdef DX_DEBUG
- DPRINT1("DDSURF_Cleanup\n");
-#endif
- return TRUE;
-}
-
-
-
-
-
-
-/************************************************************************/
-/* DIRECT DRAW SURFACR END */
-/************************************************************************/
-
-
-
-
DWORD STDCALL NtGdiDdGetAvailDriverMemory(
HANDLE hDirectDrawLocal,
PDD_GETAVAILDRIVERMEMORYDATA puGetAvailDriverMemoryData
Modified: branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c
URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/subsystems/win32…
==============================================================================
--- branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c (original)
+++ branches/reactx/reactos/subsystems/win32/win32k/ntddraw/ddsurf.c Sun Oct 14 23:02:45
2007
@@ -307,5 +307,57 @@
return
pfnDdSetOverlayPosition(hSurfaceSource,hSurfaceDestination,puSetOverlayPositionData);
}
-
-
+/************************************************************************/
+/* This is not part of the ddsurface interface but it have */
+/* deal with the surface */
+/************************************************************************/
+
+
+/************************************************************************/
+/* NtGdiDdAlphaBlt */
+/************************************************************************/
+DWORD
+STDCALL
+NtGdiDdAlphaBlt(HANDLE hSurfaceDest,
+ HANDLE hSurfaceSrc,
+ PDD_BLTDATA puBltData)
+{
+ PGD_DDALPHABLT pfnDdAlphaBlt = NULL;
+ INT i;
+
+ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdAlphaBlt, pfnDdAlphaBlt);
+
+ if (pfnDdAlphaBlt == NULL)
+ {
+ DPRINT1("Warring no pfnDdAlphaBlt");
+ return DDHAL_DRIVER_NOTHANDLED;
+ }
+
+ DPRINT1("Calling on dxg.sys DdAlphaBlt");
+ return pfnDdAlphaBlt(hSurfaceDest,hSurfaceSrc,puBltData);
+}
+
+/************************************************************************/
+/* NtGdiDdAttachSurface */
+/************************************************************************/
+BOOL
+STDCALL
+NtGdiDdAttachSurface(HANDLE hSurfaceFrom,
+ HANDLE hSurfaceTo
+)
+{
+ PGD_DDATTACHSURFACE pfnDdAttachSurface = NULL;
+ INT i;
+
+ DXG_GET_INDEX_FUNCTION(DXG_INDEX_DxDdAttachSurface, pfnDdAttachSurface);
+
+ if (pfnDdAttachSurface == NULL)
+ {
+ DPRINT1("Warring no pfnDdAttachSurface");
+ return DDHAL_DRIVER_NOTHANDLED;
+ }
+
+ DPRINT1("Calling on dxg.sys pfnDdAttachSurface");
+ return pfnDdAttachSurface(hSurfaceFrom,hSurfaceTo);
+}
+