ws2_32: Implement InetPtonW function.

Signed-off-by: Michael Müller <michael@fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
This commit is contained in:
Michael Müller 2015-10-05 04:57:53 +02:00 committed by Alexandre Julliard
parent f8aa842dea
commit af8c79343c
2 changed files with 31 additions and 0 deletions

View File

@ -7456,6 +7456,36 @@ INT WINAPI WS_inet_pton( INT family, PCSTR addr, PVOID buffer)
#endif
}
/***********************************************************************
* InetPtonW (WS2_32.@)
*/
INT WINAPI InetPtonW(INT family, PCWSTR addr, PVOID buffer)
{
char *addrA;
int len;
INT ret;
TRACE("family %d, addr %s, buffer (%p)\n", family, debugstr_w(addr), buffer);
if (!addr)
{
SetLastError(WSAEFAULT);
return SOCKET_ERROR;
}
len = WideCharToMultiByte(CP_ACP, 0, addr, -1, NULL, 0, NULL, NULL);
if (!(addrA = HeapAlloc(GetProcessHeap(), 0, len)))
{
SetLastError(WSA_NOT_ENOUGH_MEMORY);
return SOCKET_ERROR;
}
WideCharToMultiByte(CP_ACP, 0, addr, -1, addrA, len, NULL, NULL);
ret = WS_inet_pton(family, addrA, buffer);
HeapFree(GetProcessHeap(), 0, addrA);
return ret;
}
/***********************************************************************
* WSAStringToAddressA (WS2_32.80)

View File

@ -53,6 +53,7 @@
@ stdcall FreeAddrInfoW(ptr)
@ stdcall GetAddrInfoW(wstr wstr ptr ptr)
@ stdcall GetNameInfoW(ptr long ptr long ptr long long)
@ stdcall InetPtonW(long wstr ptr)
@ stdcall WSApSetPostRoutine(ptr)
@ stdcall WPUCompleteOverlappedRequest(long ptr long long ptr)
@ stdcall WSAAccept(long ptr ptr ptr long)