Jacek Caban : ws2_32: Factor out GetAddrInfoW implementation.

Alexandre Julliard julliard at winehq.org
Wed Aug 2 15:31:59 CDT 2017


Module: wine
Branch: master
Commit: 39fe376e92d1ac8a456424802be4bc28be955293
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39fe376e92d1ac8a456424802be4bc28be955293

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug  1 18:29:21 2017 +0200

ws2_32: Factor out GetAddrInfoW implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/socket.c | 91 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 50 insertions(+), 41 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 620b19b..e1cc15f 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -6823,49 +6823,13 @@ static struct WS_addrinfo *addrinfo_WtoA(const struct WS_addrinfoW *ai)
     return ret;
 }
 
-/***********************************************************************
- *		GetAddrInfoExW		(WS2_32.@)
- */
-int WINAPI GetAddrInfoExW(const WCHAR *name, const WCHAR *servname, DWORD namespace, GUID *namespace_id,
-        const ADDRINFOEXW *hints, ADDRINFOEXW **result, struct timeval *timeout, OVERLAPPED *overlapped,
-        LPLOOKUPSERVICE_COMPLETION_ROUTINE completion_routine, HANDLE *handle)
-{
-    FIXME("(%s %s %x %s %p %p %p %p %p %p)\n", debugstr_w(name), debugstr_w(servname), namespace,
-          debugstr_guid(namespace_id), hints, result, timeout, overlapped, completion_routine, handle);
-    return WSAHOST_NOT_FOUND;
-}
-
-/***********************************************************************
- *		GetAddrInfoExOverlappedResult  (WS2_32.@)
- */
-int WINAPI GetAddrInfoExOverlappedResult(OVERLAPPED *overlapped)
-{
-    FIXME("(%p)\n", overlapped);
-    return SOCKET_ERROR;
-}
-
-/***********************************************************************
- *		GetAddrInfoExCancel     (WS2_32.@)
- */
-int WINAPI GetAddrInfoExCancel(HANDLE *handle)
-{
-    FIXME("(%p)\n", handle);
-    return WSA_INVALID_HANDLE;
-}
-
-/***********************************************************************
- *		GetAddrInfoW		(WS2_32.@)
- */
-int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hints, PADDRINFOW *res)
+static int WS_getaddrinfoW(const WCHAR *nodename, const WCHAR *servname, const struct WS_addrinfo *hints, PADDRINFOW *res)
 {
     int ret = EAI_MEMORY, len, i;
     char *nodenameA = NULL, *servnameA = NULL;
-    struct WS_addrinfo *resA, *hintsA = NULL;
+    struct WS_addrinfo *resA;
     WCHAR *local_nodenameW = (WCHAR *)nodename;
 
-    TRACE("nodename %s, servname %s, hints %p, result %p\n",
-          debugstr_w(nodename), debugstr_w(servname), hints, res);
-
     *res = NULL;
     if (nodename)
     {
@@ -6911,9 +6875,7 @@ int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hin
         WideCharToMultiByte(CP_ACP, 0, servname, -1, servnameA, len, NULL, NULL);
     }
 
-    if (hints) hintsA = addrinfo_WtoA(hints);
-    ret = WS_getaddrinfo(nodenameA, servnameA, hintsA, &resA);
-    WS_freeaddrinfo(hintsA);
+    ret = WS_getaddrinfo(nodenameA, servnameA, hints, &resA);
 
     if (!ret)
     {
@@ -6930,6 +6892,53 @@ end:
 }
 
 /***********************************************************************
+ *		GetAddrInfoExW		(WS2_32.@)
+ */
+int WINAPI GetAddrInfoExW(const WCHAR *name, const WCHAR *servname, DWORD namespace, GUID *namespace_id,
+        const ADDRINFOEXW *hints, ADDRINFOEXW **result, struct timeval *timeout, OVERLAPPED *overlapped,
+        LPLOOKUPSERVICE_COMPLETION_ROUTINE completion_routine, HANDLE *handle)
+{
+    FIXME("(%s %s %x %s %p %p %p %p %p %p)\n", debugstr_w(name), debugstr_w(servname), namespace,
+          debugstr_guid(namespace_id), hints, result, timeout, overlapped, completion_routine, handle);
+    return WSAHOST_NOT_FOUND;
+}
+
+/***********************************************************************
+ *		GetAddrInfoExOverlappedResult  (WS2_32.@)
+ */
+int WINAPI GetAddrInfoExOverlappedResult(OVERLAPPED *overlapped)
+{
+    FIXME("(%p)\n", overlapped);
+    return SOCKET_ERROR;
+}
+
+/***********************************************************************
+ *		GetAddrInfoExCancel     (WS2_32.@)
+ */
+int WINAPI GetAddrInfoExCancel(HANDLE *handle)
+{
+    FIXME("(%p)\n", handle);
+    return WSA_INVALID_HANDLE;
+}
+
+/***********************************************************************
+ *		GetAddrInfoW		(WS2_32.@)
+ */
+int WINAPI GetAddrInfoW(LPCWSTR nodename, LPCWSTR servname, const ADDRINFOW *hints, PADDRINFOW *res)
+{
+    struct WS_addrinfo *hintsA = NULL;
+    int ret = EAI_MEMORY;
+
+    TRACE("nodename %s, servname %s, hints %p, result %p\n",
+          debugstr_w(nodename), debugstr_w(servname), hints, res);
+
+    if (hints) hintsA = addrinfo_WtoA(hints);
+    ret = WS_getaddrinfoW(nodename, servname, hintsA, res);
+    WS_freeaddrinfo(hintsA);
+    return ret;
+}
+
+/***********************************************************************
  *      FreeAddrInfoW        (WS2_32.@)
  */
 void WINAPI FreeAddrInfoW(PADDRINFOW ai)




More information about the wine-cvs mailing list