I saw the bug described in: http://winehq.com/hypermail/wine-users/2001/01/0516.html happened again to a program I was trying to use. At least the behavior is the same. I have no access to the source code. It seems the problem was fixed in revision 1.42 of socket.c. But now at 1.139, WSACleanup again return 0 forever on repeating calls.