From 2a45917ae264108f1a4ddd8adb1c65af0b73aaee Mon Sep 17 00:00:00 2001 From: Akihiro Sagawa Date: Tue, 24 Aug 2021 21:50:35 +0900 Subject: [PATCH] ws2_32/tests: Add socket option validity tests for a file handle. Signed-off-by: Akihiro Sagawa Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/ws2_32/tests/sock.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index a8d415c3cea..d3f2459aa3a 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -11691,6 +11691,15 @@ static void test_sockopt_validity(void) { IPV6_USER_MTU, 0, 0, TRUE }, {} }; + static const struct sockopt_validity_test file_handle_tests[] = + { + { -1, WSAENOTSOCK, 0, TRUE }, + { SO_TYPE, WSAENOTSOCK, 0, TRUE }, + { SO_OPENTYPE }, + {} + }; + char path[MAX_PATH]; + HANDLE file; SOCKET sock; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -11736,6 +11745,12 @@ static void test_sockopt_validity(void) do_sockopt_validity_tests("IPv6 raw", sock, IPPROTO_IPV6, ipv6_raw_tests); closesocket(sock); } + + GetSystemWindowsDirectoryA(path, ARRAY_SIZE(path)); + strcat(path, "\\system.ini"); + file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0x0, NULL); + do_sockopt_validity_tests("file", (SOCKET)file, SOL_SOCKET, file_handle_tests); + CloseHandle(file); } START_TEST( sock ) -- 2.11.4.GIT