Commit af8c7934 authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

ws2_32: Implement InetPtonW function.

parent f8aa842d
......@@ -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)
......
......@@ -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)
......
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