• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IoReleaseCancelSpinLock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IoReleaseCancelSpinLock函数的典型用法代码示例。如果您正苦于以下问题:C++ IoReleaseCancelSpinLock函数的具体用法?C++ IoReleaseCancelSpinLock怎么用?C++ IoReleaseCancelSpinLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IoReleaseCancelSpinLock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:25,代码来源:subr_usbd.c


示例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);
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:28,代码来源:beep.c


示例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;
}
开发者ID:RareHare,项目名称:reactos,代码行数:34,代码来源:create.c


示例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;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:59,代码来源:beep.c


示例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, &notifynode->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;
	}
}
开发者ID:Tudi,项目名称:PG2-firewall,代码行数:60,代码来源:notifyqueue.c


示例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);
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:33,代码来源:parvdm.c


示例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;
}
开发者ID:n30d0n3,项目名称:Detector,代码行数:47,代码来源:queue.c


示例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;
}
开发者ID:n30d0n3,项目名称:Detector,代码行数:47,代码来源:queue.c


示例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);
    }
}
开发者ID:Strongc,项目名称:reactos,代码行数:38,代码来源:notify.c


示例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);
}
开发者ID:Moteesh,项目名称:reactos,代码行数:32,代码来源:csq.c


示例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);
}
开发者ID:astrohr,项目名称:dagor_tca,代码行数:30,代码来源:utils.c


示例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);
}
开发者ID:Cecildt,项目名称:peerblock,代码行数:35,代码来源:notifyqueue.c


示例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;

}
开发者ID:RPG-7,项目名称:reactos,代码行数:31,代码来源:fbtpwr.c


示例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);
    } 
}
开发者ID:imahmoodz,项目名称:ScpToolkit,代码行数:60,代码来源:busenum.c


示例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);
	}
}
开发者ID:gvsurenderreddy,项目名称:CoLinux64,代码行数:30,代码来源:interface.c


示例16: ReadIrpCancel

static
VOID
NTAPI
ReadIrpCancel(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
    PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
    PNDISUIO_ADAPTER_CONTEXT AdapterContext = IrpSp->FileObject->FsContext;
    PNDISUIO_PACKET_ENTRY PacketEntry;
    
    /* Release the cancel spin lock */
    IoReleaseCancelSpinLock(Irp->CancelIrql);

    /* Indicate a 0-byte packet on the queue to cancel the read */
    PacketEntry = ExAllocatePool(NonPagedPool, sizeof(NDISUIO_PACKET_ENTRY));
    if (PacketEntry)
    {
        PacketEntry->PacketLength = 0;
        
        ExInterlockedInsertHeadList(&AdapterContext->PacketList,
                                    &PacketEntry->ListEntry,
                                    &AdapterContext->Spinlock);
        
        KeSetEvent(&AdapterContext->PacketReadEvent, IO_NO_INCREMENT, FALSE);
    }
}
开发者ID:GYGit,项目名称:reactos,代码行数:25,代码来源:readwrite.c


示例17: VR_RDF_Cancel

/*!
 * \brief Cancel routine for RDF_CARD_TRACKING.<br>
 * <br>
 * \param [in] pDeviceObject Caller-supplied pointer to a DEVICE_OBJECT structure.
	This is the device object for the target device, previously created by
	the driver's AddDevice routine.
 * \param [in] pIrp Caller-supplied pointer to an IRP structure that describes
	the I/O operation to be canceled.
 *
 * \retval STATUS_CANCELLED
 */
NTSTATUS VR_RDF_Cancel(IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp)
{
	dbg_log("VR_RDF_Cancel start");

	PDEVICE_EXTENSION pDeviceExtension = (PDEVICE_EXTENSION)pDeviceObject->DeviceExtension;
	PSMARTCARD_EXTENSION pSmartcardExtension = &pDeviceExtension->smartcardExtension;

	// The reader driver must complete the request as soon as it detects that a smart
	// card has been inserted or removed. The reader driver completes the request by
	// calling IoCompleteRequest, after which, the reader driver must set the NotificationIrp
	// member of SmartcardExtension -> OsData back to NULL to inform the driver library
	// that the reader driver can accept further smart card tracking requests.
	// http://msdn2.microsoft.com/en-us/library/ms801317.aspx
	pSmartcardExtension->OsData->NotificationIrp = NULL;

	pIrp->IoStatus.Information = 0;
	pIrp->IoStatus.Status = STATUS_CANCELLED;

	// The I/O manager calls IoAcquireCancelSpinLock before calling a driver's Cancel routine,
	// so the Cancel routine must call IoReleaseCancelSpinLock at some point.
	// The routine should not hold the spin lock longer than necessary.
	// http://msdn2.microsoft.com/en-us/library/ms795319.aspx
	IoReleaseCancelSpinLock(pIrp->CancelIrql);
	IoCompleteRequest(pIrp, IO_NO_INCREMENT);

	// The Cancel routine must set the I/O status block's Status member to STATUS_CANCELLED,
	// and set its Information member to zero. The routine must then complete the specified
	// IRP by calling IoCompleteRequest.
	dbg_log("VR_RDF_Cancel end - status: 0x%08X", STATUS_CANCELLED);
	return STATUS_CANCELLED;
}
开发者ID:kn1kn1,项目名称:jcopvr,代码行数:42,代码来源:jcop_vr.cpp


示例18: SoundRemoveFromCancellableQ

PIRP
SoundRemoveFromCancellableQ(
    PLIST_ENTRY QueueHead
)
/*++

Routine Description:


    Remove the Irp to the queue and remove the cancel routine under the
    protection of the cancel spin lock.

Arguments:

    QueueHead - the queue to remove it from

Return Value:

    The Irp at the head of the queue or NULL if the queue is empty.

--*/
{
    KIRQL OldIrql;
    PIRP Irp;
    LIST_ENTRY ListNode;

    //
    // Get the cancel spin lock so we can mess with the cancel stuff
    //

    IoAcquireCancelSpinLock(&OldIrql);


    if (IsListEmpty(QueueHead)) {
        Irp = NULL;
    } else {

        PLIST_ENTRY ListNode;
        ListNode = RemoveHeadList(QueueHead);
        Irp = CONTAINING_RECORD(ListNode, IRP, Tail.Overlay.ListEntry);

        //
        // Remove the cancel routine
        //

        IoSetCancelRoutine(Irp, NULL);
    }

    //
    // Free the spin lock
    //

    IoReleaseCancelSpinLock(OldIrql);

    //
    // Return IRP (if any)
    //

    return Irp;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:60,代码来源:soundlib.c


示例19: DispPrepareIrpForCancel

NTSTATUS DispPrepareIrpForCancel(
    PTRANSPORT_CONTEXT Context,
    PIRP Irp,
    PDRIVER_CANCEL CancelRoutine)
/*
 * FUNCTION: Prepare an IRP for cancellation
 * ARGUMENTS:
 *     Context       = Pointer to context information
 *     Irp           = Pointer to an I/O request packet
 *     CancelRoutine = Routine to be called when I/O request is cancelled
 * RETURNS:
 *     Status of operation
 */
{
    KIRQL OldIrql;
    PIO_STACK_LOCATION IrpSp;
    PTRANSPORT_CONTEXT TransContext;

    TI_DbgPrint(DEBUG_IRP, ("Called.\n"));

    IrpSp       = IoGetCurrentIrpStackLocation(Irp);
    TransContext = (PTRANSPORT_CONTEXT)IrpSp->FileObject->FsContext;

    IoAcquireCancelSpinLock(&OldIrql);

    if (!Irp->Cancel && !TransContext->CancelIrps) {
        (void)IoSetCancelRoutine(Irp, CancelRoutine);
        IoReleaseCancelSpinLock(OldIrql);

        TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP at 0x%X can now be cancelled).\n", Irp));

        return STATUS_SUCCESS;
    }

    /* IRP has already been cancelled */

    IoReleaseCancelSpinLock(OldIrql);

    Irp->IoStatus.Status      = STATUS_CANCELLED;
    Irp->IoStatus.Information = 0;

    TI_DbgPrint(DEBUG_IRP, ("Leaving (IRP was already cancelled).\n"));

    return Irp->IoStatus.Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:45,代码来源:dispatch.c


示例20: USBSTOR_Cancel

VOID
NTAPI
USBSTOR_Cancel(
    IN  PDEVICE_OBJECT DeviceObject,
    IN  PIRP Irp)
{
    PFDO_DEVICE_EXTENSION FDODeviceExtension;

    //
    // get FDO device extension
    //
    FDODeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;

    //
    // sanity check
    //
    ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
    ASSERT(FDODeviceExtension->Common.IsFDO);

    //
    // acquire irp list lock
    //
    KeAcquireSpinLockAtDpcLevel(&FDODeviceExtension->IrpListLock);

    //
    // remove the irp from the list
    //
    RemoveEntryList(&Irp->Tail.Overlay.ListEntry);

    //
    // release irp list lock
    //
    KeReleaseSpinLockFromDpcLevel(&FDODeviceExtension->IrpListLock);    

    //
    // now release the cancel lock
    //
    IoReleaseCancelSpinLock(Irp->CancelIrql);

    //
    // set cancel status
    //
    Irp->IoStatus.Status = STATUS_CANCELLED;

    //
    // now cancel the irp
    //
    USBSTOR_QueueTerminateRequest(DeviceObject, Irp);
    IoCompleteRequest(Irp, IO_NO_INCREMENT);

    //
    // start the next one
    //
    USBSTOR_QueueNextRequest(DeviceObject);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:55,代码来源:queue.c



注:本文中的IoReleaseCancelSpinLock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IoReleaseRemoveLock函数代码示例发布时间:2022-05-30
下一篇:
C++ IoObject_tag_函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap