iphlpapi: Fix byte ordering of Linux ports.

This commit is contained in:
Mark Adams 2007-07-11 00:16:37 -04:00 committed by Alexandre Julliard
parent 2569635cbf
commit 9c4a128940
2 changed files with 8 additions and 6 deletions

View file

@ -296,13 +296,15 @@ static int TcpTableSorter(const void *a, const void *b)
const MIB_TCPROW* rowA = a;
const MIB_TCPROW* rowB = b;
ret = rowA->dwLocalAddr - rowB->dwLocalAddr;
ret = ntohl (rowA->dwLocalAddr) - ntohl (rowB->dwLocalAddr);
if (ret == 0) {
ret = rowA->dwLocalPort - rowB->dwLocalPort;
ret = ntohs ((unsigned short)rowA->dwLocalPort) -
ntohs ((unsigned short)rowB->dwLocalPort);
if (ret == 0) {
ret = rowA->dwRemoteAddr - rowB->dwRemoteAddr;
ret = ntohl (rowA->dwRemoteAddr) - ntohl (rowB->dwRemoteAddr);
if (ret == 0)
ret = rowA->dwRemotePort - rowB->dwRemotePort;
ret = ntohs ((unsigned short)rowA->dwRemotePort) -
ntohs ((unsigned short)rowB->dwRemotePort);
}
}
}

View file

@ -1316,7 +1316,7 @@ DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, DWORD maxEntries, HANDLE heap,
if (ptr && *ptr) {
ptr++;
table->table[table->dwNumEntries].dwLocalPort =
strtoul(ptr, &endPtr, 16);
htons ((unsigned short)strtoul(ptr, &endPtr, 16));
ptr = endPtr;
}
if (ptr && *ptr) {
@ -1327,7 +1327,7 @@ DWORD getTcpTable(PMIB_TCPTABLE *ppTcpTable, DWORD maxEntries, HANDLE heap,
if (ptr && *ptr) {
ptr++;
table->table[table->dwNumEntries].dwRemotePort =
strtoul(ptr, &endPtr, 16);
htons ((unsigned short)strtoul(ptr, &endPtr, 16));
ptr = endPtr;
}
if (ptr && *ptr) {