https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0ce59851096c10fdc82ea…
commit 0ce59851096c10fdc82ea9e4dd483d1105a48a96
Author: Hervé Poussineau <hpoussin(a)reactos.org>
AuthorDate: Sun Apr 17 13:52:10 2022 +0200
Commit: Hervé Poussineau <hpoussin(a)reactos.org>
CommitDate: Sun Apr 17 16:20:04 2022 +0200
[WIN32SS] Do not call DrvEnableDriver/DrvDisableDriver for LDEV_IMAGE types
---
win32ss/gdi/eng/ldevobj.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/win32ss/gdi/eng/ldevobj.c b/win32ss/gdi/eng/ldevobj.c
index 03b9223e4a9..0051a4c3842 100644
--- a/win32ss/gdi/eng/ldevobj.c
+++ b/win32ss/gdi/eng/ldevobj.c
@@ -174,6 +174,9 @@ LDEVOBJ_bEnableDriver(
ASSERT(pldev);
ASSERT(pldev->cRefs == 0);
+ if (pldev->ldevtype == LDEV_IMAGE)
+ return TRUE;
+
/* Call the drivers DrvEnableDriver function */
RtlZeroMemory(&ded, sizeof(ded));
if (!pfnEnableDriver(GDI_ENGINE_VERSION, sizeof(ded), &ded))
@@ -205,6 +208,9 @@ LDEVOBJ_vDisableDriver(
TRACE("LDEVOBJ_vDisableDriver('%wZ')\n",
&pldev->pGdiDriverInfo->DriverName);
+ if (pldev->ldevtype == LDEV_IMAGE)
+ return;
+
if (pldev->pfn.DisableDriver)
{
/* Call the unload function */
@@ -430,20 +436,16 @@ LDEVOBJ_pLoadDriver(
goto leave;
}
- /* Shall we load a driver? */
- if (ldevtype != LDEV_IMAGE)
+ /* Load the driver */
+ if (!LDEVOBJ_bEnableDriver(pldev, pldev->pGdiDriverInfo->EntryPoint))
{
- /* Load the driver */
- if (!LDEVOBJ_bEnableDriver(pldev, pldev->pGdiDriverInfo->EntryPoint))
- {
- ERR("LDEVOBJ_bEnableDriver failed\n");
+ ERR("LDEVOBJ_bEnableDriver failed\n");
- /* Unload the image. */
- LDEVOBJ_bUnloadImage(pldev);
- LDEVOBJ_vFreeLDEV(pldev);
- pldev = NULL;
- goto leave;
- }
+ /* Unload the image. */
+ LDEVOBJ_bUnloadImage(pldev);
+ LDEVOBJ_vFreeLDEV(pldev);
+ pldev = NULL;
+ goto leave;
}
/* Insert the LDEV into the global list */