Huw Davies : iphlpapi: Implement ConvertInterfaceGuidToLuid() on top of nsi.
Alexandre Julliard
julliard at winehq.org
Tue Jul 6 18:09:36 CDT 2021
Module: wine
Branch: master
Commit: 13e596b3fefd4c1846f0c763c20696cf2cb3c021
URL: https://source.winehq.org/git/wine.git/?a=commit;h=13e596b3fefd4c1846f0c763c20696cf2cb3c021
Author: Huw Davies <huw at codeweavers.com>
Date: Tue Jul 6 10:11:50 2021 +0100
iphlpapi: Implement ConvertInterfaceGuidToLuid() on top of nsi.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/iphlpapi/iphlpapi_main.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 4d3ee86da0b..ee5718e5d26 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -3164,20 +3164,31 @@ ULONG WINAPI GetTcp6Table2(PMIB_TCP6TABLE2 table, PULONG size, BOOL order)
*/
DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID *guid, NET_LUID *luid)
{
- DWORD ret;
- MIB_IFROW row;
+ struct nsi_ndis_ifinfo_static *data;
+ DWORD err, count, i;
+ NET_LUID *keys;
- TRACE("(%s %p)\n", debugstr_guid(guid), luid);
+ TRACE( "(%s %p)\n", debugstr_guid(guid), luid );
if (!guid || !luid) return ERROR_INVALID_PARAMETER;
+ luid->Value = 0;
- row.dwIndex = guid->Data1;
- if ((ret = GetIfEntry( &row ))) return ret;
+ err = NsiAllocateAndGetTable( 1, &NPI_MS_NDIS_MODULEID, NSI_NDIS_IFINFO_TABLE, (void **)&keys, sizeof(*keys),
+ NULL, 0, NULL, 0, (void **)&data, sizeof(*data), &count, 0 );
+ if (err) return err;
- luid->Info.Reserved = 0;
- luid->Info.NetLuidIndex = guid->Data1;
- luid->Info.IfType = row.dwType;
- return NO_ERROR;
+ err = ERROR_INVALID_PARAMETER;
+ for (i = 0; i < count; i++)
+ {
+ if (IsEqualGUID( &data[i].if_guid, guid ))
+ {
+ luid->Value = keys[i].Value;
+ err = ERROR_SUCCESS;
+ break;
+ }
+ }
+ NsiFreeTable( keys, NULL, NULL, data );
+ return err;
}
/******************************************************************
More information about the wine-cvs
mailing list