Commit e62eadad authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

iphlpapi: Implement ConvertInterfaceAliasToLuid().

parent e5b90e93
......@@ -12,7 +12,7 @@
@ stdcall CancelMibChangeNotify2( ptr )
#@ stub ConvertGuidToStringA
#@ stub ConvertGuidToStringW
#@ stub ConvertInterfaceAliasToLuid
@ stdcall ConvertInterfaceAliasToLuid( ptr ptr )
@ stdcall ConvertInterfaceGuidToLuid( ptr ptr )
@ stdcall ConvertInterfaceIndexToLuid( long ptr )
#@ stub ConvertInterfaceLuidToAlias
......
......@@ -3160,6 +3160,39 @@ ULONG WINAPI GetTcp6Table2(PMIB_TCP6TABLE2 table, PULONG size, BOOL order)
}
/******************************************************************
* 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.@)
*/
DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID *guid, NET_LUID *luid)
......
......@@ -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);
DWORD WINAPI ConvertInterfaceAliasToLuid(const WCHAR*,NET_LUID*);
DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID*,NET_LUID*);
DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX,NET_LUID*);
DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID*,GUID*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment