iphlpapi: Implement if_nametoindex() using the ConvertInterface* functions.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-07-02 09:41:34 +01:00 committed by Alexandre Julliard
parent 7bdd9894f4
commit 259f7c7c47
1 changed files with 10 additions and 5 deletions

View File

@ -3357,13 +3357,18 @@ DWORD WINAPI ConvertLengthToIpv4Mask(ULONG mask_len, ULONG *mask)
*/
IF_INDEX WINAPI IPHLP_if_nametoindex(const char *name)
{
IF_INDEX idx;
IF_INDEX index;
NET_LUID luid;
DWORD err;
TRACE("(%s)\n", name);
if (getInterfaceIndexByName(name, &idx) == NO_ERROR)
return idx;
TRACE( "(%s)\n", name );
return 0;
err = ConvertInterfaceNameToLuidA( name, &luid );
if (err) return 0;
err = ConvertInterfaceLuidToIndex( &luid, &index );
if (err) index = 0;
return index;
}
/******************************************************************