setup-win32.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.haxx.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. * define USE_WINSOCK to 1 if we have and use WINSOCK API, else
  61. * undefine USE_WINSOCK.
  62. */
  63. #undef USE_WINSOCK
  64. #ifdef HAVE_WINSOCK2_H
  65. # define USE_WINSOCK 2
  66. #else
  67. # ifdef HAVE_WINSOCK_H
  68. # define USE_WINSOCK 1
  69. # endif
  70. #endif
  71. /*
  72. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  73. * those symbols to compare against, and even those that do may be missing
  74. * newer symbols.
  75. */
  76. #ifndef _WIN32_WINNT_NT4
  77. #define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
  78. #endif
  79. #ifndef _WIN32_WINNT_WIN2K
  80. #define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
  81. #endif
  82. #ifndef _WIN32_WINNT_WINXP
  83. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  84. #endif
  85. #ifndef _WIN32_WINNT_WS03
  86. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  87. #endif
  88. #ifndef _WIN32_WINNT_WIN6
  89. #define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
  90. #endif
  91. #ifndef _WIN32_WINNT_VISTA
  92. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  93. #endif
  94. #ifndef _WIN32_WINNT_WS08
  95. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  96. #endif
  97. #ifndef _WIN32_WINNT_LONGHORN
  98. #define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
  99. #endif
  100. #ifndef _WIN32_WINNT_WIN7
  101. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  102. #endif
  103. #ifndef _WIN32_WINNT_WIN8
  104. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  105. #endif
  106. #ifndef _WIN32_WINNT_WINBLUE
  107. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  108. #endif
  109. #ifndef _WIN32_WINNT_WINTHRESHOLD
  110. #define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
  111. #endif
  112. #ifndef _WIN32_WINNT_WIN10
  113. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  114. #endif
  115. #endif /* HEADER_CURL_SETUP_WIN32_H */