From 122331f60525851b6d91f1fec456eba61c1fca1a Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 4 Jul 2007 13:58:30 +0000 Subject: [PATCH] - Correctly set DN_DRIVER_LOADED flag. - This fixes "i8042prt/kbdclass.sys get installed one more time at each boot". See issue #2330 for more details. svn path=/trunk/; revision=27385 --- reactos/ntoskrnl/io/iomgr/driver.c | 3 +++ reactos/ntoskrnl/io/pnpmgr/pnpmgr.c | 25 +++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/reactos/ntoskrnl/io/iomgr/driver.c b/reactos/ntoskrnl/io/iomgr/driver.c index ac1f5aa56b6..bc0d07e5694 100644 --- a/reactos/ntoskrnl/io/iomgr/driver.c +++ b/reactos/ntoskrnl/io/iomgr/driver.c @@ -1645,6 +1645,9 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName) goto ReleaseCapturedString; } } + + /* We have a driver for this DeviceNode */ + DeviceNode->Flags |= DN_DRIVER_LOADED; } IopInitializeDevice(DeviceNode, DriverObject); diff --git a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c index b7468d71cda..cdcedd9786a 100644 --- a/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -2380,29 +2380,30 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode, if (!NT_SUCCESS(Status)) { /* Driver is not initialized, try to load it */ - Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject); + Status = IopLoadServiceModule(&DeviceNode->ServiceName, &ModuleObject); - if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED) - { + if (NT_SUCCESS(Status) || Status == STATUS_IMAGE_ALREADY_LOADED) + { /* STATUS_IMAGE_ALREADY_LOADED means this driver was loaded by the bootloader */ - if (Status != STATUS_IMAGE_ALREADY_LOADED) - { + if (Status != STATUS_IMAGE_ALREADY_LOADED) + { /* Initialize the driver */ - DeviceNode->Flags |= DN_DRIVER_LOADED; - Status = IopInitializeDriverModule(DeviceNode, ModuleObject, - &DeviceNode->ServiceName, FALSE, &DriverObject); - } - else - { + Status = IopInitializeDriverModule(DeviceNode, ModuleObject, + &DeviceNode->ServiceName, FALSE, &DriverObject); + } + else + { Status = STATUS_SUCCESS; - } + } } } /* Driver is loaded and initialized at this point */ if (NT_SUCCESS(Status)) { + /* We have a driver for this DeviceNode */ + DeviceNode->Flags |= DN_DRIVER_LOADED; /* Attach lower level filter drivers. */ IopAttachFilterDrivers(DeviceNode, TRUE); /* Initialize the function driver for the device node */