From: Paul Gofman <pgofman@codeweavers.com> --- dlls/iphlpapi/tests/iphlpapi.c | 45 +++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c index 982880fdb9d..0824e342766 100644 --- a/dlls/iphlpapi/tests/iphlpapi.c +++ b/dlls/iphlpapi/tests/iphlpapi.c @@ -986,7 +986,7 @@ static void testIcmpSendEcho(void) { /* The APC's signature is different pre-Vista */ HANDLE icmp; - char senddata[32], replydata[sizeof(senddata) + sizeof(ICMP_ECHO_REPLY)]; + char senddata[32], replydata[sizeof(senddata) + sizeof(ICMP_ECHO_REPLY) + 1024]; char replydata2[sizeof(replydata) + sizeof(IO_STATUS_BLOCK)]; DWORD ret, error, replysz = sizeof(replydata); struct test_echo_thread_params p; @@ -1045,11 +1045,28 @@ static void testIcmpSendEcho(void) } ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error); +ret = inet_pton(AF_INET, "192.168.0.148", &address); +ok(ret, "got error %u.\n", WSAGetLastError()); SetLastError(0xdeadbeef); + memset(replydata, 0xcc, replysz); ret = IcmpSendEcho(icmp, address, NULL, 0, NULL, replydata, replysz, 1000); error = GetLastError(); ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error); +{ + ICMP_ECHO_REPLY *reply = (ICMP_ECHO_REPLY *)replydata; + char str[256]; + + SetLastError( 0xdeadbeef ); + ret = IcmpParseReplies( reply, replysz ); + ok( ret == 0, "ret %ld\n", ret ); + ok( GetLastError() == IP_DEST_PORT_UNREACHABLE, "got %ld\n", GetLastError() ); + trace("address %s.\n", inet_ntop(AF_INET, &address, str, 256)); + trace("reply: status %#lx, addr %s.\n", reply->Status, inet_ntop(AF_INET, &reply->Address, str, 256)); + ok(reply->Status == IP_DEST_PORT_UNREACHABLE, "got %lu.\n", reply->Status); + trace( "%#x.\n", *(int *)(reply + 1)); +} +return; memset(&opt, 0, sizeof(opt)); SetLastError(0xdeadbeef); ret = IcmpSendEcho(icmp, address, NULL, 0, &opt, replydata, replysz, 1000); @@ -1482,7 +1499,7 @@ static void testIcmpParseReplies( void ) static void test_Icmp6SendEcho(void) { - char senddata[32], replydata[sizeof(senddata) + sizeof(ICMPV6_ECHO_REPLY)]; + char senddata[32], replydata[sizeof(senddata) + sizeof(ICMPV6_ECHO_REPLY) + 1024]; struct sockaddr_in6 src_addr, address; IP_OPTION_INFORMATION opt; ICMPV6_ECHO_REPLY *reply; @@ -1498,7 +1515,8 @@ static void test_Icmp6SendEcho(void) memset(&src_addr, 0, sizeof(src_addr)); memset(&address, 0, sizeof(address)); - ret = inet_pton( AF_INET6, "::1", &address.sin6_addr); + //ret = inet_pton( AF_INET6, "::1", &address.sin6_addr); + ret = inet_pton( AF_INET6, "2806:2a0:c16:8f96::4a19", &address.sin6_addr); ok(ret, "got error %u.\n", WSAGetLastError()); SetLastError(0xdeadbeef); @@ -1508,22 +1526,25 @@ static void test_Icmp6SendEcho(void) ret = Icmp6SendEcho2(icmp, NULL, NULL, NULL, &src_addr, &address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000); todo_wine_if(!ret && GetLastError() == ERROR_ACCESS_DENIED) - ok(ret == 1, "got ret %lu, error %ld.\n", ret, GetLastError()); - if (!ret) + //ok(ret == 1, "got ret %lu, error %ld.\n", ret, GetLastError()); + ok(!ret && GetLastError() == IP_DEST_PORT_UNREACHABLE, "got ret %lu, error %ld.\n", ret, GetLastError()); + if (0 && !ret) { skip( "ipv6 ping is prohibited.\n" ); IcmpCloseHandle(icmp); return; } - ok(!GetLastError(), "got %ld.\n", GetLastError()); - ok(!reply->Status, "got %lu.\n", reply->Status); + ok(GetLastError() == IP_DEST_PORT_UNREACHABLE, "got %ld.\n", GetLastError()); + //ok(!reply->Status, "got %lu.\n", reply->Status); + ok(reply->Status == IP_DEST_PORT_UNREACHABLE, "got %lu.\n", reply->Status); ok(!memcmp(reply->Address.sin6_addr, &address.sin6_addr, sizeof(address.sin6_addr)), "got %s.\n", inet_ntop(AF_INET6, (void *)&reply->Address.sin6_addr, str, sizeof(str))); ok(!reply->Address.sin6_port, "got %#x.\n", reply->Address.sin6_port); ok(!reply->Address.sin6_flowinfo, "got %#lx.\n", reply->Address.sin6_flowinfo); ok(!reply->Address.sin6_scope_id, "got %#lx.\n", reply->Address.sin6_scope_id); - ok(!memcmp(reply + 1, senddata, sizeof(senddata)), "reply data does not match.\n"); - + trace( "%#x.\n", *(int *)(reply + 1)); + //ok(!memcmp(reply + 1, senddata, sizeof(senddata)), "reply data does not match.\n"); +return; memset(&src_addr, 0, sizeof(src_addr)); memset(&address, 0, sizeof(address)); memset(&opt, 0, sizeof(opt)); @@ -4162,6 +4183,12 @@ START_TEST(iphlpapi) if (hLibrary) { HANDLE thread; +testIcmpSendEcho(); +testIcmpParseReplies(); +test_Icmp6SendEcho(); +testIcmp6ParseReplies(); +return; + testWin98OnlyFunctions(); testWinNT4Functions(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10954