mirror of
https://github.com/reactos/reactos.git
synced 2024-07-13 16:15:05 +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->Common.IsFDO = TRUE;
|
||||
|
||||
DeviceExtension->Common.Ldo =
|
||||
IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
|
||||
//DeviceExtension->Common.Ldo =
|
||||
// IoAttachDeviceToDeviceStack(Fdo, PhysicalDeviceObject);
|
||||
|
||||
DeviceExtension->State = dsStopped;
|
||||
|
||||
|
|
|
@ -696,14 +696,15 @@ static NTSTATUS STDCALL I8042AddDevice(PDRIVER_OBJECT DriverObject,
|
|||
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 @@ static NTSTATUS STDCALL I8042AddDevice(PDRIVER_OBJECT DriverObject,
|
|||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
IoAttachDeviceToDeviceStack(Fdo, Pdo);
|
||||
|
||||
DevExt = Fdo->DeviceExtension;
|
||||
|
||||
RtlZeroMemory(DevExt, sizeof(DEVICE_EXTENSION));
|
||||
|
|
|
@ -482,6 +482,9 @@ ClassAddDevice(
|
|||
|
||||
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
||||
|
||||
if (Pdo == NULL)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||
|
||||
/* Create new device object */
|
||||
|
|
|
@ -472,6 +472,9 @@ ClassAddDevice(
|
|||
|
||||
DPRINT("ClassAddDevice called. Pdo = 0x%p\n", Pdo);
|
||||
|
||||
if (Pdo == NULL)
|
||||
return STATUS_SUCCESS;
|
||||
|
||||
DriverExtension = IoGetDriverObjectExtension(DriverObject, DriverObject);
|
||||
|
||||
/* Create new device object */
|
||||
|
|
|
@ -72,6 +72,7 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
|||
{
|
||||
PDEVICE_OBJECT Fdo;
|
||||
NTSTATUS Status;
|
||||
BOOLEAN IsPnpDriver = FALSE;
|
||||
|
||||
if (DriverObject->DriverExtension->AddDevice)
|
||||
{
|
||||
|
@ -83,39 +84,43 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
|||
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);
|
||||
|
||||
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;
|
||||
|
||||
/* There can be only one system power device */
|
||||
if (!SystemPowerDeviceNodeCreated)
|
||||
{
|
||||
PopSystemPowerDeviceNode = DeviceNode;
|
||||
SystemPowerDeviceNodeCreated = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ObDereferenceObject(Fdo);
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -564,7 +569,7 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue