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


C++ IoSkipCurrentIrpStackLocation函数代码示例

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


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

示例1: DF_DispatchPower

NTSTATUS
DF_DispatchPower(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
	PDF_DEVICE_EXTENSION	DevExt;
	PIO_STACK_LOCATION		IrpSp;
	PAGED_CODE();

	DevExt = (PDF_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
	IrpSp = IoGetCurrentIrpStackLocation(Irp);

	DBG_PRINT(DBG_TRACE_ROUTINES, ("%s: ", __FUNCTION__));
	if (IrpSp->Parameters.Power.Type == SystemPowerState)
	{
		DBG_PRINT(DBG_TRACE_OPS, ("SystemPowerState...\n"));
		if (PowerSystemShutdown == IrpSp->Parameters.Power.State.SystemState)
		{
			DBG_PRINT(DBG_TRACE_OPS, ("%d-%d: Stopping Device...\n", DevExt->DiskNumber, DevExt->PartitionNumber));
			StopDevice(DeviceObject);
			DBG_PRINT(DBG_TRACE_OPS, ("%d-%d: Device Stopped.\n", DevExt->DiskNumber, DevExt->PartitionNumber));
		}
	}
	else if (IrpSp->Parameters.Power.Type == DevicePowerState)
		DBG_PRINT(DBG_TRACE_OPS, ("DevicePowerState...\n"));
	else
		DBG_PRINT(DBG_TRACE_OPS, ("\n"));

#if WINVER < _WIN32_WINNT_VISTA
	PoStartNextPowerIrp(Irp);
	IoSkipCurrentIrpStackLocation(Irp);
	return PoCallDriver(DevExt->LowerDeviceObject, Irp);
#else
	IoSkipCurrentIrpStackLocation(Irp);
	return IoCallDriver(DevExt->LowerDeviceObject, Irp);
#endif
}
开发者ID:maodapeng,项目名称:WDUtils,代码行数:35,代码来源:Dispatch.c

示例2: DriverPNP

NTSTATUS DriverPNP(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp)
{
	Debug("Enter DriverPNP");

	if(pDevObj == g_MasterDeviceObj)
	{
		pIrp->IoStatus.Information	= 0;
		pIrp->IoStatus.Status		= STATUS_SUCCESS;
		IoCompleteRequest(pIrp,IO_NO_INCREMENT);
		Debug("g_MasterDeviceObj,DriverPNP");
		return STATUS_SUCCESS;
	}

	PMYDEVICE_EXTENSION tDevExtend	= (PMYDEVICE_EXTENSION)pDevObj->DeviceExtension;
	PIO_STACK_LOCATION tIrpStack	= IoGetCurrentIrpStackLocation(pIrp);

	NTSTATUS tStatus;
	if(IRP_MN_REMOVE_DEVICE == tIrpStack->MinorFunction)
	{
		IoSkipCurrentIrpStackLocation(pIrp);
		tStatus = IoCallDriver(tDevExtend->LowDeviceObj,pIrp);

		IoDetachDevice(tDevExtend->LowDeviceObj);
		IoDeleteDevice(pDevObj);
		tStatus = STATUS_SUCCESS;
	}
	else
	{
		IoSkipCurrentIrpStackLocation(pIrp);
		tStatus = IoCallDriver(tDevExtend->LowDeviceObj,pIrp);
	}	
	Debug("Leave DriverPNP");
	return tStatus;
}
开发者ID:r0cu3,项目名称:WindowsDriver,代码行数:34,代码来源:SysMain.cpp

示例3: HotKeyKrnlPnP

NTSTATUS 
HotKeyKrnlPnP( 
    IN PDEVICE_OBJECT DeviceObject, 
    IN PIRP Irp 
    ) 
{ 
	PDEVICE_EXTENSION   devExt; 
	PIO_STACK_LOCATION  irpStack; 
	NTSTATUS status = STATUS_SUCCESS; 
    KdPrint(("[shadow] Enter HotKeyKrnlPnP...\n"));
	devExt = (PDEVICE_EXTENSION)(DeviceObject->DeviceExtension); 
	irpStack = IoGetCurrentIrpStackLocation(Irp); 
	
	switch (irpStack->MinorFunction) 
	{ 
	case IRP_MN_REMOVE_DEVICE: 
		KdPrint(("[shadow] Enter IRP_MJ_PNP - IRP_MN_REMOVE_DEVICE\n")); 
		IoSkipCurrentIrpStackLocation(Irp); 
		IoCallDriver(devExt->LowerDeviceObject, Irp); 
		IoDetachDevice(devExt->LowerDeviceObject); 
		IoDeleteDevice(DeviceObject); 
		status = STATUS_SUCCESS; 
		break; 
	default: 
		IoSkipCurrentIrpStackLocation(Irp); 
		status = IoCallDriver(devExt->LowerDeviceObject, Irp); 
	} 
	return status; 
}
开发者ID:gokutek,项目名称:HotkeyDriver,代码行数:29,代码来源:HotKeyKrnl.c

示例4: KbLayoutDispatchPNP

NTSTATUS
KbLayoutDispatchPNP(
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp
    )
{
    PDEVICE_EXTENSION devExt;
    PIO_STACK_LOCATION irpStack;
    NTSTATUS status = STATUS_SUCCESS;

    devExt = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
    irpStack = IoGetCurrentIrpStackLocation(Irp);

    switch(irpStack->MinorFunction){
        case IRP_MN_REMOVE_DEVICE:
            IoSkipCurrentIrpStackLocation(Irp);
            IoCallDriver(devExt->NextDevice, Irp);
            IoDetachDevice(devExt->NextDevice); // the argument is actually the device to detach *from*
            IoDeleteDevice(DeviceObject);
            break;

        default:
            IoSkipCurrentIrpStackLocation(Irp);
            status = IoCallDriver(devExt->NextDevice, Irp);
            break;
    }
    
    return status;
}
开发者ID:lionicsheriff,项目名称:KmKbLayout,代码行数:29,代码来源:kblayout.c

示例5: CFTDefaultDispatch

NTSTATUS CFTDefaultDispatch(PDEVICE_OBJECT aDeviceObject, PIRP aIrp)
{
	PIO_STACK_LOCATION ioStackLocation = IoGetCurrentIrpStackLocation(aIrp);
	NTSTATUS status = STATUS_SUCCESS;
	ULONG i = 0, j = 0;

	// 首先需要知道发送给了那哪个设备。
	for (i = 0; i < CFT_MAX_COM_ID; ++i)
	{
		if (global_FileDevice[i] == aDeviceObject)
		{
			// 所有电源操作一律不过滤
			if (ioStackLocation->MajorFunction == IRP_MJ_POWER)
			{
				// 直接发送
				PoStartNextPowerIrp(aIrp);
				IoSkipCurrentIrpStackLocation(aIrp);
				return PoCallDriver(global_RealDevice[i], aIrp);
			}

			// 我们只过滤写请求,获得缓冲区以及长度,打印出来。
			if (ioStackLocation->MajorFunction == IRP_MJ_WRITE)
			{
				// 获得长度
				ULONG len = ioStackLocation->Parameters.Write.Length;

				// 获得缓冲区
				PUCHAR buf = NULL;
				if (aIrp->MdlAddress != NULL)
					buf = (PUCHAR)MmGetSystemAddressForMdlSafe(aIrp->MdlAddress, NormalPagePriority);
				else
					buf = (PUCHAR)aIrp->UserBuffer;

				if (buf == NULL)
					buf = (PUCHAR)aIrp->AssociatedIrp.SystemBuffer;

				// 打印内容
				for (j = 0; j < len; ++j)
					DbgPrint("COM capture : Send-Data : %2x\r\n", buf[j]);
			}
		}

		// 直接下发
		IoSkipCurrentIrpStackLocation(aIrp);
		return IoCallDriver(global_RealDevice[i], aIrp);
	}

	// 如果根本就不在被绑定的设备中,那是有问题的,直接返回参数
	aIrp->IoStatus.Information = 0;
	aIrp->IoStatus.Status = STATUS_INVALID_PARAMETER;
	IoCompleteRequest(aIrp, IO_NO_INCREMENT);
	return STATUS_SUCCESS;
}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:53,代码来源:wycomflt.cpp

示例6: BulkUsb_DispatchSysCtrl

NTSTATUS BulkUsb_DispatchSysCtrl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
    PTDeviceExtension       deviceExtension;
    SYSCTL_IRP_DISPOSITION  disposition;
    NTSTATUS                ntStatus;
    PIO_STACK_LOCATION      irpStack;
    
    PAGED_CODE();
    irpStack = IoGetCurrentIrpStackLocation (Irp);
    deviceExtension = (PTDeviceExtension) DeviceObject->DeviceExtension;
    if(REMOVED == deviceExtension->DeviceState) 
	{
        ntStatus = STATUS_DELETE_PENDING;
        Irp->IoStatus.Status = ntStatus;
        Irp->IoStatus.Information = 0;
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
        return ntStatus;
    }

	BulkUsb_DbgPrint(3, ("file bulkwmi: BulkUsb_DispatchSysCtrl::\n"));
    BulkUsb_IoIncrement(deviceExtension);
    ntStatus = WmiSystemControl(&deviceExtension->WmiLibInfo, 
                                DeviceObject, 
                                Irp,
                                &disposition);

    switch(disposition) 
	{
        case IrpProcessed: 
            break;
        
        case IrpNotCompleted:
            IoCompleteRequest(Irp, IO_NO_INCREMENT);                
            break;
      
        case IrpForward:
        case IrpNotWmi:
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);
            break;
                                    
        default:
            IoSkipCurrentIrpStackLocation (Irp);
            ntStatus = IoCallDriver(deviceExtension->TopOfStackDeviceObject, Irp);
            break;
    }
    BulkUsb_DbgPrint(3, ("file bulkwmi: BulkUsb_DispatchSysCtrl::\n"));
    BulkUsb_IoDecrement(deviceExtension);

    return ntStatus;
}
开发者ID:stormbay,项目名称:DragonVer1.0,代码行数:51,代码来源:bulkwmi.c

示例7: RfsdPnpCancelRemove

__drv_mustHoldCriticalRegion
NTSTATUS
RfsdPnpCancelRemove (
    PRFSD_IRP_CONTEXT IrpContext,
    PRFSD_VCB         Vcb
    )
{
    NTSTATUS Status;

    PAGED_CODE();

    RfsdPrint((DBG_PNP, "RfsdPnpCancelRemove by RfsdPnp ...\n"));

    ExAcquireResourceExclusiveLite(
        &Vcb->MainResource,  TRUE );

    Status = RfsdUnlockVcb(Vcb, IrpContext->FileObject);

    ExReleaseResourceForThreadLite(
        &Vcb->MainResource,
        ExGetCurrentResourceThread());

    IoSkipCurrentIrpStackLocation(IrpContext->Irp);

    Status = IoCallDriver(Vcb->TargetDeviceObject, IrpContext->Irp);

    IrpContext->Irp = NULL;

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

示例8: ExampleFilter_Close

/**********************************************************************
 * 
 *  ExampleFilter_Close
 *
 *    This is called when an instance of this driver is closed (CloseHandle)
 *
 **********************************************************************/
NTSTATUS ExampleFilter_Close(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
    NTSTATUS NtStatus = STATUS_SUCCESS;
    PEXAMPLE_FILTER_EXTENSION pExampleFilterDeviceContext = (PEXAMPLE_FILTER_EXTENSION)DeviceObject->DeviceExtension;
    PIO_STACK_LOCATION pIoStackIrp = NULL;

    DbgPrint("ExampleFilter_Close Called \r\n");


    /*
     * We do not want to process this IRP, we simply want to send it down to the next driver.
     * We use IoSkipCurrentIrpStackLocation() since we do not want to set a completion routine.
     *
     * We should not complete this IRP!  Once we pass it down we must forget about it.
     */

    IoSkipCurrentIrpStackLocation(Irp);

   /*
    * IoCallDriver() simply calls the appropriate entry point in the driver object associated
    * with the device object.  This is how drivers are basically "chained" together, they must know
    * that there are lower driver so they can perform the appropriate action and send down the IRP.
    *
    * They do not have to send the IRP down they could simply process it completely themselves if they wish.
    */

    NtStatus = IoCallDriver(pExampleFilterDeviceContext->pNextDeviceInChain, Irp);

    DbgPrint("ExampleFilter_Close Exit 0x%0x \r\n", NtStatus);

    
    return NtStatus;
}
开发者ID:ChibiTomo,项目名称:sandbox,代码行数:40,代码来源:functions.c

示例9: vboxUsbPnPMnRemoveDevice

static NTSTATUS vboxUsbPnPMnRemoveDevice(PVBOXUSBDEV_EXT pDevExt, PIRP pIrp)
{
    ENMVBOXUSB_PNPSTATE enmState = vboxUsbPnPStateGet(pDevExt);
    NTSTATUS Status = STATUS_SUCCESS;
    if (enmState != ENMVBOXUSB_PNPSTATE_SURPRISE_REMOVED)
    {
        Status = vboxUsbPnPRmDev(pDevExt);
        Assert(Status == STATUS_SUCCESS);
    }

    vboxUsbPnPStateSet(pDevExt, ENMVBOXUSB_PNPSTATE_REMOVED);

    vboxUsbDdiStateRelease(pDevExt);

    vboxUsbDdiStateReleaseAndWaitRemoved(pDevExt);

    vboxUsbRtClear(pDevExt);

    pIrp->IoStatus.Status = STATUS_SUCCESS;
    pIrp->IoStatus.Information = 0;
    IoSkipCurrentIrpStackLocation(pIrp);
    Status = IoCallDriver(pDevExt->pLowerDO, pIrp);

    IoDetachDevice(pDevExt->pLowerDO);
    IoDeleteDevice(pDevExt->pFDO);

    return Status;
}
开发者ID:jeppeter,项目名称:vbox,代码行数:28,代码来源:VBoxUsbPnP.cpp

示例10: PassThruPnp

NTSTATUS PassThruPnp(	IN PDEVICE_OBJECT fdo,
						IN PIRP Irp)
{
	DebugPrint("PnP %I",Irp);
	PPASSTHRU_DEVICE_EXTENSION dx=(PPASSTHRU_DEVICE_EXTENSION)fdo->DeviceExtension;

	// Remember minor function
	PIO_STACK_LOCATION IrpStack = IoGetCurrentIrpStackLocation(Irp);
	ULONG MinorFunction = IrpStack->MinorFunction;

	// Just pass to lower driver
	IoSkipCurrentIrpStackLocation(Irp);
	NTSTATUS status = IoCallDriver( dx->NextStackDevice, Irp);

	// Device removed
	if( MinorFunction==IRP_MN_REMOVE_DEVICE)
	{
		DebugPrint("PnP RemoveDevice");
		// disable device interface
		IoSetDeviceInterfaceState(&dx->ifSymLinkName, FALSE);
		RtlFreeUnicodeString(&dx->ifSymLinkName);
		
		// unattach from stack
		if (dx->NextStackDevice)
			IoDetachDevice(dx->NextStackDevice);

		// delete our fdo
		IoDeleteDevice(fdo);
	}

	return status;
}
开发者ID:Kallameet,项目名称:TPG2,代码行数:32,代码来源:Pnp.cpp

示例11: PassIRP

//========================================================================================
// Function:	PassIRP
// Purpose:		Free all the allocated resources, etc.
// Return Value:
//				NT status code
//========================================================================================
NTSTATUS PassIRP(
	IN PDEVICE_OBJECT fido,
	IN PIRP irp					// Irp - pointer to an I/O Request Packet.
	)
{
	PDEVICE_EXTENSION dx;
	NTSTATUS ntStatus;

	dx = (PDEVICE_EXTENSION)fido->DeviceExtension;

	// acquire remove lock
	ntStatus = IoAcquireRemoveLock(&dx->rmLock, irp);
	if (!NT_SUCCESS(ntStatus))
	{
		//complete irp if cannot acquire remove lock
		irp->IoStatus.Status=ntStatus;
		irp->IoStatus.Information=0;
		IoCompleteRequest(irp, IO_NO_INCREMENT);
		return ntStatus;
	}

	IoSkipCurrentIrpStackLocation(irp);
	ntStatus = IoCallDriver(dx->lowerdo, irp);

	IoReleaseRemoveLock(&dx->rmLock, irp);
	return ntStatus;
}
开发者ID:allanchen1971,项目名称:20150830_BarCo_SMBIOS,代码行数:33,代码来源:PciBusFilter.c

示例12: DkDefault

NTSTATUS DkDefault(PDEVICE_OBJECT pDevObj, PIRP pIrp)
{
    NTSTATUS            ntStat = STATUS_SUCCESS;
    PDEVICE_EXTENSION   pDevExt = NULL;
    PIO_STACK_LOCATION  pStack = NULL;
    PDEVICE_OBJECT      pNextDevObj = NULL;

    pDevExt = (PDEVICE_EXTENSION) pDevObj->DeviceExtension;

    ntStat = IoAcquireRemoveLock(&pDevExt->removeLock, (PVOID) pIrp);
    if (!NT_SUCCESS(ntStat))
    {
        DkDbgVal("Error acquire lock!", ntStat);
        DkCompleteRequest(pIrp, ntStat, 0);
        return ntStat;
    }

    pStack = IoGetCurrentIrpStackLocation(pIrp);

    DkDbgVal("DkDefault", pStack->MajorFunction);
    pNextDevObj = pDevExt->pNextDevObj;

    IoSkipCurrentIrpStackLocation(pIrp);
    ntStat = IoCallDriver(pNextDevObj, pIrp);

    IoReleaseRemoveLock(&pDevExt->removeLock, (PVOID) pIrp);

    return ntStat;
}
开发者ID:jue-jiang,项目名称:usbpcap,代码行数:29,代码来源:USBPcapMain.c

示例13: DECLHIDDEN

DECLHIDDEN(NTSTATUS) vboxUsbDispatchPower(IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp)
{
    PVBOXUSBDEV_EXT pDevExt = (PVBOXUSBDEV_EXT)pDeviceObject->DeviceExtension;
    ENMVBOXUSB_PNPSTATE enmState = vboxUsbDdiStateRetainIfNotRemoved(pDevExt);
    switch (enmState)
    {
        case ENMVBOXUSB_PNPSTATE_REMOVED:
        {
            PoStartNextPowerIrp(pIrp);

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

            IoCompleteRequest(pIrp, IO_NO_INCREMENT);

            vboxUsbDdiStateRelease(pDevExt);

            return STATUS_DELETE_PENDING;
        }
        case ENMVBOXUSB_PNPSTATE_START_PENDING:
        {
            PoStartNextPowerIrp(pIrp);
            IoSkipCurrentIrpStackLocation(pIrp);

            vboxUsbDdiStateRelease(pDevExt);

            return PoCallDriver(pDevExt->pLowerDO, pIrp);
        }
        default:
        {
            return vboxUsbPwrDispatch(pDevExt, pIrp);
        }
    }
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:34,代码来源:VBoxUsbPwr.cpp

示例14: vboxUsbPwrQueryPowerDev

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

    if (enmDevPState >= pDevExt->DdiState.PwrState.PowerState.DeviceState)
    {
        Status = vboxUsbPwrIoWaitCompletionAndPostAsync(pDevExt, pIrp);
        Assert(NT_SUCCESS(Status));
        if (NT_SUCCESS(Status))
            return Status;
    }

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

    PoStartNextPowerIrp(pIrp);

    if (NT_SUCCESS(Status))
    {
        IoSkipCurrentIrpStackLocation(pIrp);
        Status = PoCallDriver(pDevExt->pLowerDO, pIrp);
    }
    else
    {
        IoCompleteRequest(pIrp, IO_NO_INCREMENT);
    }

    vboxUsbDdiStateRelease(pDevExt);

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

示例15: 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


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