NdisAllocateGenericObject function

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


PNDIS_GENERIC_OBJECT NdisAllocateGenericObject(
  PDRIVER_OBJECT DriverObject,
  ULONG          Tag,
  USHORT         Size



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


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


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.


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.


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

See Also