ws2_32: Use IOCTL_AFD_WINE_COMPLETE_ASYNC for unimplemented ioctls.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-06-09 00:04:47 -05:00 committed by Alexandre Julliard
parent dddd46624b
commit ee03ed09f6
2 changed files with 31 additions and 18 deletions

View File

@ -3491,16 +3491,9 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
return ret ? -1 : 0;
}
case WS_SIO_SET_COMPATIBILITY_MODE:
TRACE("WS_SIO_SET_COMPATIBILITY_MODE ignored\n");
status = WSAEOPNOTSUPP;
break;
case WS_SIO_UDP_CONNRESET:
FIXME("WS_SIO_UDP_CONNRESET stub\n");
break;
case 0x667e: /* Netscape tries hard to use bogus ioctl 0x667e */
SetLastError(WSAEOPNOTSUPP);
return SOCKET_ERROR;
case WS_SIO_ADDRESS_LIST_CHANGE:
{
@ -3515,8 +3508,25 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
default:
FIXME( "unimplemented ioctl %s\n", debugstr_wsaioctl( code ) );
status = WSAEOPNOTSUPP;
break;
/* fall through */
case LOWORD(WS_FIONBIO): /* Netscape tries to use this */
case WS_SIO_SET_COMPATIBILITY_MODE:
{
NTSTATUS status = STATUS_NOT_SUPPORTED;
server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
NULL, 0, ret_size, overlapped, completion );
if (overlapped)
{
SetLastError( ERROR_IO_PENDING );
}
else
{
*ret_size = 0;
SetLastError( WSAEOPNOTSUPP );
}
return -1;
}
}
if (completion)

View File

@ -4139,7 +4139,7 @@ static void test_unsupported_ioctls(void)
ok(ret == -1, "expected failure\n");
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
ok(WSAGetLastError() == WSAEOPNOTSUPP, "got error %u\n", WSAGetLastError());
todo_wine_if (codes[i] != SIO_FLUSH)
todo_wine_if (codes[i] == FIOASYNC)
ok(!size, "got size %u\n", size);
WSASetLastError(0xdeadbeef);
@ -4149,24 +4149,25 @@ static void test_unsupported_ioctls(void)
ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, NULL);
todo_wine_if (codes[i] == SIO_FLUSH)
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
todo_wine_if (codes[i] == SIO_FLUSH)
ok(size == 0xdeadbeef, "got size %u\n", size);
ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
todo_wine_if (codes[i] == SIO_FLUSH)
ok(!ret, "expected failure\n");
todo_wine_if (codes[i] != 0xdeadbeef)
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
ok(GetLastError() == ERROR_NOT_SUPPORTED, "got error %u\n", GetLastError());
todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
todo_wine_if (codes[i] == FIOASYNC)
ok(!size, "got size %u\n", size);
ok(key == 123, "got key %Iu\n", key);
todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
todo_wine_if (codes[i] == FIOASYNC)
ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr);
todo_wine_if (codes[i] != 0xdeadbeef)
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
ok((NTSTATUS)overlapped.Internal == STATUS_NOT_SUPPORTED,
"got status %#x\n", (NTSTATUS)overlapped.Internal);
todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e)
todo_wine_if (codes[i] == FIOASYNC)
ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh);
CloseHandle(port);
@ -4183,12 +4184,14 @@ static void test_unsupported_ioctls(void)
ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, socket_apc);
todo_wine_if (codes[i] == SIO_FLUSH)
ok(ret == -1, "expected failure\n");
todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError());
todo_wine_if (codes[i] == SIO_FLUSH)
ok(size == 0xdeadbeef, "got size %u\n", size);
ret = SleepEx(0, TRUE);
todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret);
todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH)
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);