Author: cgutman
Date: Sun Apr 4 02:33:19 2010
New Revision: 46707
URL:
http://svn.reactos.org/svn/reactos?rev=46707&view=rev
Log:
[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.
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnproot…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnproot.c [iso-8859-1] Sun Apr 4 02:33:19 2010
@@ -677,27 +677,26 @@
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 @@
IN PIO_STACK_LOCATION IrpSp)
{
PDEVICE_RELATIONS Relations;
- DEVICE_RELATION_TYPE RelationType;
NTSTATUS Status = Irp->IoStatus.Status;
- RelationType = IrpSp->Parameters.QueryDeviceRelations.Type;
-
- switch (RelationType)
- {
- /* 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);
- }
+ if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
+ return Status;
+
+ 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;
}
return Status;