socks & wine, patching wininet to use winsock

Gabriele Greco gabrielegreco at
Thu Dec 16 05:34:40 CST 2010

I'm trying to make programs that need a socks proxy to work on wine.

They work with freecaps or similar winsock patches as long as they don't use
wininet or other indirect winsocks APIs to make their stuff, if they use
wininet those patches could not work since wininet bypasses winsocks and use
linux sockets directly.

In the head of the wininet.dll sources there is this comment:

/* FIXME!!!!!!
 *    This should use winsock - To use winsock the functions will have to
change a bit
 *        as they are designed for unix sockets.
 *    SSL stuff should use crypt32.dll

I tried to change netconnection.c to use winsock functions WSAConnect,
WSASend & WSARecv since WS_send, WS_recv and WS_connect are not exposed by
ws2_32 instead of direct linux socket functions (connect/send/recv), but I
had no way to check the problems with unix sockets vs inet sockets cause the
library crashes wine before hitting anything related with my CODE patches.

It crashes simply because I've added in ws2_32 module IMPORTS,
doing so what I've observed is that standard linux sockets calls are
"wrapped" and points now to NULL (because ws2_32 is not loaded?).

In this specific case "getaddrinfo" is NULL and HTTP_ResolveName crashes
when calling it.

Anyone can suggest me the correct approach to implement this? I have to load
manually ws2_32 in the wininet initialization?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the wine-devel mailing list