NdisMFreeSharedMemory (NDIS 5.1) function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

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

Syntax


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

Parameters

MiniportAdapterHandle [in]

Specifies the handle originally input to MiniportInitialize.

Length [in]

Specifies the number of bytes originally allocated.

Cached [in]

Specifies TRUE if the original allocation was cacheable.

VirtualAddress [in]

Specifies the base virtual address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.

PhysicalAddress [in]

Specifies the corresponding physical address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.

Return value

None

Remarks

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:

  • Its MiniportInitialize function is unable to initialize the NIC, so this function must release all existing claims on hardware resources for that NIC before it returns control.

  • The NIC for which the miniport driver allocated the memory is being removed.

  • The driver is being unloaded, whether because the system is shutting down or because the user reconfigured the network components used in the machine.

  • The driver allocated additional shared memory with NdisMAllocateSharedMemoryAsync when I/O demand on its NIC was high but network traffic has now subsided to an average level.

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.

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

Requirements

Target platform

Universal

Version

See NdisMFreeSharedMemory.

Header

Ndis.h (include Ndis.h)

IRQL

<= DISPATCH_LEVEL

See also

MiniportAllocateComplete
MiniportHalt
MiniportInitialize
MiniportShutdown
NdisMAllocateSharedMemory
NdisMAllocateSharedMemoryAsync
NdisMFreeMapRegisters

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft