Author: tfaber Date: Sun Jun 22 18:51:11 2014 New Revision: 63632
URL: http://svn.reactos.org/svn/reactos?rev=63632&view=rev Log: [WS2_32] - Correctly handle port 0 in getaddrinfo - Stub numeric port case of getnameinfo
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c trunk/reactos/dll/win32/ws2_32/misc/stubs.c
Modified: trunk/reactos/dll/win32/ws2_32/misc/ns.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/ns.c?... ============================================================================== --- trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/misc/ns.c [iso-8859-1] Sun Jun 22 18:51:11 2014 @@ -1596,6 +1596,7 @@ struct addrinfo *ret = NULL, *ai; ULONG addr; USHORT port; + PCHAR pc; struct servent *se; char *proto; LPPROTOENT pent; @@ -1624,9 +1625,9 @@ if (servname) { /* converting port number */ - port = strtoul(servname, NULL, 10); + port = strtoul(servname, &pc, 10); /* service name was specified? */ - if (port == 0) + if (*pc != ANSI_NULL) { /* protocol was specified? */ if (hints && hints->ai_protocol)
Modified: trunk/reactos/dll/win32/ws2_32/misc/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ws2_32/misc/stubs... ============================================================================== --- trunk/reactos/dll/win32/ws2_32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ws2_32/misc/stubs.c [iso-8859-1] Sun Jun 22 18:51:11 2014 @@ -11,6 +11,7 @@ #include "ws2_32.h"
#include <ws2tcpip.h> +#include <strsafe.h>
/* * @implemented @@ -895,6 +896,16 @@ DWORD servlen, INT flags) { + if (!host && serv && flags & NI_NUMERICSERV) + { + const struct sockaddr_in *sa_in = (const struct sockaddr_in *)sa; + if (salen >= sizeof(*sa_in) && sa->sa_family == AF_INET) + { + StringCbPrintfA(serv, servlen, "%u", sa_in->sin_port); + return 0; + } + } + UNIMPLEMENTED
WSASetLastError(WSASYSCALLFAILURE);