Author: tkreuzer Date: Mon Apr 21 17:09:27 2014 New Revision: 62855
URL: http://svn.reactos.org/svn/reactos?rev=62855&view=rev Log: [WIN32K] Do not ignore failure when calling DrvEnablePDEV and properly handle a failure in PDEVOBJ_bEnablePDEV instead of ASSERTing. Properly cleanup the PDEV after failure, check if the PDEV was enabled before calling DrvDisablePDEV. Fixes some crashes with VBox driver.
Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c
Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Mon Apr 21 17:09:27 2014 @@ -94,8 +94,12 @@ PALETTE_ShareUnlockPalette(ppdev->ppalSurf); }
- /* Disable PDEV */ - ppdev->pfn.DisablePDEV(ppdev->dhpdev); + /* Check if the PDEV was enabled */ + if (ppdev->dhpdev != NULL) + { + /* Disable the PDEV */ + ppdev->pfn.DisablePDEV(ppdev->dhpdev); + }
/* Remove it from list */ if( ppdev == gppdevList ) @@ -155,6 +159,11 @@ (HDEV)ppdev, ppdev->pGraphicsDevice->pwszDescription, ppdev->pGraphicsDevice->DeviceObject); + if (ppdev->dhpdev == NULL) + { + DPRINT1("Failed to enable PDEV\n"); + return FALSE; + }
/* Fix up some values */ if (ppdev->gdiinfo.ulLogPixelsX == 0) @@ -337,7 +346,8 @@ if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL)) { DPRINT1("Failed to enable PDEV!\n"); - ASSERT(FALSE); + PDEVOBJ_vRelease(ppdev); + return NULL; }
/* FIXME: this must be done in a better way */