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


C++ IoFreeIrp函数代码示例

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


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

示例1: tdi_recv_stream

NTSTATUS tdi_recv_stream(PFILE_OBJECT connectionFileObject, char *buf, int len, ULONG flags)
{
    PDEVICE_OBJECT  devObj;
    KEVENT          event;
    PIRP            irp;
    PMDL            mdl;
    IO_STATUS_BLOCK iosb;
    NTSTATUS        status;

    devObj = IoGetRelatedDeviceObject(connectionFileObject);

    KeInitializeEvent(&event, NotificationEvent, FALSE);

    irp = TdiBuildInternalDeviceControlIrp(TDI_RECEIVE, devObj, connectionFileObject, &event, &iosb);

    if (irp == NULL)
    {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    if (len)
    {
        mdl = IoAllocateMdl((void*) buf, len, FALSE, FALSE, NULL);

        if (mdl == NULL)
        {
            IoFreeIrp(irp);
            return STATUS_INSUFFICIENT_RESOURCES;
        }

        __try
        {
            MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess);
            status = STATUS_SUCCESS;
        }
        __except (EXCEPTION_EXECUTE_HANDLER)
        {
            IoFreeMdl(mdl);
            IoFreeIrp(irp);
            status = STATUS_INVALID_USER_BUFFER;
        }

        if (!NT_SUCCESS(status))
        {
            return status;
        }
    }

    TdiBuildReceive(irp, devObj, connectionFileObject, NULL, NULL, len ? mdl : 0, flags, len);

    status = IoCallDriver(devObj, irp);

    if (status == STATUS_PENDING)
    {
        KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
        status = iosb.Status;
    }

    return NT_SUCCESS(status) ? iosb.Information : status;
}
开发者ID:baselsayeh,项目名称:winvblock,代码行数:60,代码来源:ktdi.c

示例2: DestroyTransferPacket

/*
 *  DestroyTransferPacket
 *
 */
VOID DestroyTransferPacket(PTRANSFER_PACKET Pkt)
{
    PFUNCTIONAL_DEVICE_EXTENSION fdoExt = Pkt->Fdo->DeviceExtension;
    PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
    KIRQL oldIrql;

    ASSERT(!Pkt->SlistEntry.Next);
//    ASSERT(!Pkt->OriginalIrp);

    KeAcquireSpinLock(&fdoData->SpinLock, &oldIrql);

    /*
     *  Delete the packet from our all-packets queue.
     */
    ASSERT(!IsListEmpty(&Pkt->AllPktsListEntry));
    ASSERT(!IsListEmpty(&fdoData->AllTransferPacketsList));
    RemoveEntryList(&Pkt->AllPktsListEntry);
    InitializeListHead(&Pkt->AllPktsListEntry);

    KeReleaseSpinLock(&fdoData->SpinLock, oldIrql);

    IoFreeMdl(Pkt->PartialMdl);
    IoFreeIrp(Pkt->Irp);
    FREE_POOL(Pkt->RetryHistory);
    FREE_POOL(Pkt);
}
开发者ID:kcrazy,项目名称:winekit,代码行数:30,代码来源:xferpkt.c

示例3: VBOXUSBTOOL_DECL

VBOXUSBTOOL_DECL(NTSTATUS) VBoxUsbToolGetDeviceSpeed(PDEVICE_OBJECT pDevObj, BOOLEAN *pbIsHigh)
{
    Assert(pbIsHigh);
    *pbIsHigh = FALSE;

    PIRP pIrp = IoAllocateIrp(pDevObj->StackSize, FALSE);
    Assert(pIrp);
    if (!pIrp)
    {
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    USB_BUS_INTERFACE_USBDI_V1 BusIf;
    PIO_STACK_LOCATION pSl = IoGetNextIrpStackLocation(pIrp);
    pSl->MajorFunction = IRP_MJ_PNP;
    pSl->MinorFunction = IRP_MN_QUERY_INTERFACE;
    pSl->Parameters.QueryInterface.InterfaceType = &USB_BUS_INTERFACE_USBDI_GUID;
    pSl->Parameters.QueryInterface.Size = sizeof (BusIf);
    pSl->Parameters.QueryInterface.Version = USB_BUSIF_USBDI_VERSION_1;
    pSl->Parameters.QueryInterface.Interface = (PINTERFACE)&BusIf;
    pSl->Parameters.QueryInterface.InterfaceSpecificData = NULL;

    pIrp->IoStatus.Status = STATUS_NOT_SUPPORTED;

    NTSTATUS Status = VBoxDrvToolIoPostSync(pDevObj, pIrp);
    Assert(NT_SUCCESS(Status) || Status == STATUS_NOT_SUPPORTED);
    if (NT_SUCCESS(Status))
    {
        *pbIsHigh = BusIf.IsDeviceHighSpeed(BusIf.BusContext);
        BusIf.InterfaceDereference(BusIf.BusContext);
    }
    IoFreeIrp(pIrp);

    return Status;
}
开发者ID:miguelinux,项目名称:vbox,代码行数:35,代码来源:VBoxUsbTool.cpp

示例4: IoCompletionRoutine

NTSTATUS
	IoCompletionRoutine(
	IN PDEVICE_OBJECT  DeviceObject,
	IN PIRP  Irp,
	IN PVOID  Context
	)
{
	UNREFERENCED_PARAMETER(DeviceObject);
	UNREFERENCED_PARAMETER(Context);

	PAGED_CODE();

	KdPrint(("SYS(%d:%d):IoCompletionRoutine!\n", PsGetCurrentProcessId(), PsGetCurrentThreadId()));
	*Irp->UserIosb = Irp->IoStatus;

	if (Irp->UserEvent)
		KeSetEvent(Irp->UserEvent, IO_NO_INCREMENT, 0);

	if (Irp->MdlAddress)
	{
		IoFreeMdl(Irp->MdlAddress);
		Irp->MdlAddress = NULL;
	}

	IoFreeIrp(Irp);

	return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:lcxl,项目名称:lcxl-shadow,代码行数:28,代码来源:winkernel.c

示例5: IoCompletionRoutine

NTSTATUS
IoCompletionRoutine(
	IN PDEVICE_OBJECT  DeviceObject,
	IN PIRP  Irp,
	IN PVOID  Context
	)
{
	//DbgPrint(("IoCompletionRoutine!\n"));
	*Irp->UserIosb = Irp->IoStatus;


	if (Irp->MdlAddress)
	{
		//MmUnmapLockedPages( Irp->MdlAddress, 
		//	MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority ) );
		MmUnlockPages( Irp->MdlAddress );
		IoFreeMdl(Irp->MdlAddress);
		Irp->MdlAddress = NULL;
	}

	if (Irp->UserEvent)
		KeSetEvent(Irp->UserEvent, IO_NO_INCREMENT, 0);

	IoFreeIrp(Irp);

	return STATUS_MORE_PROCESSING_REQUIRED;
	//return STATUS_SUCCESS;
}
开发者ID:shimbongsu,项目名称:secure-share-fss,代码行数:28,代码来源:gingko_readwrite.c

示例6: DeviceArrivalCompletion

NTSTATUS
DeviceArrivalCompletion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID Context)
{
    PHUB_DEVICE_EXTENSION DeviceExtension;
    LONG i;
    PWORKITEMDATA WorkItemData;

    DeviceExtension = (PHUB_DEVICE_EXTENSION)((PDEVICE_OBJECT)Context)->DeviceExtension;

    for (i=0; i < DeviceExtension->UsbExtHubInfo.NumberOfPorts; i++)
        DPRINT1("Port %x DeviceExtension->PortStatus %x\n",i+1, DeviceExtension->PortStatus[i]);

    IoFreeIrp(Irp);

    WorkItemData = ExAllocatePool(NonPagedPool, sizeof(WORKITEMDATA));
    if (!WorkItemData)
    {
        DPRINT1("Failed to allocate memory\n");
        return STATUS_NO_MEMORY;
    }


    RtlZeroMemory(WorkItemData, sizeof(WORKITEMDATA));
    WorkItemData->Context = Context;

    ExInitializeWorkItem(&WorkItemData->WorkItem, (PWORKER_THREAD_ROUTINE)WorkerThread, (PVOID)WorkItemData);
    ExQueueWorkItem(&WorkItemData->WorkItem, DelayedWorkQueue);
    return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:29,代码来源:fdo.c

示例7: ASSERT

void CIrp::DestroyIrp()
{
    ASSERT(m_Irp != nullptr);

    IoFreeIrp(m_Irp);
    m_Irp = nullptr;
}
开发者ID:daynix,项目名称:UsbDk,代码行数:7,代码来源:Irp.cpp

示例8: SelectiveSuspendCompletionRoutine

NTSTATUS SelectiveSuspendCompletionRoutine(PDEVICE_OBJECT pdo, PIRP Irp, UsbDev *pUsbDev)
{
	NTSTATUS ntStatus = Irp->IoStatus.Status;
	DBGU_TRACE("SelectiveSuspendCompletionRoutine: 0x%08X\n",ntStatus);
		
	//test 					
	/*if (InterlockedExchangePointer((PVOID *)&pUsbDev->m_SuspendIrp, NULL))
	{
		DBGU_TRACE("IoFreeIrp Suspend IRP at Completion Routine..\n");
		IoFreeIrp(Irp);
	}*/
	
	InterlockedExchangePointer((PVOID *)&pUsbDev->m_SuspendIrp, NULL);
	DBGU_TRACE("IoFreeIrp Suspend IRP at Completion Routine..\n");
	IoFreeIrp(Irp);

	// fix incorrect power state transition during S0 -> S3 (ymwu, 2005/7/16)
	// this irp will be cancelled when system power state is changed to S3
	// device power state should not be set to D0 in this situation
	// if you make incorrect power state transition, the system sometimes hangs
	{
		DBGU_TRACE("Cancel Selective Suspend..\n");
		pUsbDev->m_SuspendCancelled = 1;
	}

	KeSetEvent(&pUsbDev->m_SuspendIrpCancelEvent, IO_NO_INCREMENT, FALSE);
	return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:rancky,项目名称:skinvideo-driver,代码行数:28,代码来源:UsbDev.cpp

示例9: TdiQueryAddress

NTSTATUS
	TdiQueryAddress(
		PFILE_OBJECT		AddressObject, 
		PTDI_ADDRESS_INFO	AddressInfo,
		PULONG				pInfoLength
		)
{
	NTSTATUS	ntStatus;
	PIRP		Irp;
	PMDL		Mdl;
    PDEVICE_OBJECT	DeviceObject = IoGetRelatedDeviceObject(AddressObject);
    IO_STATUS_BLOCK IoStatus;

    if (!(Irp = TdiBuildInternalDeviceControlIrp(TDI_QUERY_INFORMATION, DeviceObject, FileObject, NULL, &IoStatus)))
		return STATUS_INSUFFICIENT_RESOURCES;

	if (!(Mdl = IoAllocateMdl(AddressInfo, *pInfoLength, FALSE, FALSE, Irp)))
	{
		IoFreeIrp(Irp);
		return STATUS_INSUFFICIENT_RESOURCES;
	}

	MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);

    TdiBuildQueryInformation(Irp, DeviceObject, AddressObject, NULL, NULL, TDI_QUERY_ADDRESS_INFO, Mdl);

    ntStatus = IoCallDriver(DeviceObject, Irp);

    return(ntStatus == STATUS_SUCCESS ? IoStatus.Status : ntStatus);

}
开发者ID:0x00dec0de,项目名称:Rovnix,代码行数:31,代码来源:tdi.c

示例10: disconnectfromserver

NTSTATUS
disconnectfromserver(PWSK_SOCKET sock)
{
	NTSTATUS status;
	KEVENT   event;
	PIRP     irp;

	irp = IoAllocateIrp(1, FALSE);
	if(!irp){
		return STATUS_INSUFFICIENT_RESOURCES;
	}

	KeInitializeEvent(&event, NotificationEvent, FALSE);

	IoSetCompletionRoutine(irp, disconnectcomplete, &event, TRUE, TRUE,
			TRUE);

	status = ((PWSK_PROVIDER_CONNECTION_DISPATCH)(sock->Dispatch))->
		WskCloseSocket(sock, irp);
	if(status == STATUS_PENDING){
		KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);

		status = irp->IoStatus.Status;
	}

	IoFreeIrp(irp);

	return status;
}
开发者ID:340211173,项目名称:Remote_Malware_Analyzer,代码行数:29,代码来源:sockets.c

示例11: SkillSetFileCompletion

NTSTATUS
SkillSetFileCompletion(
					   IN PDEVICE_OBJECT DeviceObject,
					   IN PIRP Irp,
					   IN PVOID Context
					   )
{
	BOOL bInit = FALSE;

	ReLoadNtosCALL(&RKeSetEvent,L"KeSetEvent",SystemKernelModuleBase,ImageModuleBase);
	if (RKeSetEvent)
	{
		bInit = TRUE;
	}
	if (!bInit)
		return STATUS_UNSUCCESSFUL;

	Irp->UserIosb->Status = Irp->IoStatus.Status;
	Irp->UserIosb->Information = Irp->IoStatus.Information;

	RKeSetEvent(Irp->UserEvent, IO_NO_INCREMENT, FALSE);

	IoFreeIrp(Irp);

	return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:AmesianX,项目名称:A-Protect,代码行数:26,代码来源:DeleteFile.c

示例12: CloseWskEventSocket

NTSTATUS
CloseWskEventSocket()
{
    if (!netlink_server_socket)
    {
        return STATUS_SUCCESS;
    }

    KEVENT		CompletionEvent = {0};
    PIRP		irp = NULL;

    NTSTATUS status = InitWskData(&irp, &CompletionEvent);
    if (!NT_SUCCESS(status))
    {
        return status;
    }

    status = ((PWSK_PROVIDER_BASIC_DISPATCH)netlink_server_socket->Dispatch)->WskCloseSocket(netlink_server_socket, irp);
    if (STATUS_PENDING == status)
    {
        KeWaitForSingleObject(&CompletionEvent, Executive, KernelMode, FALSE, NULL);
        status = irp->IoStatus.Status;
    }

    IoFreeIrp(irp);

    WskDeregister(&gWskEventRegistration);

    return status;
}
开发者ID:airhigh,项目名称:wdrbd,代码行数:30,代码来源:wsk2.c

示例13: PopRequestPowerIrpCompletion

static
NTSTATUS
NTAPI
PopRequestPowerIrpCompletion(IN PDEVICE_OBJECT DeviceObject,
                             IN PIRP Irp,
                             IN PVOID Context)
{
    PIO_STACK_LOCATION Stack;
    PREQUEST_POWER_COMPLETE CompletionRoutine;
    POWER_STATE PowerState;

    Stack = IoGetCurrentIrpStackLocation(Irp);
    CompletionRoutine = Context;

    PowerState.DeviceState = (ULONG_PTR)Stack->Parameters.Others.Argument3;
    CompletionRoutine(Stack->Parameters.Others.Argument1,
                      (UCHAR)(ULONG_PTR)Stack->Parameters.Others.Argument2,
                      PowerState,
                      Stack->Parameters.Others.Argument4,
                      &Irp->IoStatus);

    IoSkipCurrentIrpStackLocation(Irp);
    IoFreeIrp(Irp);
    ObDereferenceObject(DeviceObject);

    return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:reactos,项目名称:reactos,代码行数:27,代码来源:power.c

示例14: Ext2ReadWriteBlockSyncCompletionRoutine

NTSTATUS
Ext2ReadWriteBlockSyncCompletionRoutine (
    IN PDEVICE_OBJECT DeviceObject,
    IN PIRP Irp,
    IN PVOID Context    )
{
    PEXT2_RW_CONTEXT pContext = (PEXT2_RW_CONTEXT)Context;

    if (Irp != pContext->MasterIrp) {

        if (!NT_SUCCESS(Irp->IoStatus.Status)) {
            pContext->MasterIrp->IoStatus = Irp->IoStatus;
        }

        IoFreeMdl(Irp->MdlAddress);
        IoFreeIrp(Irp );
    }

    if (InterlockedDecrement(&pContext->Blocks) == 0) {

        pContext->MasterIrp->IoStatus.Information = 0;
        if (NT_SUCCESS(pContext->MasterIrp->IoStatus.Status)) {

            pContext->MasterIrp->IoStatus.Information =
                pContext->Length;
        }

        KeSetEvent(&pContext->Event, 0, FALSE);
    }

    return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:dond2008,项目名称:ext2fsd,代码行数:32,代码来源:block.c

示例15: PopRequestPowerIrpCompletion

static
NTSTATUS
NTAPI
PopRequestPowerIrpCompletion(IN PDEVICE_OBJECT DeviceObject,
                             IN PIRP Irp,
                             IN PVOID Context)
{
    PIO_STACK_LOCATION Stack;
    PREQUEST_POWER_ITEM RequestPowerItem;

    Stack = IoGetNextIrpStackLocation(Irp);
    RequestPowerItem = (PREQUEST_POWER_ITEM)Context;

    RequestPowerItem->CompletionRoutine(DeviceObject,
                                        Stack->MinorFunction,
                                        RequestPowerItem->PowerState,
                                        RequestPowerItem->Context,
                                        &Irp->IoStatus);

    IoFreeIrp(Irp);

    ObDereferenceObject(RequestPowerItem->TopDeviceObject);
    ExFreePool(Context);

    return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:26,代码来源:power.c


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