Hardware Dev Center

Using a NET_LUID Index

NDIS provides functions to allocate and free the NET_LUID indexes that are required to create NET_LUID values. An NDIS interface provider must allocate a NET_LUID value to register an interface.

To allocate a NET_LUID index, an interface provider calls the NdisIfAllocateNetLuidIndex function. After allocating the index, the interface provider calls the NDIS_MAKE_NET_LUID macro to build the NET_LUID value. To free a NET_LUID index, an interface provider calls the NdisIfFreeNetLuidIndex function.

NdisIfAllocateNetLuidIndex attempts to allocate a 24-bit value that is associated with the interface type that the caller specified at the IfType parameter and that is unique to the local computer. If the index allocation succeeds, NdisIfAllocateNetLuidIndex returns NDIS_STATUS_SUCCESS and provides a NET_LUID index at the address that is provided in the pNetLuidIndex parameter. If NDIS is not able to find a free NET_LUID index, NdisIfAllocateNetLuidIndex returns NDIS_STATUS_RESOURCES. NdisIfAllocateNetLuidIndex can return other NDIS status values to indicate internal errors within NDIS. NDIS records the allocation of this index for when the computer subsequently restarts. NDIS will not use a particular index for future callers, even after the computer restarts, until the interface provider that allocated that index calls the NdisIfFreeNetLuidIndex function for that index.

NdisIfFreeNetLuidIndex frees a previously allocated NET_LUID index so that NDIS can possibly reallocate that index to another interface. The caller must pass in the same interface type at IfType that the caller used when it called NdisIfAllocateNetLuidIndex to allocate the NET_LUID index. If the free operation succeeds, NdisIfFreeNetLuidIndex returns NDIS_STATUS_SUCCESS. If the call to NdisIfFreeNetLuidIndex fails, the interface provider should remove any information that it saved in persistent storage that is related to the NET_LUID index. Removing the information will ensure that the provider does not keep trying to free an index that is already freed after every computer restart. After calling NdisIfFreeNetLuidIndex, the caller must not use the NET_LUID value again unless it calls NdisIfAllocateNetLuidIndex again for the same interface type and receives the same NET_LUID index that it freed.

To register a network interface, an interface provider must pass a valid NET_LUID value to the NdisIfRegisterInterface function. For more information about registering network interfaces, see Registering a Network Interface.

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft