当前位置: 首页>>代码示例>>C++>>正文


C++ IoCopyCurrentIrpStackLocationToNext函数代码示例

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


在下文中一共展示了IoCopyCurrentIrpStackLocationToNext函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PciPassIrpFromFdoToPdo

NTSTATUS
NTAPI
PciPassIrpFromFdoToPdo(IN PPCI_FDO_EXTENSION DeviceExtension,
                       IN PIRP Irp)
{
    PIO_STACK_LOCATION IoStackLocation;
    NTSTATUS Status;
    DPRINT1("Pci PassIrp ...\n");

    /* Get the stack location to check which function this is */
    IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
    if (IoStackLocation->MajorFunction == IRP_MJ_POWER)
    {
        /* Power IRPs are special since we have to notify the Power Manager */
        IoCopyCurrentIrpStackLocationToNext(Irp);
        PoStartNextPowerIrp(Irp);
        Status = PoCallDriver(DeviceExtension->AttachedDeviceObject, Irp);
    }
    else
    {
        /* For a normal IRP, just call the next driver in the stack */
        IoSkipCurrentIrpStackLocation(Irp);
        Status = IoCallDriver(DeviceExtension->AttachedDeviceObject, Irp);
    }

    /* Return the status back to the caller */
    return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:28,代码来源:dispatch.c

示例2: vboxUsbPwrSetPowerDev

static NTSTATUS vboxUsbPwrSetPowerDev(IN PVBOXUSBDEV_EXT pDevExt, IN PIRP pIrp)
{
    PIO_STACK_LOCATION pSl = IoGetCurrentIrpStackLocation(pIrp);
    DEVICE_POWER_STATE enmDevPState = pSl->Parameters.Power.State.DeviceState;
    DEVICE_POWER_STATE enmCurDevPState = pDevExt->DdiState.PwrState.PowerState.DeviceState;
    NTSTATUS Status = STATUS_SUCCESS;

    if (enmDevPState > enmCurDevPState && enmCurDevPState == PowerDeviceD0)
    {
        Status = vboxUsbPwrIoWaitCompletionAndPostAsync(pDevExt, pIrp);
        Assert(NT_SUCCESS(Status));
        if (NT_SUCCESS(Status))
            return Status;
    }

    PoStartNextPowerIrp(pIrp);

    if (NT_SUCCESS(Status))
    {
        IoCopyCurrentIrpStackLocationToNext(pIrp);
        IoSetCompletionRoutine(pIrp, vboxUsbPwrIoPostDevCompletion, pDevExt, TRUE, TRUE, TRUE);
        Status = PoCallDriver(pDevExt->pLowerDO, pIrp);
    }
    else
    {
        pIrp->IoStatus.Status = Status;
        pIrp->IoStatus.Information = 0;

        IoCompleteRequest(pIrp, IO_NO_INCREMENT);
        vboxUsbDdiStateRelease(pDevExt);
    }

    return Status;
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:34,代码来源:VBoxUsbPwr.cpp

示例3: PciCallDownIrpStack

NTSTATUS
NTAPI
PciCallDownIrpStack(IN PPCI_FDO_EXTENSION DeviceExtension,
                    IN PIRP Irp)
{
    NTSTATUS Status;
    KEVENT Event;
    PAGED_CODE();
    DPRINT1("PciCallDownIrpStack ...\n");
    ASSERT_FDO(DeviceExtension);

    /* Initialize the wait event */
    KeInitializeEvent(&Event, SynchronizationEvent, 0);

    /* Setup a completion routine */
    IoCopyCurrentIrpStackLocationToNext(Irp);
    IoSetCompletionRoutine(Irp, PciSetEventCompletion, &Event, TRUE, TRUE, TRUE);

    /* Call the attached device */
    Status = IoCallDriver(DeviceExtension->AttachedDeviceObject, Irp);
    if (Status == STATUS_PENDING)
    {
        /* Wait for it to complete the request, and get its status */
        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
        Status = Irp->IoStatus.Status;
    }

    /* Return that status back to the caller */
    return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:30,代码来源:dispatch.c

示例4: DispatchForSCSI

NTSTATUS DispatchForSCSI(IN PDEVICE_OBJECT fido, IN PIRP Irp)
{
//	KdPrint((DRIVERNAME " - Enter DispatchForSCSI \n"));

	PDEVICE_EXTENSION pdx = (PDEVICE_EXTENSION) fido->DeviceExtension;
	
	PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp); 

	// Pass request down without additional processing
	NTSTATUS status;
	status = IoAcquireRemoveLock(&pdx->RemoveLock, Irp);
	if (!NT_SUCCESS(status))
		return CompleteRequest(Irp, status, 0);

	IoCopyCurrentIrpStackLocationToNext(Irp);
	
	IoSetCompletionRoutine( Irp,
							USBSCSICompletion,
							NULL,
							TRUE,
							TRUE,
							TRUE ); 
	status = IoCallDriver(pdx->LowerDeviceObject, Irp);
	IoReleaseRemoveLock(&pdx->RemoveLock, Irp);
	return status;
}
开发者ID:caidongyun,项目名称:libs,代码行数:26,代码来源:DriverEntry.cpp

示例5: XenStub_SendAndWaitForIrp

static NTSTATUS
XenStub_SendAndWaitForIrp(PDEVICE_OBJECT device_object, PIRP irp)
{
  NTSTATUS status;
  PXENSTUB_DEVICE_DATA xsdd = (PXENSTUB_DEVICE_DATA)device_object->DeviceExtension;
  KEVENT event;

  UNREFERENCED_PARAMETER(device_object);

  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));

  KeInitializeEvent(&event, NotificationEvent, FALSE);

  IoCopyCurrentIrpStackLocationToNext(irp);
  IoSetCompletionRoutine(irp, XenStub_Pnp_IoCompletion, &event, TRUE, TRUE, TRUE);

  status = IoCallDriver(xsdd->lower_do, irp);

  if (status == STATUS_PENDING)
  {
    //KdPrint((__DRIVER_NAME "     waiting ...\n"));
    KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
    //KdPrint((__DRIVER_NAME "     ... done\n"));
    status = irp->IoStatus.Status;
  }

  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));

  return status;
}
开发者ID:stilltracy,项目名称:LICMX-Win,代码行数:30,代码来源:xenstub.c

示例6: LBKFltRead

NTSTATUS LBKFltRead(IN PDEVICE_OBJECT	pDevObj, IN PIRP pIrp) 
{
	PDEVICE_EXTENSION   pDevExt = (PDEVICE_EXTENSION) pDevObj->DeviceExtension;
	PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation( pIrp );
	PREADWRITE_IO_CONTEXT Context = NULL;

	DbgPrint("LBKFltRead was called \n");

	Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(READWRITE_IO_CONTEXT), LBKFLT_TAG_NPAGED);
	if(NULL == Context){
		DbgPrint("Memory allocation failure for read io context \n");
		pIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
		pIrp->IoStatus.Information = 0;
		IoCompleteRequest(pIrp, IO_NO_INCREMENT);
		return STATUS_INSUFFICIENT_RESOURCES;
	}
	Context->liOffset = pIrpStack->Parameters.Read.ByteOffset;
	Context->ulLength = pIrpStack->Parameters.Read.Length;

	IoCopyCurrentIrpStackLocationToNext(pIrp);

	IoSetCompletionRoutine( pIrp,
							ReadIoCompletion,
							Context,
							TRUE,//InvokeOnSuccess
							TRUE, // InvokeOnError
							TRUE // InvokeOnCancel
							);
	return IoCallDriver(pDevExt->pTargetDeviceObject, pIrp);
}
开发者ID:dannydraper,项目名称:ByteGuard,代码行数:30,代码来源:LbkFlt.c

示例7: HidKmdfPowerPassThrough

NTSTATUS
HidKmdfPowerPassThrough(
    __in PDEVICE_OBJECT DeviceObject,
    __in PIRP Irp
    )
/*++

Routine Description:

    Pass through routine for power IRPs .

Arguments:

   DeviceObject - pointer to a device object.

   Irp - pointer to an I/O Request Packet.

Return Value:

      NT status code

--*/
{
    //
    // Must start the next power irp before skipping to the next stack location
    //
    PoStartNextPowerIrp(Irp);

    //
    // Copy current stack to next instead of skipping. We do this to preserve 
    // current stack information provided by hidclass driver to the minidriver
    //
    IoCopyCurrentIrpStackLocationToNext(Irp);
    return PoCallDriver(GET_NEXT_DEVICE_OBJECT(DeviceObject), Irp);
}
开发者ID:AdiCheo,项目名称:droidpad-pc-driver,代码行数:35,代码来源:hidkmdf.c

示例8: vbgdNtSendIrpSynchronously

/**
 * Helper to send a PnP IRP and wait until it's done.
 *
 * @param    pDevObj    Device object.
 * @param    pIrp       Request packet.
 * @param    fStrict    When set, returns an error if the IRP gives an error.
 * @return   NT status code
 */
static NTSTATUS vbgdNtSendIrpSynchronously(PDEVICE_OBJECT pDevObj, PIRP pIrp, BOOLEAN fStrict)
{
    KEVENT Event;

    KeInitializeEvent(&Event, SynchronizationEvent, FALSE);

    IoCopyCurrentIrpStackLocationToNext(pIrp);
    IoSetCompletionRoutine(pIrp, (PIO_COMPLETION_ROUTINE)vbgdNtPnpIrpComplete,
                           &Event, TRUE, TRUE, TRUE);

    NTSTATUS rc = IoCallDriver(pDevObj, pIrp);

    if (rc == STATUS_PENDING)
    {
        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
        rc = pIrp->IoStatus.Status;
    }

    if (!fStrict
        && (rc == STATUS_NOT_SUPPORTED || rc == STATUS_INVALID_DEVICE_REQUEST))
    {
        rc = STATUS_SUCCESS;
    }

    Log(("VBoxGuest::vbgdNtSendIrpSynchronously: Returning 0x%x\n", rc));
    return rc;
}
开发者ID:Rootkitsmm,项目名称:virtualbox-org-svn-vbox-trunk,代码行数:35,代码来源:VBoxGuest-win-pnp.cpp

示例9: ForwardIrpAndWait

NTSTATUS
ForwardIrpAndWait(
	IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp)
{
	PDEVICE_OBJECT LowerDevice;
	KEVENT Event;
	NTSTATUS Status;

	ASSERT(!((PCOMMON_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->IsClassDO);
	LowerDevice = ((PPORT_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;

	KeInitializeEvent(&Event, NotificationEvent, FALSE);
	IoCopyCurrentIrpStackLocationToNext(Irp);

	TRACE_(CLASS_NAME, "Calling lower device %p\n", LowerDevice);
	IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);

	Status = IoCallDriver(LowerDevice, Irp);
	if (Status == STATUS_PENDING)
	{
		Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
		if (NT_SUCCESS(Status))
			Status = Irp->IoStatus.Status;
	}

	return Status;
}
开发者ID:GYGit,项目名称:reactos,代码行数:28,代码来源:misc.c

示例10: PPJoyBus_SendIrpSynchronously

NTSTATUS PPJoyBus_SendIrpSynchronously (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
 KEVENT		event;
 NTSTATUS	ntStatus;

 PAGED_CODE();

 KeInitializeEvent (&event,NotificationEvent,FALSE);

 IoCopyCurrentIrpStackLocationToNext (Irp);

 /* Set completion routine, to be called when lower driver is done with */
 /* this IRP. From this routine we signal the event when done.          */
 IoSetCompletionRoutine (Irp,PPJoyBus_CompletionRoutine,&event,TRUE,TRUE,TRUE);

 /* Call the lower level driver. */ 
 ntStatus= IoCallDriver(DeviceObject,Irp);

 /* Wait for the lower drivers to finish with the IRP. */
 if (ntStatus == STATUS_PENDING)
 {
  KeWaitForSingleObject (&event,Executive,KernelMode,FALSE,NULL);
  ntStatus= Irp->IoStatus.Status;
 }

 return ntStatus;
}
开发者ID:Cyborg11,项目名称:PPJoy,代码行数:27,代码来源:IRPUtil.c

示例11: PcForwardIrpSynchronous

NTSTATUS
NTAPI
PcForwardIrpSynchronous(
    IN  PDEVICE_OBJECT DeviceObject,
    IN  PIRP Irp)
{
    KEVENT Event;
    PPCLASS_DEVICE_EXTENSION DeviceExt;
    NTSTATUS Status;

    PC_ASSERT_IRQL_EQUAL(PASSIVE_LEVEL);

    DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;

    // initialize the notification event
    KeInitializeEvent(&Event, NotificationEvent, FALSE);

    IoCopyCurrentIrpStackLocationToNext(Irp);

    IoSetCompletionRoutine(Irp, CompletionRoutine, (PVOID)&Event, TRUE, TRUE, TRUE);

    // now call the driver
    Status = IoCallDriver(DeviceExt->PrevDeviceObject, Irp);
    // did the request complete yet
    if (Status == STATUS_PENDING)
    {
        // not yet, lets wait a bit
        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
        Status = Irp->IoStatus.Status;
    }
    return Status;
}
开发者ID:RareHare,项目名称:reactos,代码行数:32,代码来源:irp.cpp

示例12: ForwardIrpAndWait

NTSTATUS NTAPI
ForwardIrpAndWait(
	IN PDEVICE_OBJECT DeviceObject,
	IN PIRP Irp)
{
	KEVENT Event;
	NTSTATUS Status;
	PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
	ASSERT(LowerDevice);

	KeInitializeEvent(&Event, NotificationEvent, FALSE);
	IoCopyCurrentIrpStackLocationToNext(Irp);

	IoSetCompletionRoutine(Irp, ForwardIrpAndWaitCompletion, &Event, TRUE, TRUE, TRUE);

	Status = IoCallDriver(LowerDevice, Irp);
	if (Status == STATUS_PENDING)
	{
		Status = KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
		if (NT_SUCCESS(Status))
			Status = Irp->IoStatus.Status;
	}

	return Status;
}
开发者ID:RareHare,项目名称:reactos,代码行数:25,代码来源:misc.c

示例13: ImDiskDeviceControlLowerDevice

NTSTATUS
ImDiskDeviceControlLowerDevice(PIRP Irp, PDEVICE_EXTENSION DeviceExtension)
{
    PIO_STACK_LOCATION io_stack = IoGetCurrentIrpStackLocation(Irp);
    PIO_STACK_LOCATION lower_io_stack = IoGetNextIrpStackLocation(Irp);

    IoCopyCurrentIrpStackLocationToNext(Irp);

    if (io_stack->Parameters.DeviceIoControl.IoControlCode ==
        IOCTL_IMDISK_FSCTL_PASS_THROUGH)
    {
        lower_io_stack->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
    }

    lower_io_stack->Parameters.DeviceIoControl.IoControlCode =
        *(PULONG)Irp->AssociatedIrp.SystemBuffer;

    lower_io_stack->Parameters.DeviceIoControl.InputBufferLength -=
        sizeof(ULONG);

    RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer,
        (PUCHAR)Irp->AssociatedIrp.SystemBuffer + sizeof(ULONG),
        lower_io_stack->Parameters.DeviceIoControl.InputBufferLength);

    lower_io_stack->FileObject = DeviceExtension->file_object;

    return IoCallDriver(DeviceExtension->dev_object, Irp);
}
开发者ID:nnaabbcc,项目名称:exercise,代码行数:28,代码来源:lowerdev.cpp

示例14: HidUmdfPowerPassThrough

NTSTATUS
HidUmdfPowerPassThrough(
    _In_ PDEVICE_OBJECT DeviceObject,
    _Inout_ PIRP Irp
    )
/*++

Routine Description:

    Pass through routine for power IRPs .

Arguments:

   DeviceObject - pointer to a device object.

   Irp - pointer to an I/O Request Packet.

Return Value:

      NT status code

--*/
{
    PoStartNextPowerIrp(Irp);
    IoCopyCurrentIrpStackLocationToNext(Irp);
    return PoCallDriver(GET_NEXT_DEVICE_OBJECT(DeviceObject), Irp);
}
开发者ID:Realhram,项目名称:wdk81,代码行数:27,代码来源:hidumdf.c

示例15: PdoSurpriseRemoval

static DECLSPEC_NOINLINE NTSTATUS
PdoSurpriseRemoval(
    IN  PXENFILT_PDO    Pdo,
    IN  PIRP            Irp
    )
{
    NTSTATUS            status;

    status = IoAcquireRemoveLock(&Pdo->Dx->RemoveLock, Irp);
    if (!NT_SUCCESS(status))
        goto fail1;

    __PdoSetDevicePnpState(Pdo, SurpriseRemovePending);
    Irp->IoStatus.Status = STATUS_SUCCESS;

    IoCopyCurrentIrpStackLocationToNext(Irp);
    IoSetCompletionRoutine(Irp,
                           __PdoSurpriseRemoval,
                           Pdo,
                           TRUE,
                           TRUE,
                           TRUE);

    status = IoCallDriver(Pdo->LowerDeviceObject, Irp);

    return status;

fail1:
    Irp->IoStatus.Status = status;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);

    return status;
}
开发者ID:HeidCloud,项目名称:win-xenbus,代码行数:33,代码来源:pdo.c


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