setup-win32.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 - 2022, 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. * SPDX-License-Identifier: curl
  24. *
  25. ***************************************************************************/
  26. /*
  27. * Include header files for windows builds before redefining anything.
  28. * Use this preprocessor block only to include or exclude windows.h,
  29. * winsock2.h or ws2tcpip.h. Any other windows thing belongs
  30. * to any other further and independent block. Under Cygwin things work
  31. * just as under linux (e.g. <sys/socket.h>) and the winsock headers should
  32. * never be included when __CYGWIN__ is defined. configure script takes
  33. * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK2_H,
  34. * neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
  35. */
  36. #ifdef HAVE_WINDOWS_H
  37. # if defined(UNICODE) && !defined(_UNICODE)
  38. # error "UNICODE is defined but _UNICODE is not defined"
  39. # endif
  40. # if defined(_UNICODE) && !defined(UNICODE)
  41. # error "_UNICODE is defined but UNICODE is not defined"
  42. # endif
  43. /*
  44. * Don't include unneeded stuff in Windows headers to avoid compiler
  45. * warnings and macro clashes.
  46. * Make sure to define this macro before including any Windows headers.
  47. */
  48. # ifndef WIN32_LEAN_AND_MEAN
  49. # define WIN32_LEAN_AND_MEAN
  50. # endif
  51. # ifndef NOGDI
  52. # define NOGDI
  53. # endif
  54. # include <winerror.h>
  55. # include <windows.h>
  56. # ifdef HAVE_WINSOCK2_H
  57. # include <winsock2.h>
  58. # ifdef HAVE_WS2TCPIP_H
  59. # include <ws2tcpip.h>
  60. # endif
  61. # endif
  62. # include <tchar.h>
  63. # ifdef UNICODE
  64. typedef wchar_t *(*curl_wcsdup_callback)(const wchar_t *str);
  65. # endif
  66. #endif
  67. /*
  68. * Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
  69. * undefine USE_WINSOCK.
  70. */
  71. #undef USE_WINSOCK
  72. #ifdef HAVE_WINSOCK2_H
  73. # define USE_WINSOCK 2
  74. #endif
  75. /*
  76. * Define _WIN32_WINNT_[OS] symbols because not all Windows build systems have
  77. * those symbols to compare against, and even those that do may be missing
  78. * newer symbols.
  79. */
  80. #ifndef _WIN32_WINNT_NT4
  81. #define _WIN32_WINNT_NT4 0x0400 /* Windows NT 4.0 */
  82. #endif
  83. #ifndef _WIN32_WINNT_WIN2K
  84. #define _WIN32_WINNT_WIN2K 0x0500 /* Windows 2000 */
  85. #endif
  86. #ifndef _WIN32_WINNT_WINXP
  87. #define _WIN32_WINNT_WINXP 0x0501 /* Windows XP */
  88. #endif
  89. #ifndef _WIN32_WINNT_WS03
  90. #define _WIN32_WINNT_WS03 0x0502 /* Windows Server 2003 */
  91. #endif
  92. #ifndef _WIN32_WINNT_WIN6
  93. #define _WIN32_WINNT_WIN6 0x0600 /* Windows Vista */
  94. #endif
  95. #ifndef _WIN32_WINNT_VISTA
  96. #define _WIN32_WINNT_VISTA 0x0600 /* Windows Vista */
  97. #endif
  98. #ifndef _WIN32_WINNT_WS08
  99. #define _WIN32_WINNT_WS08 0x0600 /* Windows Server 2008 */
  100. #endif
  101. #ifndef _WIN32_WINNT_LONGHORN
  102. #define _WIN32_WINNT_LONGHORN 0x0600 /* Windows Vista */
  103. #endif
  104. #ifndef _WIN32_WINNT_WIN7
  105. #define _WIN32_WINNT_WIN7 0x0601 /* Windows 7 */
  106. #endif
  107. #ifndef _WIN32_WINNT_WIN8
  108. #define _WIN32_WINNT_WIN8 0x0602 /* Windows 8 */
  109. #endif
  110. #ifndef _WIN32_WINNT_WINBLUE
  111. #define _WIN32_WINNT_WINBLUE 0x0603 /* Windows 8.1 */
  112. #endif
  113. #ifndef _WIN32_WINNT_WINTHRESHOLD
  114. #define _WIN32_WINNT_WINTHRESHOLD 0x0A00 /* Windows 10 */
  115. #endif
  116. #ifndef _WIN32_WINNT_WIN10
  117. #define _WIN32_WINNT_WIN10 0x0A00 /* Windows 10 */
  118. #endif
  119. #endif /* HEADER_CURL_SETUP_WIN32_H */