reactos/drivers/wdm/audio/legacy/stream/helper.c
Pierre Schweitzer 321bcc056d Create the AHCI branch for Aman's work
svn path=/branches/GSoC_2016/AHCI/; revision=71203
2016-04-24 20:17:09 +00:00

57 lines
1.4 KiB
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Kernel Streaming
* FILE: drivers/wdm/audio/legacy/stream/helper.c
* PURPOSE: irp helper routines
* PROGRAMMER: Johannes Anderwald
*/
#include "stream.h"
NTSTATUS
NTAPI
CompletionRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context)
{
if (Irp->PendingReturned == TRUE)
{
KeSetEvent ((PKEVENT) Context, IO_NO_INCREMENT, FALSE);
}
return STATUS_MORE_PROCESSING_REQUIRED;
}
NTSTATUS
NTAPI
ForwardIrpSynchronous(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
KEVENT Event;
PSTREAM_DEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
DeviceExt = (PSTREAM_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
/* initialize the notification event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
IoCopyCurrentIrpStackLocationToNext(Irp);
IoSetCompletionRoutine(Irp, CompletionRoutine, (PVOID)&Event, TRUE, TRUE, TRUE);
/* now call the driver */
Status = IoCallDriver(DeviceExt->LowerDeviceObject, Irp);
/* did the request complete yet */
if (Status == STATUS_PENDING)
{
/* not yet, lets wait a bit */
KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
Status = Irp->IoStatus.Status;
}
return Status;
}