From 4a5a775bf650999404fbe0d3a6bfbf8c1862a4e8 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sat, 21 Mar 2015 16:29:40 +0000 Subject: [PATCH] [WIN32K] Gracefully handle failure in DrvEnableSurface. patch by Timo Kreuzer svn path=/trunk/; revision=66851 --- reactos/win32ss/gdi/eng/pdevobj.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/reactos/win32ss/gdi/eng/pdevobj.c b/reactos/win32ss/gdi/eng/pdevobj.c index 32ba8eb663e..39d8bf95c93 100644 --- a/reactos/win32ss/gdi/eng/pdevobj.c +++ b/reactos/win32ss/gdi/eng/pdevobj.c @@ -217,9 +217,15 @@ PDEVOBJ_pSurface( { /* Call the drivers DrvEnableSurface */ hsurf = ppdev->pldev->pfn.EnableSurface(ppdev->dhpdev); + if (hsurf== NULL) + { + DPRINT1("Failed to create PDEV surface!"); + return NULL; + } /* Get a reference to the surface */ ppdev->pSurface = SURFACE_ShareLockSurface(hsurf); + NT_ASSERT(ppdev->pSurface != NULL); } /* Increment reference count */ @@ -469,7 +475,7 @@ PDEVOBJ_bSwitchMode( pSurface = PDEVOBJ_pSurface(ppdevTmp); if (!pSurface) { - DPRINT1("DrvEnableSurface failed\n"); + DPRINT1("PDEVOBJ_pSurface failed\n"); goto leave; }