When a driver is a legacy driver, call its AddDevice function with a
NULL Pdo
Modified: trunk/reactos/drivers/bus/acpi/ospm/acpisys.c
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
Modified: trunk/reactos/ntoskrnl/io/device.c
_____
Modified: trunk/reactos/drivers/bus/acpi/ospm/acpisys.c
--- trunk/reactos/drivers/bus/acpi/ospm/acpisys.c 2005-11-08
17:14:19 UTC (rev 19058)
+++ trunk/reactos/drivers/bus/acpi/ospm/acpisys.c 2005-11-08
17:20:58 UTC (rev 19059)
@@ -143,8 +143,8 @@
DeviceExtension->Pdo = PhysicalDeviceObject;
DeviceExtension->Common.IsFDO = TRUE;
- DeviceExtension->Common.Ldo =
- IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
+ //DeviceExtension->Common.Ldo =
+ // IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
DeviceExtension->State = dsStopped;
_____
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
--- trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-11-08
17:14:19 UTC (rev 19058)
+++ trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-11-08
17:20:58 UTC (rev 19059)
@@ -696,14 +696,15 @@
PDEVICE_EXTENSION DevExt;
PFDO_DEVICE_EXTENSION FdoDevExt;
PDEVICE_OBJECT Fdo;
- static BOOLEAN AlreadyAdded = FALSE;
DPRINT("I8042AddDevice\n");
- /* HACK! */
- if (AlreadyAdded)
+ if (Pdo != NULL)
+ {
+ /* Device detected by pnpmgr. Ignore it, as we already
have
+ * detected the keyboard and mouse at first call */
return STATUS_UNSUCCESSFUL;
- AlreadyAdded = TRUE;
+ }
Status = IoCreateDevice(DriverObject,
sizeof(DEVICE_EXTENSION),
@@ -716,8 +717,6 @@
if (!NT_SUCCESS(Status))
return Status;
- IoAttachDeviceToDeviceStack(Fdo, Pdo);
-
DevExt = Fdo->DeviceExtension;
RtlZeroMemory(DevExt, sizeof(DEVICE_EXTENSION));
_____
Modified: trunk/reactos/drivers/input/kbdclass/kbdclass.c
--- trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-08
17:14:19 UTC (rev 19058)
+++ trunk/reactos/drivers/input/kbdclass/kbdclass.c 2005-11-08
17:20:58 UTC (rev 19059)
@@ -482,6 +482,9 @@
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
+ if (Pdo == NULL)
+ return STATUS_SUCCESS;
+
DriverExtension = IoGetDriverObjectExtension(DriverObject,
DriverObject);
/* Create new device object */
_____
Modified: trunk/reactos/drivers/input/mouclass/mouclass.c
--- trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-08
17:14:19 UTC (rev 19058)
+++ trunk/reactos/drivers/input/mouclass/mouclass.c 2005-11-08
17:20:58 UTC (rev 19059)
@@ -472,6 +472,9 @@
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
+ if (Pdo == NULL)
+ return STATUS_SUCCESS;
+
DriverExtension = IoGetDriverObjectExtension(DriverObject,
DriverObject);
/* Create new device object */
_____
Modified: trunk/reactos/ntoskrnl/io/device.c
--- trunk/reactos/ntoskrnl/io/device.c 2005-11-08 17:14:19 UTC (rev
19058)
+++ trunk/reactos/ntoskrnl/io/device.c 2005-11-08 17:20:58 UTC (rev
19059)
@@ -72,6 +72,7 @@
{
PDEVICE_OBJECT Fdo;
NTSTATUS Status;
+ BOOLEAN IsPnpDriver = FALSE;
if (DriverObject->DriverExtension->AddDevice)
{
@@ -83,39 +84,43 @@
DPRINT("Calling driver AddDevice entrypoint at %08lx\n",
DriverObject->DriverExtension->AddDevice);
+ IsPnpDriver = !IopDeviceNodeHasFlag(DeviceNode,
DNF_LEGACY_DRIVER);
Status = DriverObject->DriverExtension->AddDevice(
- DriverObject, DeviceNode->PhysicalDeviceObject);
+ DriverObject, IsPnpDriver ? DeviceNode->PhysicalDeviceObject :
NULL);
if (!NT_SUCCESS(Status))
{
return Status;
}
- Fdo =
IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
-
- if (Fdo == DeviceNode->PhysicalDeviceObject)
+ if (IsPnpDriver)
{
- /* FIXME: What do we do? Unload the driver or just disable the
device? */
- DbgPrint("An FDO was not attached\n");
- IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
- return STATUS_UNSUCCESSFUL;
- }
+ Fdo =
IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
- IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
+ if (Fdo == DeviceNode->PhysicalDeviceObject)
+ {
+ /* FIXME: What do we do? Unload the driver or just disable
the device? */
+ DbgPrint("An FDO was not attached\n");
+ IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
+ return STATUS_UNSUCCESSFUL;
+ }
- if (Fdo->DeviceType == FILE_DEVICE_ACPI)
- {
- static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
+ if (Fdo->DeviceType == FILE_DEVICE_ACPI)
+ {
+ static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
- /* There can be only one system power device */
- if (!SystemPowerDeviceNodeCreated)
- {
- PopSystemPowerDeviceNode = DeviceNode;
- SystemPowerDeviceNodeCreated = TRUE;
+ /* There can be only one system power device */
+ if (!SystemPowerDeviceNodeCreated)
+ {
+ PopSystemPowerDeviceNode = DeviceNode;
+ SystemPowerDeviceNodeCreated = TRUE;
+ }
}
+
+ ObDereferenceObject(Fdo);
}
- ObDereferenceObject(Fdo);
+ IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
}
return STATUS_SUCCESS;
@@ -564,7 +569,7 @@
if (!NT_SUCCESS(Status))
{
- DPRINT1("Cannot insert Device Object into Handle Table\n");
+ DPRINT1("Cannot insert Device Object into Handle Table (status
0x%08lx)\n", Status);
*DeviceObject = NULL;
return Status;
}
Show replies by date