Commit ed4a566f authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

iphlpapi: Fix the IPv4 address network order for comparisons.

ipaddrrow_cmp() and ipforward_row_cmp() must perform byte-swapping in order for the rows to be sorted as expected. Signed-off-by: 's avatarFrancois Gouget <fgouget@codeweavers.com> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3aa18cc5
......@@ -1928,7 +1928,7 @@ done:
static int ipaddrrow_cmp( const void *a, const void *b )
{
const MIB_IPADDRROW *rowA = a, *rowB = b;
return DWORD_cmp(rowA->dwAddr, rowB->dwAddr);
return DWORD_cmp(RtlUlongByteSwap( rowA->dwAddr ), RtlUlongByteSwap( rowB->dwAddr ));
}
/******************************************************************
......@@ -2034,10 +2034,10 @@ DWORD WINAPI AllocateAndGetIpAddrTableFromStack( MIB_IPADDRTABLE **table, BOOL s
static int ipforward_row_cmp( const void *a, const void *b )
{
const MIB_IPFORWARDROW *rowA = a, *rowB = b;
return DWORD_cmp(rowA->dwForwardDest, rowB->dwForwardDest) ||
return DWORD_cmp(RtlUlongByteSwap( rowA->dwForwardDest ), RtlUlongByteSwap( rowB->dwForwardDest )) ||
DWORD_cmp(rowA->dwForwardProto, rowB->dwForwardProto) ||
DWORD_cmp(rowA->dwForwardPolicy, rowB->dwForwardPolicy) ||
DWORD_cmp(rowA->dwForwardNextHop, rowB->dwForwardNextHop);
DWORD_cmp(RtlUlongByteSwap( rowA->dwForwardNextHop ), RtlUlongByteSwap( rowB->dwForwardNextHop ));
}
/******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment