Previous Next

NdisMFreeSharedMemory

NdisMFreeSharedMemory frees memory that was previously allocated by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync by the driver of a DMA NIC.

VOID 
  NdisMFreeSharedMemory(
    IN NDIS_HANDLE  MiniportAdapterHandle,
    IN ULONG  Length,
    IN BOOLEAN  Cached,
    IN PVOID  VirtualAddress,
    IN NDIS_PHYSICAL_ADDRESS  PhysicalAddress
    );

Parameters

MiniportAdapterHandle
Specifies the handle originally input to MiniportInitialize.
Length
Specifies the number of bytes originally allocated.
Cached
Specifies TRUE if the original allocation was cacheable.
VirtualAddress
Specifies the base virtual address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.
PhysicalAddress
Specifies the corresponding physical address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.

Headers

Declared in Ndis.h. Include Ndis.h.

Comments

If it has already made a successful call to NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync, the NIC driver of a DMA device calls NdisMFreeSharedMemory if any of the following occurs:

A miniport driver cannot call NdisMFreeSharedMemory to free a subrange within an allocated shared memory range. The parameters passed to NdisMFreeSharedMemory must match exactly those that were passed to NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.

NdisMFreeSharedMemory cannot be called from a MiniportShutdown function.

Before calling NdisMFreeMapRegisters, a miniport driver must free any shared memory that it has allocated.

Windows Server 2003 and Windows XP Service Pack 1 and later releases allow both bus-master DMA NICs and slave DMA NICs to call NdisMFreeSharedMemory. Prior releases allow only bus-master DMA NICs to call NdisMFreeSharedMemory.

Callers of NdisMFreeSharedMemory run at IRQL = DISPATCH_LEVEL, except when in the context of MiniportHalt or MiniportInitialize (a failed initialization code path), in which case callers of this function must run at IRQL = PASSIVE_LEVEL.

See Also

MiniportAllocateComplete, MiniportHalt, MiniportInitialize, MiniportShutdown, NdisMAllocateSharedMemory, NdisMAllocateSharedMemoryAsync, NdisMFreeMapRegisters