Author: greatlrd
Date: Sat Apr 7 19:10:01 2007
New Revision: 26278
URL:
http://svn.reactos.org/svn/reactos?rev=26278&view=rev
Log:
tested NtGdiDdGetScanLine not suppored by vmware drv did use another 3d party driver for
the test.
fixed some werid loop of pseh, all code are tested in 0.3.1 for I do not have a working
vmware drv
for the driver. NtGdiDdGetScanLine is working same as windows 2000 now.
Modified:
trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c
trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntddraw/dd.c Sat Apr 7 19:10:01 2007
@@ -453,8 +453,6 @@
{
ProbeForRead(puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA), 1);
RtlCopyMemory(&CanCreateSurfaceData,puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA));
-
- /* FIXME can be version 2 of DDSURFACEDESC */
ProbeForRead(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
RtlCopyMemory(&desc,puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC));
}
@@ -481,7 +479,6 @@
ProbeForWrite(puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA), 1);
puCanCreateSurfaceData->ddRVal = CanCreateSurfaceData.ddRVal;
- /* FIXME can be version 2 of DDSURFACEDESC */
ProbeForWrite(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
RtlCopyMemory(puCanCreateSurfaceData->lpDDSurfaceDesc,&desc,
sizeof(DDSURFACEDESC));
@@ -501,53 +498,55 @@
/************************************************************************/
/* GetScanLine */
-/* status : not implement, was undoc in msdn now it is doc */
+/* status : is now documented in MSDN and I checked the code it works */
+/* like windows 2000 */
/************************************************************************/
DWORD STDCALL
NtGdiDdGetScanLine( HANDLE hDirectDrawLocal, PDD_GETSCANLINEDATA puGetScanLineData)
{
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
DD_GETSCANLINEDATA GetScanLineData;
- PDD_DIRECTDRAW pDirectDraw;
+ PDD_DIRECTDRAW pDirectDraw = NULL;
NTSTATUS Status = FALSE;
-
- DPRINT1("NtGdiDdGetScanLine\n");
-
- _SEH_TRY
- {
- ProbeForRead(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1);
- RtlCopyMemory(&GetScanLineData,puGetScanLineData,
sizeof(DD_GETSCANLINEDATA));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- if(NT_SUCCESS(Status))
+ LPDDHAL_GETSCANLINEDATA ourpuGetScanLineData;
+
+ if (hDirectDrawLocal)
{
pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);;
- if (pDirectDraw != NULL)
- {
- if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)
- {
- GetScanLineData.ddRVal = DDERR_GENERIC;
- GetScanLineData.lpDD = &pDirectDraw->Global;
- ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData);
-
- _SEH_TRY
- {
- ProbeForWrite(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1);
- puGetScanLineData->dwScanLine = GetScanLineData.dwScanLine;
- puGetScanLineData->ddRVal = GetScanLineData.ddRVal;
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
- }
- GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
- }
+ }
+
+ if (pDirectDraw != NULL)
+ {
+ DPRINT1("GetScanLine\n");
+ if (pDirectDraw->DD.dwFlags & DDHAL_CB32_GETSCANLINE)
+ {
+ RtlZeroMemory(&GetScanLineData,sizeof(DD_GETSCANLINEDATA));
+ GetScanLineData.ddRVal = DDERR_GENERIC;
+ GetScanLineData.lpDD = &pDirectDraw->Global;
+ ddRVal = pDirectDraw->DD.GetScanLine(&GetScanLineData);
+
+ DPRINT1("GetScanLine\n");
+ _SEH_TRY
+ {
+ ProbeForWrite(puGetScanLineData, sizeof(DD_GETSCANLINEDATA), 1);
+ ourpuGetScanLineData = (LPDDHAL_GETSCANLINEDATA)puGetScanLineData;
+ ourpuGetScanLineData->dwScanLine = GetScanLineData.dwScanLine;
+ ourpuGetScanLineData->ddRVal = GetScanLineData.ddRVal;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("GetScanLine\n");
+ ddRVal = DDHAL_DRIVER_NOTHANDLED;
+ }
+ }
+
+ GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
return ddRVal;
Modified: trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntddraw/ddraw.c Sat Apr 7 19:10:01 2007
@@ -365,21 +365,74 @@
/*
* Get puD3dCallbacks
*/
- if (puD3dCallbacks != NULL)
- {
- if (pDirectDraw->Hal.lpD3DHALCallbacks != NULL)
- {
+ 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(puD3dCallbacks, sizeof(D3DNTHAL_CALLBACKS), 1);
- RtlCopyMemory( puD3dCallbacks, pDirectDraw->Hal.lpD3DHALCallbacks,
- sizeof( D3DNTHAL_CALLBACKS ) );
+ ProbeForWrite(puD3dTextureFormats, Size, 1);
+ RtlCopyMemory( puD3dTextureFormats, pD3dDriverData->lpTextureFormats,
Size);
}
_SEH_HANDLE
{
Status = _SEH_GetExceptionCode();
}
_SEH_END;
+
if(!NT_SUCCESS(Status))
{
SetLastNtError(Status);
@@ -394,43 +447,25 @@
return FALSE;
}
- /*
- * Get lpD3DGlobalDriverData
- */
- if (puD3dDriverData != NULL)
- {
- if (pDirectDraw->Hal.lpD3DGlobalDriverData != NULL)
- {
- _SEH_TRY
- {
- /* Get puD3dDriverData */
- ProbeForWrite(puD3dDriverData, sizeof(D3DNTHAL_GLOBALDRIVERDATA), 1);
- RtlCopyMemory( puD3dDriverData,
pDirectDraw->Hal.lpD3DGlobalDriverData,
- sizeof(D3DNTHAL_GLOBALDRIVERDATA));
-
- /* Get puD3dTextureFormats */
- pD3dDriverData =pDirectDraw->Hal.lpD3DGlobalDriverData;
- if (puD3dTextureFormats != NULL)
- {
- if ((pD3dDriverData->dwNumTextureFormats) &&
(pD3dDriverData->lpTextureFormats))
- {
- DWORD Size =sizeof(DDSURFACEDESC) *
pD3dDriverData->dwNumTextureFormats;
- 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;
- }
+ /*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
@@ -439,53 +474,17 @@
return FALSE;
}
- /*
- * Get puD3dBufferCallbacks
- */
- if (puD3dBufferCallbacks != NULL)
- {
- if (pDirectDraw->Hal.lpD3DBufCallbacks != NULL)
- {
- _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
{
- /* Waring :
- * In Windows 2000 puvmList and puNumHeaps does not export from
- * NtGdiDdQueryDirectDrawObject, I did remove the puvmList code
- * I wrote. See MSDN and my private note about this matter,
- * the private note will be in my book as well when it comes.
- */
ProbeForWrite(puNumFourCC, sizeof(DWORD), 1);
*puNumFourCC = pDirectDraw->dwNumFourCC;
- if ((pDirectDraw->pdwFourCC != NULL) && (puFourCC != NULL))
+ if ((pDirectDraw->pdwFourCC) &&
+ (puFourCC))
{
ProbeForWrite(puFourCC, sizeof(DWORD) * pDirectDraw->dwNumFourCC, 1);
- RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) *
pDirectDraw->dwNumFourCC);
+ RtlCopyMemory( puFourCC, pDirectDraw->pdwFourCC, sizeof(DWORD) *
pDirectDraw->dwNumFourCC);
}
}
_SEH_HANDLE
@@ -511,6 +510,11 @@
NtGdiDdDeleteDirectDrawObject( HANDLE hDirectDrawLocal)
{
DPRINT1("NtGdiDdDeleteDirectDrawObject\n");
+ if (hDirectDrawLocal == NULL)
+ {
+ return FALSE;
+ }
+
return GDIOBJ_FreeObj(DdHandleTable, hDirectDrawLocal, GDI_OBJECT_TYPE_DIRECTDRAW);
}