mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Don't send multiple IRP_MJ_PNP/IRP_MN_START_DEVICE in case of a device with lower/upper filters
svn path=/trunk/; revision=15347
This commit is contained in:
parent
d0ea6a10df
commit
903edc501a
5 changed files with 59 additions and 31 deletions
|
@ -501,6 +501,10 @@ IopInitializeDevice(
|
|||
PDEVICE_NODE DeviceNode,
|
||||
PDRIVER_OBJECT DriverObject);
|
||||
|
||||
NTSTATUS
|
||||
IopStartDevice(
|
||||
PDEVICE_NODE DeviceNode);
|
||||
|
||||
/* driver.c */
|
||||
|
||||
VOID FASTCALL
|
||||
|
|
|
@ -80,8 +80,6 @@ FASTCALL
|
|||
IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
||||
PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
IO_STACK_LOCATION Stack;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
NTSTATUS Status;
|
||||
|
||||
|
@ -115,26 +113,6 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
|||
|
||||
IopDeviceNodeSetFlag(DeviceNode, DNF_ADDED);
|
||||
|
||||
DPRINT("Sending IRP_MN_START_DEVICE to driver\n");
|
||||
|
||||
/* FIXME: Should be DeviceNode->ResourceList */
|
||||
Stack.Parameters.StartDevice.AllocatedResources = DeviceNode->BootResources;
|
||||
/* FIXME: Should be DeviceNode->ResourceListTranslated */
|
||||
Stack.Parameters.StartDevice.AllocatedResourcesTranslated = DeviceNode->BootResources;
|
||||
|
||||
Status = IopInitiatePnpIrp(
|
||||
Fdo,
|
||||
&IoStatusBlock,
|
||||
IRP_MN_START_DEVICE,
|
||||
&Stack);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IopInitiatePnpIrp() failed\n");
|
||||
ObDereferenceObject(Fdo);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (Fdo->DeviceType == FILE_DEVICE_ACPI)
|
||||
{
|
||||
static BOOLEAN SystemPowerDeviceNodeCreated = FALSE;
|
||||
|
@ -147,23 +125,54 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode,
|
|||
}
|
||||
}
|
||||
|
||||
ObDereferenceObject(Fdo);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
IopStartDevice(
|
||||
PDEVICE_NODE DeviceNode)
|
||||
{
|
||||
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
IO_STACK_LOCATION Stack;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
NTSTATUS Status;
|
||||
|
||||
DPRINT("Sending IRP_MN_START_DEVICE to driver\n");
|
||||
|
||||
Fdo = IoGetAttachedDeviceReference(DeviceNode->PhysicalDeviceObject);
|
||||
/* FIXME: Should be DeviceNode->ResourceList */
|
||||
Stack.Parameters.StartDevice.AllocatedResources = DeviceNode->BootResources;
|
||||
/* FIXME: Should be DeviceNode->ResourceListTranslated */
|
||||
Stack.Parameters.StartDevice.AllocatedResourcesTranslated = DeviceNode->BootResources;
|
||||
|
||||
Status = IopInitiatePnpIrp(
|
||||
Fdo,
|
||||
&IoStatusBlock,
|
||||
IRP_MN_START_DEVICE,
|
||||
&Stack);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("IopInitiatePnpIrp() failed\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Fdo->DeviceType == FILE_DEVICE_BUS_EXTENDER ||
|
||||
Fdo->DeviceType == FILE_DEVICE_ACPI)
|
||||
{
|
||||
DPRINT("Bus extender found\n");
|
||||
|
||||
Status = IopInvalidateDeviceRelations(DeviceNode, BusRelations);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject(Fdo);
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
ObDereferenceObject(Fdo);
|
||||
}
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
ObDereferenceObject(Fdo);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
|
@ -1202,6 +1202,10 @@ IopInitializeBuiltinDriver(
|
|||
}
|
||||
|
||||
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = IopStartDevice(DeviceNode);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -1938,6 +1942,7 @@ NtLoadDriver(IN PUNICODE_STRING DriverServiceName)
|
|||
}
|
||||
|
||||
IopInitializeDevice(DeviceNode, DriverObject);
|
||||
Status = IopStartDevice(DeviceNode);
|
||||
|
||||
ReleaseCapturedString:
|
||||
RtlReleaseCapturedUnicodeString(&CapturedDriverServiceName,
|
||||
|
|
|
@ -378,6 +378,14 @@ IoInit2(BOOLEAN BootLog)
|
|||
return;
|
||||
}
|
||||
|
||||
Status = IopStartDevice(DeviceNode);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
IopFreeDeviceNode(DeviceNode);
|
||||
CPRINT("IopInitializeDevice() failed with status (%x)\n", Status);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize PnP root releations
|
||||
*/
|
||||
|
|
|
@ -1523,9 +1523,11 @@ IopActionInitChildServices(
|
|||
Status = IopInitializeDevice(DeviceNode, DriverObject);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
||||
/* Attach upper level filter drivers. */
|
||||
IopAttachFilterDrivers(DeviceNode, FALSE);
|
||||
IopDeviceNodeSetFlag(DeviceNode, DNF_STARTED);
|
||||
|
||||
Status = IopStartDevice(DeviceNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue