本文整理汇总了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")));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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"));
}
示例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 */
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}