ReactOS 0.4.15-dev-7681-g776c3a3
irp cancel boilerplate.c File Reference

Go to the source code of this file.

Functions

 CancelRoutine (DEV_OBJ Dev, Irp)
 
 IoSetCancelRoutine (Irp, CancelRoutine)
 
 if (Irp->Cancel &&IoSetCancelRoutine(Irp, NULL))
 
 IoMarkIrpPending (Irp)
 
 InsertTailList (Queue)
 
 Unlock (theLock)
 
 if (!IoSetCancelRoutine(Irp, NULL))
 
 IoCompleteRequest (Irp, IO_NO_INCREMENT)
 

Variables

 QUEUE_BOLIERPLATE
 
Irp Tail Overlay DriverContext [3] = &theLock
 
Irp IoStatus Status = STATUS_PENDING
 
 DEQUEUE_BOILERPLATE
 
 Irp = RemoveHeadList(Queue)
 
Irp IoStatus Information = 0
 

Function Documentation

◆ CancelRoutine()

CancelRoutine ( DEV_OBJ  Dev,
Irp   
)

Definition at line 10 of file irp cancel boilerplate.c.

14{
15 //don't need this since we have our own sync. protecting irp cancellation
16 IoReleaseCancelSpinLock(Irp->CancelIrql);
17
18 theLock = Irp->Tail.Overlay.DriverContext[3];
19
20 Lock(theLock);
21 RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
22 Unlock(theLock);
23
24 Irp->IoStatus.Status = STATUS_CANCELLED;
25 Irp->IoStatus.Information = 0;
26
28
29}
_In_ PIRP Irp
Definition: csq.h:116
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define IoCompleteRequest
Definition: irp.c:1240
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
@ Unlock
Definition: ntsecapi.h:294
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ if() [1/2]

if ( IoSetCancelRoutineIrp, NULL)

Definition at line 75 of file irp cancel boilerplate.c.

76 {
77 /*
78 Cancel routine WILL be called after we release the spinlock. It will try to remove
79 the irp from the list and cancel/complete this irp. Since we allready removed it,
80 make its ListEntry point to itself.
81 */
82
83 InitializeListHead(&Irp->Tail.Overlay.ListEntry);
84
85 Unlock(theLock);
86
87 return;
88 }
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

◆ if() [2/2]

if ( Irp->Cancel &&  IoSetCancelRoutineIrp, NULL)

Definition at line 39 of file irp cancel boilerplate.c.

40 {
41 /*
42 Irp has already been cancelled (before we got to queue it),
43 and we got to remove the cancel routine before the canceler could,
44 so we cancel/complete the irp ourself.
45 */
46
47 Unlock(theLock);
48
49 Irp->IoStatus.Status = STATUS_CANCELLED;
50 Irp->IoStatus.Information = 0;
52
53 return FALSE;
54 }
#define FALSE
Definition: types.h:117

◆ InsertTailList()

InsertTailList ( Queue  )

◆ IoCompleteRequest()

IoCompleteRequest ( Irp  ,
IO_NO_INCREMENT   
)

◆ IoMarkIrpPending()

IoMarkIrpPending ( Irp  )

Referenced by _Dispatch_type_(), _Function_class_(), _Requires_lock_held_(), _Success_(), ACPIDispatchDeviceControl(), AfdConnectedSocketReadData(), AfdSelect(), BeepDeviceControl(), CdDevCtrlCompletionRoutine(), CdMultiAsyncCompletionRoutine(), CdSingleAsyncCompletionRoutine(), ClassDeviceControl(), ClassDeviceHwFirmwareDownloadProcess(), ClassIoComplete(), ClasspDeviceLockFailurePowerIrpCompletion(), ClasspEnqueueIdleRequest(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClasspStartNextPowerIrpCompletion(), ClassReadWrite(), ClassRetryRequest(), CreateRedirectedFile(), DGReceiveDatagram(), DiskInfoExceptionCheck(), DiskInfoExceptionComplete(), DiskIoctlVerify(), DiskShutdownFlush(), DispatchReadWrite(), DispEchoRequest(), DispTdiConnect(), DispTdiDisconnect(), DispTdiListen(), DispTdiQueryIpHwAddress(), DispTdiReceive(), DispTdiReceiveDatagram(), DispTdiSend(), DispTdiSendDatagram(), do_read(), Ext2DeviceControlCompletion(), Ext2ExceptionHandler(), Ext2FlushCompletionRoutine(), Ext2LockIrp(), Ext2ReadWriteBlocks(), FatFlushCompletionRoutine(), FatMultiAsyncCompletionRoutine(), FatPrePostIrp(), FatSingleAsyncCompletionRoutine(), FDO_HandleResetCyclePort(), FinishDevPoUpIrp(), FreeBT_DispatchPower(), FreeBT_DispatchRead(), FreeBT_DispatchWrite(), FreeBT_GetHCIEvent(), FreeBT_HCIEventCompletion(), FreeBT_HCISendCompletion(), FreeBT_SendHCICommand(), FsRtlAcknowledgeOplockBreak(), FsRtlCancelNotify(), FsRtlNotifyCompleteIrp(), FsRtlNotifyFilterChangeDirectory(), FsRtlPrivateLock(), FsRtlRequestExclusiveOplock(), FsRtlRequestOplockII(), FsRtlWaitOnIrp(), HandleReadIrp(), HidClass_Read(), HidUsb_ReadReportCompletion(), HoldIoRequests(), i8042KbdDeviceControl(), i8042KbdInternalDeviceControl(), i8042MouInternalDeviceControl(), IKsPin_DispatchKsStream(), IoCsqInsertIrpEx(), IofCompleteRequest(), KsServiceBusEnumCreateRequest(), LanReadData(), MountMgrChangeNotify(), MsfsRead(), MupForwardIoRequest(), NdisIDeviceIoControl(), NpAddDataQueueEntry(), NpAddWaiter(), NpSetListeningPipeState(), NtfsQueueRequest(), PortClsPower(), ProSendAndFreePnPEvent(), QueueRequest(), QueueUserModeIrp(), RawCompletionRoutine(), RequestProcessPowerIrpCompletion(), RequestProcessSetPower(), RxFsdCommonDispatch(), RxFsdDispatch(), RxLowIoSubmit(), RxPrePostIrp(), ScsiPortDispatchScsi(), SendIrpToThread(), SerialDeviceControl(), SerialRead(), SermouseInternalDeviceControl(), ServiceTransferRequest(), SetIrpIoStatus(), TestIrpHandler(), TransferPktComplete(), UDFDevIoctlCompletion(), UDFExceptionHandler(), UDFFlushCompletion(), UDFPostRequest(), USBH_FdoPower(), USBH_PdoIoctlResetPort(), USBH_PortIdleNotificationRequest(), USBH_QueryCapsComplete(), USBH_SelectConfigOrInterfaceComplete(), USBPORT_AbortPipe(), USBPORT_HandleSubmitURB(), USBPORT_IdleNotification(), USBPORT_PdoPower(), USBPORT_QueuePendingTransferIrp(), USBSTOR_HandleInternalDeviceControl(), USBSTOR_QueueAddIrp(), USBSTOR_SendRequest(), VfatQueueRequest(), VfatWrite(), VfdDeviceControl(), VfdReadWrite(), WaitWakeCompletionRoutine(), and WmipReceiveNotifications().

◆ IoSetCancelRoutine()

IoSetCancelRoutine ( Irp  ,
CancelRoutine   
)

Referenced by AfdConnectedSocketReadData(), AfdConnectedSocketWriteData(), AfdDisconnect(), AfdPacketSocketWriteData(), AfdSelect(), BeepCleanup(), BeepStartIo(), DisconnectComplete(), DispPrepareIrpForCancel(), EndRequestHandler(), FreeBT_DispatchClean(), FsRtlAcknowledgeOplockBreak(), FsRtlCancelExclusiveIrp(), FsRtlCancelNotify(), FsRtlCancelOplockIIIrp(), FsRtlCancelWaitIrp(), FsRtlNotifySetCancelRoutine(), FsRtlOplockBreakToII(), FsRtlOplockBreakToNone(), FsRtlOplockCleanup(), FsRtlRemoveAndCompleteIrp(), FsRtlRemoveAndCompleteWaitIrp(), FsRtlRequestExclusiveOplock(), FsRtlRequestOplockII(), FsRtlUninitializeOplock(), FsRtlWaitOnIrp(), HandleReadIrp(), IoCancelIrp(), IoCsqInsertIrpEx(), IoCsqRemoveIrp(), IoCsqRemoveNextIrp(), IRPFinish(), KsAddIrpToCancelableQueue(), KsCancelIo(), KsReleaseIrpOnCancelableQueue(), ListenComplete(), MountMgrChangeNotify(), MountMgrNotify(), NduDispatchRead(), NpAddDataQueueEntry(), NpAddWaiter(), NpCancelWaiter(), NpCheckForNotify(), NpCompleteStalledWrites(), NpRemoveDataQueueEntry(), NpSetClosingPipeState(), NpSetConnectedPipeState(), NpSetDisconnectedPipeState(), NpSetListeningPipeState(), NpTimerDispatch(), PacketSocketRecvComplete(), PacketSocketSendComplete(), ProcessQueuedRequests(), QueueRequest(), QueueUserModeIrp(), ReceiveActivity(), ReceiveComplete(), RemoveHeadList_IRP(), RxCompleteRequest_Real(), RxFsdCommonDispatch(), SatisfyPreAccept(), SendComplete(), SignalSocket(), StreamSocketConnectComplete(), UnlockAndMaybeComplete(), USBH_FdoCleanup(), USBH_HubQueuePortIdleIrps(), USBH_PdoRemoveDevice(), USBH_PortIdleNotificationRequest(), USBPORT_CompletePdoWaitWake(), USBPORT_DoneTransfer(), USBPORT_FlushCancelList(), USBPORT_FlushPendingTransfers(), USBPORT_PdoPower(), USBPORT_QueuePendingTransferIrp(), USBSTOR_QueueAddIrp(), USBSTOR_StartIo(), and WmipReceiveNotifications().

◆ Unlock()

Unlock ( theLock  )

Variable Documentation

◆ DEQUEUE_BOILERPLATE

DEQUEUE_BOILERPLATE
Initial value:
{
Lock(theLock)

Definition at line 69 of file irp cancel boilerplate.c.

◆ DriverContext

Irp Tail Overlay DriverContext[3] = &theLock

Definition at line 36 of file irp cancel boilerplate.c.

◆ Information

Definition at line 100 of file irp cancel boilerplate.c.

◆ Irp

Definition at line 73 of file irp cancel boilerplate.c.

◆ QUEUE_BOLIERPLATE

QUEUE_BOLIERPLATE
Initial value:
{
Lock(theLock)

Definition at line 32 of file irp cancel boilerplate.c.

◆ Status