Author: janderwald
Date: Mon Apr 20 02:57:21 2009
New Revision: 40598
URL:
http://svn.reactos.org/svn/reactos?rev=40598&view=rev
Log:
- Forward & wait IRP_MN_START_DEVICE to lower device objects before starting the
device
- Fix several irp leaks and return correct status in PcForwardIrpSynchronous
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] Mon Apr 20 02:57:21
2009
@@ -76,24 +76,37 @@
return Status;
}
- /* Assign the resource list to our extension */
- DeviceExt->resources = resource_list;
-
+ /* forward irp to lower device object */
+ Status = PcForwardIrpSynchronous(DeviceObject, Irp);
+
+ if (!NT_SUCCESS(Status))
+ {
+ /* lower device object failed to start */
+ resource_list->lpVtbl->Release(resource_list);
+ /* complete the request */
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ /* return result */
+ return Status;
+ }
+
+ /* sanity check */
ASSERT(DeviceExt->StartDevice);
-
/* Call the StartDevice routine */
DPRINT("Calling StartDevice at 0x%8p\n",
DeviceExt->StartDevice);
Status = DeviceExt->StartDevice(DeviceObject, Irp, resource_list);
if (!NT_SUCCESS(Status))
{
DPRINT("StartDevice returned a failure code [0x%8x]\n",
Status);
- //resource_list->lpVtbl->Release(resource_list);
+ resource_list->lpVtbl->Release(resource_list);
Irp->IoStatus.Status = Status;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
+ /* Assign the resource list to our extension */
+ DeviceExt->resources = resource_list;
+
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
@@ -112,7 +125,10 @@
case IRP_MN_QUERY_INTERFACE:
DPRINT("IRP_MN_QUERY_INTERFACE\n");
- return PcForwardIrpSynchronous(DeviceObject, Irp);
+ Status = PcForwardIrpSynchronous(DeviceObject, Irp);
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return Status;
case IRP_MN_QUERY_DEVICE_RELATIONS:
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
@@ -124,7 +140,10 @@
return STATUS_SUCCESS;
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
DPRINT("IRP_MN_QUERY_RESOURCE_REQUIREMENTS\n");
- return PcForwardIrpSynchronous(DeviceObject, Irp);
+ Status = PcForwardIrpSynchronous(DeviceObject, Irp);
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return Status;
}
DPRINT1("unhandled function %u\n", IoStack->MinorFunction);
@@ -282,7 +301,7 @@
{
/* not yet, lets wait a bit */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
- Status = STATUS_SUCCESS;
+ Status = Irp->IoStatus.Status;
}
return Status;
}
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.c [iso-8859-1] Mon Apr
20 02:57:21 2009
@@ -691,6 +691,7 @@
This->CloseIrp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(This->CloseIrp, IO_NO_INCREMENT);
}
+ DPRINT1("Closing stream at Irql %u\n", KeGetCurrentIrql());
Stream->lpVtbl->Release(Stream);
/* this line is never reached */
}
@@ -970,7 +971,10 @@
DPRINT1("Failed to add pin to service group\n");
return Status;
}
+ This->ServiceGroup->lpVtbl->AddRef(This->ServiceGroup);
This->ServiceGroup->lpVtbl->SupportDelayedService(This->ServiceGroup);
+ This->DmaChannel->lpVtbl->AddRef(This->DmaChannel);
+
This->State = KSSTATE_STOP;
This->CommonBufferOffset = 0;
@@ -979,6 +983,9 @@
This->Capture = Capture;
Status = This->Stream->lpVtbl->SetNotificationFreq(This->Stream, 10,
&This->FrameSize);
+
+ This->Stream->lpVtbl->SetFormat(This->Stream,
(PKSDATAFORMAT)This->Format);
+
return STATUS_SUCCESS;
}