ConvertInterfaceNameToLuidW function (netioapi.h)

The ConvertInterfaceNameToLuidW function converts a Unicode network interface name to the locally unique identifier (LUID) for the interface.

Syntax

IPHLPAPI_DLL_LINKAGE _NETIOAPI_SUCCESS_ NETIOAPI_API ConvertInterfaceNameToLuidW(
  [in]  const WCHAR *InterfaceName,
  [out] NET_LUID    *InterfaceLuid
);

Parameters

[in] InterfaceName

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

[out] InterfaceLuid

A pointer to the NET_LUID for this interface.

Return value

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

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

Remarks

The ConvertInterfaceNameToLuidW function is available on Windows Vista and later.

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

The ConvertInterfaceNameToLuidA converts an ANSI 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

Requirement Value
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

ConvertInterfaceNameToLuidA

NET_LUID

if_indextoname

if_nametoindex