iphlpapi: Use RtlIpv4AddressToStringA instead of inet_ntoa.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
be8729c9f5
commit
2d3b1c1288
|
@ -35,14 +35,6 @@
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_ARPA_INET_H
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_NET_IF_H
|
#ifdef HAVE_NET_IF_H
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1106,15 +1098,3 @@ ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_ad
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *toIPAddressString(unsigned int addr, char string[16])
|
|
||||||
{
|
|
||||||
if (string) {
|
|
||||||
struct in_addr iAddr;
|
|
||||||
|
|
||||||
iAddr.s_addr = addr;
|
|
||||||
/* extra-anal, just to make auditors happy */
|
|
||||||
lstrcpynA(string, inet_ntoa(iAddr), 16);
|
|
||||||
}
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
|
@ -109,11 +109,6 @@ DWORD getIPAddrTable(PMIB_IPADDRTABLE *ppIpAddrTable, HANDLE heap, DWORD flags)
|
||||||
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs,
|
ULONG v6addressesFromIndex(IF_INDEX index, SOCKET_ADDRESS **addrs, ULONG *num_addrs,
|
||||||
SOCKET_ADDRESS **masks) DECLSPEC_HIDDEN;
|
SOCKET_ADDRESS **masks) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* Converts the network-order bytes in addr to a printable string. Returns
|
|
||||||
* string.
|
|
||||||
*/
|
|
||||||
char *toIPAddressString(unsigned int addr, char string[16]) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) DECLSPEC_HIDDEN;
|
DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) DECLSPEC_HIDDEN;
|
||||||
DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status) DECLSPEC_HIDDEN;
|
DWORD getInterfaceStatusByName(const char *name, INTERNAL_IF_OPER_STATUS *status) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
|
@ -717,18 +717,18 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
|
||||||
for (i = 0; i < ipAddrTable->dwNumEntries; i++) {
|
for (i = 0; i < ipAddrTable->dwNumEntries; i++) {
|
||||||
if (ipAddrTable->table[i].dwIndex == ptr->Index) {
|
if (ipAddrTable->table[i].dwIndex == ptr->Index) {
|
||||||
if (firstIPAddr) {
|
if (firstIPAddr) {
|
||||||
toIPAddressString(ipAddrTable->table[i].dwAddr,
|
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwAddr,
|
||||||
ptr->IpAddressList.IpAddress.String);
|
ptr->IpAddressList.IpAddress.String);
|
||||||
toIPAddressString(ipAddrTable->table[i].dwMask,
|
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwMask,
|
||||||
ptr->IpAddressList.IpMask.String);
|
ptr->IpAddressList.IpMask.String);
|
||||||
firstIPAddr = FALSE;
|
firstIPAddr = FALSE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
currentIPAddr->Next = nextIPAddr;
|
currentIPAddr->Next = nextIPAddr;
|
||||||
currentIPAddr = nextIPAddr;
|
currentIPAddr = nextIPAddr;
|
||||||
toIPAddressString(ipAddrTable->table[i].dwAddr,
|
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwAddr,
|
||||||
currentIPAddr->IpAddress.String);
|
currentIPAddr->IpAddress.String);
|
||||||
toIPAddressString(ipAddrTable->table[i].dwMask,
|
RtlIpv4AddressToStringA((IN_ADDR *)&ipAddrTable->table[i].dwMask,
|
||||||
currentIPAddr->IpMask.String);
|
currentIPAddr->IpMask.String);
|
||||||
nextIPAddr++;
|
nextIPAddr++;
|
||||||
}
|
}
|
||||||
|
@ -749,9 +749,9 @@ DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
|
||||||
&& routeTable->table[i].u1.ForwardType ==
|
&& routeTable->table[i].u1.ForwardType ==
|
||||||
MIB_IPROUTE_TYPE_INDIRECT)
|
MIB_IPROUTE_TYPE_INDIRECT)
|
||||||
{
|
{
|
||||||
toIPAddressString(routeTable->table[i].dwForwardNextHop,
|
RtlIpv4AddressToStringA((IN_ADDR *)&routeTable->table[i].dwForwardNextHop,
|
||||||
ptr->GatewayList.IpAddress.String);
|
ptr->GatewayList.IpAddress.String);
|
||||||
toIPAddressString(routeTable->table[i].dwForwardMask,
|
RtlIpv4AddressToStringA((IN_ADDR *)&routeTable->table[i].dwForwardMask,
|
||||||
ptr->GatewayList.IpMask.String);
|
ptr->GatewayList.IpMask.String);
|
||||||
}
|
}
|
||||||
if (winsEnabled) {
|
if (winsEnabled) {
|
||||||
|
@ -2224,7 +2224,7 @@ static DWORD get_dns_server_list(PIP_ADDR_STRING list,
|
||||||
get_dns_servers( addr, num, TRUE );
|
get_dns_servers( addr, num, TRUE );
|
||||||
|
|
||||||
for (i = 0, ptr = list; i < num; i++, ptr = ptr->Next) {
|
for (i = 0, ptr = list; i < num; i++, ptr = ptr->Next) {
|
||||||
toIPAddressString(((struct sockaddr_in *)(addr + i))->sin_addr.s_addr,
|
RtlIpv4AddressToStringA((IN_ADDR *)&((struct sockaddr_in *)(addr + i))->sin_addr.s_addr,
|
||||||
ptr->IpAddress.String);
|
ptr->IpAddress.String);
|
||||||
if (i == num - 1)
|
if (i == num - 1)
|
||||||
ptr->Next = NULL;
|
ptr->Next = NULL;
|
||||||
|
|
Loading…
Reference in New Issue