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


C++ IoFreeMdl函数代码示例

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


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

示例1: DispTdiQueryInformationExComplete

VOID DispTdiQueryInformationExComplete(
    PVOID Context,
    ULONG Status,
    UINT ByteCount)
/*
 * FUNCTION: Completes a TDI QueryInformationEx request
 * ARGUMENTS:
 *     Context   = Pointer to the IRP for the request
 *     Status    = TDI status of the request
 *     ByteCount = Number of bytes returned in output buffer
 */
{
    PTI_QUERY_CONTEXT QueryContext;

    QueryContext = (PTI_QUERY_CONTEXT)Context;
    if (NT_SUCCESS(Status)) {
        CopyBufferToBufferChain(
            QueryContext->InputMdl,
            FIELD_OFFSET(TCP_REQUEST_QUERY_INFORMATION_EX, Context),
            (PCHAR)&QueryContext->QueryInfo.Context,
            CONTEXT_SIZE);
    }

    MmUnlockPages(QueryContext->InputMdl);
    IoFreeMdl(QueryContext->InputMdl);
    if( QueryContext->OutputMdl ) {
	MmUnlockPages(QueryContext->OutputMdl);
	IoFreeMdl(QueryContext->OutputMdl);
    }

    QueryContext->Irp->IoStatus.Information = ByteCount;
    QueryContext->Irp->IoStatus.Status      = Status;

    ExFreePoolWithTag(QueryContext, QUERY_CONTEXT_TAG);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:35,代码来源:dispatch.c

示例2: CdRomDeAllocateMmcResources

VOID
NTAPI
CdRomDeAllocateMmcResources(
    IN PDEVICE_OBJECT Fdo
    )
{
    PCOMMON_DEVICE_EXTENSION commonExtension = Fdo->DeviceExtension;
    PCDROM_DATA cddata = commonExtension->DriverData;
    PCDROM_MMC_EXTENSION mmcData = &cddata->Mmc;
    //NTSTATUS status;

    if (mmcData->CapabilitiesWorkItem) {
        IoFreeWorkItem(mmcData->CapabilitiesWorkItem);
        mmcData->CapabilitiesWorkItem = NULL;
    }
    if (mmcData->CapabilitiesIrp) {
        IoFreeIrp(mmcData->CapabilitiesIrp);
        mmcData->CapabilitiesIrp = NULL;
    }
    if (mmcData->CapabilitiesMdl) {
        IoFreeMdl(mmcData->CapabilitiesMdl);
        mmcData->CapabilitiesMdl = NULL;
    }
    if (mmcData->CapabilitiesBuffer) {
        ExFreePool(mmcData->CapabilitiesBuffer);
        mmcData->CapabilitiesBuffer = NULL;
    }
    mmcData->CapabilitiesBuffer = 0;
    mmcData->IsMmc = FALSE;
    mmcData->WriteAllowed = FALSE;
    
    return;
}
开发者ID:reactos,项目名称:reactos,代码行数:33,代码来源:mmc.c

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

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

/// <summary>
/// Unmap memory region, release corresponding MDL, and remove region form list
/// </summary>
/// <param name="pPageEntry">Region data</param>
/// <param name="pFoundEntry">Process data</param>
/// <returns>Status code</returns>
NTSTATUS BBUnmapRegionEntry( IN PMAP_ENTRY pPageEntry, IN PPROCESS_MAP_ENTRY pFoundEntry )
{
    NTSTATUS status = STATUS_SUCCESS;

    UNREFERENCED_PARAMETER( pFoundEntry );

    // MDL is valid
    if (pPageEntry->pMdl)
    {
        // If MDL is mapped
        if (pPageEntry->newPtr)
        {
            DPRINT( "BlackBone: %s: Unmapping region at 0x%p from process %u\n", __FUNCTION__, pPageEntry->newPtr, pFoundEntry->target.pid );
            MmUnmapLockedPages( (PVOID)pPageEntry->newPtr, pPageEntry->pMdl );
            pPageEntry->newPtr = 0;
        }

        if (pPageEntry->locked)
            MmUnlockPages( pPageEntry->pMdl );

        IoFreeMdl( pPageEntry->pMdl );
    }

    RemoveEntryList( &pPageEntry->link );
    ExFreePoolWithTag( pPageEntry, BB_POOL_TAG );

    return status;
}
开发者ID:capturePointer,项目名称:Blackbone,代码行数:34,代码来源:Remap.c

示例7: hax_pin_user_pages

int hax_pin_user_pages(uint64 start_uva, uint64 size, hax_memdesc_user *memdesc)
{
    PMDL pmdl = NULL;

    if (!memdesc) {
        hax_error("%s: memdesc == NULL\n", __func__);
        return -EINVAL;
    }

    // TODO: Check whether [start_uva, start_uva + size) is a valid UVA range

    pmdl = IoAllocateMdl((PVOID)start_uva, size, FALSE, FALSE, NULL);
    if (!pmdl) {
        hax_error("Failed to allocate MDL for va: 0x%llx, size: 0x%llx.\n",
                  start_uva, size);
        return -EFAULT;
    }

    try {
        MmProbeAndLockPages(pmdl, UserMode, IoWriteAccess);
    } except (EXCEPTION_EXECUTE_HANDLER) {
        hax_error("Failed to probe pages for guest's memory! va: 0x%llx\n",
                  start_uva);
        IoFreeMdl(pmdl);
        return -ENOMEM;
    }

    memdesc->pmdl = pmdl;
    return 0;
}
开发者ID:tisma,项目名称:haxm,代码行数:30,代码来源:hax_host_mem.c

示例8: redirect_irp_completion

static NTSTATUS
redirect_irp_completion(PDEVICE_OBJECT dev_obj, PIRP irp, PVOID ctxt)
{
    IO_STACK_LOCATION *const isl = IoGetCurrentIrpStackLocation(irp);
    struct scsifilt *const sf = get_scsifilt(dev_obj);
    SCSI_REQUEST_BLOCK *const new_srb = isl->Parameters.Scsi.Srb;
    SCSI_REQUEST_BLOCK *const srb = new_srb->OriginalRequest;
    MDL *const mdl = irp->MdlAddress;
    void *const buf = new_srb->DataBuffer;

    UNREFERENCED_PARAMETER(ctxt);

    srb->SrbStatus = new_srb->SrbStatus;
    srb->ScsiStatus = new_srb->ScsiStatus;
    memcpy(srb->DataBuffer, buf, srb->DataTransferLength);

    IoFreeIrp(irp);
    IoFreeMdl(mdl);
    ExFreePool(buf);
    XmFreeMemory(new_srb);

    queue_srb_for_completion(sf, srb);

    return STATUS_MORE_PROCESSING_REQUIRED;
}
开发者ID:OpenXT,项目名称:xc-windows,代码行数:25,代码来源:redirect_srb.c

示例9: LlcTerminate

VOID
LlcTerminate(
    VOID
    )

/*++

Routine Description:

    The routines terminates the LLC protocol module and frees its global
    resources. This assumes all adapter bindings to be closed.

Arguments:

    None.

Return Value:

    None.

--*/

{
    NDIS_STATUS Status;

    ASSUME_IRQL(PASSIVE_LEVEL);

    LlcTerminateTimerSystem();
    NdisDeregisterProtocol(&Status, LlcProtocolHandle);
    IoFreeMdl(pXidMdl);
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:31,代码来源:llcmain.c

示例10: FatDestroyIrpContext

VOID
NTAPI
FatDestroyIrpContext(PFAT_IRP_CONTEXT IrpContext)
{
    PAGED_CODE();

    /* Make sure it has no pinned stuff */
    ASSERT(IrpContext->PinCount == 0);

    /* If there is a FatIo context associated with it - free it */
    if (IrpContext->FatIoContext)
    {
        if (!(IrpContext->Flags & IRPCONTEXT_STACK_IO_CONTEXT))
        {
            /* If a zero mdl was allocated - free it */
            if (IrpContext->FatIoContext->ZeroMdl)
                IoFreeMdl(IrpContext->FatIoContext->ZeroMdl);

            /* Free memory of FatIo context */
            ExFreePool(IrpContext->FatIoContext);
        }
    }

    /* Free memory */
    ExFreeToNPagedLookasideList(&FatGlobalData.IrpContextList, IrpContext);
}
开发者ID:GYGit,项目名称:reactos,代码行数:26,代码来源:fastfat.c

示例11: PsGetCurrentProcess

void 
UserMemoryManager::CleanupCurrentProcess()
{
	PEPROCESS	curProc	= PsGetCurrentProcess();

	mLMIList.PublicLock();
	LockedMemInfo	*pLMI = mLMIList.Head();

	// Unlock memory for this process.
	while (NULL!=(int)(pLMI))
	{
		LockedMemInfo	*pNext	= mLMIList.Next(pLMI);

		if (pLMI->proc == curProc)
		{
			MmUnlockPages(pLMI->pMdl);
			IoFreeMdl(pLMI->pMdl);

			mLMIList.Remove(pLMI);
			mLMIAllocator.Free(pLMI);
		}

		pLMI = pNext;
	}

	mLMIList.PublicUnlock();
}
开发者ID:ysangkok,项目名称:pgp-win32-6.5.8,代码行数:27,代码来源:UserMemoryManager.cpp

示例12: StreamOobInjectCompletionFn

void 
NTAPI 
StreamOobInjectCompletionFn(
   _Inout_ void* context,
   _Inout_ NET_BUFFER_LIST* netBufferList,
   BOOLEAN dispatchLevel
   )
/* ++

   Injection completion function for injecting an NBL created using 
   FwpsAllocateNetBufferAndNetBufferList. This function frees up 
   resources allocated during StreamOobReinjectData().

-- */
{
   MDL* mdl = (MDL*)context;

   UNREFERENCED_PARAMETER(dispatchLevel);

   FwpsFreeNetBufferList(netBufferList);

   if (mdl != NULL)
   {
      IoFreeMdl(mdl);

      //
      // The MDL mapped over a pool alloc which we need to free here.
      //

      ExFreePoolWithTag(
         mdl->MappedSystemVa, 
         STREAM_EDITOR_MDL_DATA_TAG
         );
   }
}
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:35,代码来源:oob_edit.c

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

示例14: MiSimpleReadComplete

NTSTATUS
NTAPI
MiSimpleReadComplete(PDEVICE_OBJECT DeviceObject,
                     PIRP Irp,
                     PVOID Context)
{
    PMDL Mdl = Irp->MdlAddress;

    /* Unlock MDL Pages, page 167. */
    DPRINT("MiSimpleReadComplete %p\n", Irp);
    while (Mdl)
    {
        DPRINT("MDL Unlock %p\n", Mdl);
        MmUnlockPages(Mdl);
        Mdl = Mdl->Next;
    }

    /* Check if there's an MDL */
    while ((Mdl = Irp->MdlAddress))
    {
        /* Clear all of them */
        Irp->MdlAddress = Mdl->Next;
        IoFreeMdl(Mdl);
    }

    return STATUS_SUCCESS;
}
开发者ID:killvxk,项目名称:NT_OS,代码行数:27,代码来源:io.c

示例15: CcMdlReadComplete

VOID
NTAPI
CcMdlReadComplete(IN PFILE_OBJECT FileObject,
                  IN PMDL MdlChain)
{
	IoFreeMdl(MdlChain);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:7,代码来源:mdlsup.c


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