iphlpapi: Improved GetTcpStatisticsEx stub (try 2)
André Hentschel
nerv at dawncrow.de
Thu Sep 20 16:57:33 CDT 2012
---
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" );
--
1.7.4.1
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list