From: Mike Kaplinskiy Subject: ws2_32: implement SO_UPDATE_CONNECT_CONTEXT Message-Id: Date: Sun, 15 Aug 2010 12:42:17 -0400 --- dlls/ws2_32/socket.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index f129b08..39c1d2a 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3496,7 +3496,7 @@ int WINAPI WS_sendto(SOCKET s, const char *buf, int len, int flags, * setsockopt (WS2_32.21) */ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, - const char *optval, int optlen) + const char *optval, int optlen) { int fd; int woptval; @@ -3507,7 +3507,7 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, s, level, optname, optval, optlen); /* some broken apps pass the value directly instead of a pointer to it */ - if(IS_INTRESOURCE(optval)) + if(optlen && IS_INTRESOURCE(optval)) { SetLastError(WSAEFAULT); return SOCKET_ERROR; @@ -3585,6 +3585,12 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname, TRACE("Ignoring SO_EXCLUSIVEADDRUSE, is always set.\n"); return 0; + /* After a ConnectEx call succeeds, the socket can't be used with half of the + * normal winsock functions on windows. We don't have that problem. */ + case WS_SO_UPDATE_CONNECT_CONTEXT: + TRACE("Ignoring SO_UPDATE_CONNECT_CONTEXT, since our sockets are normal"); + return 0; + /* SO_OPENTYPE does not require a valid socket handle. */ case WS_SO_OPENTYPE: if (!optlen || optlen < sizeof(int) || !optval)