From 57e93b72bb620306731ad44f5a2c9f88d913dd4b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 5 Apr 2017 13:38:03 +0200 Subject: [PATCH] ws2_32: Use register_async for WS2_async_recv. This changes behaviour in case when winsock attempts to use both completion routine and completion value. Tests from previous patch show that it should fail anyway. It will be possible to properly return error once APCs are passed to server in register_async request. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/ws2_32/socket.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 702d281bdca..2a957ce4d7a 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -7792,18 +7792,12 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount, iosb->u.Status = STATUS_PENDING; iosb->Information = 0; - SERVER_START_REQ( register_async ) - { - req->type = ASYNC_TYPE_READ; - req->async.handle = wine_server_obj_handle( wsa->hSocket ); - req->async.callback = wine_server_client_ptr( WS2_async_recv ); - req->async.iosb = wine_server_client_ptr( iosb ); - req->async.arg = wine_server_client_ptr( wsa ); - req->async.event = wine_server_obj_handle( lpCompletionRoutine ? 0 : lpOverlapped->hEvent ); - req->async.cvalue = cvalue; - err = wine_server_call( req ); - } - SERVER_END_REQ; + if (wsa->completion_func) + err = register_async( ASYNC_TYPE_READ, wsa->hSocket, WS2_async_recv, wsa, NULL, + ws2_async_apc, wsa, iosb ); + else + err = register_async( ASYNC_TYPE_READ, wsa->hSocket, WS2_async_recv, wsa, lpOverlapped->hEvent, + NULL, (void *)cvalue, iosb ); if (err != STATUS_PENDING) HeapFree( GetProcessHeap(), 0, wsa ); SetLastError(NtStatusToWSAError( err ));