https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8aff2c9de7cf45dd306e4…
commit 8aff2c9de7cf45dd306e447b0c27a379f827fe4c
Author: Victor Perevertkin <victor.perevertkin(a)reactos.org>
AuthorDate: Wed Jun 24 19:37:20 2020 +0300
Commit: Victor Perevertkin <victor.perevertkin(a)reactos.org>
CommitDate: Fri Aug 21 08:19:53 2020 +0300
[HALX86] Report HAL root device to the stack before passing it to the driver
PnP manager now correctly delays device actions if needed, so this can
be safely done as a one operation (IoReportDetectedDevice itself creates
a PDO for us if not passed)
CORE-10456
---
hal/halx86/acpi/halpnpdd.c | 27 +++++++++------------------
hal/halx86/legacy/halpnpdd.c | 27 +++++++++------------------
2 files changed, 18 insertions(+), 36 deletions(-)
diff --git a/hal/halx86/acpi/halpnpdd.c b/hal/halx86/acpi/halpnpdd.c
index 0719e7ebcb0..beec1190f76 100644
--- a/hal/halx86/acpi/halpnpdd.c
+++ b/hal/halx86/acpi/halpnpdd.c
@@ -862,14 +862,15 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject,
DriverObject->MajorFunction[IRP_MJ_POWER] = HalpDispatchPower;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HalpDispatchWmi;
- /* Create the PDO */
- Status = IoCreateDevice(DriverObject,
- 0,
- NULL,
- FILE_DEVICE_CONTROLLER,
- 0,
- FALSE,
- &TargetDevice);
+ /* Create the PDO and tell the PnP manager about us*/
+ Status = IoReportDetectedDevice(DriverObject,
+ InterfaceTypeUndefined,
+ -1,
+ -1,
+ NULL,
+ NULL,
+ FALSE,
+ &TargetDevice);
if (!NT_SUCCESS(Status))
return Status;
@@ -883,16 +884,6 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject,
return Status;
}
- /* Tell the PnP manager about us */
- Status = IoReportDetectedDevice(DriverObject,
- InterfaceTypeUndefined,
- -1,
- -1,
- NULL,
- NULL,
- FALSE,
- &TargetDevice);
-
/* Return to kernel */
return Status;
}
diff --git a/hal/halx86/legacy/halpnpdd.c b/hal/halx86/legacy/halpnpdd.c
index 5f84e03a684..4bf1ff3f18d 100644
--- a/hal/halx86/legacy/halpnpdd.c
+++ b/hal/halx86/legacy/halpnpdd.c
@@ -888,14 +888,15 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject,
DriverObject->MajorFunction[IRP_MJ_POWER] = HalpDispatchPower;
DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = HalpDispatchWmi;
- /* Create the PDO */
- Status = IoCreateDevice(DriverObject,
- 0,
- NULL,
- FILE_DEVICE_CONTROLLER,
- 0,
- FALSE,
- &TargetDevice);
+ /* Create the PDO and tell the PnP manager about us*/
+ Status = IoReportDetectedDevice(DriverObject,
+ InterfaceTypeUndefined,
+ -1,
+ -1,
+ NULL,
+ NULL,
+ FALSE,
+ &TargetDevice);
if (!NT_SUCCESS(Status))
return Status;
@@ -909,16 +910,6 @@ HalpDriverEntry(IN PDRIVER_OBJECT DriverObject,
return Status;
}
- /* Tell the PnP manager about us */
- Status = IoReportDetectedDevice(DriverObject,
- InterfaceTypeUndefined,
- -1,
- -1,
- NULL,
- NULL,
- FALSE,
- &TargetDevice);
-
/* Return to kernel */
return Status;
}