server: Return void from the ioctl callback.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
a36e2769c9
commit
b1e4d920c3
|
@ -102,7 +102,7 @@ static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned
|
|||
static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
|
||||
static void console_read( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static void console_flush( struct fd *fd, struct async *async );
|
||||
static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops console_fd_ops =
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ static const struct object_ops console_server_ops =
|
|||
console_server_destroy /* destroy */
|
||||
};
|
||||
|
||||
static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops console_server_fd_ops =
|
||||
{
|
||||
|
@ -241,7 +241,7 @@ static const struct object_ops screen_buffer_ops =
|
|||
};
|
||||
|
||||
static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops screen_buffer_fd_ops =
|
||||
{
|
||||
|
@ -327,7 +327,7 @@ static const struct object_ops console_input_ops =
|
|||
|
||||
static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static void console_input_flush( struct fd *fd, struct async *async );
|
||||
static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops console_input_fd_ops =
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ static const struct object_ops console_output_ops =
|
|||
};
|
||||
|
||||
static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops console_output_fd_ops =
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ static const struct object_ops console_connection_ops =
|
|||
console_connection_destroy /* destroy */
|
||||
};
|
||||
|
||||
static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct fd_ops console_connection_fd_ops =
|
||||
{
|
||||
|
@ -913,7 +913,7 @@ static int is_blocking_read_ioctl( unsigned int code )
|
|||
}
|
||||
}
|
||||
|
||||
static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct console *console = get_fd_user( fd );
|
||||
|
||||
|
@ -926,25 +926,25 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async
|
|||
if (get_req_data_size() != sizeof(*event))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
group = event->group_id ? event->group_id : current->process->group_id;
|
||||
if (!group)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
propagate_console_signal( console, event->event, group );
|
||||
return !get_error();
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
if (!console->server || code >> 16 != FILE_DEVICE_CONSOLE)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q );
|
||||
queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -986,7 +986,7 @@ static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t
|
|||
screen_buffer->id, async, &screen_buffer->ioctl_q );
|
||||
}
|
||||
|
||||
static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct screen_buffer *screen_buffer = get_fd_user( fd );
|
||||
|
||||
|
@ -996,25 +996,25 @@ static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *
|
|||
if (!screen_buffer->input)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_active_screen_buffer( screen_buffer->input, screen_buffer );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
default:
|
||||
if (!screen_buffer->input || !screen_buffer->input->server || code >> 16 != FILE_DEVICE_CONSOLE ||
|
||||
is_blocking_read_ioctl( code ))
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return queue_host_ioctl( screen_buffer->input->server, code, screen_buffer->id,
|
||||
async, &screen_buffer->ioctl_q );
|
||||
queue_host_ioctl( screen_buffer->input->server, code, screen_buffer->id,
|
||||
async, &screen_buffer->ioctl_q );
|
||||
}
|
||||
}
|
||||
|
||||
static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct console_connection *console_connection = get_fd_user( fd );
|
||||
|
||||
|
@ -1027,31 +1027,31 @@ static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct as
|
|||
if (get_req_data_size() != sizeof(unsigned int))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (current->process->console)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
pid = *(unsigned int *)get_req_data();
|
||||
if (pid == ATTACH_PARENT_PROCESS) pid = current->process->parent_id;
|
||||
if (!(process = get_process_from_id( pid ))) return 0;
|
||||
if (!(process = get_process_from_id( pid ))) return;
|
||||
|
||||
if (process->console)
|
||||
current->process->console = (struct console *)grab_object( process->console );
|
||||
else set_error( STATUS_ACCESS_DENIED );
|
||||
release_object( process );
|
||||
return !get_error();
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return default_fd_ioctl( console_connection->fd, code, async );
|
||||
default_fd_ioctl( console_connection->fd, code, async );
|
||||
}
|
||||
}
|
||||
|
||||
static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct console_server *server = get_fd_user( fd );
|
||||
|
||||
|
@ -1063,15 +1063,15 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async
|
|||
if (get_req_data_size() != sizeof(*event))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (!server->console)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
propagate_console_signal( server->console, event->event, event->group_id );
|
||||
return !get_error();
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_CONDRV_SETUP_INPUT:
|
||||
|
@ -1084,7 +1084,7 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async
|
|||
if (get_req_data_size() != sizeof(unsigned int) || get_reply_max_size())
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (server->term_fd != -1)
|
||||
{
|
||||
|
@ -1093,10 +1093,10 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async
|
|||
server->term_fd = -1;
|
||||
}
|
||||
handle = *(unsigned int *)get_req_data();
|
||||
if (!handle) return 1;
|
||||
if (!handle) return;
|
||||
if (!(file = get_file_obj( current->process, handle, FILE_READ_DATA )))
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
unix_fd = get_file_unix_fd( file );
|
||||
release_object( file );
|
||||
|
@ -1104,7 +1104,7 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async
|
|||
if (tcgetattr( unix_fd, &server->termios ))
|
||||
{
|
||||
file_set_error();
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
term = server->termios;
|
||||
term.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN);
|
||||
|
@ -1114,16 +1114,13 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async
|
|||
term.c_cc[VMIN] = 1;
|
||||
term.c_cc[VTIME] = 0;
|
||||
if (tcsetattr( unix_fd, TCSANOW, &term ) || (server->term_fd = dup( unix_fd )) == -1)
|
||||
{
|
||||
file_set_error();
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1337,16 +1334,16 @@ static void console_input_destroy( struct object *obj )
|
|||
if (console_input->fd) release_object( console_input->fd );
|
||||
}
|
||||
|
||||
static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct console *console = current->process->console;
|
||||
|
||||
if (!console)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return console_ioctl( console->fd, code, async );
|
||||
console_ioctl( console->fd, code, async );
|
||||
}
|
||||
|
||||
static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos )
|
||||
|
@ -1409,16 +1406,16 @@ static void console_output_destroy( struct object *obj )
|
|||
if (console_output->fd) release_object( console_output->fd );
|
||||
}
|
||||
|
||||
static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct console *console = current->process->console;
|
||||
|
||||
if (!console || !console->active)
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
return screen_buffer_ioctl( console->active->fd, code, async );
|
||||
screen_buffer_ioctl( console->active->fd, code, async );
|
||||
}
|
||||
|
||||
static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos )
|
||||
|
|
|
@ -204,7 +204,7 @@ static enum server_fd_type device_file_get_fd_type( struct fd *fd );
|
|||
static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos );
|
||||
static void device_file_flush( struct fd *fd, struct async *async );
|
||||
static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void device_file_reselect_async( struct fd *fd, struct async_queue *queue );
|
||||
static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
|
||||
|
||||
|
@ -596,17 +596,16 @@ static void free_irp_params( struct irp_call *irp )
|
|||
}
|
||||
|
||||
/* queue an irp to the device */
|
||||
static int queue_irp( struct device_file *file, const irp_params_t *params, struct async *async )
|
||||
static void queue_irp( struct device_file *file, const irp_params_t *params, struct async *async )
|
||||
{
|
||||
struct irp_call *irp = create_irp( file, params, async );
|
||||
if (!irp) return 0;
|
||||
if (!irp) return;
|
||||
|
||||
fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT );
|
||||
irp->async = (struct async *)grab_object( async );
|
||||
add_irp_to_queue( file->device->manager, irp, current );
|
||||
release_object( irp );
|
||||
async_set_unknown_status( async );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static enum server_fd_type device_file_get_fd_type( struct fd *fd )
|
||||
|
@ -659,7 +658,7 @@ static void device_file_flush( struct fd *fd, struct async *async )
|
|||
queue_irp( file, ¶ms, async );
|
||||
}
|
||||
|
||||
static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct device_file *file = get_fd_user( fd );
|
||||
irp_params_t params;
|
||||
|
@ -667,7 +666,7 @@ static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
|
|||
memset( ¶ms, 0, sizeof(params) );
|
||||
params.ioctl.type = IRP_CALL_IOCTL;
|
||||
params.ioctl.code = code;
|
||||
return queue_irp( file, ¶ms, async );
|
||||
queue_irp( file, ¶ms, async );
|
||||
}
|
||||
|
||||
static void cancel_irp_call( struct irp_call *irp )
|
||||
|
|
|
@ -2372,23 +2372,22 @@ void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int inf
|
|||
}
|
||||
|
||||
/* default ioctl() routine */
|
||||
int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
void no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
set_error( STATUS_OBJECT_TYPE_MISMATCH );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* default ioctl() routine */
|
||||
int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
void default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case FSCTL_DISMOUNT_VOLUME:
|
||||
unmount_device( fd );
|
||||
return 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ struct fd_ops
|
|||
/* query volume info */
|
||||
void (*get_volume_info)( struct fd *, struct async *, unsigned int );
|
||||
/* perform an ioctl on the file */
|
||||
int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
void (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
/* queue an async operation */
|
||||
void (*queue_async)(struct fd *, struct async *async, int type, int count);
|
||||
/* selected events for async i/o need an update */
|
||||
|
@ -115,8 +115,8 @@ extern void no_fd_flush( struct fd *fd, struct async *async );
|
|||
extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
|
||||
extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
|
||||
extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
|
||||
extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
extern void no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
extern void default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
|
||||
extern void default_fd_queue_async( struct fd *fd, struct async *async, int type, int count );
|
||||
extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue );
|
||||
|
|
|
@ -157,7 +157,7 @@ static struct object *pipe_server_lookup_name( struct object *obj, struct unicod
|
|||
static struct object *pipe_server_open_file( struct object *obj, unsigned int access,
|
||||
unsigned int sharing, unsigned int options );
|
||||
static void pipe_server_destroy( struct object *obj);
|
||||
static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct object_ops pipe_server_ops =
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ static const struct fd_ops pipe_server_fd_ops =
|
|||
|
||||
/* client end functions */
|
||||
static void pipe_client_dump( struct object *obj, int verbose );
|
||||
static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
|
||||
static const struct object_ops pipe_client_ops =
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static const struct object_ops named_pipe_device_ops =
|
|||
static void named_pipe_device_file_dump( struct object *obj, int verbose );
|
||||
static struct fd *named_pipe_device_file_get_fd( struct object *obj );
|
||||
static WCHAR *named_pipe_device_file_get_full_name( struct object *obj, data_size_t *len );
|
||||
static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd );
|
||||
static void named_pipe_device_file_destroy( struct object *obj );
|
||||
|
||||
|
@ -973,7 +973,7 @@ static enum server_fd_type pipe_end_get_fd_type( struct fd *fd )
|
|||
return FD_TYPE_PIPE;
|
||||
}
|
||||
|
||||
static int pipe_end_peek( struct pipe_end *pipe_end )
|
||||
static void pipe_end_peek( struct pipe_end *pipe_end )
|
||||
{
|
||||
unsigned reply_size = get_reply_max_size();
|
||||
FILE_PIPE_PEEK_BUFFER *buffer;
|
||||
|
@ -984,7 +984,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
|||
if (reply_size < offsetof( FILE_PIPE_PEEK_BUFFER, Data ))
|
||||
{
|
||||
set_error( STATUS_INFO_LENGTH_MISMATCH );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
reply_size -= offsetof( FILE_PIPE_PEEK_BUFFER, Data );
|
||||
|
||||
|
@ -995,10 +995,10 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
|||
case FILE_PIPE_CLOSING_STATE:
|
||||
if (!list_empty( &pipe_end->message_queue )) break;
|
||||
set_error( STATUS_PIPE_BROKEN );
|
||||
return 0;
|
||||
return;
|
||||
default:
|
||||
set_error( pipe_end->pipe ? STATUS_INVALID_PIPE_STATE : STATUS_PIPE_DISCONNECTED );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
LIST_FOR_EACH_ENTRY( message, &pipe_end->message_queue, struct pipe_message, entry )
|
||||
|
@ -1012,7 +1012,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
|||
reply_size = min( reply_size, message_length );
|
||||
}
|
||||
|
||||
if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return 0;
|
||||
if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return;
|
||||
buffer->NamedPipeState = pipe_end->state;
|
||||
buffer->ReadDataAvailable = avail;
|
||||
buffer->NumberOfMessages = 0; /* FIXME */
|
||||
|
@ -1031,10 +1031,9 @@ static int pipe_end_peek( struct pipe_end *pipe_end )
|
|||
}
|
||||
}
|
||||
if (message_length > reply_size) set_error( STATUS_BUFFER_OVERFLOW );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async )
|
||||
static void pipe_end_transceive( struct pipe_end *pipe_end, struct async *async )
|
||||
{
|
||||
struct pipe_message *message;
|
||||
struct iosb *iosb;
|
||||
|
@ -1042,20 +1041,20 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async )
|
|||
if (!pipe_end->connection)
|
||||
{
|
||||
set_error( pipe_end->pipe ? STATUS_INVALID_PIPE_STATE : STATUS_PIPE_DISCONNECTED );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(pipe_end->flags & NAMED_PIPE_MESSAGE_STREAM_READ))
|
||||
{
|
||||
set_error( STATUS_INVALID_READ_MODE );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* not allowed if we already have read data buffered */
|
||||
if (!list_empty( &pipe_end->message_queue ))
|
||||
{
|
||||
set_error( STATUS_PIPE_BUSY );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
iosb = async_get_iosb( async );
|
||||
|
@ -1064,16 +1063,15 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async )
|
|||
/* transaction never blocks on write, so just queue a message without async */
|
||||
message = queue_message( pipe_end->connection, iosb );
|
||||
release_object( iosb );
|
||||
if (!message) return 0;
|
||||
if (!message) return;
|
||||
reselect_read_queue( pipe_end->connection, 0 );
|
||||
|
||||
queue_async( &pipe_end->read_q, async );
|
||||
reselect_read_queue( pipe_end, 0 );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int pipe_end_get_connection_attribute( struct pipe_end *pipe_end )
|
||||
static void pipe_end_get_connection_attribute( struct pipe_end *pipe_end )
|
||||
{
|
||||
const char *attr = get_req_data();
|
||||
data_size_t value_size, attr_size = get_req_data_size();
|
||||
|
@ -1092,38 +1090,40 @@ static int pipe_end_get_connection_attribute( struct pipe_end *pipe_end )
|
|||
else
|
||||
{
|
||||
set_error( STATUS_ILLEGAL_FUNCTION );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_reply_max_size() < value_size)
|
||||
{
|
||||
set_error( STATUS_INFO_LENGTH_MISMATCH );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( value, value_size );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int pipe_end_ioctl( struct pipe_end *pipe_end, ioctl_code_t code, struct async *async )
|
||||
static void pipe_end_ioctl( struct pipe_end *pipe_end, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
switch(code)
|
||||
{
|
||||
case FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE:
|
||||
return pipe_end_get_connection_attribute( pipe_end );
|
||||
pipe_end_get_connection_attribute( pipe_end );
|
||||
break;
|
||||
|
||||
case FSCTL_PIPE_PEEK:
|
||||
return pipe_end_peek( pipe_end );
|
||||
pipe_end_peek( pipe_end );
|
||||
break;
|
||||
|
||||
case FSCTL_PIPE_TRANSCEIVE:
|
||||
return pipe_end_transceive( pipe_end, async );
|
||||
pipe_end_transceive( pipe_end, async );
|
||||
break;
|
||||
|
||||
default:
|
||||
return default_fd_ioctl( pipe_end->fd, code, async );
|
||||
default_fd_ioctl( pipe_end->fd, code, async );
|
||||
}
|
||||
}
|
||||
|
||||
static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct pipe_server *server = get_fd_user( fd );
|
||||
|
||||
|
@ -1140,21 +1140,21 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
|
|||
break;
|
||||
case FILE_PIPE_CONNECTED_STATE:
|
||||
set_error( STATUS_PIPE_CONNECTED );
|
||||
return 0;
|
||||
return;
|
||||
case FILE_PIPE_CLOSING_STATE:
|
||||
set_error( STATUS_PIPE_CLOSING );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (server->pipe_end.flags & NAMED_PIPE_NONBLOCKING_MODE)
|
||||
{
|
||||
set_error( STATUS_PIPE_LISTENING );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
queue_async( &server->listen_q, async );
|
||||
async_wake_up( &server->pipe_end.pipe->waiters, STATUS_SUCCESS );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case FSCTL_PIPE_DISCONNECT:
|
||||
switch(server->pipe_end.state)
|
||||
|
@ -1169,32 +1169,32 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
|
|||
break;
|
||||
case FILE_PIPE_LISTENING_STATE:
|
||||
set_error( STATUS_PIPE_LISTENING );
|
||||
return 0;
|
||||
return;
|
||||
case FILE_PIPE_DISCONNECTED_STATE:
|
||||
set_error( STATUS_PIPE_DISCONNECTED );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
pipe_end_disconnect( &server->pipe_end, STATUS_PIPE_DISCONNECTED );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case FSCTL_PIPE_IMPERSONATE:
|
||||
if (current->process->token) /* FIXME: use the client token */
|
||||
{
|
||||
struct token *token;
|
||||
if (!(token = token_duplicate( current->process->token, 0, SecurityImpersonation, NULL, NULL, 0, NULL, 0 )))
|
||||
return 0;
|
||||
return;
|
||||
if (current->token) release_object( current->token );
|
||||
current->token = token;
|
||||
}
|
||||
return 1;
|
||||
return;
|
||||
|
||||
default:
|
||||
return pipe_end_ioctl( &server->pipe_end, code, async );
|
||||
pipe_end_ioctl( &server->pipe_end, code, async );
|
||||
}
|
||||
}
|
||||
|
||||
static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct pipe_end *client = get_fd_user( fd );
|
||||
|
||||
|
@ -1202,10 +1202,10 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
|
|||
{
|
||||
case FSCTL_PIPE_LISTEN:
|
||||
set_error( STATUS_ILLEGAL_FUNCTION );
|
||||
return 0;
|
||||
return;
|
||||
|
||||
default:
|
||||
return pipe_end_ioctl( client, code, async );
|
||||
pipe_end_ioctl( client, code, async );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1323,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc
|
|||
return &client->obj;
|
||||
}
|
||||
|
||||
static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct named_pipe_device *device = get_fd_user( fd );
|
||||
|
||||
|
@ -1341,11 +1341,11 @@ static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct asy
|
|||
size < FIELD_OFFSET(FILE_PIPE_WAIT_FOR_BUFFER, Name[buffer->NameLength/sizeof(WCHAR)]))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
name.str = buffer->Name;
|
||||
name.len = (buffer->NameLength / sizeof(WCHAR)) * sizeof(WCHAR);
|
||||
if (!(pipe = open_named_object( &device->obj, &named_pipe_ops, &name, 0 ))) return 0;
|
||||
if (!(pipe = open_named_object( &device->obj, &named_pipe_ops, &name, 0 ))) return;
|
||||
|
||||
if (list_empty( &pipe->listeners ))
|
||||
{
|
||||
|
@ -1356,11 +1356,11 @@ static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct asy
|
|||
}
|
||||
|
||||
release_object( pipe );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return default_fd_ioctl( fd, code, async );
|
||||
default_fd_ioctl( fd, code, async );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ static struct fd *serial_get_fd( struct object *obj );
|
|||
static void serial_destroy(struct object *obj);
|
||||
|
||||
static enum server_fd_type serial_get_fd_type( struct fd *fd );
|
||||
static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void serial_queue_async( struct fd *fd, struct async *async, int type, int count );
|
||||
static void serial_reselect_async( struct fd *fd, struct async_queue *queue );
|
||||
|
||||
|
@ -179,7 +179,7 @@ static enum server_fd_type serial_get_fd_type( struct fd *fd )
|
|||
return FD_TYPE_SERIAL;
|
||||
}
|
||||
|
||||
static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
{
|
||||
struct serial *serial = get_fd_user( fd );
|
||||
|
||||
|
@ -189,43 +189,42 @@ static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(serial->timeouts))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
set_reply_data( &serial->timeouts, sizeof(serial->timeouts ));
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case IOCTL_SERIAL_SET_TIMEOUTS:
|
||||
if (get_req_data_size() < sizeof(serial->timeouts))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
memcpy( &serial->timeouts, get_req_data(), sizeof(serial->timeouts) );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case IOCTL_SERIAL_GET_WAIT_MASK:
|
||||
if (get_reply_max_size() < sizeof(serial->eventmask))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
set_reply_data( &serial->eventmask, sizeof(serial->eventmask) );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case IOCTL_SERIAL_SET_WAIT_MASK:
|
||||
if (get_req_data_size() < sizeof(serial->eventmask))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
serial->eventmask = *(unsigned int *)get_req_data();
|
||||
serial->generation++;
|
||||
fd_async_wake_up( serial->fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
184
server/sock.c
184
server/sock.c
|
@ -230,7 +230,7 @@ static void sock_release_ifchange( struct sock *sock );
|
|||
static int sock_get_poll_events( struct fd *fd );
|
||||
static void sock_poll_event( struct fd *fd, int event );
|
||||
static enum server_fd_type sock_get_fd_type( struct fd *fd );
|
||||
static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
|
||||
static void sock_queue_async( struct fd *fd, struct async *async, int type, int count );
|
||||
static void sock_reselect_async( struct fd *fd, struct async_queue *queue );
|
||||
|
||||
|
@ -2022,14 +2022,14 @@ static struct accept_req *alloc_accept_req( struct sock *sock, struct sock *acce
|
|||
return req;
|
||||
}
|
||||
|
||||
static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
||||
static void 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 && (unix_fd = get_unix_fd( fd )) < 0) return 0;
|
||||
if (code != IOCTL_AFD_WINE_CREATE && (unix_fd = get_unix_fd( fd )) < 0) return;
|
||||
|
||||
switch(code)
|
||||
{
|
||||
|
@ -2040,10 +2040,10 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() != sizeof(*params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
init_socket( sock, params->family, params->type, params->protocol, params->flags );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_ACCEPT:
|
||||
|
@ -2054,31 +2054,31 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() != sizeof(handle))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(acceptsock = accept_socket( sock )))
|
||||
{
|
||||
struct accept_req *req;
|
||||
|
||||
if (sock->nonblocking) return 0;
|
||||
if (get_error() != STATUS_DEVICE_NOT_READY) return 0;
|
||||
if (sock->nonblocking) return;
|
||||
if (get_error() != STATUS_DEVICE_NOT_READY) return;
|
||||
|
||||
if (!(req = alloc_accept_req( sock, NULL, async, NULL ))) return 0;
|
||||
if (!(req = alloc_accept_req( sock, NULL, async, NULL ))) return;
|
||||
list_add_tail( &sock->accept_list, &req->entry );
|
||||
|
||||
async_set_completion_callback( async, free_accept_req, req );
|
||||
queue_async( &sock->accept_q, async );
|
||||
sock_reselect( sock );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
handle = alloc_handle( current->process, &acceptsock->obj,
|
||||
GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, OBJ_INHERIT );
|
||||
acceptsock->wparam = handle;
|
||||
release_object( acceptsock );
|
||||
set_reply_data( &handle, sizeof(handle) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_ACCEPT_INTO:
|
||||
|
@ -2094,30 +2094,30 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
get_reply_max_size() - params->recv_len < params->local_len)
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
remote_len = get_reply_max_size() - params->recv_len - params->local_len;
|
||||
if (remote_len < sizeof(int))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(acceptsock = (struct sock *)get_handle_obj( current->process, params->accept_handle, access, &sock_ops )))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (acceptsock->accept_recv_req)
|
||||
{
|
||||
release_object( acceptsock );
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(req = alloc_accept_req( sock, acceptsock, async, params )))
|
||||
{
|
||||
release_object( acceptsock );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
list_add_tail( &sock->accept_list, &req->entry );
|
||||
acceptsock->accept_recv_req = req;
|
||||
|
@ -2128,7 +2128,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
queue_async( &sock->accept_q, async );
|
||||
sock_reselect( sock );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_LISTEN:
|
||||
|
@ -2138,19 +2138,19 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(*params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sock->bound)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (listen( unix_fd, params->backlog ) < 0)
|
||||
{
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
sock->state = SOCK_LISTENING;
|
||||
|
@ -2160,7 +2160,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
|
||||
/* we may already be selecting for AFD_POLL_ACCEPT */
|
||||
sock_reselect( sock );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_CONNECT:
|
||||
|
@ -2176,7 +2176,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
get_req_data_size() - sizeof(*params) < params->addr_len)
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
send_len = get_req_data_size() - sizeof(*params) - params->addr_len;
|
||||
addr = (const struct WS_sockaddr *)(params + 1);
|
||||
|
@ -2184,36 +2184,36 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (!params->synchronous && !sock->bound)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->accept_recv_req)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->connect_req)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (sock->state)
|
||||
{
|
||||
case SOCK_LISTENING:
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
|
||||
case SOCK_CONNECTING:
|
||||
/* FIXME: STATUS_ADDRESS_ALREADY_ASSOCIATED probably isn't right,
|
||||
* but there's no status code that maps to WSAEALREADY... */
|
||||
set_error( params->synchronous ? STATUS_ADDRESS_ALREADY_ASSOCIATED : STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
|
||||
case SOCK_CONNECTED:
|
||||
set_error( STATUS_CONNECTION_ACTIVE );
|
||||
return 0;
|
||||
return;
|
||||
|
||||
case SOCK_UNCONNECTED:
|
||||
case SOCK_CONNECTIONLESS:
|
||||
|
@ -2224,7 +2224,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (!unix_len)
|
||||
{
|
||||
set_error( STATUS_INVALID_ADDRESS );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (unix_addr.addr.sa_family == AF_INET && !memcmp( &unix_addr.in.sin_addr, magic_loopback_addr, 4 ))
|
||||
unix_addr.in.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
|
||||
|
@ -2233,7 +2233,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (ret < 0 && errno != EINPROGRESS)
|
||||
{
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* a connected or connecting socket can no longer be accepted into */
|
||||
|
@ -2248,11 +2248,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
{
|
||||
sock->state = SOCK_CONNECTED;
|
||||
|
||||
if (!send_len) return 1;
|
||||
if (!send_len) return;
|
||||
}
|
||||
|
||||
if (!(req = mem_alloc( sizeof(*req) )))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
sock->state = SOCK_CONNECTING;
|
||||
|
||||
|
@ -2260,7 +2260,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
{
|
||||
sock_reselect( sock );
|
||||
set_error( STATUS_DEVICE_NOT_READY );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
req->async = (struct async *)grab_object( async );
|
||||
|
@ -2275,7 +2275,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
queue_async( &sock->connect_q, async );
|
||||
sock_reselect( sock );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_SHUTDOWN:
|
||||
|
@ -2285,20 +2285,20 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(int))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
how = *(int *)get_req_data();
|
||||
|
||||
if (how > SD_BOTH)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->state != SOCK_CONNECTED && sock->state != SOCK_CONNECTIONLESS)
|
||||
{
|
||||
set_error( STATUS_INVALID_CONNECTION );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (how != SD_SEND)
|
||||
|
@ -2324,7 +2324,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
}
|
||||
|
||||
sock_reselect( sock );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE:
|
||||
|
@ -2334,26 +2334,26 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(int))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
force_async = *(int *)get_req_data();
|
||||
|
||||
if (sock->nonblocking && !force_async)
|
||||
{
|
||||
set_error( STATUS_DEVICE_NOT_READY );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (!sock_get_ifchange( sock )) return 0;
|
||||
if (!sock_get_ifchange( sock )) return;
|
||||
queue_async( &sock->ifchange_q, async );
|
||||
set_error( STATUS_PENDING );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_FIONBIO:
|
||||
if (get_req_data_size() < sizeof(int))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (*(int *)get_req_data())
|
||||
{
|
||||
|
@ -2364,11 +2364,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (sock->mask)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
sock->nonblocking = 0;
|
||||
}
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case IOCTL_AFD_GET_EVENTS:
|
||||
{
|
||||
|
@ -2378,7 +2378,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
params.flags = sock->pending_events & sock->mask;
|
||||
|
@ -2389,7 +2389,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
sock_reselect( sock );
|
||||
|
||||
set_reply_data( ¶ms, sizeof(params) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_EVENT_SELECT:
|
||||
|
@ -2407,7 +2407,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(*params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
event_handle = params->event;
|
||||
|
@ -2420,7 +2420,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(*params))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
event_handle = params->event;
|
||||
|
@ -2431,7 +2431,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
!(event = get_event_obj( current->process, event_handle, EVENT_MODIFY_STATE )))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->event) release_object( sock->event );
|
||||
|
@ -2444,7 +2444,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
|
||||
sock_reselect( sock );
|
||||
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_MESSAGE_SELECT:
|
||||
|
@ -2454,7 +2454,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(params))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->event) release_object( sock->event );
|
||||
|
@ -2473,7 +2473,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
|
||||
sock_reselect( sock );
|
||||
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_BIND:
|
||||
|
@ -2488,27 +2488,27 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < get_reply_max_size())
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
in_size = get_req_data_size() - get_reply_max_size();
|
||||
if (in_size < offsetof(struct afd_bind_params, addr.sa_data)
|
||||
|| get_reply_max_size() < in_size - sizeof(int))
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->bound)
|
||||
{
|
||||
set_error( STATUS_ADDRESS_ALREADY_ASSOCIATED );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
unix_len = sockaddr_to_unix( ¶ms->addr, in_size - sizeof(int), &unix_addr );
|
||||
if (!unix_len)
|
||||
{
|
||||
set_error( STATUS_INVALID_ADDRESS );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
bind_addr = unix_addr;
|
||||
|
||||
|
@ -2543,7 +2543,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
}
|
||||
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
sock->bound = 1;
|
||||
|
@ -2560,24 +2560,24 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
|
||||
if (get_reply_max_size() >= sock->addr_len)
|
||||
set_reply_data( &sock->addr, sock->addr_len );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_GETSOCKNAME:
|
||||
if (!sock->bound)
|
||||
{
|
||||
set_error( STATUS_INVALID_PARAMETER );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_reply_max_size() < sock->addr_len)
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &sock->addr, sock->addr_len );
|
||||
return 1;
|
||||
return;
|
||||
|
||||
case IOCTL_AFD_WINE_DEFER:
|
||||
{
|
||||
|
@ -2587,14 +2587,14 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(*handle))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
acceptsock = (struct sock *)get_handle_obj( current->process, *handle, 0, &sock_ops );
|
||||
if (!acceptsock) return 0;
|
||||
if (!acceptsock) return;
|
||||
|
||||
sock->deferred = acceptsock;
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_INFO:
|
||||
|
@ -2604,14 +2604,14 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(params))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
params.family = sock->family;
|
||||
params.type = sock->type;
|
||||
params.protocol = sock->proto;
|
||||
set_reply_data( ¶ms, sizeof(params) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_ACCEPTCONN:
|
||||
|
@ -2621,11 +2621,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(listening))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &listening, sizeof(listening) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_ERROR:
|
||||
|
@ -2637,13 +2637,13 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(error))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (getsockopt( unix_fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len ) < 0)
|
||||
{
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!error)
|
||||
|
@ -2659,7 +2659,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
}
|
||||
|
||||
set_reply_data( &error, sizeof(error) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_RCVBUF:
|
||||
|
@ -2669,11 +2669,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(rcvbuf))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &rcvbuf, sizeof(rcvbuf) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_SET_SO_RCVBUF:
|
||||
|
@ -2683,7 +2683,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(rcvbuf))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
rcvbuf = *(DWORD *)get_req_data();
|
||||
|
||||
|
@ -2691,7 +2691,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
sock->rcvbuf = rcvbuf;
|
||||
else
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_RCVTIMEO:
|
||||
|
@ -2701,11 +2701,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(rcvtimeo))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &rcvtimeo, sizeof(rcvtimeo) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_SET_SO_RCVTIMEO:
|
||||
|
@ -2715,12 +2715,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(rcvtimeo))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
rcvtimeo = *(DWORD *)get_req_data();
|
||||
|
||||
sock->rcvtimeo = rcvtimeo;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_SNDBUF:
|
||||
|
@ -2730,11 +2730,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(sndbuf))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &sndbuf, sizeof(sndbuf) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_SET_SO_SNDBUF:
|
||||
|
@ -2744,7 +2744,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(sndbuf))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
sndbuf = *(DWORD *)get_req_data();
|
||||
|
||||
|
@ -2753,7 +2753,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
{
|
||||
/* setsockopt fails if a zero value is passed */
|
||||
sock->sndbuf = sndbuf;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2761,7 +2761,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
sock->sndbuf = sndbuf;
|
||||
else
|
||||
set_error( sock_get_ntstatus( errno ) );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_SNDTIMEO:
|
||||
|
@ -2771,11 +2771,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(sndtimeo))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
set_reply_data( &sndtimeo, sizeof(sndtimeo) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_SET_SO_SNDTIMEO:
|
||||
|
@ -2785,12 +2785,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_req_data_size() < sizeof(sndtimeo))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
sndtimeo = *(DWORD *)get_req_data();
|
||||
|
||||
sock->sndtimeo = sndtimeo;
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
case IOCTL_AFD_WINE_GET_SO_CONNECT_TIME:
|
||||
|
@ -2800,19 +2800,19 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
|
|||
if (get_reply_max_size() < sizeof(time))
|
||||
{
|
||||
set_error( STATUS_BUFFER_TOO_SMALL );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sock->state == SOCK_CONNECTED)
|
||||
time = (current_time - sock->connect_time) / 10000000;
|
||||
|
||||
set_reply_data( &time, sizeof(time) );
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
set_error( STATUS_NOT_SUPPORTED );
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue