mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
Fixes #13893 - some standard library networking tests are failing on Windows
This commit is contained in:
parent
e41bc640c6
commit
a7a709aaa9
@ -2068,7 +2068,7 @@ pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid:
|
||||
ws2_32.SIO_GET_EXTENSION_FUNCTION_POINTER,
|
||||
@ptrCast(*const anyopaque, &guid),
|
||||
@sizeOf(GUID),
|
||||
@intToPtr(?*anyopaque, @ptrToInt(function)),
|
||||
@intToPtr(?*anyopaque, @ptrToInt(&function)),
|
||||
@sizeOf(T),
|
||||
&num_bytes,
|
||||
null,
|
||||
|
||||
@ -63,3 +63,28 @@ test "removeDotDirs" {
|
||||
try testRemoveDotDirs("a\\b\\..\\", "a\\");
|
||||
try testRemoveDotDirs("a\\b\\..\\c", "a\\c");
|
||||
}
|
||||
|
||||
test "loadWinsockExtensionFunction" {
|
||||
_ = try windows.WSAStartup(2, 2);
|
||||
defer windows.WSACleanup() catch unreachable;
|
||||
|
||||
const LPFN_CONNECTEX = *const fn (
|
||||
Socket: windows.ws2_32.SOCKET,
|
||||
SockAddr: *const windows.ws2_32.sockaddr,
|
||||
SockLen: std.os.socklen_t,
|
||||
SendBuf: ?*const anyopaque,
|
||||
SendBufLen: windows.DWORD,
|
||||
BytesSent: *windows.DWORD,
|
||||
Overlapped: *windows.OVERLAPPED,
|
||||
) callconv(windows.WINAPI) windows.BOOL;
|
||||
|
||||
_ = windows.loadWinsockExtensionFunction(
|
||||
LPFN_CONNECTEX,
|
||||
try std.os.socket(std.os.AF.INET, std.os.SOCK.DGRAM, 0),
|
||||
windows.ws2_32.WSAID_CONNECTEX,
|
||||
) catch |err| switch (err) {
|
||||
error.OperationNotSupported => unreachable,
|
||||
error.ShortRead => unreachable,
|
||||
else => |e| return e,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user