From: Paul Gofman <pgofman@codeweavers.com> --- dlls/ws2_32/tests/sock.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index d861f303367..f8658d1a15f 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -4360,6 +4360,8 @@ static void test_select(void) unsigned int apc_count; unsigned int maxfd, i; char *page_pair; + char path[MAX_PATH]; + HANDLE file; fdRead = socket(AF_INET, SOCK_STREAM, 0); ok( (fdRead != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() ); @@ -4459,8 +4461,42 @@ static void test_select(void) maxfd = fdRead; if(fdWrite > maxfd) maxfd = fdWrite; + GetSystemWindowsDirectoryA(path, ARRAY_SIZE(path)); + strcat(path, "\\system.ini"); + + file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0x0, NULL); + ok(file != INVALID_HANDLE_VALUE, "failed to open file, error %lu\n", GetLastError()); + + if ((SOCKET)file > maxfd) maxfd = (SOCKET)file; + + FD_ZERO_ALL(); + FD_SET((SOCKET)file, &readfds); + SetLastError(0); + ret = select(maxfd + 1, &readfds, &writefds, &exceptfds, &select_timeout); + ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + todo_wine ok ( WSAGetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", WSAGetLastError()); + ok ( !FD_ISSET(fdRead, &readfds), "FD should not be set\n"); + FD_ZERO(&readfds); FD_SET(fdRead, &readfds); + FD_SET(fdRead, &exceptfds); + FD_SET((SOCKET)file, &writefds); + ret = select(maxfd + 1, &readfds, &writefds, &exceptfds, &select_timeout); + ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( WSAGetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", WSAGetLastError()); + + FD_ZERO_ALL(); + FD_SET(fdRead, &readfds); + FD_SET(fdWrite, &writefds); + FD_SET((SOCKET)file, &exceptfds); + ret = select(maxfd + 1, &readfds, &writefds, &exceptfds, &select_timeout); + ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + todo_wine ok ( WSAGetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", WSAGetLastError()); + + CloseHandle(file); + + FD_ZERO_ALL(); + FD_SET(fdRead, &readfds); apc_count = 0; ret = QueueUserAPC(apc_func, GetCurrentThread(), (ULONG_PTR)&apc_count); ok(ret, "QueueUserAPC returned %d\n", ret); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10894