ws2_32: Implement GetNameInfoW.

Hans Leidekker hans at codeweavers.com
Tue Mar 29 06:03:24 CDT 2011


Fixes http://bugs.winehq.org/show_bug.cgi?id=26440
---
 dlls/ws2_32/socket.c    |   25 +++++++++++++++++++++++++
 dlls/ws2_32/ws2_32.spec |    1 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 9469d30..d72ed80 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5104,6 +5104,31 @@ int WINAPI WS_getnameinfo(const SOCKADDR *sa, WS_socklen_t salen, PCHAR host,
 #endif
 }
 
+int WINAPI GetNameInfoW(const SOCKADDR *sa, WS_socklen_t salen, PWCHAR host,
+                        DWORD hostlen, PWCHAR serv, DWORD servlen, INT flags)
+{
+    int ret;
+    char *hostA = NULL, *servA = NULL;
+
+    if (host && (!(hostA = HeapAlloc(GetProcessHeap(), 0, hostlen)))) return EAI_MEMORY;
+    if (serv && (!(servA = HeapAlloc(GetProcessHeap(), 0, servlen))))
+    {
+        HeapFree(GetProcessHeap(), 0, hostA);
+        return EAI_MEMORY;
+    }
+
+    ret = WS_getnameinfo(sa, salen, hostA, hostlen, servA, servlen, flags);
+    if (!ret)
+    {
+        if (host) MultiByteToWideChar(CP_ACP, 0, hostA, -1, host, hostlen);
+        if (serv) MultiByteToWideChar(CP_ACP, 0, servA, -1, serv, servlen);
+    }
+
+    HeapFree(GetProcessHeap(), 0, hostA);
+    HeapFree(GetProcessHeap(), 0, servA);
+    return ret;
+}
+
 /***********************************************************************
  *		getservbyport		(WS2_32.56)
  */
diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec
index 537e7f3..ccec106 100644
--- a/dlls/ws2_32/ws2_32.spec
+++ b/dlls/ws2_32/ws2_32.spec
@@ -52,6 +52,7 @@
 
 @ stdcall FreeAddrInfoW(ptr)
 @ stdcall GetAddrInfoW(wstr wstr ptr ptr)
+@ stdcall GetNameInfoW(ptr long ptr long ptr long long)
 @ stdcall WSApSetPostRoutine(ptr)
 @ stdcall WPUCompleteOverlappedRequest(long ptr long long ptr)
 @ stdcall WSAAccept(long ptr ptr ptr long)
-- 
1.7.1







More information about the wine-patches mailing list