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


C++ NdisFreeMemory函数代码示例

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


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

示例1: DEBUGMSG

void        BackOut				(MINIPORT_ADAPTER *pAdapter)
{
	DEBUGMSG(ZONE_INIT, (TEXT("LPC3xxx NDIS==> BackOut\r\n")));
	DEBUGMSG(ZONE_INIT, (TEXT("LPC3xxx NDIS==> Releasing all LPC3250 NDIS resources\r\n")));

	if (pAdapter->IsInterruptSet)
		NdisMDeregisterInterrupt(&pAdapter->InterruptInfo);

	if(pAdapter->pVAEMACBuffers != NULL)
	{
		UnMapRegisters (pAdapter->pVAEMACBuffers,pAdapter->dwEMACBuffersSize);
		pAdapter->pVAEMACBuffers = NULL;
	}

	if(pAdapter->pVALookAheadBuffer != NULL)
	{
		NdisFreeMemory(pAdapter->pVALookAheadBuffer,pAdapter->dwLookAheadBufferSize,0);
		pAdapter->pVALookAheadBuffer = NULL;
	}

	if(pAdapter->pTXPackets != NULL)
	{
		NdisFreeMemory(pAdapter->pTXPackets, sizeof(TX_PACKET) * pAdapter->dwTxStrides, 0);
		pAdapter->pTXPackets = NULL;
	}

	//Release the adapter structure.
    NdisFreeMemory(pAdapter, MINIPORT_ADAPTER_SIZE, 0);
	DEBUGMSG(ZONE_INIT, (TEXT("LPC3xxx NDIS<== BackOut\r\n")));
}
开发者ID:blueskycoco,项目名称:d5,代码行数:30,代码来源:lpc3250_NDIS_Init.c

示例2: CleanupRSSParameters

static VOID CleanupRSSParameters(PARANDIS_RSS_PARAMS *RSSParameters)
{
    if(RSSParameters->ActiveRSSScalingSettings.CPUIndexMapping != NULL)
        NdisFreeMemory(RSSParameters->ActiveRSSScalingSettings.CPUIndexMapping, 0, 0);

    if(RSSParameters->RSSScalingSettings.CPUIndexMapping != NULL)
        NdisFreeMemory(RSSParameters->RSSScalingSettings.CPUIndexMapping, 0, 0);

}
开发者ID:YehudaItkin,项目名称:kvm-guest-drivers-windows,代码行数:9,代码来源:ParaNdis6-RSS.cpp

示例3: NdisCloseConfiguration

VOID
NdisCloseConfiguration(
	IN NDIS_HANDLE					ConfigurationHandle
	)
/*++

Routine Description:

	This routine is used to close a configuration database opened by
	NdisOpenConfiguration.

Arguments:

	ConfigurationHandle - Handle returned by NdisOpenConfiguration.

Return Value:

	None.

--*/
{
	//
	// Obtain the actual configuration handle structure
	//
	PNDIS_CONFIGURATION_HANDLE NdisConfigHandle = (PNDIS_CONFIGURATION_HANDLE)ConfigurationHandle;

	//
	// Pointer to a parameter node
	//
	PNDIS_CONFIGURATION_PARAMETER_QUEUE ParameterNode;

	ASSERT (KeGetCurrentIrql() < DISPATCH_LEVEL);

	//
	// deallocate the parameter nodes
	//
	ParameterNode = NdisConfigHandle->ParameterList;

	while (ParameterNode != NULL)
	{
		NdisConfigHandle->ParameterList = ParameterNode->Next;

		NdisFreeMemory(ParameterNode,
					   sizeof(NDIS_CONFIGURATION_PARAMETER_QUEUE),
					   0);

		ParameterNode = NdisConfigHandle->ParameterList;
	}

	NdisFreeMemory(ConfigurationHandle,
				   sizeof(NDIS_CONFIGURATION_HANDLE),
				   0);
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:53,代码来源:init.c

示例4: trc_destroy

/* delte a trace object */
INT
trc_destroy(VOID *trc_1)
{
	TRC		*trc = (TRC*)trc_1;
    
    D_LOG(D_ENTRY, ("trc_destroy: entry, trc: 0x%lx", trc));

    /* free memory */
    NdisFreeMemory(trc->ent_tbl, sizeof(TRC_ENTRY) * trc->stat.depth, 0);
    NdisFreeMemory(trc, sizeof(*trc), 0);

    return(TRC_E_SUCC);        
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:14,代码来源:trc_core.c

示例5: FilterPacket_ReceiveHandler

BOOLEAN
FilterPacket_ReceiveHandler (
	PVOID pHeadBuffer,
	ULONG ulHeadSize,
	PNDIS_PACKET pPacket
	)
/*++

Routine Description:

	Filters network packets for NDISReceiveHandler.


Arguments:

	...


Return Value:

	TRUE: This packet should be blocked.

	FALSE: This packet should pass through.


Author:

	xiaonie

	2012/07/12


--*/
{
	ULONG ulPacketSize;
	PUCHAR pBuffer = NULL;
	NDIS_STATUS status;
	PNDIS_BUFFER pFirstBuffer, pNextBuffer;
	BOOLEAN bRet = FALSE;

	NdisQueryPacket(pPacket, NULL, NULL, NULL, &ulPacketSize);
	if (ulPacketSize == 0)
		return FALSE;

	DbgPrint("ulHeadSize == %d, ulPacketSize == %d in FilterPacket_ReceiveHandler!\r\n", ulHeadSize, ulPacketSize);

	status = NdisAllocateMemoryWithTag(&pBuffer, ulPacketSize + ulHeadSize, '!nmN');
	if (status != NDIS_STATUS_SUCCESS/* || pBuffer == NULL */)
		return FALSE;

	//obtain content from the packet
	NdisMoveMemory(pBuffer, pHeadBuffer, ulHeadSize);
	ReadPacket(pPacket, pBuffer + ulHeadSize, ulPacketSize);

	bRet = RabbitHole(pBuffer, ulPacketSize + ulHeadSize);

	NdisFreeMemory(pBuffer, ulPacketSize + ulHeadSize, 0);

	return bRet;
}
开发者ID:geemion,项目名称:HookNdis,代码行数:60,代码来源:HookNdis.c

示例6: ParaNdis6_Reset

/**********************************************************
Required NDIS handler for RESET operation
Never happens under normal condition, only if
OID or other call returns PENDING and not completed or if
ParaNdis6_CheckForHang returns true
***********************************************************/
static NDIS_STATUS ParaNdis6_Reset(
        NDIS_HANDLE miniportAdapterContext,
        PBOOLEAN  pAddressingReset)
{
    NDIS_STATUS  status = NDIS_STATUS_FAILURE;
    PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)miniportAdapterContext;
    NDIS_HANDLE hwo;
    tGeneralWorkItem *pwi;
    DEBUG_ENTRY(0);
    *pAddressingReset = TRUE;
    ParaNdis_DebugHistory(pContext, hopSysReset, NULL, 1, 0, 0);
    hwo = NdisAllocateIoWorkItem(pContext->MiniportHandle);
    pwi = ParaNdis_AllocateMemory(pContext, sizeof(tGeneralWorkItem));
    if (pwi && hwo)
    {
        pwi->pContext = pContext;
        pwi->WorkItem = hwo;
        NdisQueueIoWorkItem(hwo, OnResetWorkItem, pwi);
        status = NDIS_STATUS_PENDING;
    }
    else
    {
        if (pwi) NdisFreeMemory(pwi, 0, 0);
        if (hwo) NdisFreeIoWorkItem(hwo);
        ParaNdis_DebugHistory(pContext, hopSysReset, NULL, 0, status, 0);
    }
    DEBUG_EXIT_STATUS(0, status);
    return status;
}
开发者ID:represent-communications,项目名称:kvm-guest-drivers-windows,代码行数:35,代码来源:ParaNdis6-Driver.c

示例7: ApplySettings

static VOID ApplySettings(PPARANDIS_RSS_PARAMS RSSParameters,
        PARANDIS_RSS_MODE NewRSSMode,
        PARANDIS_HASHING_SETTINGS *ReceiveHashingSettings,
        PARANDIS_SCALING_SETTINGS *ReceiveScalingSettings)
{
    NdisAcquireSpinLock(&RSSParameters->RSSSettingsLock);

    RSSParameters->RSSMode = NewRSSMode;

    if(NewRSSMode != PARANDIS_RSS_DISABLED)
    {
        RSSParameters->ActiveHashingSettings = *ReceiveHashingSettings;

        if(NewRSSMode == PARANDIS_RSS_FULL)
        {
            if(RSSParameters->ActiveRSSScalingSettings.CPUIndexMapping != NULL)
                NdisFreeMemory(RSSParameters->ActiveRSSScalingSettings.CPUIndexMapping, 0, 0);

            RSSParameters->ActiveRSSScalingSettings = *ReceiveScalingSettings;

            ReceiveScalingSettings->CPUIndexMapping = NULL;
        }
    }

    NdisReleaseSpinLock(&RSSParameters->RSSSettingsLock);
}
开发者ID:bdacode,项目名称:kvm-guest-drivers-windows,代码行数:26,代码来源:ParaNdis6-RSS.cpp

示例8: tapAdapterContextFree

// Free adapter context memory and associated resources.
VOID tapAdapterContextFree(__in PTAP_ADAPTER_CONTEXT Adapter) {
  PLIST_ENTRY listEntry = &Adapter->AdapterListLink;

  DEBUGP(("[TAP] --> tapAdapterContextFree\n"));

  // Adapter context should already be removed.
  ASSERT((listEntry->Flink == listEntry) && (listEntry->Blink == listEntry));

  // Insure that adapter context has been removed from global adapter list.
  RemoveEntryList(&Adapter->AdapterListLink);

  // Free the adapter lock.
  NdisFreeSpinLock(&Adapter->AdapterLock);

  // Free the ANSI NetCfgInstanceId buffer.
  if (Adapter->NetCfgInstanceIdAnsi.Buffer != NULL) {
    RtlFreeAnsiString(&Adapter->NetCfgInstanceIdAnsi);
  }

  Adapter->NetCfgInstanceIdAnsi.Buffer = NULL;

  // Free the receive NBL pool.
  if (Adapter->ReceiveNblPool != NULL) {
    NdisFreeNetBufferListPool(Adapter->ReceiveNblPool);
  }

  Adapter->ReceiveNblPool = NULL;

  NdisFreeMemory(Adapter, 0, 0);

  DEBUGP(("[TAP] <-- tapAdapterContextFree\n"));
}
开发者ID:hlyu368,项目名称:outline-client,代码行数:33,代码来源:adapter.c

示例9: _rtw_mfree

void	_rtw_mfree(u8 *pbuf, u32 sz)
{

#ifdef	PLATFORM_LINUX
#ifdef RTK_DMP_PLATFORM
	if(sz > 0x4000)
		dvr_free(pbuf);
	else
#endif
		kfree(pbuf);

#endif	
#ifdef PLATFORM_FREEBSD
	free(pbuf,M_DEVBUF);	
#endif		
#ifdef PLATFORM_WINDOWS

	NdisFreeMemory(pbuf,sz, 0);

#endif
	
#ifdef DBG_MEMORY_LEAK
#ifdef PLATFORM_LINUX
	atomic_dec(&_malloc_cnt);
	atomic_sub(sz, &_malloc_size);
#endif
#endif /* DBG_MEMORY_LEAK */
	
}
开发者ID:Dee-UK,项目名称:RK3188_KK_4.4.02_Beta,代码行数:29,代码来源:osdep_service.c

示例10: PKTCloseAdapter

/*
 * Closes the open adapter
 *
 */
BOOL PKTCloseAdapter (POPEN_INSTANCE pOI)
{
	BOOL			bRet = TRUE;
	NDIS_STATUS		nsError;


	// close the adapter
	NdisCloseAdapter (&nsError, pOI->AdapterHandle);

	if (nsError == NDIS_STATUS_PENDING) {
		SuspendExecution (pOI);
	} else {
		PacketCloseAdapterComplete (pOI, nsError);
	}

	if (pOI->Status != NDIS_STATUS_SUCCESS) {
		bRet = FALSE;
	}

	// set all the events to release the waits
	SetEvent (pOI->ReadEvent);
	CloseHandle (pOI->ReadEvent);

	// Free the open instance memory
	NdisFreeMemory (pOI, sizeof (OPEN_INSTANCE), 0);

	// set no instances open
	g_pDeviceExtension->pOpenInstance = NULL;

	return bRet;
}
开发者ID:469306621,项目名称:Languages,代码行数:35,代码来源:Openclose.c

示例11: procedure

/*************************************************************
Required NDIS procedure
Called when some procedure (like OID handler) returns PENDING and
does not complete or when CheckForHang return TRUE
*************************************************************/
static NDIS_STATUS ParaNdis5_Reset(
	OUT PBOOLEAN AddressingReset,
	IN NDIS_HANDLE MiniportAdapterContext)
{
	NDIS_STATUS status;
	tGeneralWorkItem *pwi;
	PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
	DEBUG_ENTRY(0);
	ParaNdis_DebugHistory(pContext, hopSysReset, NULL, 1, 0, 0);
	status = NDIS_STATUS_FAILURE;
	pwi = ParaNdis_AllocateMemory(pContext, sizeof(tGeneralWorkItem));
	if (pwi)
	{
		pwi->pContext = pContext;
		NdisInitializeWorkItem(&pwi->wi, OnResetWorkItem, pwi);
		if (NdisScheduleWorkItem(&pwi->wi) == NDIS_STATUS_SUCCESS)
		{
			status = NDIS_STATUS_PENDING;
		}
		else
		{
			NdisFreeMemory(pwi, 0, 0);
		}
	}
	if (status != NDIS_STATUS_PENDING)
	{
		ParaNdis_DebugHistory(pContext, hopSysReset, NULL, 0, status, 0);
	}
	return status;
}
开发者ID:bloomier,项目名称:kvm-guest-drivers-windows,代码行数:35,代码来源:ParaNdis5-Driver.c

示例12: MpFreeAllocatedBlocks

/**
 * This function will dump out the contents of the GlobalMemoryList and free them as well.
 * Used to dump out leaking memory when driver is exiting
 * 
 * \sa MpAllocateMemory, MpFreeMemory
 */
VOID 
MpFreeAllocatedBlocks ()
{
    if (GlobalMemoryManagerInitialized)
    {
        NdisAcquireSpinLock (&GlobalMemoryLock);   
        if (!IsListEmpty (&GlobalMemoryList))
        {
            PLIST_ENTRY currentEntry;
            PMP_MEMORY_BLOCK currentMemory;

            while (!IsListEmpty (&GlobalMemoryList))
            {
                currentEntry = RemoveHeadList(&GlobalMemoryList);

                currentMemory = CONTAINING_RECORD (currentEntry, MP_MEMORY_BLOCK, ListEntry);
                MpTrace(COMP_DBG, DBG_SERIOUS, ("LEAK in %s on line %u\n", currentMemory->File,
                                      currentMemory->Line));

                NdisFreeMemory (currentMemory, 0, 0);
            }
        }
        NdisReleaseSpinLock (&GlobalMemoryLock);

        NdisFreeSpinLock(&GlobalMemoryLock);
        GlobalMemoryManagerInitialized = FALSE;
    }
}
开发者ID:kcrazy,项目名称:winekit,代码行数:34,代码来源:mp_dbg.c

示例13: ParaNdis5_Halt

/*************************************************************
Required NDIS procedure
Stops TX and RX path and finished the function of adapter
*************************************************************/
static VOID ParaNdis5_Halt(
	IN NDIS_HANDLE MiniportAdapterContext)
{
	NDIS_STATUS status = NDIS_STATUS_SUCCESS;
	BOOLEAN bUnused;
	PARANDIS_ADAPTER *pContext = (PARANDIS_ADAPTER *)MiniportAdapterContext;
	DEBUG_ENTRY(0);

	ParaNdis_DebugHistory(pContext, hopHalt, NULL, 1, 0, 0);

	NdisCancelTimer(&pContext->ConnectTimer, &bUnused);
	NdisResetEvent(&pContext->HaltEvent);
	if (NDIS_STATUS_PENDING != ParaNdis5_StopSend(pContext, TRUE, OnSendStopped))
		NdisSetEvent(&pContext->HaltEvent);
	WaitHaltEvent(pContext, "Send");
	NdisResetEvent(&pContext->HaltEvent);
	if (NDIS_STATUS_PENDING != ParaNdis5_StopReceive(pContext, TRUE, OnReceiveStopped))
		NdisSetEvent(&pContext->HaltEvent);
	WaitHaltEvent(pContext, "Receive");
	ParaNdis_CleanupContext(pContext);
	NdisCancelTimer(&pContext->DPCPostProcessTimer, &bUnused);
	ParaNdis_DebugHistory(pContext, hopHalt, NULL, 0, 0, 0);
	ParaNdis_DebugRegisterMiniport(pContext, FALSE);
	NdisFreeMemory(pContext, 0, 0);
	DEBUG_EXIT_STATUS(0, status);
}
开发者ID:bloomier,项目名称:kvm-guest-drivers-windows,代码行数:30,代码来源:ParaNdis5-Driver.c

示例14: PacketUnbindAdapterComplete

VOID NDIS_API PacketUnbindAdapterComplete(IN POPEN_INSTANCE Open,
                                          IN NDIS_STATUS Status)
{
  // upcall on NdisCloseAdapter completion


  // If Open->Status == NDIS_STATUS_PENDING then we must complete the pended unbinding
  if (Open->Status == NDIS_STATUS_PENDING) {
    NdisCompleteUnbindAdapter(Open->BindAdapterContext, Status);
    Open->Status = NDIS_STATUS_SUCCESS;
  }

  if (Status != NDIS_STATUS_SUCCESS)
    return;

  // Remove Adapter from global list
  RemoveEntryList(&Open->ListElement);

  // Free Memory
  NdisFreeSpinLock(&Open->RequestSpinLock);
  NdisFreeSpinLock(&Open->RcvQSpinLock);
  NdisFreeSpinLock(&Open->ResetSpinLock);

  NdisFreeBufferPool(Open->BufferPool);

  NdisFreePacketPool(Open->PacketPool);

  NdisFreeMemory(Open, sizeof(OPEN_INSTANCE), 0);
}
开发者ID:OPSF,项目名称:uClinux,代码行数:29,代码来源:epacket.c

示例15: ParaNdis_OnSetPower

/**********************************************************
NDIS5.X handler of power management
***********************************************************/
NDIS_STATUS ParaNdis_OnSetPower(PARANDIS_ADAPTER *pContext, tOidDesc *pOid)
{
	NDIS_STATUS status;
	NDIS_DEVICE_POWER_STATE newState;
	DEBUG_ENTRY(0);
	status = ParaNdis_OidSetCopy(pOid, &newState, sizeof(newState));
	if (status == NDIS_STATUS_SUCCESS)
	{
		tPowerWorkItem *pwi = ParaNdis_AllocateMemory(pContext, sizeof(tPowerWorkItem));
		status = NDIS_STATUS_FAILURE;
		if (pwi)
		{
			pwi->pContext = pContext;
			pwi->state    = newState;
			NdisInitializeWorkItem(&pwi->wi, OnSetPowerWorkItem, pwi);
			if (NdisScheduleWorkItem(&pwi->wi) == NDIS_STATUS_SUCCESS)
			{
				status = NDIS_STATUS_PENDING;
			}
			else
				NdisFreeMemory(pwi, 0, 0);
		}
	}
	return status;
}
开发者ID:HitMann1,项目名称:kvm-guest-drivers-windows,代码行数:28,代码来源:ParaNdis5-Oid.c


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