diff --git a/CMakeLists.txt b/CMakeLists.txt
index 845c330..9f2e787 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -471,6 +471,7 @@ check_include_file_concat("netinet/tcp.h"    HAVE_NETINET_TCP_H)
 
 check_include_file_concat("pem.h"            HAVE_PEM_H)
 check_include_file_concat("poll.h"           HAVE_POLL_H)
+check_include_file_concat("process.h"        HAVE_PROCESS_H)
 check_include_file_concat("pwd.h"            HAVE_PWD_H)
 check_include_file_concat("rsa.h"            HAVE_RSA_H)
 check_include_file_concat("setjmp.h"         HAVE_SETJMP_H)
@@ -589,12 +590,15 @@ check_symbol_exists(strcasecmp    "${CURL_INCLUDES}" HAVE_STRCASECMP)
 check_symbol_exists(stricmp       "${CURL_INCLUDES}" HAVE_STRICMP)
 check_symbol_exists(strcmpi       "${CURL_INCLUDES}" HAVE_STRCMPI)
 check_symbol_exists(strncmpi      "${CURL_INCLUDES}" HAVE_STRNCMPI)
+check_symbol_exists(strnicmp      "${CURL_INCLUDES}" HAVE_STRNICMP)
 check_symbol_exists(alarm         "${CURL_INCLUDES}" HAVE_ALARM)
 if(NOT HAVE_STRNCMPI)
   set(HAVE_STRCMPI)
 endif(NOT HAVE_STRNCMPI)
 check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR)
 check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R)
+check_symbol_exists(gethostname   "${CURL_INCLUDES}" HAVE_GETHOSTNAME)
+check_symbol_exists(getservbyname "${CURL_INCLUDES}" HAVE_GETSERVBYNAME)
 check_symbol_exists(gettimeofday  "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
 check_symbol_exists(inet_addr     "${CURL_INCLUDES}" HAVE_INET_ADDR)
 check_symbol_exists(inet_ntoa     "${CURL_INCLUDES}" HAVE_INET_NTOA)
@@ -603,6 +607,7 @@ check_symbol_exists(tcsetattr     "${CURL_INCLUDES}" HAVE_TCSETATTR)
 check_symbol_exists(tcgetattr     "${CURL_INCLUDES}" HAVE_TCGETATTR)
 check_symbol_exists(perror        "${CURL_INCLUDES}" HAVE_PERROR)
 check_symbol_exists(closesocket   "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
+check_symbol_exists(setmode       "${CURL_INCLUDES}" HAVE_SETMODE)
 check_symbol_exists(setvbuf       "${CURL_INCLUDES}" HAVE_SETVBUF)
 check_symbol_exists(sigsetjmp     "${CURL_INCLUDES}" HAVE_SIGSETJMP)
 check_symbol_exists(getpass_r     "${CURL_INCLUDES}" HAVE_GETPASS_R)
@@ -653,6 +658,9 @@ check_symbol_exists(setrlimit      "${CURL_INCLUDES}" HAVE_SETRLIMIT)
 check_symbol_exists(fcntl          "${CURL_INCLUDES}" HAVE_FCNTL)
 check_symbol_exists(ioctl          "${CURL_INCLUDES}" HAVE_IOCTL)
 check_symbol_exists(setsockopt     "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
+check_symbol_exists(recvfrom       "${CURL_INCLUDES}" HAVE_RECVFROM)
+check_symbol_exists(getaddrinfo    "${CURL_INCLUDES}" HAVE_GETADDRINFO)
+check_symbol_exists(getnameinfo    "${CURL_INCLUDES}" HAVE_GETNAMEINFO)
 
 # symbol exists in win32, but function does not.
 check_function_exists(inet_pton HAVE_INET_PTON)
@@ -858,15 +866,68 @@ set(CURL_PULL_INTTYPES_H ${HAVE_INTTYPES_H})
 
 include(CMake/OtherTests.cmake)
 
+# Override the prototype extractions in OtherTests for some Windows functions
+# TODO: Fix OtherTests so this override isn't necessary.
+if(WIN32)
+  if(HAVE_WS2TCPIP_H)
+    set (GETNAMEINFO_QUAL_ARG1 "const")
+    set (GETNAMEINFO_TYPE_ARG1 "struct sockaddr *")
+    set (GETNAMEINFO_TYPE_ARG2 "socklen_t")
+    set (GETNAMEINFO_TYPE_ARG46 "DWORD")
+    set (GETNAMEINFO_TYPE_ARG7 "int")
+  endif()
+
+  set (RECV_TYPE_ARG1 "SOCKET")
+  set (RECV_TYPE_ARG2 "char *")
+  set (RECV_TYPE_ARG3 "int")
+  set (RECV_TYPE_ARG4 "int")
+  set (RECV_TYPE_RETV "int")
+
+  #For RECVFROM_TYPE_ARG macros the asterisk in 2,5,6 does not go in the macro
+  set (RECVFROM_TYPE_ARG1 "SOCKET")
+  set (RECVFROM_TYPE_ARG2 "char")
+  set (RECVFROM_TYPE_ARG3 "int")
+  set (RECVFROM_TYPE_ARG4 "int")
+  set (RECVFROM_TYPE_ARG5 "struct sockaddr")
+  set (RECVFROM_TYPE_ARG6 "int")
+  set (RECVFROM_TYPE_RETV "int")
+
+  set (SEND_TYPE_ARG1 "SOCKET")
+  set (SEND_QUAL_ARG2 "const")
+  set (SEND_TYPE_ARG2 "char *")
+  set (SEND_TYPE_ARG3 "int")
+  set (SEND_TYPE_ARG4 "int")
+  set (SEND_TYPE_RETV "int")
+endif(WIN32)
+
 add_definitions(-DHAVE_CONFIG_H)
 
-# For windows, do not allow the compiler to use default target (Vista).
 if(WIN32)
+  # For windows, do not allow the compiler to use default target (Vista).
   add_definitions(-D_WIN32_WINNT=0x0501)
+
+  set (HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1)
+  set (HAVE_STRUCT_SOCKADDR_STORAGE 1)
+  set (USE_MANUAL 1)
+
+  if(NOT CURL_USE_ARES)
+    #This is to use asynchronous DNS without ares.
+    #If synchronous DNS is needed USE_THREADS_WIN32 shouldn't be defined.
+    set (USE_THREADS_WIN32 1)
+  endif()
+
+  if(NOT (MSVC_VERSION LESS 900))
+    set (USE_WIN32_LARGE_FILES 1)
+  else()
+    set (USE_WIN32_SMALL_FILES 1)
+  endif()
 endif(WIN32)
 
 if(MSVC)
   add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
+  if((MSVC_VERSION GREATER 1400) OR (MSVC_VERSION EQUAL 1400))
+    set (HAVE_VARIADIC_MACROS_C99 1)
+  endif()
 endif(MSVC)
 
 # Sets up the dependencies (zlib, OpenSSL, etc.) of a cURL subproject according to options.
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
index 32bae39..5ff772c 100644
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -220,6 +220,9 @@
 /* Define to 1 if you have the `getrlimit' function. */
 #cmakedefine HAVE_GETRLIMIT 1
 
+/* Define to 1 if you have the getservbyname function. */
+#cmakedefine HAVE_GETSERVBYNAME 1
+
 /* Define to 1 if you have the getservbyport_r function. */
 #cmakedefine HAVE_GETSERVBYPORT_R 1
 
@@ -512,6 +515,9 @@
 /* Define to 1 if you have a working setsockopt SO_NONBLOCK function. */
 #cmakedefine HAVE_SETSOCKOPT_SO_NONBLOCK 1
 
+/* Define to 1 if you have the setvbuf function. */
+#cmakedefine HAVE_SETVBUF 1
+
 /* Define to 1 if you have the <sgtty.h> header file. */
 #cmakedefine HAVE_SGTTY_H 1
 
@@ -575,6 +581,9 @@
 /* Define to 1 if you have the strerror_r function. */
 #cmakedefine HAVE_STRERROR_R 1
 
+/* Define to 1 if you have the strftime function. */
+#cmakedefine HAVE_STRFTIME 1
+
 /* Define to 1 if you have the stricmp function. */
 #cmakedefine HAVE_STRICMP 1
 
@@ -906,6 +915,9 @@
 /* if SSL is enabled */
 #cmakedefine USE_SSLEAY 1
 
+/* if use windows threads */
+#cmakedefine USE_THREADS_WIN32 1
+
 /* Define to 1 if you are building a Windows target without large file
    support. */
 #cmakedefine USE_WIN32_LARGE_FILES 1
@@ -953,3 +965,11 @@
 
 /* the signed version of size_t */
 #cmakedefine ssize_t ${ssize_t}
+
+#if defined(HAVE_WINSOCK2_H) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
+#define HAVE_STRUCT_POLLFD 1
+#endif
+
+#if defined(USE_ARES) && defined(USE_THREADS_WIN32)
+#  error "Only one DNS lookup specialty may be defined at most"
+#endif
