[Wine] getaddrinfo confusion (wine 1.5.5)

Emanuel Rietveld codehotter at gmail.com
Fri Jun 1 04:28:52 CDT 2012


Question: How can it be that getaddrinfo when called by a game returns 
an error, but when I call it in a small test program with the same 
parameters, is succeeds?

Details:

I have a game (League of Legends) that gives an assertion failed before 
starting a game, as per this bug: 
http://bugs.winehq.org/show_bug.cgi?id=29609

I am using wine 1.5.5

Using "ollydbg" 110 from http://ollydbg.de I have tracked down the code 
path leading to the failed assertion.

The game calls getaddrinfo, checks the return value, and if it is not 
happy with it, eventually gives the assertion failed message.

Using the debugger, I figured out exactly what parameters is calls 
getaddrinfo with:

pNodeName = "" (pointer to empty string)
pServiceName = "0" (pointer to string "0")
pHints = Pointer to addrinfo structure filled as follows:
     ai_flags = 0x1 (AI_PASSIVE)
     ai_family = 0x2 (AF_INET)
     ai_socktype= 0x2 (SOCK_DGRAM)
     ai_protocol = 0x11 (IPPROTO_UDP)
     ai_addrlen = 0
     ai_canonname = NULL
     ai_addr = NULL
     ai_next = NULL
ppResult = (pointer to memory allocated by game)

What happens is that wine passes these parameters down to the native 
getaddrinfo on my platform (Linux, Fedora 17) as follows

getaddrinfo(hostname, "0", pUnixhints, ppResult)

Wine has some logic to turn a nodeName that is the empty string "", into 
the hostname before passing it to the native call.

Wine transforms the windows hints into unix hints with some helper 
functions, but they do not appear to change the contents at all for 
these particular values. The relevant code is in dlls/ws2_32/socket.c

When the game, through wine, calls my native getaddrinfo like that, it 
retuns -2 (E_NONAME) which is transformed by wine into WSAHOST_NOT_FOUND 
(0x2AF9) which the game doesn't like and leads to the assertion failed.

When I, in a small test program, call my native getaddrinfo with exactly 
the same parameters, it succeeds (returns 0).

How can this happen? Please, any ideas, to help me continue debugging 
this frustrating problem.

Thank you for reading this far.



More information about the wine-users mailing list