Fix Win32 adb build.

Change-Id: I0a07379c470b7fa7f9bdef68c17ccb7bd0bd2079
diff --git a/adb/adb_utils.cpp b/adb/adb_utils.cpp
index 3846c21..cd3c7bc 100644
--- a/adb/adb_utils.cpp
+++ b/adb/adb_utils.cpp
@@ -18,7 +18,6 @@
 
 #include "adb_utils.h"
 
-#include <netdb.h>
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -34,6 +33,12 @@
 #include "adb_trace.h"
 #include "sysdeps.h"
 
+#if defined(_WIN32)
+#include <ws2tcpip.h>
+#else
+#include <netdb.h>
+#endif
+
 bool getcwd(std::string* s) {
   char* cwd = getcwd(nullptr, 0);
   if (cwd != nullptr) *s = cwd;
@@ -168,7 +173,7 @@
         return fd;
     }
     if (getaddrinfo_error != 0) {
-        // TODO: not thread safe on Win32.
+        // TODO: gai_strerror is not thread safe on Win32.
         *error = gai_strerror(getaddrinfo_error);
     } else {
         *error = strerror(errno);
diff --git a/adb/sysdeps.h b/adb/sysdeps.h
index c051eb3..6160923 100644
--- a/adb/sysdeps.h
+++ b/adb/sysdeps.h
@@ -187,11 +187,6 @@
 /* normally provided by <cutils/misc.h> */
 extern void*  load_file(const char*  pathname, unsigned*  psize);
 
-/* normally provided by <cutils/sockets.h> */
-extern int socket_loopback_client(int port, int type);
-extern int socket_loopback_server(int port, int type);
-extern int socket_inaddr_any_server(int port, int type);
-
 /* normally provided by "fdevent.h" */
 
 #define FDE_READ              0x0001
diff --git a/adb/sysdeps_win32.cpp b/adb/sysdeps_win32.cpp
index 91e1495..a274892 100644
--- a/adb/sysdeps_win32.cpp
+++ b/adb/sysdeps_win32.cpp
@@ -25,6 +25,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cutils/sockets.h>
+
 #include "adb.h"
 
 extern void fatal(const char *fmt, ...);
@@ -669,7 +671,7 @@
 
 
 int socket_network_client_timeout(const char *host, int port, int type, int timeout,
-                                  std::string* error) {
+                                  int* getaddrinfo_error) {
     FH  f = _fh_alloc( &_fh_socket_class );
     if (!f) return -1;