From 219cbd064d6a1f0ef6289b57f5d118b353701a0d Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 16 Dec 2010 11:56:12 +0000 Subject: [PATCH 1/1] [AUDIO-BRINGUP] - Implement SwDispatchPower svn path=/branches/audio-bringup/; revision=50036 --- drivers/ksfilter/swenum/swenum.c | 51 ++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/drivers/ksfilter/swenum/swenum.c b/drivers/ksfilter/swenum/swenum.c index 2f3c46ecfa5..e44575d85a4 100644 --- a/drivers/ksfilter/swenum/swenum.c +++ b/drivers/ksfilter/swenum/swenum.c @@ -18,8 +18,56 @@ SwDispatchPower( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { + NTSTATUS Status, PnpStatus; + BOOLEAN ChildDevice; + PIO_STACK_LOCATION IoStack; + PDEVICE_OBJECT PnpDeviceObject = NULL; + + /* get current stack location */ + IoStack = IoGetCurrentIrpStackLocation(Irp); + + /* check if the device object is a child device */ + Status = KsIsBusEnumChildDevice(DeviceObject, &ChildDevice); + + /* get bus enum pnp object */ + PnpStatus = KsGetBusEnumPnpDeviceObject(DeviceObject, &PnpDeviceObject); + + /* check for success */ + if (!NT_SUCCESS(Status) || !NT_SUCCESS(PnpStatus)) + { + /* start next power irp */ + PoStartNextPowerIrp(Irp); - UNIMPLEMENTED; + /* just complete the irp */ + Irp->IoStatus.Status = STATUS_SUCCESS; + + /* complete the irp */ + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + /* done */ + return STATUS_SUCCESS; + } + + if (IoStack->MinorFunction == IRP_MN_SET_POWER || IoStack->MinorFunction == IRP_MN_QUERY_POWER) + { + /* fake success */ + Irp->IoStatus.Status = STATUS_SUCCESS; + } + + if (!ChildDevice) + { + /* forward to pnp device object */ + PoStartNextPowerIrp(Irp); + + /* skip current location */ + IoSkipCurrentIrpStackLocation(Irp); + + /* done */ + return PoCallDriver(PnpDeviceObject, Irp); + } + + /* start next power irp */ + PoStartNextPowerIrp(Irp); /* just complete the irp */ Irp->IoStatus.Status = STATUS_SUCCESS; @@ -29,7 +77,6 @@ SwDispatchPower( /* done */ return STATUS_SUCCESS; - } NTSTATUS -- 2.17.1