iphlpapi: Add a stub for getInterfacePhysicalByName in case configure found no way to determine interface data

André Hentschel nerv at dawncrow.de
Sat Nov 10 09:57:42 CST 2012


I just had this case with Haiku, i know it's Haiku, but when there's one there are others too.
Further this way it seems cleaner. We do such things often in iphlpapi anyway.
---
 dlls/iphlpapi/ifenum.c | 29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c
index aff88cd..372d20c 100644
--- a/dlls/iphlpapi/ifenum.c
+++ b/dlls/iphlpapi/ifenum.c
@@ -304,11 +304,10 @@ static DWORD getInterfaceMaskByName(const char *name)
   return ret;
 }
 
-#if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
-static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr,
- PDWORD type)
+static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr, PDWORD type)
 {
   DWORD ret;
+#if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
   int fd;
 
   if (!name || !len || !addr || !type)
@@ -390,13 +389,7 @@ static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr
   }
   else
     ret = ERROR_NO_MORE_FILES;
-  return ret;
-}
 #elif defined (SIOCGARP)
-static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr,
- PDWORD type)
-{
-  DWORD ret;
   int fd;
 
   if (!name || !len || !addr || !type)
@@ -448,14 +441,7 @@ static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr
   }
     else
       ret = ERROR_NO_MORE_FILES;
-
-  return ret;
-}
 #elif defined (HAVE_SYS_SYSCTL_H) && defined (HAVE_NET_IF_DL_H)
-static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr,
- PDWORD type)
-{
-  DWORD ret;
   struct if_msghdr *ifm;
   struct sockaddr_dl *sdl;
   u_char *p, *buf;
@@ -538,9 +524,18 @@ static DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr
     }
   }
   HeapFree(GetProcessHeap(), 0, buf);
+#else
+  if (!name || !len || !addr || !type)
+    return ERROR_INVALID_PARAMETER;
+
+  FIXME("not implemented\n");
+
+  *len = 0;
+  *type = 0;
+  ret = ERROR_NOT_SUPPORTED;
+#endif
   return ret;
 }
-#endif
 
 DWORD getInterfacePhysicalByIndex(IF_INDEX index, PDWORD len, PBYTE addr,
  PDWORD type)
-- 
1.8.0


-- 

Best Regards, André Hentschel


More information about the wine-patches mailing list