mirror of
https://github.com/reactos/reactos.git
synced 2024-08-11 21:58:10 +00:00
When a driver is a legacy driver, call its AddDevice function with a NULL Pdo
svn path=/trunk/; revision=19059
This commit is contained in:
parent
f2ff67ecde
commit
1974f400e3
|
@ -143,8 +143,8 @@ ACPIAddDevice(
|
||||||
DeviceExtension->Pdo = PhysicalDeviceObject;
|
DeviceExtension->Pdo = PhysicalDeviceObject;
|
||||||
DeviceExtension->Common.IsFDO = TRUE;
|
DeviceExtension->Common.IsFDO = TRUE;
|
||||||
|
|
||||||
DeviceExtension->Common.Ldo =
|
//DeviceExtension->Common.Ldo =
|
||||||
IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
|
// IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
|
||||||
|
|
||||||
DeviceExtension->State = dsStopped;
|
DeviceExtension->State = dsStopped;
|
||||||
|
|
||||||
|
|
|
@ -696,14 +696,15 @@ static NTSTATUS STDCALL I8042AddDevice(PDRIVER_OBJECT DriverObject,
|
||||||
PDEVICE_EXTENSION DevExt;
|
PDEVICE_EXTENSION DevExt;
|
||||||
PFDO_DEVICE_EXTENSION FdoDevExt;
|
PFDO_DEVICE_EXTENSION FdoDevExt;
|
||||||
PDEVICE_OBJECT Fdo;
|
PDEVICE_OBJECT Fdo;
|
||||||
static BOOLEAN AlreadyAdded = FALSE;
|
|
||||||
|
|
||||||
DPRINT("I8042AddDevice\n");
|
DPRINT("I8042AddDevice\n");
|
||||||
|
|
||||||
/* HACK! */
|
if (Pdo != NULL)
|
||||||
if (AlreadyAdded)
|
{
|
||||||
|
/* Device detected by pnpmgr. Ignore it, as we already have
|
||||||
|
* detected the keyboard and mouse at first call */
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
AlreadyAdded = TRUE;
|
}
|
||||||
|
|
||||||
Status = IoCreateDevice(DriverObject,
|
Status = IoCreateDevice(DriverObject,
|
||||||
sizeof(DEVICE_EXTENSION),
|
sizeof(DEVICE_EXTENSION),
|
||||||
|
@ -716,8 +717,6 @@ static NTSTATUS STDCALL I8042AddDevice(PDRIVER_OBJECT DriverObject,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
IoAttachDeviceToDeviceStack(Fdo, Pdo);
|
|
||||||
|
|
||||||
DevExt = Fdo->DeviceExtension;
|
DevExt = Fdo->DeviceExtension;
|
||||||
|
|
||||||
RtlZeroMemory(DevExt, sizeof(DEVICE_EXTENSION));
|
RtlZeroMemory(DevExt, sizeof(DEVICE_EXTENSION));
|
||||||
|
|
|
@ -482,6 +482,9 @@ ClassAddDevice(
|
||||||
|
|
||||||
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
||||||
|
|
||||||
|
if (Pdo == NULL)
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||||
|
|
||||||
/* Create new device object */
|
/* Create new device object */
|
||||||
|
|
|
@ -472,6 +472,9 @@ ClassAddDevice(
|
||||||
|
|
||||||
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
||||||
|
|
||||||
|
if (Pdo == NULL)
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||||
|
|
||||||
/* Create new device object */
|
/* Create new device object */
|
||||||
|
|
|
@ -72,6 +72,7 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT Fdo;
|
PDEVICE_OBJECT Fdo;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
BOOLEAN IsPnpDriver = FALSE;
|
||||||
|
|
||||||
if (DriverObject->DriverExtension->AddDevice)
|
if (DriverObject->DriverExtension->AddDevice)
|
||||||
{
|
{
|
||||||
|
@ -83,39 +84,43 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||||
DPRINT("Calling driver AddDevice entrypoint at %08lx\n",
|
DPRINT("Calling driver AddDevice entrypoint at %08lx\n",
|
||||||
DriverObject->DriverExtension->AddDevice);
|
DriverObject->DriverExtension->AddDevice);
|
||||||
|
|
||||||
|
IsPnpDriver = !IopDeviceNodeHasFlag(DeviceNode, DNF_LEGACY_DRIVER);
|
||||||
Status = DriverObject->DriverExtension->AddDevice(
|
Status = DriverObject->DriverExtension->AddDevice(
|
||||||
DriverObject, DeviceNode->PhysicalDeviceObject);
|
DriverObject, IsPnpDriver ? DeviceNode->PhysicalDeviceObject : NULL);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
|
if (IsPnpDriver)
|
||||||
|
|
||||||
if (Fdo == DeviceNode->PhysicalDeviceObject)
|
|
||||||
{
|
{
|
||||||
/* FIXME: What do we do? Unload the driver or just disable the device? */
|
Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
|
||||||
DbgPrint("An FDO was not attached\n");
|
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED);
|
if (Fdo == DeviceNode->PhysicalDeviceObject)
|
||||||
return STATUS_UNSUCCESSFUL;
|
{
|
||||||
|
/* 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;
|
||||||
|
|
||||||
|
/* There can be only one system power device */
|
||||||
|
if (!SystemPowerDeviceNodeCreated)
|
||||||
|
{
|
||||||
|
PopSystemPowerDeviceNode = DeviceNode;
|
||||||
|
SystemPowerDeviceNodeCreated = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObDereferenceObject(Fdo);
|
||||||
}
|
}
|
||||||
|
|
||||||
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
|
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
|
||||||
|
|
||||||
if (Fdo->DeviceType == FILE_DEVICE_ACPI)
|
|
||||||
{
|
|
||||||
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
|
||||||
|
|
||||||
/* There can be only one system power device */
|
|
||||||
if (!SystemPowerDeviceNodeCreated)
|
|
||||||
{
|
|
||||||
PopSystemPowerDeviceNode = DeviceNode;
|
|
||||||
SystemPowerDeviceNodeCreated = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ObDereferenceObject(Fdo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -564,7 +569,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
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;
|
*DeviceObject = NULL;
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue