ConvertInterfaceNameToLuidA function

The ConvertInterfaceNameToLuidA function converts an ANSI network interface name to the locally unique identifier (LUID) for the interface.

Syntax

IPHLPAPI_DLL_LINKAGE _NETIOAPI_SUCCESS_ NETIOAPI_API ConvertInterfaceNameToLuidA(
  const CHAR *InterfaceName,
  NET_LUID   *InterfaceLuid
);

Parameters

InterfaceName

A pointer to a NULL-terminated ANSI string containing the network interface name.

InterfaceLuid

A pointer to the NET_LUID for this interface.

Return Value

On success, ConvertInterfaceNameToLuidA returns NETIO_ERROR_SUCCESS. Any nonzero return value indicates failure.

Error code Meaning
ERROR_BUFFER_OVERFLOW
The length of the ANSI interface name was invalid. This error is returned if the InterfaceName parameter exceeded the maximum allowed string length for this parameter.
ERROR_INVALID_NAME
The interface name was invalid. This error is returned if the InterfaceName parameter contained an invalid name.
ERROR_INVALID_PARAMETER
One of the parameters was invalid. This error is returned if the InterfaceLuid parameter was NULL.

Remarks

The ConvertInterfaceNameToLuidA function is available on Windows Vistaand later.

The ConvertInterfaceNameToLuidA function is protocol independent and works with network interfaces for both the IPv6 and IPv4 protocol. The ConvertInterfaceNameToLuidA converts an ANSI interface name to a LUID.

The ConvertInterfaceNameToLuidW converts a Unicode interface name to a LUID.

The maximum length of an interface name, NDIS_IF_MAX_STRING_SIZE, without the terminating NULL is declared in the Ntddndis.h header file. The NDIS_IF_MAX_STRING_SIZE is defined to be the IF_MAX_STRING_SIZE constant defined in the Ifdef.h header file. The Ntddndis.h and Ifdef.h header files are automatically included in the Netioapi.h header file which is automatically included by the Iphlpapi.h header file. The Ntddndis.h, Ifdef.h, and Netioapi.h header files should never be used directly.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header netioapi.h (include Iphlpapi.h)
Library Iphlpapi.lib
DLL Iphlpapi.dll

See Also

ConvertInterfaceAliasToLuid

ConvertInterfaceGuidToLuid

ConvertInterfaceIndexToLuid

ConvertInterfaceLuidToAlias

ConvertInterfaceLuidToGuid

ConvertInterfaceLuidToIndex

ConvertInterfaceLuidToNameA

ConvertInterfaceLuidToNameW

ConvertInterfaceNameToLuidW

NET_LUID

if_indextoname

if_nametoindex