diff --git a/configure b/configure index 66335f05353..30aff749bf1 100755 --- a/configure +++ b/configure @@ -14711,6 +14711,7 @@ fi + for ac_func in \ @@ -14737,6 +14738,7 @@ for ac_func in \ futimes \ futimesat \ getaddrinfo \ + getnameinfo \ getnetbyname \ getopt_long \ getpagesize \ diff --git a/configure.ac b/configure.ac index 8fc5519f819..652de1a2098 100644 --- a/configure.ac +++ b/configure.ac @@ -1156,6 +1156,7 @@ AC_CHECK_FUNCS(\ futimes \ futimesat \ getaddrinfo \ + getnameinfo \ getnetbyname \ getopt_long \ getpagesize \ diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index a86249db86c..a07c5b423a5 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -3235,6 +3235,33 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hin return EAI_FAIL; } +int WINAPI WS_getnameinfo(const struct WS_sockaddr *sa, socklen_t salen, char *host, + DWORD hostlen, char *serv, DWORD servlen, int flags) +{ +#if HAVE_GETNAMEINFO + int ret; + const struct sockaddr* sa_u; + unsigned int size; + + TRACE("%s %d %p %ld %p %ld %d\n", debugstr_sockaddr(sa), salen, host, hostlen, + serv, servlen, flags); + + sa_u = ws_sockaddr_ws2u(sa, salen, &size); + if (!sa_u) + { + WSASetLastError(WSAEFAULT); + return WSA_NOT_ENOUGH_MEMORY; + } + ret = getnameinfo(sa_u, size, host, hostlen, serv, servlen, flags); + + ws_sockaddr_free(sa_u, sa); + return convert_eai_u2w(ret); +#else + FIXME("getnameinfo() failed, not found during buildtime.\n"); + return EAI_FAIL; +#endif +} + /*********************************************************************** * getservbyport (WS2_32.56) */ diff --git a/dlls/winsock/ws2_32.spec b/dlls/winsock/ws2_32.spec index b36b85478c5..bbcafc0659b 100644 --- a/dlls/winsock/ws2_32.spec +++ b/dlls/winsock/ws2_32.spec @@ -116,4 +116,4 @@ @ stdcall WSCWriteProviderOrder(ptr long) @ stdcall freeaddrinfo(ptr) WS_freeaddrinfo @ stdcall getaddrinfo(str str ptr ptr) WS_getaddrinfo -@ stub getnameinfo +@ stdcall getnameinfo(ptr long ptr long ptr long long) WS_getnameinfo diff --git a/include/config.h.in b/include/config.h.in index c0573143a9d..8d2502128b8 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -161,6 +161,9 @@ /* Define to 1 if you have the `gethostbyname' function. */ #undef HAVE_GETHOSTBYNAME +/* Define to 1 if you have the `getnameinfo' function. */ +#undef HAVE_GETNAMEINFO + /* Define to 1 if you have the `getnetbyname' function. */ #undef HAVE_GETNETBYNAME diff --git a/include/ws2tcpip.h b/include/ws2tcpip.h index 90a224b6c94..16efab6da96 100644 --- a/include/ws2tcpip.h +++ b/include/ws2tcpip.h @@ -215,7 +215,7 @@ int WINAPI WS(getaddrinfo)(const char*,const char*,const struct WS(addrinfo)*,s #define GetAddrInfoA WS(getaddrinfo) int WINAPI GetAddrInfoW(PCWSTR,PCWSTR,const ADDRINFOW*,PADDRINFOW*); #define GetAddrInfo WINELIB_NAME_AW(GetAddrInfo) -int WINAPI WS(getnameinfo)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int); +int WINAPI WS(getnameinfo)(const struct WS(sockaddr)*,socklen_t,char*,DWORD,char*,DWORD,int); #define GetNameInfoA WS(getnameinfo) INT WINAPI GetNameInfoW(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT); #define GetNameInfo WINELIB_NAME_AW(GetNameInfo)