Skip to content

Commit 61cf125

Browse files
seritoolsmbilker
authored andcommitted
Convert winsock calls to WSA...A
1 parent 64ae3d9 commit 61cf125

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

library/std/src/os/windows/io/socket.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ impl BorrowedSocket<'_> {
113113
/// object as the existing `BorrowedSocket` instance.
114114
#[stable(feature = "io_safety", since = "1.63.0")]
115115
pub fn try_clone_to_owned(&self) -> io::Result<OwnedSocket> {
116-
let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOW>() };
116+
let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOA>() };
117117
let result = unsafe {
118-
sys::c::WSADuplicateSocketW(
118+
sys::c::WSADuplicateSocketA(
119119
self.as_raw_socket(),
120120
sys::c::GetCurrentProcessId(),
121121
&mut info,
122122
)
123123
};
124124
sys::net::cvt(result)?;
125125
let socket = unsafe {
126-
sys::c::WSASocketW(
126+
sys::c::WSASocketA(
127127
info.iAddressFamily,
128128
info.iSocketType,
129129
info.iProtocol,
@@ -143,7 +143,7 @@ impl BorrowedSocket<'_> {
143143
}
144144

145145
let socket = unsafe {
146-
sys::c::WSASocketW(
146+
sys::c::WSASocketA(
147147
info.iAddressFamily,
148148
info.iSocketType,
149149
info.iProtocol,

library/std/src/sys/windows/c/windows_sys.lst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ Windows.Win32.Networking.WinSock.WSABUF
21082108
Windows.Win32.Networking.WinSock.WSACleanup
21092109
Windows.Win32.Networking.WinSock.WSADATA
21102110
Windows.Win32.Networking.WinSock.WSADATA
2111-
Windows.Win32.Networking.WinSock.WSADuplicateSocketW
2111+
Windows.Win32.Networking.WinSock.WSADuplicateSocketA
21122112
Windows.Win32.Networking.WinSock.WSAEACCES
21132113
Windows.Win32.Networking.WinSock.WSAEADDRINUSE
21142114
Windows.Win32.Networking.WinSock.WSAEADDRNOTAVAIL
@@ -2164,12 +2164,12 @@ Windows.Win32.Networking.WinSock.WSAHOST_NOT_FOUND
21642164
Windows.Win32.Networking.WinSock.WSANO_DATA
21652165
Windows.Win32.Networking.WinSock.WSANO_RECOVERY
21662166
Windows.Win32.Networking.WinSock.WSANOTINITIALISED
2167-
Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW
2167+
Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOA
21682168
Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN
21692169
Windows.Win32.Networking.WinSock.WSARecv
21702170
Windows.Win32.Networking.WinSock.WSASend
21712171
Windows.Win32.Networking.WinSock.WSASERVICE_NOT_FOUND
2172-
Windows.Win32.Networking.WinSock.WSASocketW
2172+
Windows.Win32.Networking.WinSock.WSASocketA
21732173
Windows.Win32.Networking.WinSock.WSAStartup
21742174
Windows.Win32.Networking.WinSock.WSASYSCALLFAILURE
21752175
Windows.Win32.Networking.WinSock.WSASYSNOTREADY

library/std/src/sys/windows/c/windows_sys.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,10 @@ extern "system" {
543543
}
544544
#[link(name = "ws2_32")]
545545
extern "system" {
546-
pub fn WSADuplicateSocketW(
546+
pub fn WSADuplicateSocketA(
547547
s: SOCKET,
548548
dwprocessid: u32,
549-
lpprotocolinfo: *mut WSAPROTOCOL_INFOW,
549+
lpprotocolinfo: *mut WSAPROTOCOL_INFOA,
550550
) -> i32;
551551
}
552552
#[link(name = "ws2_32")]
@@ -579,11 +579,11 @@ extern "system" {
579579
}
580580
#[link(name = "ws2_32")]
581581
extern "system" {
582-
pub fn WSASocketW(
582+
pub fn WSASocketA(
583583
af: i32,
584584
r#type: i32,
585585
protocol: i32,
586-
lpprotocolinfo: *const WSAPROTOCOL_INFOW,
586+
lpprotocolinfo: *const WSAPROTOCOL_INFOA,
587587
g: u32,
588588
dwflags: u32,
589589
) -> SOCKET;
@@ -4021,7 +4021,7 @@ impl ::core::clone::Clone for WSAPROTOCOLCHAIN {
40214021
}
40224022
}
40234023
#[repr(C)]
4024-
pub struct WSAPROTOCOL_INFOW {
4024+
pub struct WSAPROTOCOL_INFOA {
40254025
pub dwServiceFlags1: u32,
40264026
pub dwServiceFlags2: u32,
40274027
pub dwServiceFlags3: u32,
@@ -4041,10 +4041,10 @@ pub struct WSAPROTOCOL_INFOW {
40414041
pub iSecurityScheme: i32,
40424042
pub dwMessageSize: u32,
40434043
pub dwProviderReserved: u32,
4044-
pub szProtocol: [u16; 256],
4044+
pub szProtocol: [u8; 256],
40454045
}
4046-
impl ::core::marker::Copy for WSAPROTOCOL_INFOW {}
4047-
impl ::core::clone::Clone for WSAPROTOCOL_INFOW {
4046+
impl ::core::marker::Copy for WSAPROTOCOL_INFOA {}
4047+
impl ::core::clone::Clone for WSAPROTOCOL_INFOA {
40484048
fn clone(&self) -> Self {
40494049
*self
40504050
}

library/std/src/sys/windows/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Socket {
106106
SocketAddr::V6(..) => c::AF_INET6,
107107
};
108108
let socket = unsafe {
109-
c::WSASocketW(
109+
c::WSASocketA(
110110
family,
111111
ty,
112112
0,
@@ -126,7 +126,7 @@ impl Socket {
126126
}
127127

128128
let socket =
129-
unsafe { c::WSASocketW(family, ty, 0, ptr::null_mut(), 0, c::WSA_FLAG_OVERLAPPED) };
129+
unsafe { c::WSASocketA(family, ty, 0, ptr::null_mut(), 0, c::WSA_FLAG_OVERLAPPED) };
130130

131131
if socket == c::INVALID_SOCKET {
132132
return Err(last_error());

0 commit comments

Comments
 (0)