Commit 0e05a7f8 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Use IOCTL_WINE_AFD_COMPLETE_ASYNC in SIO_ADDRESS_LIST_QUERY.

parent 82c7da31
......@@ -3399,8 +3399,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
break;
}
case WS_SIO_ADDRESS_LIST_QUERY:
{
case WS_SIO_ADDRESS_LIST_QUERY:
{
DWORD size;
TRACE("-> SIO_ADDRESS_LIST_QUERY request\n");
......@@ -3415,17 +3415,19 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
if (GetAdaptersInfo(NULL, &size) == ERROR_BUFFER_OVERFLOW)
{
IP_ADAPTER_INFO *p, *table = HeapAlloc(GetProcessHeap(), 0, size);
NTSTATUS status = STATUS_SUCCESS;
SOCKET_ADDRESS_LIST *sa_list;
SOCKADDR_IN *sockaddr;
SOCKET_ADDRESS *sa;
unsigned int i;
DWORD ret = 0;
DWORD num;
if (!table || GetAdaptersInfo(table, &size))
{
HeapFree(GetProcessHeap(), 0, table);
status = WSAEINVAL;
break;
SetLastError( WSAEINVAL );
return -1;
}
for (p = table, num = 0; p; p = p->Next)
......@@ -3436,8 +3438,8 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
{
*ret_size = total;
HeapFree(GetProcessHeap(), 0, table);
status = WSAEFAULT;
break;
SetLastError( WSAEFAULT );
return -1;
}
sa_list = out_buff;
......@@ -3459,14 +3461,20 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
}
HeapFree(GetProcessHeap(), 0, table);
ret = server_ioctl_sock( s, IOCTL_AFD_WINE_COMPLETE_ASYNC, &status, sizeof(status),
NULL, 0, ret_size, overlapped, completion );
*ret_size = total;
SetLastError( ret );
return ret ? -1 : 0;
}
else
{
WARN("unable to get IP address list\n");
status = WSAEINVAL;
SetLastError( WSAEINVAL );
return -1;
}
break;
}
}
case WS_SIO_FLUSH:
FIXME("SIO_FLUSH: stub.\n");
......
......@@ -9297,7 +9297,7 @@ static void test_address_list_query(void)
size = 0;
ret = WSAIoctl(s, SIO_ADDRESS_LIST_QUERY, NULL, 0, buffer, sizeof(buffer), &size, NULL, NULL);
ok(!ret, "Got unexpected ret %d.\n", ret);
todo_wine ok(!WSAGetLastError(), "Got unexpected error %d.\n", WSAGetLastError());
ok(!WSAGetLastError(), "Got unexpected error %d.\n", WSAGetLastError());
ok(size == expect_size, "Expected size %u, got %u.\n", expect_size, size);
expect_size = FIELD_OFFSET(SOCKET_ADDRESS_LIST, Address[address_list->iAddressCount]);
......@@ -9346,8 +9346,8 @@ static void test_address_list_query(void)
ok(ret == -1, "Got unexpected ret %d.\n", ret);
ok(WSAGetLastError() == WSAEFAULT, "Got unexpected error %d.\n", WSAGetLastError());
ok(size == expect_size, "Expected size %u, got %u.\n", expect_size, size);
todo_wine ok(overlapped.Internal == 0xdeadbeef, "Got status %#x.\n", (NTSTATUS)overlapped.Internal);
todo_wine ok(overlapped.InternalHigh == 0xdeadbeef, "Got size %Iu.\n", overlapped.InternalHigh);
ok(overlapped.Internal == 0xdeadbeef, "Got status %#x.\n", (NTSTATUS)overlapped.Internal);
ok(overlapped.InternalHigh == 0xdeadbeef, "Got size %Iu.\n", overlapped.InternalHigh);
overlapped.Internal = 0xdeadbeef;
overlapped.InternalHigh = 0xdeadbeef;
......@@ -9367,8 +9367,8 @@ static void test_address_list_query(void)
ok(ret == -1, "Got unexpected ret %d.\n", ret);
ok(WSAGetLastError() == WSAEFAULT, "Got unexpected error %d.\n", WSAGetLastError());
ok(size == expect_size, "Expected size %u, got %u.\n", expect_size, size);
todo_wine ok(overlapped.Internal == 0xdeadbeef, "Got status %#x.\n", (NTSTATUS)overlapped.Internal);
todo_wine ok(overlapped.InternalHigh == 0xdeadbeef, "Got size %Iu.\n", overlapped.InternalHigh);
ok(overlapped.Internal == 0xdeadbeef, "Got status %#x.\n", (NTSTATUS)overlapped.Internal);
ok(overlapped.InternalHigh == 0xdeadbeef, "Got size %Iu.\n", overlapped.InternalHigh);
ok(address_list->iAddressCount == 0xcccccccc, "Got %u addresses.\n", address_list->iAddressCount);
overlapped.Internal = 0xdeadbeef;
......@@ -9376,19 +9376,19 @@ static void test_address_list_query(void)
size = 0xdeadbeef;
ret = WSAIoctl(s, SIO_ADDRESS_LIST_QUERY, NULL, 0, buffer, sizeof(buffer), &size, &overlapped, NULL);
ok(!ret, "Got unexpected ret %d.\n", ret);
todo_wine ok(!WSAGetLastError(), "Got unexpected error %d.\n", WSAGetLastError());
ok(!WSAGetLastError(), "Got unexpected error %d.\n", WSAGetLastError());
ok(size == expect_size, "Expected size %u, got %u.\n", expect_size, size);
ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
todo_wine ok(ret, "Got error %u.\n", GetLastError());
todo_wine ok(!size, "Got size %u.\n", size);
ok(ret, "Got error %u.\n", GetLastError());
ok(!size, "Got size %u.\n", size);
ok(overlapped_ptr == &overlapped, "Got overlapped %p.\n", overlapped_ptr);
ok(!overlapped.Internal, "Got status %#x.\n", (NTSTATUS)overlapped.Internal);
todo_wine ok(!overlapped.InternalHigh, "Got size %Iu.\n", overlapped.InternalHigh);
ok(!overlapped.InternalHigh, "Got size %Iu.\n", overlapped.InternalHigh);
ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0);
ok(!ret, "Expected failure.\n");
todo_wine ok(GetLastError() == WAIT_TIMEOUT, "Got error %u.\n", GetLastError());
ok(GetLastError() == WAIT_TIMEOUT, "Got error %u.\n", GetLastError());
closesocket(s);
CloseHandle(port);
......@@ -9408,14 +9408,11 @@ static void test_address_list_query(void)
ok(size == expect_size, "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(s);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment