LibCore/LibIPC/Meta: Stop using deprecated Winsock functions

This commit stops using deprecated WSA functions. While the ANSI
versions are most likely not going anywhere, Windows is natively UTF-16
so it has to convert to ANSI internally. All the ANSI functions in
Winsock are marked as deprecated. The macro suppressing the warnings is
no longer defined.
This commit is contained in:
R-Goc
2026-01-21 02:18:31 +01:00
committed by Jelle Raaijmakers
parent 473391fd26
commit 3a86e779bd
Notes: github-actions[bot] 2026-02-06 10:46:34 +00:00
6 changed files with 10 additions and 12 deletions

View File

@@ -213,10 +213,10 @@ ErrorOr<int> dup(int handle)
return Error::from_windows_error(ERROR_INVALID_HANDLE);
}
if (is_socket(handle)) {
WSAPROTOCOL_INFO pi = {};
if (WSADuplicateSocket(handle, GetCurrentProcessId(), &pi))
WSAPROTOCOL_INFOW pi = {};
if (WSADuplicateSocketW(handle, GetCurrentProcessId(), &pi))
return Error::from_windows_error();
SOCKET socket = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi, 0, WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT);
SOCKET socket = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, &pi, 0, WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT);
if (socket == INVALID_SOCKET)
return Error::from_windows_error();
return socket;