本文整理汇总了C++中IoReleaseCancelSpinLock函数的典型用法代码示例。如果您正苦于以下问题:C++ IoReleaseCancelSpinLock函数的具体用法?C++ IoReleaseCancelSpinLock怎么用?C++ IoReleaseCancelSpinLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoReleaseCancelSpinLock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usbd_irpcancel
static void
usbd_irpcancel(device_object *dobj, irp *ip)
{
device_t dev = IRP_NDIS_DEV(ip);
struct ndis_softc *sc = device_get_softc(dev);
struct ndisusb_ep *ne = IRP_NDISUSB_EP(ip);
if (ne == NULL) {
ip->irp_cancel = TRUE;
IoReleaseCancelSpinLock(ip->irp_cancelirql);
return;
}
/*
* Make sure that the current USB transfer proxy is
* cancelled and then restarted.
*/
NDISUSB_LOCK(sc);
usbd_transfer_stop(ne->ne_xfer[0]);
usbd_transfer_start(ne->ne_xfer[0]);
NDISUSB_UNLOCK(sc);
ip->irp_cancel = TRUE;
IoReleaseCancelSpinLock(ip->irp_cancelirql);
}
示例2: BeepCancel
VOID
NTAPI
BeepCancel(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
/* Check if this is the current request */
if (Irp == DeviceObject->CurrentIrp)
{
/* Clear it */
DeviceObject->CurrentIrp = NULL;
/* Release the cancel lock and start the next packet */
IoReleaseCancelSpinLock(Irp->CancelIrql);
IoStartNextPacket(DeviceObject, TRUE);
}
else
{
/* Otherwise, remove the packet from the queue and relelase the lock */
KeRemoveEntryDeviceQueue(&DeviceObject->DeviceQueue,
&Irp->Tail.Overlay.DeviceQueueEntry);
IoReleaseCancelSpinLock(Irp->CancelIrql);
}
/* Complete the request */
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
}
示例3: NpfsFindListeningServerInstance
static PNPFS_CCB
NpfsFindListeningServerInstance(PNPFS_FCB Fcb)
{
PLIST_ENTRY CurrentEntry;
PNPFS_WAITER_ENTRY Waiter;
KIRQL oldIrql;
PIRP Irp;
CurrentEntry = Fcb->WaiterListHead.Flink;
while (CurrentEntry != &Fcb->WaiterListHead)
{
Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry);
Irp = CONTAINING_RECORD(Waiter, IRP, Tail.Overlay.DriverContext);
if (Waiter->Ccb->PipeState == FILE_PIPE_LISTENING_STATE)
{
DPRINT("Server found! CCB %p\n", Waiter->Ccb);
IoAcquireCancelSpinLock(&oldIrql);
if (!Irp->Cancel)
{
if (IoSetCancelRoutine(Irp, NULL) != NULL)
{
IoReleaseCancelSpinLock(oldIrql);
return Waiter->Ccb;
}
}
IoReleaseCancelSpinLock(oldIrql);
}
CurrentEntry = CurrentEntry->Flink;
}
return NULL;
}
示例4: BeepCleanup
NTSTATUS
NTAPI
BeepCleanup(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
KIRQL OldIrql, CancelIrql;
PKDEVICE_QUEUE_ENTRY Packet;
PIRP CurrentIrp;
/* Raise IRQL and acquire the cancel lock */
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
IoAcquireCancelSpinLock(&CancelIrql);
/* Get the current IRP */
CurrentIrp = DeviceObject->CurrentIrp;
DeviceObject->CurrentIrp = NULL;
while (CurrentIrp)
{
/* Clear its cancel routine */
(VOID)IoSetCancelRoutine(CurrentIrp, NULL);
/* Cancel the IRP */
CurrentIrp->IoStatus.Status = STATUS_CANCELLED;
CurrentIrp->IoStatus.Information = 0;
/* Release the cancel lock and complete it */
IoReleaseCancelSpinLock(CancelIrql);
IoCompleteRequest(CurrentIrp, IO_NO_INCREMENT);
/* Reacquire the lock and get the next queue packet */
IoAcquireCancelSpinLock(&CancelIrql);
Packet = KeRemoveDeviceQueue(&DeviceObject->DeviceQueue);
if (Packet)
{
/* Get the IRP */
CurrentIrp = CONTAINING_RECORD(Packet,
IRP,
Tail.Overlay.DeviceQueueEntry);
}
else
{
/* No more IRPs */
CurrentIrp = NULL;
}
}
/* Release lock and go back to low IRQL */
IoReleaseCancelSpinLock(CancelIrql);
KeLowerIrql(OldIrql);
/* Complete the IRP */
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
/* Stop and beep and return */
HalMakeBeep(0);
return STATUS_SUCCESS;
}
示例5: Notification_Recieve
NTSTATUS Notification_Recieve(NOTIFICATION_QUEUE *queue, PIRP irp) {
PIO_STACK_LOCATION irpstack = IoGetCurrentIrpStackLocation(irp);
KIRQL irq;
if(irpstack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PGNOTIFICATION)) {
irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
irp->IoStatus.Information = 0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
return STATUS_BUFFER_TOO_SMALL;
}
KeAcquireSpinLock(&queue->lock, &irq);
if(IsListEmpty(&queue->notification_list)) {
PGIRPNODE *irpnode;
KIRQL crirq;
irpnode = ExAllocateFromNPagedLookasideList(&queue->lookaside);
InitializeListHead(&irpnode->entry);
irpnode->irp = irp;
//irp->Tail.Overlay.DriverContext[0] = irpnode;
InsertTailList(&queue->irp_list, &irpnode->entry);
IoMarkIrpPending(irp);
IoAcquireCancelSpinLock(&crirq);
#pragma warning(push)
#pragma warning(disable:4311 4312)
//IoSetCancelRoutine generates warnings in 32-bit due to silly macroisms.
IoSetCancelRoutine(irp, Notification_OnCancel);
#pragma warning(pop)
IoReleaseCancelSpinLock(crirq);
KeReleaseSpinLock(&queue->lock, irq);
return STATUS_PENDING;
}
else {
PGNOTIFYNODE *notifynode = (PGNOTIFYNODE*)RemoveHeadList(&queue->notification_list);
PGNOTIFICATION *notification = irp->AssociatedIrp.SystemBuffer;
RtlCopyMemory(notification, ¬ifynode->notification, sizeof(PGNOTIFICATION));
ExFreeToNPagedLookasideList(&queue->lookaside, notifynode);
--queue->queued;
KeReleaseSpinLock(&queue->lock, irq);
irp->IoStatus.Status = STATUS_SUCCESS;
irp->IoStatus.Information = sizeof(PGNOTIFICATION);
IoCompleteRequest(irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
}
示例6: ParCancel
VOID
ParCancel(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
/*++
Routine Description:
This is the cancel routine for this driver.
Arguments:
DeviceObject - Supplies the device object.
Irp - Supplies the I/O request packet.
Return Value:
None.
--*/
{
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
IoReleaseCancelSpinLock(Irp->CancelIrql);
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_CANCELLED;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
示例7: testdrvQueueCancelRoutine
///////////////////////////////////////////////////////////////////////////////////////////////////
// testdrvQueueCancelRoutine
// Cancel routine used for queue IRPs while in the queue
//
// Arguments:
// IN DeviceObject
// Device object for our device
//
// IN Irp
// IRP to be cancelled
//
// Return Value:
// none
//
VOID testdrvQueueCancelRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
KIRQL oldIrql;
PTESTDRV_QUEUE queue;
// release the system cancel spinlock
oldIrql = Irp->CancelIrql;
IoReleaseCancelSpinLock(DISPATCH_LEVEL);
// get our queue from the IRP
queue = (PTESTDRV_QUEUE)Irp->Tail.Overlay.DriverContext[0];
ASSERT(queue != NULL);
// grab the queue protection
KeAcquireSpinLockAtDpcLevel(&queue->QueueLock);
// remove our IRP from the queue
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
// drop the queue protection
KeReleaseSpinLock(&queue->QueueLock, oldIrql);
// cancel the IRP
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return;
}
示例8: testdrvListCancelRoutine
///////////////////////////////////////////////////////////////////////////////////////////////////
// testdrvListCancelRoutine
// Cancel routine used for our cancel safe IRP list
//
// Arguments:
// IN DeviceObject
// Device object for our device
//
// IN Irp
// IRP to be cancelled
//
// Return Value:
// none
//
VOID testdrvListCancelRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
KIRQL oldIrql;
PTESTDRV_LIST list;
oldIrql = Irp->CancelIrql;
// release the system cancel spinlock
IoReleaseCancelSpinLock(DISPATCH_LEVEL);
// get our list context from the IRP
list = (PTESTDRV_LIST)Irp->Tail.Overlay.DriverContext[0];
// grab the list protection
KeAcquireSpinLockAtDpcLevel(&list->ListLock);
// remove our IRP from the list
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
// drop the list protection
KeReleaseSpinLock(&list->ListLock, oldIrql);
// cancel the IRP
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return;
}
示例9: MountMgrNotify
/*
* @implemented
*/
VOID
MountMgrNotify(IN PDEVICE_EXTENSION DeviceExtension)
{
PIRP Irp;
KIRQL OldIrql;
LIST_ENTRY CopyList;
PLIST_ENTRY NextEntry;
/* Increase the epic number */
DeviceExtension->EpicNumber++;
InitializeListHead(&CopyList);
/* Copy all the pending IRPs for notification */
IoAcquireCancelSpinLock(&OldIrql);
while (!IsListEmpty(&(DeviceExtension->IrpListHead)))
{
NextEntry = RemoveHeadList(&(DeviceExtension->IrpListHead));
Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
InsertTailList(&CopyList, &(Irp->Tail.Overlay.ListEntry));
}
IoReleaseCancelSpinLock(OldIrql);
/* Then, notifiy them one by one */
while (!IsListEmpty(&CopyList))
{
NextEntry = RemoveHeadList(&CopyList);
Irp = CONTAINING_RECORD(NextEntry, IRP, Tail.Overlay.ListEntry);
*((PULONG)Irp->AssociatedIrp.SystemBuffer) = DeviceExtension->EpicNumber;
Irp->IoStatus.Information = sizeof(DeviceExtension->EpicNumber);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
}
示例10: IopCsqCancelRoutine
static
VOID
NTAPI
IopCsqCancelRoutine(
_Inout_ PDEVICE_OBJECT DeviceObject,
_Inout_ _IRQL_uses_cancel_ PIRP Irp)
{
PIO_CSQ Csq;
KIRQL Irql;
/* First things first: */
IoReleaseCancelSpinLock(Irp->CancelIrql);
/* We could either get a context or just a csq */
Csq = (PIO_CSQ)Irp->Tail.Overlay.DriverContext[3];
if(Csq->Type == IO_TYPE_CSQ_IRP_CONTEXT)
{
PIO_CSQ_IRP_CONTEXT Context = (PIO_CSQ_IRP_CONTEXT)Csq;
Csq = Context->Csq;
/* clean up context while we're here */
Context->Irp = NULL;
}
/* Now that we have our CSQ, complete the IRP */
Csq->CsqAcquireLock(Csq, &Irql);
Csq->CsqRemoveIrp(Csq, Irp);
Csq->CsqReleaseLock(Csq, Irql);
Csq->CsqCompleteCanceledIrp(Csq, Irp);
}
示例11: Ik220FilterCancelQueued
VOID
Ik220FilterCancelQueued(IN PDEVICE_OBJECT PDevObj, IN PIRP PIrp)
/*++
Routine Description:
This routine will be used cancel irps on the stalled queue.
Arguments:
PDevObj - Pointer to the device object.
PIrp - Pointer to the Irp to cancel
Return Value:
None.
--*/
{
PIK220_DEVICE_EXTENSION pDevExt = PDevObj->DeviceExtension;
PIO_STACK_LOCATION pIrpSp = IoGetCurrentIrpStackLocation(PIrp);
PIrp->IoStatus.Status = STATUS_CANCELLED;
PIrp->IoStatus.Information = 0;
RemoveEntryList(&PIrp->Tail.Overlay.ListEntry);
IoReleaseCancelSpinLock(PIrp->CancelIrql);
}
示例12: Notification_OnCancel
static void Notification_OnCancel(PDEVICE_OBJECT device, PIRP irp)
{
KIRQL irq;
NOTIFICATION_QUEUE *queue = &((PBINTERNAL*)device->DeviceExtension)->queue;
LIST_ENTRY *iter;
int found = 0;
DbgPrint("pbfilter: Canceling IRP...\n");
KeAcquireSpinLock(&queue->lock, &irq);
for(iter = queue->irp_list.Flink; iter != &queue->irp_list; iter = iter->Flink)
{
PBIRPNODE *irpnode = (PBIRPNODE*)iter;
if(irpnode->irp == irp)
{
RemoveEntryList(iter);
ExFreeToNPagedLookasideList(&queue->lookaside, irpnode);
found = 1;
break;
}
}
KeReleaseSpinLock(&queue->lock, irq);
// if it wasn't found, it has already been dequeued and handled.
if(found)
{
DbgPrint("pbfilter: IRP found, completing.\n");
irp->IoStatus.Status = STATUS_CANCELLED;
irp->IoStatus.Information = 0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
}
IoReleaseCancelSpinLock(irp->CancelIrql);
}
示例13: CancelQueued
VOID NTAPI CancelQueued(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
PDEVICE_EXTENSION deviceExtension;
KIRQL oldIrql;
FreeBT_DbgPrint(3, ("FBTUSB: CancelQueued: Entered\n"));
deviceExtension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
oldIrql = Irp->CancelIrql;
// Release the cancel spin lock
IoReleaseCancelSpinLock(Irp->CancelIrql);
// Acquire the queue lock
KeAcquireSpinLockAtDpcLevel(&deviceExtension->QueueLock);
// Remove the cancelled Irp from queue and release the lock
RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
KeReleaseSpinLock(&deviceExtension->QueueLock, oldIrql);
// complete with STATUS_CANCELLED
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
FreeBT_DbgPrint(3, ("FBTUSB: CancelQueued: Leaving\n"));
return;
}
示例14: Bus_CancelIrp
VOID Bus_CancelIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
PPDO_DEVICE_DATA pdoData = (PPDO_DEVICE_DATA) DeviceObject->DeviceExtension;
PLIST_ENTRY le = NULL;
PIRP cancelIrp = NULL;
KIRQL irql;
Bus_KdPrint(("Bus_CancelIrp : %p", Irp));
IoReleaseCancelSpinLock(Irp->CancelIrql);
KeAcquireSpinLock(&pdoData->PendingQueueLock, &irql);
for (le = pdoData->PendingQueue.Flink; le != &pdoData->PendingQueue; le = le->Flink)
{
PPENDING_IRP lr = CONTAINING_RECORD(le, PENDING_IRP, Link);
cancelIrp = lr->Irp;
if (cancelIrp->Cancel && cancelIrp == Irp)
{
Bus_KdPrint(("PendingQueue : %p", cancelIrp));
RemoveEntryList(le);
break;
}
cancelIrp = NULL;
}
if (cancelIrp == NULL)
{
for (le = pdoData->HoldingQueue.Flink; le != &pdoData->HoldingQueue; le = le->Flink)
{
PPENDING_IRP lr = CONTAINING_RECORD(le, PENDING_IRP, Link);
cancelIrp = lr->Irp;
if (cancelIrp->Cancel && cancelIrp == Irp)
{
Bus_KdPrint(("HoldingQueue : %p", cancelIrp));
RemoveEntryList(le);
break;
}
cancelIrp = NULL;
}
}
KeReleaseSpinLock(&pdoData->PendingQueueLock, irql);
if (cancelIrp)
{
cancelIrp->IoStatus.Status = STATUS_CANCELLED;
cancelIrp->IoStatus.Information = 0;
IoCompleteRequest(cancelIrp, IO_NO_INCREMENT);
}
}
示例15: manager_irp_cancel
static NTAPI void manager_irp_cancel(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
co_manager_t *manager;
co_manager_open_desc_t opened = NULL;
bool_t myIRP = PFALSE;
fixme_IoSetCancelRoutine(Irp, NULL);
manager = (co_manager_t *)DeviceObject->DeviceExtension;
if (manager) {
opened = (typeof(opened))(Irp->Tail.Overlay.DriverContext[0]);
if (opened) {
myIRP = opened->os->irp == Irp;
opened->os->irp = NULL;
}
}
Irp->IoStatus.Status = STATUS_CANCELLED;
Irp->IoStatus.Information = 0;
IoReleaseCancelSpinLock(Irp->CancelIrql);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
if (myIRP) {
co_manager_close(manager, opened);
}
}