setup-win32.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 - 2021, 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 or ws2tcpip.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_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. # endif
  49. # include <tchar.h>
  50. # ifdef UNICODE
  51. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  52. # endif
  53. #endif
  54. /*
  55. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  56. * undefine USE_WINSOCK.
  57. */
  58. #undef USE_WINSOCK
  59. #ifdef HAVE_WINSOCK2_H
  60. # define USE_WINSOCK 2
  61. #endif
  62. /*
  63. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  64. * those symbols to compare against, and even those that do may be missing
  65. * newer symbols.
  66. */
  67. #ifndef _WIN32_WINNT_NT4
  68. #define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
  69. #endif
  70. #ifndef _WIN32_WINNT_WIN2K
  71. #define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
  72. #endif
  73. #ifndef _WIN32_WINNT_WINXP
  74. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  75. #endif
  76. #ifndef _WIN32_WINNT_WS03
  77. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  78. #endif
  79. #ifndef _WIN32_WINNT_WIN6
  80. #define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
  81. #endif
  82. #ifndef _WIN32_WINNT_VISTA
  83. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  84. #endif
  85. #ifndef _WIN32_WINNT_WS08
  86. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  87. #endif
  88. #ifndef _WIN32_WINNT_LONGHORN
  89. #define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
  90. #endif
  91. #ifndef _WIN32_WINNT_WIN7
  92. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  93. #endif
  94. #ifndef _WIN32_WINNT_WIN8
  95. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  96. #endif
  97. #ifndef _WIN32_WINNT_WINBLUE
  98. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  99. #endif
  100. #ifndef _WIN32_WINNT_WINTHRESHOLD
  101. #define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
  102. #endif
  103. #ifndef _WIN32_WINNT_WIN10
  104. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  105. #endif
  106. #endif /* HEADER_CURL_SETUP_WIN32_H */