NdisAllocateSharedMemory function

The NdisAllocateSharedMemory function allocates shared memory from a shared memory provider.

Syntax


NDIS_STATUS NdisAllocateSharedMemory(
  _In_     NDIS_HANDLE NdisHandle,
  _In_     PNDIS_SHARED_MEMORY_PARAMETERS SharedMemoryParameters,
  _Inout_  PNDIS_HANDLE pAllocationHandle
);

Parameters

NdisHandle [in]

An NDIS driver or instance handle that was obtained during caller initialization. For example, a miniport driver can use the NDIS handle that it obtained from the NdisMRegisterMiniportDriver or MiniportInitializeEx function. Other NDIS drivers can use the handles from the following functions:

NdisRegisterProtocolDriver

NdisOpenAdapterEx

SharedMemoryParameters [in]

A pointer to an NDIS_SHARED_MEMORY_PARAMETERS structure that defines the requested attributes for the shared memory.

pAllocationHandle [in, out]

A pointer to a location for a handle that identifies the shared memory that was allocated. The handle is available when the function returns or it is NULL if the function fails. The caller must use this handle to free the shared memory that was allocated successfully.

Return value

NdisAllocateSharedMemory can return the following status values:

Return codeDescription
NDIS_STATUS_SUCCESS

The operation completed successfully.

NDIS_STATUS_RESOURCES

The operation failed because there were insufficient resources to complete the operation.

NDIS_STATUS_INVALID_PARAMETER

The operation failed because of an invalid input parameter.

NDIS_STATUS_FAILURE

The operation failed for unspecified reasons.

 

Remarks

Note  A miniport driver must have already called NdisMRegisterScatterGatherDma or NdisMRegisterDmaChannel to initialize a scatter/gather DMA channel before calling NdisAllocateSharedMemory.

NDIS drivers call the NdisAllocateSharedMemory function to allocate a block of shared memory from an NDIS shared memory provider.

The SharedMemoryParameters parameter contains a pointer to an NDIS_SHARED_MEMORY_PARAMETERS structure that defines the requested attributes for the shared memory. If the NDIS_SHARED_MEM_PARAMETERS_CONTIGUOUS flag is not set in the Flags member, shared memory can be specified in a scatter-gather list that is contained in non-contiguous memory.

NDIS calls the NetAllocateSharedMemory function of a shared memory provider from the context of the call to NdisAllocateSharedMemory.

The driver must call the NdisFreeSharedMemory function to free the shared memory that it allocates with NdisAllocateSharedMemory.

Requirements

Version

Supported in NDIS 6.20 and later.

Header

Ndis.h (include Ndis.h)

IRQL

PASSIVE_LEVEL

See also

FilterAttach
MiniportInitializeEx
NDIS_SHARED_MEMORY_PARAMETERS
NdisFRegisterFilterDriver
NdisFreeSharedMemory
NdisMRegisterDmaChannel
NdisMRegisterMiniportDriver
NdisMRegisterScatterGatherDma
NdisOpenAdapterEx
NdisRegisterProtocolDriver
NetAllocateSharedMemory

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft