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, ...@@ -512,7 +512,7 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
*/ */
typedef int (CALLBACK * GETNAMEINFO) ( const struct sockaddr*, socklen_t, typedef int (CALLBACK * GETNAMEINFO) ( const struct sockaddr*, socklen_t,
char*, DWORD, char*, DWORD, int ); char*, DWORD, char*, DWORD, int );
HINSTANCE wship6_module; HINSTANCE module;
GETNAMEINFO ws2_getnameinfo; GETNAMEINFO ws2_getnameinfo;
#endif #endif
...@@ -528,24 +528,24 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen, ...@@ -528,24 +528,24 @@ int vlc_getnameinfo( const struct sockaddr *sa, int salen,
i_servlen = 0; i_servlen = 0;
} }
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) && !defined( UNDER_CE )
wship6_module = LoadLibrary( "wship6.dll" ); /* Production IPv6 stack releases are in WS2_32.DLL */
if( wship6_module != NULL ) module = LoadLibrary( "ws2_32.dll" );
if( module != NULL )
{ {
ws2_getnameinfo = (GETNAMEINFO)GetProcAddress( wship6_module, ws2_getnameinfo = (GETNAMEINFO)GetProcAddress( module, "getnameinfo" );
"getnameinfo" );
if( ws2_getnameinfo != NULL ) if( ws2_getnameinfo != NULL )
{ {
i_val = ws2_getnameinfo( sa, salen, host, hostlen, psz_serv, i_val = ws2_getnameinfo( sa, salen, host, hostlen, psz_serv,
i_servlen, flags ); i_servlen, flags );
FreeLibrary( wship6_module ); FreeLibrary( module );
if( portnum != NULL ) if( portnum != NULL )
*portnum = atoi( psz_serv ); *portnum = atoi( psz_serv );
return i_val; return i_val;
} }
FreeLibrary( wship6_module ); FreeLibrary( module );
} }
#endif #endif
#if defined( HAVE_GETNAMEINFO ) || defined( UNDER_CE ) #if defined( HAVE_GETNAMEINFO ) || defined( UNDER_CE )
...@@ -653,25 +653,24 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node, ...@@ -653,25 +653,24 @@ int vlc_getaddrinfo( vlc_object_t *p_this, const char *node,
typedef int (CALLBACK * GETADDRINFO) ( const char *, const char *, typedef int (CALLBACK * GETADDRINFO) ( const char *, const char *,
const struct addrinfo *, const struct addrinfo *,
struct addrinfo ** ); struct addrinfo ** );
HINSTANCE wship6_module; HINSTANCE module;
GETADDRINFO ws2_getaddrinfo; GETADDRINFO ws2_getaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" ); module = LoadLibrary( "ws2_32.dll" );
if( wship6_module != NULL ) if( module != NULL )
{ {
ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( wship6_module, ws2_getaddrinfo = (GETADDRINFO)GetProcAddress( module, "getaddrinfo" );
"getaddrinfo" );
if( ws2_getaddrinfo != NULL ) if( ws2_getaddrinfo != NULL )
{ {
int i_ret; int i_ret;
i_ret = ws2_getaddrinfo( psz_node, psz_service, &hints, res ); i_ret = ws2_getaddrinfo( psz_node, psz_service, &hints, res );
FreeLibrary( wship6_module ); /* is this wise ? */ FreeLibrary( module ); /* is this wise ? */
return i_ret; return i_ret;
} }
FreeLibrary( wship6_module ); FreeLibrary( module );
} }
} }
#endif #endif
...@@ -724,27 +723,26 @@ void vlc_freeaddrinfo( struct addrinfo *infos ) ...@@ -724,27 +723,26 @@ void vlc_freeaddrinfo( struct addrinfo *infos )
{ {
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) && !defined( UNDER_CE )
typedef void (CALLBACK * FREEADDRINFO) ( struct addrinfo * ); typedef void (CALLBACK * FREEADDRINFO) ( struct addrinfo * );
HINSTANCE wship6_module; HINSTANCE module;
FREEADDRINFO ws2_freeaddrinfo; FREEADDRINFO ws2_freeaddrinfo;
wship6_module = LoadLibrary( "wship6.dll" ); module = LoadLibrary( "ws2_32.dll" );
if( wship6_module != NULL ) if( module != NULL )
{ {
ws2_freeaddrinfo = (FREEADDRINFO)GetProcAddress( wship6_module, ws2_freeaddrinfo = (FREEADDRINFO)GetProcAddress( module, "freeaddrinfo" );
"freeaddrinfo" );
/* /*
* NOTE: it is assumed that wship6.dll defines either both * NOTE: it is assumed that ws2_32.dll defines either both or neither
* getaddrinfo and freeaddrinfo or none of them. * getaddrinfo() and freeaddrinfo().
*/ */
if( ws2_freeaddrinfo != NULL ) if( ws2_freeaddrinfo != NULL )
{ {
ws2_freeaddrinfo( infos ); ws2_freeaddrinfo( infos );
FreeLibrary( wship6_module ); FreeLibrary( module );
return; return;
} }
FreeLibrary( wship6_module ); FreeLibrary( module );
} }
#endif #endif
#if defined( HAVE_GETADDRINFO ) || defined( UNDER_CE ) #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