NdisAllocateGenericObject function (ndis.h)

Components that do not have an NDIS handle use the NdisAllocateGenericObject function to allocate a generic NDIS object.

Syntax

PNDIS_GENERIC_OBJECT NdisAllocateGenericObject(
  [optional] PDRIVER_OBJECT DriverObject,
             ULONG          Tag,
             USHORT         Size
);

Parameters

[optional] DriverObject

A driver object to associate with the generic object. This parameter can be NULL.

Tag

The kernel memory tag that NDIS should use to allocate memory for the generic object.

Size

The amount of memory, in bytes, to reserve for the caller. This does not include the size of the NDIS_GENERIC_OBJECT structure. Use the additional memory space for your own purposes. To access the additional memory, use sizeof(NDIS_GENERIC_OBJECT) to skip over the generic object structure.

Return value

NdisAllocateGenericObject returns a pointer to the NDIS_GENERIC_OBJECT that it allocated. If NDIS failed to create the object, the return value is NULL.

Remarks

NDIS uses a generic object to manage resources that are allocated by a component that does not otherwise have an NDIS handle. Such a component uses the returned generic object pointer as an NDIS handle in some NDIS resource allocation APIs that require an NDIS handle.

NDIS drivers must call the NdisFreeGenericObject function to free a generic object that was created with NdisAllocateGenericObject.

Requirements

Requirement Value
Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Universal
Header ndis.h (include Ndis.h)
Library Ndis.lib
IRQL <= DISPATCH_LEVEL
DDI compliance rules Irql_Miscellaneous_Function(ndis), NdisAllocateGenericObject(ndis)

See also

NDIS_GENERIC_OBJECT

NdisFreeGenericObject