win: drop code checking for Windows XP / Server 2k3

Our minimum requirements are Windows 8 now.
This commit is contained in:
Saúl Ibarra Corretgé 2022-11-07 14:10:35 +01:00
parent 2b4b293ebb
commit a7b16bfb33
6 changed files with 10 additions and 136 deletions

View File

@ -465,10 +465,6 @@ API
The background story and some more details on these issues can be checked The background story and some more details on these issues can be checked
`here <https://github.com/nodejs/node/issues/7726>`_. `here <https://github.com/nodejs/node/issues/7726>`_.
.. note::
This function is not implemented on Windows XP and Windows Server 2003.
On these systems, UV_ENOSYS is returned.
.. versionadded:: 1.8.0 .. versionadded:: 1.8.0
.. c:function:: int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb) .. c:function:: int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb)

View File

@ -164,7 +164,7 @@ IPv6 stack only
IPv6 sockets can be used for both IPv4 and IPv6 communication. If you want to IPv6 sockets can be used for both IPv4 and IPv6 communication. If you want to
restrict the socket to IPv6 only, pass the ``UV_UDP_IPV6ONLY`` flag to restrict the socket to IPv6 only, pass the ``UV_UDP_IPV6ONLY`` flag to
``uv_udp_bind`` [#]_. ``uv_udp_bind``.
Multicast Multicast
~~~~~~~~~ ~~~~~~~~~
@ -250,7 +250,6 @@ times, with each address being reported once.
---- ----
.. [#] https://beej.us/guide/bgnet/html/#broadcast-packetshello-world .. [#] https://beej.us/guide/bgnet/html/#broadcast-packetshello-world
.. [#] on Windows only supported on Windows Vista and later.
.. [#] https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html#ss6.1 .. [#] https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html#ss6.1
.. [#] libuv use the system ``getaddrinfo`` in the libuv threadpool. libuv .. [#] libuv use the system ``getaddrinfo`` in the libuv threadpool. libuv
v0.8.0 and earlier also included c-ares_ as an alternative, but this has been v0.8.0 and earlier also included c-ares_ as an alternative, but this has been

View File

@ -425,9 +425,8 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
return uv_translate_sys_error(WSAGetLastError()); return uv_translate_sys_error(WSAGetLastError());
/* Try to obtain a base handle for the socket. This increases this chances that /* Try to obtain a base handle for the socket. This increases this chances that
* we find an AFD handle and are able to use the fast poll mechanism. This will * we find an AFD handle and are able to use the fast poll mechanism.
* always fail on windows XP/2k3, since they don't support the. SIO_BASE_HANDLE */
* ioctl. */
#ifndef NDEBUG #ifndef NDEBUG
base_socket = INVALID_SOCKET; base_socket = INVALID_SOCKET;
#endif #endif

View File

@ -1401,7 +1401,7 @@ static void uv__tcp_try_cancel_reqs(uv_tcp_t* tcp) {
uv_tcp_non_ifs_lsp_ipv4; uv_tcp_non_ifs_lsp_ipv4;
/* If there are non-ifs LSPs then try to obtain a base handle for the socket. /* If there are non-ifs LSPs then try to obtain a base handle for the socket.
* This will always fail on Windows XP/3k. */ */
if (non_ifs_lsp) { if (non_ifs_lsp) {
DWORD bytes; DWORD bytes;
if (WSAIoctl(socket, if (WSAIoctl(socket,

View File

@ -686,37 +686,6 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
} }
static int is_windows_version_or_greater(DWORD os_major,
DWORD os_minor,
WORD service_pack_major,
WORD service_pack_minor) {
OSVERSIONINFOEX osvi;
DWORDLONG condition_mask = 0;
int op = VER_GREATER_EQUAL;
/* Initialize the OSVERSIONINFOEX structure. */
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = os_major;
osvi.dwMinorVersion = os_minor;
osvi.wServicePackMajor = service_pack_major;
osvi.wServicePackMinor = service_pack_minor;
/* Initialize the condition mask. */
VER_SET_CONDITION(condition_mask, VER_MAJORVERSION, op);
VER_SET_CONDITION(condition_mask, VER_MINORVERSION, op);
VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMAJOR, op);
VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMINOR, op);
/* Perform the test. */
return (int) VerifyVersionInfo(
&osvi,
VER_MAJORVERSION | VER_MINORVERSION |
VER_SERVICEPACKMAJOR | VER_SERVICEPACKMINOR,
condition_mask);
}
static int address_prefix_match(int family, static int address_prefix_match(int family,
struct sockaddr* address, struct sockaddr* address,
struct sockaddr* prefix_address, struct sockaddr* prefix_address,
@ -763,26 +732,13 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
uv_interface_address_t* uv_address; uv_interface_address_t* uv_address;
int count; int count;
int is_vista_or_greater;
ULONG flags; ULONG flags;
*addresses_ptr = NULL; *addresses_ptr = NULL;
*count_ptr = 0; *count_ptr = 0;
is_vista_or_greater = is_windows_version_or_greater(6, 0, 0, 0);
if (is_vista_or_greater) {
flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
GAA_FLAG_SKIP_DNS_SERVER; GAA_FLAG_SKIP_DNS_SERVER;
} else {
/* We need at least XP SP1. */
if (!is_windows_version_or_greater(5, 1, 1, 0))
return UV_ENOTSUP;
flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST |
GAA_FLAG_SKIP_DNS_SERVER | GAA_FLAG_INCLUDE_PREFIX;
}
/* Fetch the size of the adapters reported by windows, and then get the list /* Fetch the size of the adapters reported by windows, and then get the list
* itself. */ * itself. */
@ -946,37 +902,8 @@ int uv_interface_addresses(uv_interface_address_t** addresses_ptr,
sa = unicast_address->Address.lpSockaddr; sa = unicast_address->Address.lpSockaddr;
/* XP has no OnLinkPrefixLength field. */
if (is_vista_or_greater) {
prefix_len = prefix_len =
((IP_ADAPTER_UNICAST_ADDRESS_LH*) unicast_address)->OnLinkPrefixLength; ((IP_ADAPTER_UNICAST_ADDRESS_LH*) unicast_address)->OnLinkPrefixLength;
} else {
/* Prior to Windows Vista the FirstPrefix pointed to the list with
* single prefix for each IP address assigned to the adapter.
* Order of FirstPrefix does not match order of FirstUnicastAddress,
* so we need to find corresponding prefix.
*/
IP_ADAPTER_PREFIX* prefix;
prefix_len = 0;
for (prefix = adapter->FirstPrefix; prefix; prefix = prefix->Next) {
/* We want the longest matching prefix. */
if (prefix->Address.lpSockaddr->sa_family != sa->sa_family ||
prefix->PrefixLength <= prefix_len)
continue;
if (address_prefix_match(sa->sa_family, sa,
prefix->Address.lpSockaddr, prefix->PrefixLength)) {
prefix_len = prefix->PrefixLength;
}
}
/* If there is no matching prefix information, return a single-host
* subnet mask (e.g. 255.255.255.255 for IPv4).
*/
if (!prefix_len)
prefix_len = (sa->sa_family == AF_INET6) ? 128 : 32;
}
memset(uv_address, 0, sizeof *uv_address); memset(uv_address, 0, sizeof *uv_address);

View File

@ -219,16 +219,6 @@ static void realpath_cb(uv_fs_t* req) {
char test_file_abs_buf[PATHMAX]; char test_file_abs_buf[PATHMAX];
size_t test_file_abs_size = sizeof(test_file_abs_buf); size_t test_file_abs_size = sizeof(test_file_abs_buf);
ASSERT(req->fs_type == UV_FS_REALPATH); ASSERT(req->fs_type == UV_FS_REALPATH);
#ifdef _WIN32
/*
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
*/
if (req->result == UV_ENOSYS) {
realpath_cb_count++;
uv_fs_req_cleanup(req);
return;
}
#endif
ASSERT(req->result == 0); ASSERT(req->result == 0);
uv_cwd(test_file_abs_buf, &test_file_abs_size); uv_cwd(test_file_abs_buf, &test_file_abs_size);
@ -770,11 +760,10 @@ TEST_IMPL(fs_file_loop) {
r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL); r = uv_fs_symlink(NULL, &req, "test_symlink", "test_symlink", 0, NULL);
#ifdef _WIN32 #ifdef _WIN32
/* /*
* Windows XP and Server 2003 don't support symlinks; we'll get UV_ENOTSUP. * Symlinks are only suported but only when elevated, otherwise
* Starting with vista they are supported, but only when elevated, otherwise
* we'll see UV_EPERM. * we'll see UV_EPERM.
*/ */
if (r == UV_ENOTSUP || r == UV_EPERM) if (r == UV_EPERM)
return 0; return 0;
#elif defined(__MSYS__) #elif defined(__MSYS__)
/* MSYS2's approximation of symlinks with copies does not work for broken /* MSYS2's approximation of symlinks with copies does not work for broken
@ -2049,15 +2038,6 @@ TEST_IMPL(fs_realpath) {
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
ASSERT(dummy_cb_count == 1); ASSERT(dummy_cb_count == 1);
ASSERT_NULL(req.ptr); ASSERT_NULL(req.ptr);
#ifdef _WIN32
/*
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
*/
if (req.result == UV_ENOSYS) {
uv_fs_req_cleanup(&req);
RETURN_SKIP("realpath is not supported on Windows XP");
}
#endif
ASSERT(req.result == UV_ENOENT); ASSERT(req.result == UV_ENOENT);
uv_fs_req_cleanup(&req); uv_fs_req_cleanup(&req);
@ -2168,15 +2148,6 @@ TEST_IMPL(fs_symlink) {
uv_fs_req_cleanup(&req); uv_fs_req_cleanup(&req);
r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL); r = uv_fs_realpath(NULL, &req, "test_file_symlink_symlink", NULL);
#ifdef _WIN32
/*
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
*/
if (r == UV_ENOSYS) {
uv_fs_req_cleanup(&req);
RETURN_SKIP("realpath is not supported on Windows XP");
}
#endif
ASSERT(r == 0); ASSERT(r == 0);
#ifdef _WIN32 #ifdef _WIN32
ASSERT(stricmp(req.ptr, test_file_abs_buf) == 0); ASSERT(stricmp(req.ptr, test_file_abs_buf) == 0);
@ -2226,15 +2197,6 @@ TEST_IMPL(fs_symlink) {
ASSERT(readlink_cb_count == 1); ASSERT(readlink_cb_count == 1);
r = uv_fs_realpath(loop, &req, "test_file", realpath_cb); r = uv_fs_realpath(loop, &req, "test_file", realpath_cb);
#ifdef _WIN32
/*
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
*/
if (r == UV_ENOSYS) {
uv_fs_req_cleanup(&req);
RETURN_SKIP("realpath is not supported on Windows XP");
}
#endif
ASSERT(r == 0); ASSERT(r == 0);
uv_run(loop, UV_RUN_DEFAULT); uv_run(loop, UV_RUN_DEFAULT);
ASSERT(realpath_cb_count == 1); ASSERT(realpath_cb_count == 1);
@ -2335,15 +2297,6 @@ int test_symlink_dir_impl(int type) {
uv_fs_req_cleanup(&req); uv_fs_req_cleanup(&req);
r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL); r = uv_fs_realpath(NULL, &req, "test_dir_symlink", NULL);
#ifdef _WIN32
/*
* Windows XP and Server 2003 don't support GetFinalPathNameByHandleW()
*/
if (r == UV_ENOSYS) {
uv_fs_req_cleanup(&req);
RETURN_SKIP("realpath is not supported on Windows XP");
}
#endif
ASSERT(r == 0); ASSERT(r == 0);
#ifdef _WIN32 #ifdef _WIN32
ASSERT(strlen(req.ptr) == test_dir_abs_size - 5); ASSERT(strlen(req.ptr) == test_dir_abs_size - 5);