iphlpapi: Account for structs inpcb and tcpcb being unavailable for userland in FreeBSD 12.

FreeBSD 12, specifically __FreeBSD_version 1200026 and later, no longer
exposes struct inpcb and struct tcpcb to userland.  New structs xinpcb
and xtcpcb shall be used instead.

Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Gleb Smirnoff 2019-08-17 10:32:31 +02:00 committed by Alexandre Julliard
parent 8d55542473
commit 424e1e71ca
1 changed files with 16 additions and 12 deletions

View File

@ -2226,13 +2226,15 @@ DWORD build_tcp_table( TCP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
pXIG->xig_len > sizeof (struct xinpgen);
pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
{
struct tcpcb *pTCPData = NULL;
struct inpcb *pINData;
struct xsocket *pSockData;
pTCPData = &((struct xtcpcb *)pXIG)->xt_tp;
pINData = &((struct xtcpcb *)pXIG)->xt_inp;
pSockData = &((struct xtcpcb *)pXIG)->xt_socket;
#if __FreeBSD_version >= 1200026
struct xtcpcb *pTCPData = (struct xtcpcb *)pXIG;
struct xinpcb *pINData = &pTCPData->xt_inp;
struct xsocket *pSockData = &pINData->xi_socket;
#else
struct tcpcb *pTCPData = &((struct xtcpcb *)pXIG)->xt_tp;
struct inpcb *pINData = &((struct xtcpcb *)pXIG)->xt_inp;
struct xsocket *pSockData = &((struct xtcpcb *)pXIG)->xt_socket;
#endif
/* Ignore sockets for other protocols */
if (pSockData->xso_protocol != IPPROTO_TCP)
@ -2538,11 +2540,13 @@ DWORD build_udp_table( UDP_TABLE_CLASS class, void **tablep, BOOL order, HANDLE
pXIG->xig_len > sizeof (struct xinpgen);
pXIG = (struct xinpgen *)((char *)pXIG + pXIG->xig_len))
{
struct inpcb *pINData;
struct xsocket *pSockData;
pINData = &((struct xinpcb *)pXIG)->xi_inp;
pSockData = &((struct xinpcb *)pXIG)->xi_socket;
#if __FreeBSD_version >= 1200026
struct xinpcb *pINData = (struct xinpcb *)pXIG;
struct xsocket *pSockData = &pINData->xi_socket;
#else
struct inpcb *pINData = &((struct xinpcb *)pXIG)->xi_inp;
struct xsocket *pSockData = &((struct xinpcb *)pXIG)->xi_socket;
#endif
/* Ignore sockets for other protocols */
if (pSockData->xso_protocol != IPPROTO_UDP)