From: "Erich E. Hoover" erich.e.hoover@gmail.com
Based on a patch by Ralf Habacker.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34372 Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- dlls/iphlpapi/iphlpapi.spec | 1 + dlls/iphlpapi/ipstats.c | 36 ++++++++++++++++++++++++++++++++++++ include/iphlpapi.h | 1 + 3 files changed, 38 insertions(+)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index b4f77beced..2a4b3d84c7 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -5,6 +5,7 @@ @ stdcall AllocateAndGetIpAddrTableFromStack( ptr long long long ) @ stdcall AllocateAndGetIpForwardTableFromStack( ptr long long long ) @ stdcall AllocateAndGetIpNetTableFromStack( ptr long long long ) +@ stdcall AllocateAndGetTcpExTableFromStack( ptr long long long long ) @ stdcall AllocateAndGetTcpTableFromStack( ptr long long long ) @ stdcall AllocateAndGetUdpTableFromStack( ptr long long long ) @ stdcall CancelIPChangeNotify( ptr ) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index b4ed5426c6..0b762ebc8e 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -2320,6 +2320,42 @@ DWORD WINAPI AllocateAndGetTcpTableFromStack( PMIB_TCPTABLE *ppTcpTable, BOOL bO return build_tcp_table( TCP_TABLE_BASIC_ALL, (void **)ppTcpTable, bOrder, heap, flags, NULL ); }
+/****************************************************************** + * AllocateAndGetTcpExTableFromStack (IPHLPAPI.@) + * + * Get the TCP connection table. + * Like GetTcpTable(), but allocate the returned table from heap. + * + * PARAMS + * ppTcpTable [Out] pointer into which the MIB_TCPTABLE_EX is + * allocated and returned. + * bOrder [In] whether to sort the table + * heap [In] heap from which the table is allocated + * flags [In] flags to HeapAlloc + * family [In] address family [AF_INET|AF_INET6] + * + * RETURNS + * ERROR_INVALID_PARAMETER if ppTcpTable is NULL, whatever GetTcpTable() + * returns otherwise. + */ +DWORD WINAPI AllocateAndGetTcpExTableFromStack( VOID **ppTcpTable, BOOL bOrder, + HANDLE heap, DWORD flags, DWORD family ) +{ + TRACE("table %p, bOrder %d, heap %p, flags 0x%08x, family %u\n", + ppTcpTable, bOrder, heap, flags, family); + + if (!ppTcpTable || !family) + return ERROR_INVALID_PARAMETER; + + if (family != WS_AF_INET) + { + FIXME( "family = %u not supported\n", family ); + return ERROR_NOT_SUPPORTED; + } + + return build_tcp_table( TCP_TABLE_OWNER_PID_ALL, ppTcpTable, bOrder, heap, flags, NULL ); +} + static DWORD get_udp_table_sizes( UDP_TABLE_CLASS class, DWORD row_count, DWORD *row_size ) { DWORD table_size; diff --git a/include/iphlpapi.h b/include/iphlpapi.h index 86507dfd4d..f52387a1ca 100644 --- a/include/iphlpapi.h +++ b/include/iphlpapi.h @@ -158,6 +158,7 @@ ULONG WINAPI GetAdaptersAddresses(ULONG family, ULONG flags, PVOID reserved,
DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags); +DWORD WINAPI AllocateAndGetTcpExTableFromStack(VOID **ppTcpTable, BOOL bOrder, HANDLE heap, DWORD flags, DWORD family); DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, BOOL bOrder, HANDLE heap, DWORD flags); DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForwardTable, BOOL bOrder, HANDLE heap, DWORD flags);