Zebediah Figura : ws2_32: Use IOCTL_AFD_LISTEN.
Alexandre Julliard
julliard at winehq.org
Fri May 14 15:47:04 CDT 2021
Module: wine
Branch: master
Commit: cdd24b1d9f0ddcc40cf9346aba28b919075c8db4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=cdd24b1d9f0ddcc40cf9346aba28b919075c8db4
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Thu May 13 22:54:40 2021 -0500
ws2_32: Use IOCTL_AFD_LISTEN.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 43 +++++++++++++++++++++----------------------
1 file changed, 21 insertions(+), 22 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 6c03a57e325..2ba1982b1d9 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -4566,37 +4566,36 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
return WSAIoctl( s, cmd, argp, sizeof(WS_u_long), argp, sizeof(WS_u_long), &ret_size, NULL, NULL );
}
+
/***********************************************************************
- * listen (WS2_32.13)
+ * listen (ws2_32.13)
*/
-int WINAPI WS_listen(SOCKET s, int backlog)
+int WINAPI WS_listen( SOCKET s, int backlog )
{
- int fd = get_sock_fd( s, FILE_READ_DATA, NULL ), ret = SOCKET_ERROR;
+ struct afd_listen_params params = {.backlog = backlog};
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ int fd, bound;
- TRACE("socket %04lx, backlog %d\n", s, backlog);
- if (fd != -1)
- {
- int bound = is_fd_bound(fd, NULL, NULL);
+ TRACE( "socket %#lx, backlog %d\n", s, backlog );
- if (bound <= 0)
- {
- SetLastError(bound == -1 ? wsaErrno() : WSAEINVAL);
- }
- else if (listen(fd, backlog) == 0)
- {
- _enable_event(SOCKET2HANDLE(s), FD_ACCEPT,
- FD_WINE_LISTENING,
- FD_CONNECT|FD_WINE_CONNECTED);
- ret = 0;
- }
- else
- SetLastError(wsaErrno());
- release_sock_fd( s, fd );
+ if ((fd = get_sock_fd( s, FILE_READ_DATA, NULL )) == -1)
+ return -1;
+ bound = is_fd_bound( fd, NULL, NULL );
+ release_sock_fd( s, fd );
+ if (bound <= 0)
+ {
+ SetLastError( bound ? wsaErrno() : WSAEINVAL );
+ return -1;
}
- return ret;
+ status = NtDeviceIoControlFile( SOCKET2HANDLE(s), NULL, NULL, NULL, &io,
+ IOCTL_AFD_LISTEN, ¶ms, sizeof(params), NULL, 0 );
+ SetLastError( NtStatusToWSAError( status ) );
+ return status ? -1 : 0;
}
+
/***********************************************************************
* recv (WS2_32.16)
*/
More information about the wine-cvs
mailing list