[NTOSKRNL]

- Pass IRPs down to the root PDO if we don't handle it
- Don't complain if we get an IRP that we don't expect. We are the parent bus driver for the device so we are responsible for completing those IRPs.

svn path=/trunk/; revision=46707
This commit is contained in:
Cameron Gutman 2010-04-04 00:33:19 +00:00
parent d6d462f203
commit 28971e63f3

View File

@ -677,27 +677,26 @@ PnpRootFdoPnpControl(
if (NT_SUCCESS(Status))
DeviceExtension->State = dsStarted;
}
break;
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
case IRP_MN_STOP_DEVICE:
DPRINT("IRP_MJ_PNP / IRP_MN_STOP_DEVICE\n");
/* Root device cannot be stopped */
Status = STATUS_NOT_SUPPORTED;
break;
Irp->IoStatus.Status = Status = STATUS_INVALID_DEVICE_REQUEST;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
default:
DPRINT("IRP_MJ_PNP / Unknown minor function 0x%lx\n", IrpSp->MinorFunction);
Status = STATUS_NOT_IMPLEMENTED;
break;
}
if (Status != STATUS_PENDING)
{
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
return Status;
/* Pass this IRP down to the root device PDO */
IoSkipCurrentIrpStackLocation(Irp);
return IoCallDriver(DeviceExtension->Ldo, Irp);
}
static NTSTATUS
@ -707,48 +706,25 @@ PdoQueryDeviceRelations(
IN PIO_STACK_LOCATION IrpSp)
{
PDEVICE_RELATIONS Relations;
DEVICE_RELATION_TYPE RelationType;
NTSTATUS Status = Irp->IoStatus.Status;
RelationType = IrpSp->Parameters.QueryDeviceRelations.Type;
if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
return Status;
switch (RelationType)
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));
if (!Relations)
{
/* FIXME: remove */
case BusRelations:
{
if (IoGetAttachedDevice(DeviceObject) != DeviceObject)
{
/* We're not alone in the stack */
DPRINT1("PnP is misbehaving ; don't know how to handle IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n");
}
break;
}
case TargetDeviceRelation:
{
DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / TargetDeviceRelation\n");
Relations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS));
if (!Relations)
{
DPRINT("ExAllocatePoolWithTag() failed\n");
Status = STATUS_NO_MEMORY;
}
else
{
ObReferenceObject(DeviceObject);
Relations->Count = 1;
Relations->Objects[0] = DeviceObject;
Status = STATUS_SUCCESS;
Irp->IoStatus.Information = (ULONG_PTR)Relations;
}
break;
}
default:
{
DPRINT1("IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / unknown relation type 0x%lx\n", RelationType);
}
DPRINT("ExAllocatePoolWithTag() failed\n");
Status = STATUS_NO_MEMORY;
}
else
{
ObReferenceObject(DeviceObject);
Relations->Count = 1;
Relations->Objects[0] = DeviceObject;
Status = STATUS_SUCCESS;
Irp->IoStatus.Information = (ULONG_PTR)Relations;
}
return Status;