diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 535cf570818..5098f851dd9 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -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) diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec index d08d59a522c..1b096b57361 100644 --- a/dlls/ws2_32/ws2_32.spec +++ b/dlls/ws2_32/ws2_32.spec @@ -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)