Commit 507cd452 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use the not so broken getaddrinfo implementation from ws2_32.dll

instead of the painfully braindead one from wship6 that we'd rather
flatly ignore
parent 99226c98
......@@ -512,7 +512,7 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
*/
typedef int (CALLBACK * GETNAMEINFO) ( const struct sockaddr*, socklen_t,
char*, DWORD, char*, DWORD, int );
HINSTANCE wship6_module;
HINSTANCE module;
GETNAMEINFO ws2_getnameinfo;
#endif
......@@ -528,24 +528,24 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
i_servlen = 0;
}
#if defined( WIN32 ) && !defined( UNDER_CE )
wship6_module = LoadLibrary( "wship6.dll" );
if( wship6_module != NULL )
/* Production IPv6 stack releases are in WS2_32.DLL */
module = LoadLibrary( "ws2_32.dll" );
if( module != NULL )
{
ws2_getnameinfo = (GETNAMEINFO)GetProcAddress( wship6_module,
"getnameinfo" );
ws2_getnameinfo = (GETNAMEINFO)GetProcAddress( module, "getnameinfo" );
if( ws2_getnameinfo != NULL )
{
i_val = ws2_getnameinfo( sa, salen, host, hostlen, psz_serv,
i_servlen, flags );
FreeLibrary( wship6_module );
FreeLibrary( module );
if( portnum != NULL )
*portnum = atoi( psz_serv );
return i_val;
}
FreeLibrary( wship6_module );
FreeLibrary( module );
}
#endif
#if defined( HAVE_GETNAMEINFO ) || defined( UNDER_CE )
......@@ -653,25 +653,24 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
typedef int (CALLBACK * GETADDRINFO) ( const char *, const char *,
const struct addrinfo *,
struct addrinfo ** );
HINSTANCE wship6_module;
HINSTANCE module;
GETADDRINFO ws2_getaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" );
if( wship6_module != NULL )
module = LoadLibrary( "ws2_32.dll" );
if( module != NULL )
{
ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( wship6_module,
"getaddrinfo" );
ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( module, "getaddrinfo" );
if( ws2_getaddrinfo != NULL )
{
int i_ret;
i_ret = ws2_getaddrinfo( psz_node, psz_service, &hints, res );
FreeLibrary( wship6_module ); /* is this wise ? */
FreeLibrary( module ); /* is this wise ? */
return i_ret;
}
FreeLibrary( wship6_module );
FreeLibrary( module );
}
}
#endif
......@@ -724,27 +723,26 @@ void vlc_freeaddrinfo( struct addrinfo *infos )
{
#if defined( WIN32 ) && !defined( UNDER_CE )
typedef void (CALLBACK * FREEADDRINFO) ( struct addrinfo * );
HINSTANCE wship6_module;
HINSTANCE module;
FREEADDRINFO ws2_freeaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" );
if( wship6_module != NULL )
module = LoadLibrary( "ws2_32.dll" );
if( module != NULL )
{
ws2_freeaddrinfo = (FREEADDRINFO)GetProcAddress( wship6_module,
"freeaddrinfo" );
ws2_freeaddrinfo = (FREEADDRINFO)GetProcAddress( module, "freeaddrinfo" );
/*
* NOTE: it is assumed that wship6.dll defines either both
* getaddrinfo and freeaddrinfo or none of them.
* NOTE: it is assumed that ws2_32.dll defines either both or neither
* getaddrinfo() and freeaddrinfo().
*/
if( ws2_freeaddrinfo != NULL )
{
ws2_freeaddrinfo( infos );
FreeLibrary( wship6_module );
FreeLibrary( module );
return;
}
FreeLibrary( wship6_module );
FreeLibrary( module );
}
#endif
#if defined( HAVE_GETADDRINFO ) || defined( UNDER_CE )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment