socks & wine, patching wininet to use winsock

Mike Kaplinskiy mike.kaplinskiy at gmail.com
Fri Dec 17 23:03:10 CST 2010


I was thinking about looking at wininet soon myself, but haven't had
the time. I don't know what the right approach should be, but the
least I can tell you is stop including all the linux headers:

#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <sys/types.h>
# include <netinet/in.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif

Then you want to include the winsock headers and change Makefile.in to
stop linking with @SOCKETLIBS@ and instead link with ws2_32. Make sure
to run configure again after doing that. After that get to fixing
warnings about SOCKET/int conversion and various crashes :)

On Thu, Dec 16, 2010 at 6:34 AM, Gabriele Greco <gabrielegreco at gmail.com> wrote:
> 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 Makefile.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?
> --
> Bye,
>  Gabry
>
>
>
>
>
>



More information about the wine-devel mailing list