// ndis.h
NDIS_STATUS NdisAllocateSharedMemory(
[in] NDIS_HANDLE NdisHandle,
[in] PNDIS_SHARED_MEMORY_PARAMETERS SharedMemoryParameters,
[in, out] PNDIS_HANDLE pAllocationHandle
);
View the official Windows Driver Kit DDI reference
No description available.
The NdisAllocateSharedMemory function allocates shared memory from a shared memory provider.
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:
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.
NdisAllocateSharedMemory can return the following status values:
Return code | Description |
---|---|
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. |
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.