windows: USE_WINSOCK to guard winsock2 code (where missing)

Replacing `_WIN32`.

Also:
- tool_doswin: guard possibly non-portable socket code with
  `USE_WINSOCK`. The socket is cast to `HANDLE` and passed to
  win32 API `SetStdHandle(STD_INPUT_HANDLE, ...)`.
- lib/setup-win32.h: move `#undef`s before their `#define` pair.

Closes #20455
This commit is contained in:
Viktor Szakats 2026-01-27 23:53:05 +01:00
parent a4e2232c43
commit 2f7d37f54a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
6 changed files with 16 additions and 14 deletions

View file

@ -693,6 +693,7 @@ static void init_terminal(void)
}
}
#ifdef USE_WINSOCK
/* The following STDIN non - blocking read techniques are heavily inspired
by nmap and ncat (https://nmap.org/ncat/) */
struct win_thread_data {
@ -895,6 +896,7 @@ curl_socket_t win32_stdin_read_thread(void)
assert(socket_r != CURL_SOCKET_BAD);
return socket_r;
}
#endif /* USE_WINSOCK */
#endif /* !CURL_WINDOWS_UWP */