本文整理汇总了C++中IoMarkIrpPending函数的典型用法代码示例。如果您正苦于以下问题:C++ IoMarkIrpPending函数的具体用法?C++ IoMarkIrpPending怎么用?C++ IoMarkIrpPending使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoMarkIrpPending函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DispatchReadWriteFlush
NTSTATUS DispatchReadWriteFlush(PDEVICE_OBJECT fdo, PIRP Irp)
{
KIRQL OldIrql;
ULONG count;
PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fdo->DeviceExtension;
PIO_STACK_LOCATION stack = IoGetCurrentIrpStackLocation( Irp );
if(stack->MajorFunction == IRP_MJ_WRITE)
{
if(stack->Parameters.Write.Length == 0)
{
return CompleteRequest( Irp, STATUS_SUCCESS, 0 );
}
// write
IoMarkIrpPending(Irp);
StartPacket( &pdx->dqWrite, fdo, Irp, OnCancelWrite );
}
else if(stack->MajorFunction == IRP_MJ_READ)
{
if(stack->Parameters.Read.Length == 0)
{
return CompleteRequest( Irp, STATUS_SUCCESS, 0 );
}
// read
IoAcquireRemoveLock( &pdx->RemoveLock, Irp );
IoMarkIrpPending ( Irp );
IoSetCancelRoutine ( Irp, OnCancelQueuedRead );
KeAcquireSpinLock( &pdx->ReadIrpLock, &OldIrql );
InsertTailList ( &pdx->ReadIrpList, &Irp->Tail.Overlay.ListEntry );
KeReleaseSpinLock( &pdx->ReadIrpLock, OldIrql );
CompleteQueuedReads(pdx);
}
else
{
// flush
IoMarkIrpPending( Irp );
StartPacket ( &pdx->dqWrite, fdo, Irp, OnCancelWrite );
}
return STATUS_PENDING;
}
示例2: BeepDeviceControl
NTSTATUS
NTAPI
BeepDeviceControl(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
PBEEP_SET_PARAMETERS BeepParam;
NTSTATUS Status;
/* Get the stack location and parameters */
Stack = IoGetCurrentIrpStackLocation(Irp);
BeepParam = (PBEEP_SET_PARAMETERS)Irp->AssociatedIrp.SystemBuffer;
/* We only support one IOCTL */
if (Stack->Parameters.DeviceIoControl.IoControlCode != IOCTL_BEEP_SET)
{
/* Unsupported command */
Status = STATUS_NOT_IMPLEMENTED;
}
else
{
/* Validate the input buffer length */
if (Stack->Parameters.DeviceIoControl.InputBufferLength <
sizeof(BEEP_SET_PARAMETERS))
{
/* Invalid buffer */
Status = STATUS_INVALID_PARAMETER;
}
else if ((BeepParam->Frequency != 0) && !(BeepParam->Duration))
{
/* No duration, return imemdiately */
Status = STATUS_SUCCESS;
}
else
{
/* We'll queue this request */
Status = STATUS_PENDING;
}
}
/* Set packet information */
Irp->IoStatus.Status = Status;
Irp->IoStatus.Information = 0;
/* Check if we're completing or queuing a packet */
if (Status == STATUS_PENDING)
{
/* Start the queue */
IoMarkIrpPending(Irp);
IoStartPacket(DeviceObject, Irp, NULL, BeepCancel);
}
else
{
/* Complete the request */
IoCompleteRequest(Irp, IO_NO_INCREMENT);
}
/* Return */
return Status;
}
示例3: vboxUsbPwrIoPostDevCompletion
static NTSTATUS vboxUsbPwrIoPostDevCompletion(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp, IN PVOID pvContext)
{
PVBOXUSBDEV_EXT pDevExt = (PVBOXUSBDEV_EXT)pvContext;
if (pIrp->PendingReturned)
{
IoMarkIrpPending(pIrp);
}
NTSTATUS Status = pIrp->IoStatus.Status;
Assert(Status == STATUS_SUCCESS);
if (NT_SUCCESS(Status))
{
PIO_STACK_LOCATION pSl = IoGetCurrentIrpStackLocation(pIrp);
switch (pSl->MinorFunction)
{
case IRP_MN_SET_POWER:
{
pDevExt->DdiState.PwrState.PowerState.DeviceState = pSl->Parameters.Power.State.DeviceState;
PoSetPowerState(pDevExt->pFDO, DevicePowerState, pSl->Parameters.Power.State);
break;
}
default:
{
break;
}
}
}
PoStartNextPowerIrp(pIrp);
vboxUsbDdiStateRelease(pDevExt);
return STATUS_SUCCESS;
}
示例4: IoMarkIrpPending
FORCEINLINE
VOID
FxIrp::MarkIrpPending(
)
{
IoMarkIrpPending(m_Irp);
}
示例5: KBFReadCompleteRoutine
NTSTATUS KBFReadCompleteRoutine(IN PDEVICE_OBJECT aDeviceObjec, IN PIRP aIrp, IN PVOID aContext)
{
PAGED_CODE();
PIO_STACK_LOCATION irpStackLocation;
ULONG_PTR buflen = 0;
PUCHAR buf = NULL;
irpStackLocation = IoGetCurrentIrpStackLocation(aIrp);
if (NT_SUCCESS(aIrp->IoStatus.Status))
{
// 获得读取请求完成后输出的缓冲区
buf = (PUCHAR)aIrp->AssociatedIrp.SystemBuffer;
// 获得缓冲区长度
buflen = aIrp->IoStatus.Information;
for (size_t i = 0; i < buflen; ++i)
{
DbgPrint("wykbflt.sys : %2x\r\n", buf[i]);
}
}
--gC2pKeyCount;
if (aIrp->PendingReturned)
{
IoMarkIrpPending(aIrp);
}
return aIrp->IoStatus.Status;
}
示例6: on_query_capabilities_complete
static NTSTATUS DDKAPI
on_query_capabilities_complete(DEVICE_OBJECT *device_object,
IRP *irp, void *context)
{
libusb_device_t *dev = device_object->DeviceExtension;
IO_STACK_LOCATION *stack_location = IoGetCurrentIrpStackLocation(irp);
if(irp->PendingReturned)
{
IoMarkIrpPending(irp);
}
if(NT_SUCCESS(irp->IoStatus.Status))
{
if(!dev->is_filter)
{
/* apply registry setting */
stack_location->Parameters.DeviceCapabilities.Capabilities
->SurpriseRemovalOK = dev->surprise_removal_ok;
}
/* save supported device power states */
memcpy(dev->device_power_states, stack_location
->Parameters.DeviceCapabilities.Capabilities->DeviceState,
sizeof(dev->device_power_states));
}
remove_lock_release(dev);
return STATUS_SUCCESS;
}
示例7: Pkt0DispatchWrite
static NTSTATUS
Pkt0DispatchWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
PIO_WORKITEM work_item;
KIRQL old_irql;
NTSTATUS status;
work_item = IoAllocateWorkItem(DeviceObject);
if (work_item == NULL) {
return Pkt0CompleteIrp(Irp, STATUS_INSUFFICIENT_RESOURCES, 0);
}
KeAcquireSpinLock(&Pkt0ContextLock, &old_irql);
if (Pkt0Context->closing) {
status = Pkt0CompleteIrp(Irp, STATUS_PIPE_CLOSING, 0);
} else {
InsertTailList(&Pkt0Context->irp_write_queue, &Irp->Tail.Overlay.ListEntry);
IoMarkIrpPending(Irp);
status = STATUS_PENDING;
}
KeReleaseSpinLock(&Pkt0ContextLock, old_irql);
if (status == STATUS_PENDING) {
IoQueueWorkItemEx(work_item, Pkt0DeferredWrite, DelayedWorkQueue, NULL);
} else {
IoFreeWorkItem(work_item);
}
return status;
}
示例8: EncryptedIoQueueAddIrp
NTSTATUS EncryptedIoQueueAddIrp (EncryptedIoQueue *queue, PIRP irp)
{
NTSTATUS status;
InterlockedIncrement (&queue->OutstandingIoCount);
if (queue->StopPending)
{
Dump ("STATUS_DEVICE_NOT_READY out=%d\n", queue->OutstandingIoCount);
status = STATUS_DEVICE_NOT_READY;
goto err;
}
status = IoAcquireRemoveLock (&queue->RemoveLock, irp);
if (!NT_SUCCESS (status))
goto err;
#ifdef TC_TRACE_IO_QUEUE
{
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (irp);
Dump ("* %I64d [%I64d] %c len=%d out=%d\n", irpSp->MajorFunction == IRP_MJ_WRITE ? irpSp->Parameters.Write.ByteOffset : irpSp->Parameters.Read.ByteOffset, GetElapsedTime (&queue->LastPerformanceCounter), irpSp->MajorFunction == IRP_MJ_WRITE ? 'W' : 'R', irpSp->MajorFunction == IRP_MJ_WRITE ? irpSp->Parameters.Write.Length : irpSp->Parameters.Read.Length, queue->OutstandingIoCount);
}
#endif
IoMarkIrpPending (irp);
ExInterlockedInsertTailList (&queue->MainThreadQueue, &irp->Tail.Overlay.ListEntry, &queue->MainThreadQueueLock);
KeSetEvent (&queue->MainThreadQueueNotEmptyEvent, IO_DISK_INCREMENT, FALSE);
return STATUS_PENDING;
err:
DecrementOutstandingIoCount (queue);
return status;
}
示例9: MyIoCompletion
NTSTATUS MyIoCompletion(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
{
Debug("Enter MyIoCompletion");
if(NT_SUCCESS(Irp->IoStatus.Status))
{
PKEYBOARD_INPUT_DATA tKeyData = (PKEYBOARD_INPUT_DATA )Irp->AssociatedIrp.SystemBuffer;
if(tKeyData->Flags)
{
g_CurMakeCode = tKeyData->MakeCode;
if(0 != g_ShareEvent && (g_Status & INTERCEPT))
{
KeSetEvent((PRKEVENT)g_ShareEvent,(KPRIORITY)0, false); //弹起
}
}
if(!(g_Status & ENABLE)) //按下与弹起
{
ULONG tBufLen = Irp->IoStatus.Information;
ULONG tNumKeys = tBufLen / sizeof(KEYBOARD_INPUT_DATA);
for(int i=0;i<tNumKeys;++i)
tKeyData[i].MakeCode = 0x00;
}
KdPrint(("扫描码:%x,%s\n",tKeyData->MakeCode,tKeyData->Flags?"弹起":"按下"));
}
if(Irp->PendingReturned)
{
IoMarkIrpPending(Irp);
}
Debug("Leave MyIoCompletion");
return Irp->IoStatus.Status;
}
示例10: FinishDevPoUpIrp
NTSTATUS NTAPI FinishDevPoUpIrp(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PDEVICE_EXTENSION DeviceExtension)
{
NTSTATUS ntStatus;
FreeBT_DbgPrint(3, ("FBTUSB: FinishDevPoUpIrp: Entered\n"));
ntStatus = Irp->IoStatus.Status;
if(Irp->PendingReturned)
{
IoMarkIrpPending(Irp);
}
if(!NT_SUCCESS(ntStatus))
{
PoStartNextPowerIrp(Irp);
FreeBT_DbgPrint(3, ("FBTUSB: FinishDevPoUpIrp::"));
FreeBT_IoDecrement(DeviceExtension);
return STATUS_SUCCESS;
}
SetDeviceFunctional(DeviceObject, Irp, DeviceExtension);
FreeBT_DbgPrint(3, ("FBTUSB: FinishDevPoUpIrp: Leaving\n"));
return STATUS_MORE_PROCESSING_REQUIRED;
}
示例11: Pkt0DispatchRead
static NTSTATUS
Pkt0DispatchRead(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
struct pkt0_packet *pkt = NULL;
KIRQL old_irql;
PLIST_ENTRY entry;
NTSTATUS status;
KeAcquireSpinLock(&Pkt0ContextLock, &old_irql);
if (Pkt0Context->closing) {
status = Pkt0CompleteIrp(Irp, STATUS_PIPE_CLOSING, 0);
} else if (IsListEmpty(&Pkt0Context->pkt_read_queue)) {
InsertTailList(&Pkt0Context->irp_read_queue, &Irp->Tail.Overlay.ListEntry);
IoMarkIrpPending(Irp);
status = STATUS_PENDING;
} else {
entry = RemoveHeadList(&Pkt0Context->pkt_read_queue);
pkt = CONTAINING_RECORD(entry, struct pkt0_packet, list_entry);
}
KeReleaseSpinLock(&Pkt0ContextLock, old_irql);
if (pkt != NULL) {
status = Pkt0TransferPacketToUser(Irp, pkt);
}
return status;
}
示例12: AFSWriteComplete
//
// AFSWriteComplete
//
static
NTSTATUS
AFSWriteComplete( IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PVOID Context)
{
UNREFERENCED_PARAMETER(DeviceObject);
UNREFERENCED_PARAMETER(Irp);
UNREFERENCED_PARAMETER(Context);
BOOLEAN bPending = FALSE;
//
// Indicate the library/IRP pair is done with the request
//
AFSClearLibraryRequest();
if (Irp->PendingReturned) {
bPending = TRUE;
IoMarkIrpPending(Irp);
}
AFSDbgTrace(( AFS_SUBSYSTEM_IO_PROCESSING,
AFS_TRACE_LEVEL_VERBOSE,
"AFSWriteComplete Irp %p%s\n",
Irp,
bPending ? " PENDING" : ""));
return STATUS_CONTINUE_COMPLETION;
}
示例13: CompletionRoutineDevUsgNotify
//========================================================================================
// Function: CompletionRoutineStartDevice of DispatchPnp
// Purpose: PNP DEVICE USAGE NOTIFICATION irp completion routine
// Return Value:
// NT status code
//========================================================================================
NTSTATUS
CompletionRoutineDevUsgNotify(
IN PDEVICE_OBJECT fido, // fido - pointer to a device object.
IN PIRP irp, // irp - pointer to an I/O Request Packet.
IN PVOID Context // Context - pointer to an event object.
)
{
PDEVICE_EXTENSION dx;
UNREFERENCED_PARAMETER(Context);
dx = (PDEVICE_EXTENSION)fido->DeviceExtension;
if (irp->PendingReturned)
IoMarkIrpPending(irp);
//On the way up, pagable might become clear. Mimic the driver below us.
if (!(dx->lowerdo->Flags & DO_POWER_PAGABLE))
{
fido->Flags &= ~DO_POWER_PAGABLE;
}
IoReleaseRemoveLock(&dx->rmLock, irp);
return STATUS_SUCCESS;
}
示例14: SecLabReceivePacket
NTSTATUS SecLabReceivePacket(PADAPT pAdapt,IN PDEVICE_OBJECT DeviceObject,IN PIRP Irp)
{
// 某一时刻只有一个读IRP被允许存放在队列中
NdisAcquireSpinLock(&ReadIrpLock);
if(ReadIrp!=NULL /*&& ReadCount!=0*/)
{
NdisReleaseSpinLock(&ReadIrpLock);
return CompleteIrp(Irp,STATUS_UNSUCCESSFUL,0);
}
// 看是否成功取出封包数据
if( PickPacketFromList(pAdapt,Irp))
{
ReadCount=0;
ReadIrp=NULL;
NdisReleaseSpinLock(&ReadIrpLock);
return STATUS_SUCCESS;
}
// 如果队列中没有封包数据,就将此IRP排队
ReadIrp = Irp;
ReadCount=1;
// Mark Irp as pending and set Cancel routine
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_PENDING;
IoMarkIrpPending(Irp);
IoSetCancelRoutine(Irp,SecLabCancelIrp);
NdisReleaseSpinLock(&ReadIrpLock);
return STATUS_PENDING;
}
示例15: FFSQueueRequest
NTSTATUS
FFSQueueRequest(
IN PFFS_IRP_CONTEXT IrpContext)
{
ASSERT(IrpContext);
ASSERT((IrpContext->Identifier.Type == FFSICX) &&
(IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
// IsSynchronous means we can block (so we don't requeue it)
IrpContext->IsSynchronous = TRUE;
SetFlag(IrpContext->Flags, IRP_CONTEXT_FLAG_REQUEUED);
IoMarkIrpPending(IrpContext->Irp);
ExInitializeWorkItem(
&IrpContext->WorkQueueItem,
FFSDeQueueRequest,
IrpContext);
ExQueueWorkItem(&IrpContext->WorkQueueItem, CriticalWorkQueue);
return STATUS_PENDING;
}