Author: greatlrd
Date: Mon Apr 9 15:45:25 2007
New Revision: 26293
URL:
http://svn.reactos.org/svn/reactos?rev=26293&view=rev
Log:
NtGdiDdCanCreateSurface
1. fixed the input of DDSURFACEDESC2 so it been convert to DDSURFACEDESC.
2. fixed varius bsod in ros 0.3.1
3. fixed some return code.
Modified:
trunk/reactos/subsystems/win32/win32k/ntddraw/dd.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 Mon Apr 9 15:45:25 2007
@@ -449,41 +449,60 @@
)
{
DWORD ddRVal = DDHAL_DRIVER_NOTHANDLED;
- DD_CANCREATESURFACEDATA CanCreateSurfaceData;
- DDSURFACEDESC desc;
- NTSTATUS Status = FALSE;
- PDD_DIRECTDRAW pDirectDraw = NULL;
-
- DPRINT1("NtGdiDdCanCreateSurface\n");
-
- _SEH_TRY
- {
- ProbeForRead(puCanCreateSurfaceData, sizeof(DD_CANCREATESURFACEDATA), 1);
- RtlCopyMemory(&CanCreateSurfaceData,puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA));
- ProbeForRead(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
- RtlCopyMemory(&desc,puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC));
- }
- _SEH_HANDLE
- {
- Status = _SEH_GetExceptionCode();
- }
- _SEH_END;
-
- if(NT_SUCCESS(Status))
- {
- pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
- if (pDirectDraw != NULL)
- {
- if (pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE)
+
+
+
+ if ((puCanCreateSurfaceData) &&
+ (hDirectDrawLocal))
+ {
+ DDSURFACEDESC desc;
+ DWORD descSize = 0;
+ NTSTATUS Status = FALSE;
+ PDD_DIRECTDRAW pDirectDraw = NULL;
+ DD_CANCREATESURFACEDATA CanCreateSurfaceData;
+ LPDDHAL_CANCREATESURFACEDATA pCanCreateSurfaceData =
(LPDDHAL_CANCREATESURFACEDATA)puCanCreateSurfaceData;
+
+ RtlZeroMemory(&CanCreateSurfaceData,sizeof(DDSURFACEDESC));
+ RtlZeroMemory(&desc,sizeof(DDSURFACEDESC));
+
+ _SEH_TRY
+ {
+ ProbeForRead(pCanCreateSurfaceData, sizeof(DDHAL_CANCREATESURFACEDATA), 1);
+ CanCreateSurfaceData.bIsDifferentPixelFormat =
pCanCreateSurfaceData->bIsDifferentPixelFormat;
+
+ if (pCanCreateSurfaceData->lpDDSurfaceDesc)
+ {
+ ProbeForRead(pCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
+ RtlCopyMemory(&desc,pCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC));
+
+ /*if it was DDSURFACEDESC2 been pass down */
+ descSize = desc.dwSize;
+ desc.dwSize = sizeof(DDSURFACEDESC);
+ }
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+
+ if ((NT_SUCCESS(Status)) &&
+ (desc.dwSize != 0))
+ {
+ pDirectDraw = GDIOBJ_LockObj(DdHandleTable, hDirectDrawLocal,
GDI_OBJECT_TYPE_DIRECTDRAW);
+ if ((pDirectDraw) &&
+ (pDirectDraw->DD.dwFlags & DDHAL_CB32_CANCREATESURFACE))
{
CanCreateSurfaceData.ddRVal = DDERR_GENERIC;
CanCreateSurfaceData.lpDD = &pDirectDraw->Global;
CanCreateSurfaceData.lpDDSurfaceDesc = &desc;
ddRVal = pDirectDraw->DD.CanCreateSurface(&CanCreateSurfaceData);
+ /*if it was DDSURFACEDESC2 been pass down */
+ desc.dwSize = descSize;
_SEH_TRY
{
- ProbeForWrite(puCanCreateSurfaceData,
sizeof(DD_CANCREATESURFACEDATA), 1);
+ ProbeForWrite(puCanCreateSurfaceData,
sizeof(DDHAL_CANCREATESURFACEDATA), 1);
puCanCreateSurfaceData->ddRVal = CanCreateSurfaceData.ddRVal;
ProbeForWrite(puCanCreateSurfaceData->lpDDSurfaceDesc,
sizeof(DDSURFACEDESC), 1);
@@ -499,7 +518,6 @@
GDIOBJ_UnlockObjByPtr(DdHandleTable, pDirectDraw);
}
}
-
return ddRVal;
}