ws2_32/tests: Add tests for zero option length in test_set_getsockopt().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-03-08 12:22:47 +03:00 committed by Alexandre Julliard
parent 0baf44e320
commit 8fef57b1ef
1 changed files with 21 additions and 0 deletions

View File

@ -1459,6 +1459,27 @@ static void test_set_getsockopt(void)
}
ok(size == (test_optsize[i].optname == SO_OPENTYPE ? 4 : -1), "Got unexpected size %d.\n", size);
if (test_optsize[i].level == SOL_SOCKET && test_optsize[i].bool_value)
{
expected_err = 0;
expected_last_error = 0;
}
else
{
expected_err = -1;
expected_last_error = WSAEFAULT;
}
value = 1;
SetLastError(0xdeadbeef);
err = setsockopt(s2, test_optsize[i].level, test_optsize[i].optname, (char*)&value, 0);
ok(err == expected_err, "Unexpected setsockopt result %d.\n", err);
ok(WSAGetLastError() == expected_last_error, "Unexpected WSAGetLastError() %u.\n", WSAGetLastError());
size = 0;
err = getsockopt(s2, test_optsize[i].level, test_optsize[i].optname, (char*)&value, &size);
ok(err == -1, "Unexpected getsockopt result %d.\n", err);
ok(WSAGetLastError() == WSAEFAULT, "Unexpected WSAGetLastError() %u.\n", WSAGetLastError());
expected_size = test_optsize[i].sizes[2];
if (expected_size == 1)
expected_value = 0xdeadbe00;