diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index ed3b1f3efd1..c61b23ca7e1 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -25,11 +25,20 @@ #include #include #ifdef HAVE_SYS_SOCKET_H -# include +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include #endif #if HAVE_NET_IF_H #include #endif +#if HAVE_NET_IF_ARP_H +#include +#endif #if HAVE_NETINET_TCP_H #include #endif @@ -664,20 +673,26 @@ PMIB_IPNETTABLE getArpTable(void) if (ptr) { char *endPtr; - if (ptr && *ptr) { - ret->table[ret->dwNumEntries].dwAddr = strtoul(ptr, &endPtr, 16); - ptr = endPtr; - } + ret->table[ret->dwNumEntries].dwAddr = inet_addr(ptr); + while (ptr && *ptr && !isspace(*ptr)) + ptr++; + if (ptr && *ptr) { strtoul(ptr, &endPtr, 16); /* hw type (skip) */ ptr = endPtr; } if (ptr && *ptr) { - strtoul(ptr, &endPtr, 16); /* flags (skip) */ + DWORD flags = strtoul(ptr, &endPtr, 16); + + if (flags & ATF_COM) + ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_DYNAMIC; + else if (flags & ATF_PERM) + ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_STATIC; + else + ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_OTHER; + ptr = endPtr; } - /* FIXME: maybe this comes from flags? */ - ret->table[ret->dwNumEntries].dwType = MIB_IPNET_TYPE_DYNAMIC; while (ptr && *ptr && isspace(*ptr)) ptr++; while (ptr && *ptr && !isspace(*ptr)) {