setup-win32.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef HEADER_CURL_SETUP_WIN32_H
  2. #define HEADER_CURL_SETUP_WIN32_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  11. *
  12. * This software is licensed as described in the file COPYING, which
  13. * you should have received as part of this distribution. The terms
  14. * are also available at https://curl.se/docs/copyright.html.
  15. *
  16. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  17. * copies of the Software, and permit persons to whom the Software is
  18. * furnished to do so, under the terms of the COPYING file.
  19. *
  20. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  21. * KIND, either express or implied.
  22. *
  23. ***************************************************************************/
  24. /*
  25. * Include header files for windows builds before redefining anything.
  26. * Use this preprocessor block only to include or exclude windows.h,
  27. * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
  28. * to any other further and independent block. Under Cygwin things work
  29. * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
  30. * never be included when __CYGWIN__ is defined. configure script takes
  31. * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
  32. * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
  33. */
  34. #ifdef HAVE_WINDOWS_H
  35. # if defined(UNICODE) && !defined(_UNICODE)
  36. # define _UNICODE
  37. # endif
  38. # if defined(_UNICODE) && !defined(UNICODE)
  39. # define UNICODE
  40. # endif
  41. # include <winerror.h>
  42. # include <windows.h>
  43. # ifdef HAVE_WINSOCK2_H
  44. # include <winsock2.h>
  45. # ifdef HAVE_WS2TCPIP_H
  46. # include <ws2tcpip.h>
  47. # endif
  48. # else
  49. # ifdef HAVE_WINSOCK_H
  50. # include <winsock.h>
  51. # endif
  52. # endif
  53. # include <tchar.h>
  54. # ifdef UNICODE
  55. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  56. # endif
  57. #endif
  58. /*
  59. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  60. * undefine USE_WINSOCK.
  61. */
  62. #undef USE_WINSOCK
  63. #ifdef HAVE_WINSOCK2_H
  64. # define USE_WINSOCK 2
  65. #else
  66. # ifdef HAVE_WINSOCK_H
  67. # error "WinSock version 1 is no longer supported, version 2 is required!"
  68. # endif
  69. #endif
  70. /*
  71. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  72. * those symbols to compare against, and even those that do may be missing
  73. * newer symbols.
  74. */
  75. #ifndef _WIN32_WINNT_NT4
  76. #define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
  77. #endif
  78. #ifndef _WIN32_WINNT_WIN2K
  79. #define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
  80. #endif
  81. #ifndef _WIN32_WINNT_WINXP
  82. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  83. #endif
  84. #ifndef _WIN32_WINNT_WS03
  85. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  86. #endif
  87. #ifndef _WIN32_WINNT_WIN6
  88. #define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
  89. #endif
  90. #ifndef _WIN32_WINNT_VISTA
  91. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  92. #endif
  93. #ifndef _WIN32_WINNT_WS08
  94. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  95. #endif
  96. #ifndef _WIN32_WINNT_LONGHORN
  97. #define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
  98. #endif
  99. #ifndef _WIN32_WINNT_WIN7
  100. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  101. #endif
  102. #ifndef _WIN32_WINNT_WIN8
  103. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  104. #endif
  105. #ifndef _WIN32_WINNT_WINBLUE
  106. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  107. #endif
  108. #ifndef _WIN32_WINNT_WINTHRESHOLD
  109. #define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
  110. #endif
  111. #ifndef _WIN32_WINNT_WIN10
  112. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  113. #endif
  114. #endif /* HEADER_CURL_SETUP_WIN32_H */