Compartilhar via


KsCancelRoutine function

The KsCancelRoutine function performs standard IRP cancel functionality: it removes the entry and then cancels and completes the request. The function is defined as a PDRIVER_CANCEL routine. It is the default function used for KsAddIrpToCancelableQueue if none is provided.

Syntax

KSDDKAPI VOID NTAPI KsCancelRoutine(
  _In_ PDEVICE_OBJECT DeviceObject,
  _In_ PIRP           Irp
);

Parameters

  • DeviceObject [in]
    Specifies the device object that owns the IRP.

  • Irp [in]
    Specifies the IRP being canceled.

Return value

None

Remarks

This function would typically be called by the I/O subsystem on canceling an IRP but can be called directly in response to an KSMETHOD_STREAM_PRESENTATION Set request. As with any typical cancel routine, this function expects the I/O cancel spin lock to have been acquired upon entering the function.

Note that this routine expects the KSQUEUE_SPINLOCK_IRP_STORAGE(Irp) to point to the list access spin lock as provided in KsAddIrpToCancelableQueue.

KsCancelRoutine can be used to do the preliminary list removal processing, without actually completing the IRP. If the Irp->IoStatus.Status is set to STATUS_CANCELLED on entering this function, then the IRP will not be completed. Otherwise, the status will be set to STATUS_CANCELLED and the IRP will be completed. This KsCancelRoutine can be used within a cancel routine to do the initial list and spin lock manipulation and return to the driver's completion routine to do specific processing and final IRP completion.

Requirements

Target platform

Universal

Header

Ks.h (include Ks.h)

Library

Ks.lib

See also

KsAddIrpToCancelableQueue

 

 

Send comments about this topic to Microsoft