Commit 07316882 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

iphlpapi: Improved GetTcpStatisticsEx stub.

parent 6715b186
......@@ -134,7 +134,7 @@
#@ stub GetSessionCompartmentId
@ stdcall GetTcp6Table( ptr ptr long )
@ stdcall GetTcp6Table2( ptr ptr long )
#@ stub GetTcpStatisticsEx
@ stdcall GetTcpStatisticsEx( ptr long )
@ stdcall GetTcpStatistics( ptr )
@ stub GetTcpStatsFromStack
@ stdcall GetTcpTable( ptr ptr long )
......
......@@ -975,24 +975,32 @@ DWORD WINAPI GetIpStatistics(PMIB_IPSTATS stats)
}
/******************************************************************
* GetTcpStatistics (IPHLPAPI.@)
* GetTcpStatisticsEx (IPHLPAPI.@)
*
* Get the TCP statistics for the local computer.
* Get the IPv4 and IPv6 TCP statistics for the local computer.
*
* PARAMS
* stats [Out] buffer for TCP statistics
* family [In] specifies wether IPv4 or IPv6 statistics are returned
*
* RETURNS
* Success: NO_ERROR
* Failure: error code from winerror.h
*/
DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
DWORD WINAPI GetTcpStatisticsEx(PMIB_TCPSTATS stats, DWORD family)
{
DWORD ret = ERROR_NOT_SUPPORTED;
if (!stats) return ERROR_INVALID_PARAMETER;
if (family != WS_AF_INET && family != WS_AF_INET6) return ERROR_INVALID_PARAMETER;
memset( stats, 0, sizeof(*stats) );
if (family == WS_AF_INET6)
{
FIXME( "unimplemented for IPv6\n" );
return ret;
}
#ifdef __linux__
{
FILE *fp;
......@@ -1111,6 +1119,22 @@ DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
return ret;
}
/******************************************************************
* GetTcpStatistics (IPHLPAPI.@)
*
* Get the TCP statistics for the local computer.
*
* PARAMS
* stats [Out] buffer for TCP statistics
*
* RETURNS
* Success: NO_ERROR
* Failure: error code from winerror.h
*/
DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS stats)
{
return GetTcpStatisticsEx(stats, WS_AF_INET);
}
/******************************************************************
* GetUdpStatistics (IPHLPAPI.@)
......
......@@ -659,7 +659,7 @@ static void testGetTcpStatisticsEx(void)
if (!pGetTcpStatisticsEx)
{
skip( "GetTcpStatisticsEx not available\n" );
win_skip( "GetTcpStatisticsEx not available\n" );
return;
}
......@@ -667,6 +667,10 @@ static void testGetTcpStatisticsEx(void)
ok(apiReturn == ERROR_INVALID_PARAMETER,
"GetTcpStatisticsEx(NULL, AF_INET); returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
apiReturn = pGetTcpStatisticsEx(&stats, AF_BAN);
ok(apiReturn == ERROR_INVALID_PARAMETER || apiReturn == ERROR_NOT_SUPPORTED,
"GetTcpStatisticsEx(&stats, AF_BAN) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
apiReturn = pGetTcpStatisticsEx(&stats, AF_INET);
ok(apiReturn == NO_ERROR, "GetTcpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
if (apiReturn == NO_ERROR && winetest_debug > 1)
......@@ -690,8 +694,8 @@ static void testGetTcpStatisticsEx(void)
}
apiReturn = pGetTcpStatisticsEx(&stats, AF_INET6);
ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
"GetTcpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
todo_wine ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
"GetTcpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
if (apiReturn == NO_ERROR && winetest_debug > 1)
{
trace( "TCP IPv6 Ex stats:\n" );
......
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