iphlpapi: Implement ConvertInterfaceAliasToLuid().

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-07 09:05:55 +01:00 committed by Alexandre Julliard
parent e5b90e93b2
commit e62eadadd5
3 changed files with 35 additions and 1 deletions

View File

@ -12,7 +12,7 @@
@ stdcall CancelMibChangeNotify2( ptr ) @ stdcall CancelMibChangeNotify2( ptr )
#@ stub ConvertGuidToStringA #@ stub ConvertGuidToStringA
#@ stub ConvertGuidToStringW #@ stub ConvertGuidToStringW
#@ stub ConvertInterfaceAliasToLuid @ stdcall ConvertInterfaceAliasToLuid( ptr ptr )
@ stdcall ConvertInterfaceGuidToLuid( ptr ptr ) @ stdcall ConvertInterfaceGuidToLuid( ptr ptr )
@ stdcall ConvertInterfaceIndexToLuid( long ptr ) @ stdcall ConvertInterfaceIndexToLuid( long ptr )
#@ stub ConvertInterfaceLuidToAlias #@ stub ConvertInterfaceLuidToAlias

View File

@ -3159,6 +3159,39 @@ ULONG WINAPI GetTcp6Table2(PMIB_TCP6TABLE2 table, PULONG size, BOOL order)
return ERROR_NOT_SUPPORTED; return ERROR_NOT_SUPPORTED;
} }
/******************************************************************
* ConvertInterfaceAliasToLuid (IPHLPAPI.@)
*/
DWORD WINAPI ConvertInterfaceAliasToLuid( const WCHAR *alias, NET_LUID *luid )
{
struct nsi_ndis_ifinfo_rw *data;
DWORD err, count, i, len;
NET_LUID *keys;
TRACE( "(%s %p)\n", debugstr_w(alias), luid );
if (!alias || !*alias || !luid) return ERROR_INVALID_PARAMETER;
luid->Value = 0;
len = strlenW( alias );
err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&keys, sizeof(*keys),
(void **)&data, sizeof(*data), NULL, 0, NULL, 0, &count, 0 );
if (err) return err;
err = ERROR_INVALID_PARAMETER;
for (i = 0; i < count; i++)
{
if (data[i].alias.Length == len * 2 && !memcmp( data[i].alias.String, alias, len * 2 ))
{
luid->Value = keys[i].Value;
err = ERROR_SUCCESS;
break;
}
}
NsiFreeTable( keys, data, NULL, NULL );
return err;
}
/****************************************************************** /******************************************************************
* ConvertInterfaceGuidToLuid (IPHLPAPI.@) * ConvertInterfaceGuidToLuid (IPHLPAPI.@)
*/ */

View File

@ -238,6 +238,7 @@ typedef VOID (WINAPI *PUNICAST_IPADDRESS_CHANGE_CALLBACK)(PVOID, PMIB_UNICASTIPA
typedef VOID (WINAPI *PIPFORWARD_CHANGE_CALLBACK)(VOID*,MIB_IPFORWARD_ROW2*,MIB_NOTIFICATION_TYPE); typedef VOID (WINAPI *PIPFORWARD_CHANGE_CALLBACK)(VOID*,MIB_IPFORWARD_ROW2*,MIB_NOTIFICATION_TYPE);
DWORD WINAPI ConvertInterfaceAliasToLuid(const WCHAR*,NET_LUID*);
DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID*,NET_LUID*); DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID*,NET_LUID*);
DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX,NET_LUID*); DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX,NET_LUID*);
DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID*,GUID*); DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID*,GUID*);