mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:17:14 +00:00
iphlpapi: Fix byte ordering of Linux ports.
This commit is contained in:
parent
2569635cbf
commit
9c4a128940
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue