server: Implement IOCTL_AFD_LISTEN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b07384c292
commit
6ccf61fbc7
|
@ -24,6 +24,15 @@
|
|||
#include <winioctl.h>
|
||||
#include "wine/server_protocol.h"
|
||||
|
||||
#define IOCTL_AFD_LISTEN CTL_CODE(FILE_DEVICE_BEEP, 0x802, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
struct afd_listen_params
|
||||
{
|
||||
int unknown1;
|
||||
int backlog;
|
||||
int unknown2;
|
||||
};
|
||||
|
||||
#define IOCTL_AFD_WINE_CREATE CTL_CODE(FILE_DEVICE_NETWORK, 200, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFD_WINE_ACCEPT CTL_CODE(FILE_DEVICE_NETWORK, 201, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
#define IOCTL_AFD_WINE_ACCEPT_INTO CTL_CODE(FILE_DEVICE_NETWORK, 202, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||
|
|
|
@ -1354,10 +1354,11 @@ static struct accept_req *alloc_accept_req( struct sock *sock, struct sock *acce
|
|||
static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct sock *sock = get_fd_user( fd );
|
||||
int unix_fd;
|
||||
|
||||
assert( sock->obj.ops == &sock_ops );
|
||||
|
||||
if (code != IOCTL_AFD_WINE_CREATE && get_unix_fd( fd ) < 0) return 0;
|
||||
if (code != IOCTL_AFD_WINE_CREATE && (unix_fd = get_unix_fd( fd )) < 0) return 0;
|
||||
|
||||
switch(code)
|
||||
{
|
||||
|
@ -1459,6 +1460,32 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
return 1;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_LISTEN:
|
||||
{
|
||||
const struct afd_listen_params *params = get_req_data();
|
||||
|
||||
if (get_req_data_size() < sizeof(*params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (listen( unix_fd, params->backlog ) < 0)
|
||||
{
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
sock->pending_events &= ~FD_ACCEPT;
|
||||
sock->reported_events &= ~FD_ACCEPT;
|
||||
sock->state |= FD_WINE_LISTENING;
|
||||
sock->state &= ~(FD_CONNECT | FD_WINE_CONNECTED);
|
||||
|
||||
/* we may already be selecting for FD_ACCEPT */
|
||||
sock_reselect( sock );
|
||||
return 0;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE:
|
||||
if ((sock->state & FD_WINE_NONBLOCKING) && async_is_blocking( async ))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue