ws2_32: Use IOCTL_AFD_EVENT_SELECT.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9bbf3ab96b
commit
6e4f03d745
|
@ -4379,30 +4379,51 @@ int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lp
|
||||||
return SOCKET_ERROR;
|
return SOCKET_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned int afd_poll_flag_from_win32( unsigned int flags )
|
||||||
|
{
|
||||||
|
static const unsigned int map[] =
|
||||||
|
{
|
||||||
|
AFD_POLL_READ,
|
||||||
|
AFD_POLL_WRITE,
|
||||||
|
AFD_POLL_OOB,
|
||||||
|
AFD_POLL_ACCEPT,
|
||||||
|
AFD_POLL_CONNECT | AFD_POLL_CONNECT_ERR,
|
||||||
|
AFD_POLL_RESET | AFD_POLL_HUP,
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int i, ret = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(map); ++i)
|
||||||
|
{
|
||||||
|
if (flags & (1 << i)) ret |= map[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* WSAEventSelect (WS2_32.39)
|
* WSAEventSelect (ws2_32.@)
|
||||||
*/
|
*/
|
||||||
int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEvent, LONG lEvent)
|
int WINAPI WSAEventSelect( SOCKET s, WSAEVENT event, LONG mask )
|
||||||
{
|
{
|
||||||
int ret;
|
struct afd_event_select_params params;
|
||||||
|
IO_STATUS_BLOCK io;
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
TRACE("%04lx, hEvent %p, event %08x\n", s, hEvent, lEvent);
|
TRACE( "socket %#lx, event %p, mask %#x\n", s, event, mask );
|
||||||
|
|
||||||
SERVER_START_REQ( set_socket_event )
|
params.event = event;
|
||||||
{
|
params.mask = afd_poll_flag_from_win32( mask );
|
||||||
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
|
|
||||||
req->mask = lEvent;
|
status = NtDeviceIoControlFile( (HANDLE)s, NULL, NULL, NULL, &io, IOCTL_AFD_EVENT_SELECT,
|
||||||
req->event = wine_server_obj_handle( hEvent );
|
¶ms, sizeof(params), NULL, 0 );
|
||||||
req->window = 0;
|
SetLastError( NtStatusToWSAError( status ) );
|
||||||
req->msg = 0;
|
return status ? -1 : 0;
|
||||||
ret = wine_server_call( req );
|
|
||||||
}
|
|
||||||
SERVER_END_REQ;
|
|
||||||
if (!ret) return 0;
|
|
||||||
SetLastError(WSAEINVAL);
|
|
||||||
return SOCKET_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* WSAGetOverlappedResult (WS2_32.40)
|
* WSAGetOverlappedResult (WS2_32.40)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue