[ros-dev] [ros-diffs] [janderwald] 72725: [USBAUDIO] - start implementing init routines - not yet added to build
Thomas Faber
thomas.faber at reactos.org
Sun Sep 18 14:46:51 UTC 2016
On 2016-09-18 16:24, janderwald at svn.reactos.org wrote:
> +NTSTATUS
> +SubmitUrbSync(
> + IN PKSDEVICE Device,
> + IN PURB Urb)
> +{
> + PIRP Irp;
> + KEVENT Event;
> + PDEVICE_EXTENSION DeviceExtension;
> + IO_STATUS_BLOCK IoStatus;
> + PIO_STACK_LOCATION IoStack;
> + NTSTATUS Status;
> +
> + // init event
> + KeInitializeEvent(&Event, NotificationEvent, FALSE);
> +
> + // get device extension
> + DeviceExtension = (PDEVICE_EXTENSION)Device->Context;
> +
> + // build irp
> + Irp = IoBuildDeviceIoControlRequest(IOCTL_INTERNAL_USB_SUBMIT_URB,
> + DeviceExtension->LowerDevice,
> + NULL,
> + 0,
> + NULL,
> + 0,
> + TRUE,
> + &Event,
> + &IoStatus);
> +
> + if (!Irp)
> + {
> + //
> + // no memory
> + //
> + return STATUS_INSUFFICIENT_RESOURCES;
> + }
> +
> + // get next stack location
> + IoStack = IoGetNextIrpStackLocation(Irp);
> +
> + // store urb
> + IoStack->Parameters.Others.Argument1 = Urb;
> +
> + // set completion routine
> + IoSetCompletionRoutine(Irp, USBAudioCancelCompleteSynch, &Event, TRUE, TRUE, TRUE);
You don't need a completion routine here, completing the IRP will set
the event specified in IoBuildDeviceIoControlRequest.
See https://support.microsoft.com/en-us/kb/326315#bookmark-2
More information about the Ros-dev
mailing list