Module: wine Branch: master Commit: 07316882a55c14f6ab68a668f0e838611e2a85fd URL: http://source.winehq.org/git/wine.git/?a=commit;h=07316882a55c14f6ab68a668f0...
Author: André Hentschel nerv@dawncrow.de Date: Thu Sep 20 23:57:33 2012 +0200
iphlpapi: Improved GetTcpStatisticsEx stub.
---
dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/ipstats.c | 30 +++++++++++++++++++++++++++--- dlls/iphlpapi/tests/iphlpapi.c | 10 +++++++--- 3 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec index 368159a..36ba13f 100644 --- a/dlls/iphlpapi/iphlpapi.spec +++ b/dlls/iphlpapi/iphlpapi.spec @@ -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 ) diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c index 79dac58..a56e753 100644 --- a/dlls/iphlpapi/ipstats.c +++ b/dlls/iphlpapi/ipstats.c @@ -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.@) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index eb96189..26bf26e 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -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" );