iphlpapi/tests: Add more IcmpSendEcho tests related to the reply size.

This commit is contained in:
Bruno Jesus 2014-01-08 21:47:11 -02:00 committed by Alexandre Julliard
parent a4664409ef
commit 2548d75f16
1 changed files with 38 additions and 1 deletions

View File

@ -44,6 +44,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#define ICMP_MINLEN 8 /* copied from dlls/iphlpapi/ip_icmp.h file */
static HMODULE hLibrary = NULL; static HMODULE hLibrary = NULL;
static DWORD (WINAPI *pGetNumberOfInterfaces)(PDWORD); static DWORD (WINAPI *pGetNumberOfInterfaces)(PDWORD);
@ -956,7 +958,8 @@ todo_wine
"expected 87, got %d\n", error); "expected 87, got %d\n", error);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, sizeof(replydata) - 1, 1000); replysz = sizeof(replydata) - 1;
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
error = GetLastError(); error = GetLastError();
todo_wine { todo_wine {
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n"); ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
@ -965,8 +968,42 @@ todo_wine
"expected 11050, got %d\n", error); "expected 11050, got %d\n", error);
} }
SetLastError(0xdeadbeef);
replysz = sizeof(ICMP_ECHO_REPLY);
ret = pIcmpSendEcho(icmp, address, senddata, 0, NULL, replydata, replysz, 1000);
error = GetLastError();
todo_wine
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
SetLastError(0xdeadbeef);
replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz, 1000);
error = GetLastError();
todo_wine
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
SetLastError(0xdeadbeef);
replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN + 1, NULL, replydata, replysz, 1000);
error = GetLastError();
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
todo_wine
ok (error == IP_GENERAL_FAILURE
|| broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
"expected 11050, got %d\n", error);
SetLastError(0xdeadbeef);
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz - 1, 1000);
error = GetLastError();
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
todo_wine
ok (error == IP_GENERAL_FAILURE
|| broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
"expected 11050, got %d\n", error);
/* in windows >= vista the timeout can't be invalid */ /* in windows >= vista the timeout can't be invalid */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
replysz = sizeof(replydata);
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 0); ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 0);
error = GetLastError(); error = GetLastError();
if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", error); if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", error);