mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-15 00:56:07 +00:00
ws2_32: Use IOCTL_AFD_WINE_SIOCATMARK.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
27609da351
commit
1f44a257db
|
@ -3370,29 +3370,13 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
|
|||
|
||||
case WS_SIOCATMARK:
|
||||
{
|
||||
unsigned int oob = 0, atmark = 0;
|
||||
socklen_t oobsize = sizeof(int);
|
||||
if (out_size != sizeof(WS_u_long) || IS_INTRESOURCE(out_buff))
|
||||
{
|
||||
SetLastError(WSAEFAULT);
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
if ((fd = get_sock_fd( s, 0, NULL )) == -1) return SOCKET_ERROR;
|
||||
/* SO_OOBINLINE sockets must always return TRUE to SIOCATMARK */
|
||||
if ((getsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &oob, &oobsize ) == -1)
|
||||
|| (!oob && ioctl(fd, SIOCATMARK, &atmark ) == -1))
|
||||
status = wsaErrno();
|
||||
else
|
||||
{
|
||||
/* The SIOCATMARK value read from ioctl() is reversed
|
||||
* because BSD returns TRUE if it's in the OOB mark
|
||||
* while Windows returns TRUE if there are NO OOB bytes.
|
||||
*/
|
||||
(*(WS_u_long *) out_buff) = oob || !atmark;
|
||||
}
|
||||
DWORD ret;
|
||||
|
||||
release_sock_fd( s, fd );
|
||||
break;
|
||||
ret = server_ioctl_sock( s, IOCTL_AFD_WINE_SIOCATMARK, in_buff, in_size,
|
||||
out_buff, out_size, ret_size, overlapped, completion );
|
||||
SetLastError( ret );
|
||||
if (!ret) *ret_size = sizeof(WS_u_long);
|
||||
return ret ? -1 : 0;
|
||||
}
|
||||
|
||||
case WS_FIOASYNC:
|
||||
|
|
|
@ -3674,7 +3674,7 @@ static void check_fionread_siocatmark_(int line, SOCKET s, unsigned int normal,
|
|||
WSASetLastError(0xdeadbeef);
|
||||
ret = WSAIoctl(s, SIOCATMARK, NULL, 0, &value, sizeof(value), &size, NULL, NULL);
|
||||
ok_(__FILE__, line)(!ret, "expected success\n");
|
||||
todo_wine ok_(__FILE__, line)(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
|
||||
ok_(__FILE__, line)(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
|
||||
todo_wine_if (todo_oob) ok_(__FILE__, line)(value == oob, "SIOCATMARK returned %u\n", value);
|
||||
}
|
||||
|
||||
|
@ -3765,9 +3765,9 @@ static void test_fionread_siocatmark(void)
|
|||
overlapped.InternalHigh = 0xdeadbeef;
|
||||
ret = WSAIoctl(client, SIOCATMARK, NULL, 0, &value, sizeof(value), &size, &overlapped, NULL);
|
||||
ok(!ret, "expected success\n");
|
||||
todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
|
||||
ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError());
|
||||
ok(value == TRUE, "got %u\n", value);
|
||||
todo_wine ok(size == sizeof(value), "got size %u\n", size);
|
||||
ok(size == sizeof(value), "got size %u\n", size);
|
||||
ok(!overlapped.Internal, "got status %#x\n", (NTSTATUS)overlapped.Internal);
|
||||
ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh);
|
||||
|
||||
|
@ -3881,17 +3881,14 @@ static void test_fionread_siocatmark(void)
|
|||
size = 0xdeadbeef;
|
||||
ret = WSAIoctl(server, SIOCATMARK, NULL, 0, &value, sizeof(value), &size, &overlapped, socket_apc);
|
||||
ok(!ret, "expected success\n");
|
||||
todo_wine ok(size == sizeof(value), "got size %u\n", size);
|
||||
ok(size == sizeof(value), "got size %u\n", size);
|
||||
|
||||
ret = SleepEx(0, TRUE);
|
||||
todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
|
||||
if (ret == WAIT_IO_COMPLETION)
|
||||
{
|
||||
ok(apc_count == 1, "APC was called %u times\n", apc_count);
|
||||
ok(!apc_error, "got APC error %u\n", apc_error);
|
||||
ok(!apc_size, "got APC size %u\n", apc_size);
|
||||
ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped);
|
||||
}
|
||||
ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
|
||||
ok(apc_count == 1, "APC was called %u times\n", apc_count);
|
||||
ok(!apc_error, "got APC error %u\n", apc_error);
|
||||
ok(!apc_size, "got APC size %u\n", apc_size);
|
||||
ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped);
|
||||
|
||||
closesocket(server);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue