server: Don't allow APCs on objects associated with completion port.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-07-10 12:51:05 +02:00 committed by Alexandre Julliard
parent f55a116101
commit 82e6713b75
3 changed files with 9 additions and 5 deletions

View File

@ -1045,7 +1045,6 @@ static void test_iocp_fileio(HANDLE h)
/* using APCs on handle with associated completion port is not allowed */
res = NtReadFile( hPipeSrv, NULL, apc, &apc_count, &iosb, recv_buf, sizeof(recv_buf), NULL, NULL );
todo_wine
ok(res == STATUS_INVALID_PARAMETER, "NtReadFile returned %x\n", res);
}
@ -1094,7 +1093,6 @@ static void test_iocp_fileio(HANDLE h)
/* using APCs on handle with associated completion port is not allowed */
res = NtReadFile( hPipeSrv, NULL, apc, &apc_count, &iosb, recv_buf, sizeof(recv_buf), NULL, NULL );
todo_wine
ok(res == STATUS_INVALID_PARAMETER, "NtReadFile returned %x\n", res);
}

View File

@ -6824,7 +6824,6 @@ static void test_WSARecv(void)
memset(&ov, 0, sizeof(ov));
completion_called = 0;
iret = WSARecv(dest, bufs, 1, NULL, &flags, &ov, io_completion);
todo_wine
ok(iret == SOCKET_ERROR && GetLastError() == WSAEINVAL, "WSARecv failed - %d error %d\n", iret, GetLastError());
ok(!completion_called, "completion called\n");

View File

@ -192,7 +192,7 @@ void free_async_queue( struct async_queue *queue )
LIST_FOR_EACH_ENTRY_SAFE( async, next, &queue->queue, struct async, queue_entry )
{
async->completion = fd_get_completion( async->fd, &async->comp_key );
if (!async->completion) async->completion = fd_get_completion( async->fd, &async->comp_key );
async->fd = NULL;
async_terminate( async, STATUS_HANDLES_CLOSED );
async->queue = NULL;
@ -236,7 +236,7 @@ struct async *create_async( struct fd *fd, struct thread *thread, const async_da
async->signaled = 0;
async->wait_handle = 0;
async->direct_result = 0;
async->completion = NULL;
async->completion = fd_get_completion( fd, &async->comp_key );
if (iosb) async->iosb = (struct iosb *)grab_object( iosb );
else async->iosb = NULL;
@ -244,6 +244,13 @@ struct async *create_async( struct fd *fd, struct thread *thread, const async_da
list_add_head( &thread->process->asyncs, &async->process_entry );
if (event) reset_event( event );
if (async->completion && data->apc)
{
release_object( async );
set_error( STATUS_INVALID_PARAMETER );
return NULL;
}
return async;
}