ntdll: Pass a length pointer instead of an IO_STATUS_BLOCK to the async callbacks.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-07-08 16:21:51 +02:00
parent 0c71a9879d
commit 92a66c08ba
4 changed files with 25 additions and 33 deletions

View File

@ -4681,10 +4681,9 @@ static NTSTATUS wait_async( HANDLE handle, BOOL alertable )
}
/* callback for irp async I/O completion */
static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
static NTSTATUS irp_completion( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_irp *async = user;
ULONG information = 0;
if (status == STATUS_ALERTED)
{
@ -4693,20 +4692,15 @@ static NTSTATUS irp_completion( void *user, IO_STATUS_BLOCK *io, NTSTATUS status
req->user_arg = wine_server_client_ptr( async );
wine_server_set_reply( req, async->buffer, async->size );
status = virtual_locked_server_call( req );
information = reply->size;
*info = reply->size;
}
SERVER_END_REQ;
}
if (status != STATUS_PENDING)
{
io->u.Status = status;
io->Information = information;
release_fileio( &async->io );
}
if (status != STATUS_PENDING) release_fileio( &async->io );
return status;
}
static NTSTATUS async_read_proc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
static NTSTATUS async_read_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_fileio_read *fileio = user;
int fd, needs_close, result;
@ -4750,14 +4744,13 @@ static NTSTATUS async_read_proc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS sta
}
if (status != STATUS_PENDING)
{
iosb->u.Status = status;
iosb->Information = fileio->already;
*info = fileio->already;
release_fileio( &fileio->io );
}
return status;
}
static NTSTATUS async_write_proc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
static NTSTATUS async_write_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_fileio_write *fileio = user;
int result, fd, needs_close;
@ -4797,8 +4790,7 @@ static NTSTATUS async_write_proc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS st
}
if (status != STATUS_PENDING)
{
iosb->u.Status = status;
iosb->Information = fileio->already;
*info = fileio->already;
release_fileio( &fileio->io );
}
return status;
@ -6064,7 +6056,7 @@ NTSTATUS WINAPI NtUnlockFile( HANDLE handle, IO_STATUS_BLOCK *io_status, LARGE_I
}
static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status )
static NTSTATUS read_changes_apc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_fileio_read_changes *fileio = user;
int size = 0;
@ -6133,8 +6125,7 @@ static NTSTATUS read_changes_apc( void *user, IO_STATUS_BLOCK *iosb, NTSTATUS st
if (status != STATUS_PENDING)
{
iosb->u.Status = status;
iosb->Information = size;
*info = size;
release_fileio( &fileio->io );
}
return status;

View File

@ -379,11 +379,16 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
{
IO_STATUS_BLOCK *iosb = wine_server_get_ptr( call->async_io.sb );
struct async_fileio *user = wine_server_get_ptr( call->async_io.user );
ULONG_PTR info = 0;
result->type = call->type;
result->async_io.status = user->callback( user, iosb, call->async_io.status );
result->async_io.status = user->callback( user, &info, call->async_io.status );
if (result->async_io.status != STATUS_PENDING)
result->async_io.total = iosb->Information;
{
result->async_io.total = info;
iosb->Status = result->async_io.status;
iosb->Information = info;
}
break;
}
case APC_VIRTUAL_ALLOC:

View File

@ -543,7 +543,7 @@ static NTSTATUS try_recv( int fd, struct async_recv_ioctl *async, ULONG_PTR *siz
return status;
}
static NTSTATUS async_recv_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
static NTSTATUS async_recv_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_recv_ioctl *async = user;
ULONG_PTR information = 0;
@ -566,8 +566,7 @@ static NTSTATUS async_recv_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS statu
}
if (status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
*info = information;
release_fileio( &async->io );
}
return status;
@ -684,7 +683,7 @@ static ULONG_PTR fill_poll_output( struct async_poll_ioctl *async, NTSTATUS stat
return offsetof( struct afd_poll_params, sockets[count] );
}
static NTSTATUS async_poll_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
static NTSTATUS async_poll_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_poll_ioctl *async = user;
ULONG_PTR information = 0;
@ -704,8 +703,7 @@ static NTSTATUS async_poll_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS statu
if (status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
*info = information;
free( async->input );
release_fileio( &async->io );
}
@ -868,7 +866,7 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async )
return STATUS_SUCCESS;
}
static NTSTATUS async_send_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
static NTSTATUS async_send_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
struct async_send_ioctl *async = user;
int fd, needs_close;
@ -890,8 +888,7 @@ static NTSTATUS async_send_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS statu
}
if (status != STATUS_PENDING)
{
io->Status = status;
io->Information = async->sent_len;
*info = async->sent_len;
release_fileio( &async->io );
}
return status;
@ -1033,7 +1030,7 @@ static NTSTATUS try_transmit( int sock_fd, int file_fd, struct async_transmit_io
return STATUS_SUCCESS;
}
static NTSTATUS async_transmit_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS status )
static NTSTATUS async_transmit_proc( void *user, ULONG_PTR *info, NTSTATUS status )
{
int sock_fd, file_fd = -1, sock_needs_close = FALSE, file_needs_close = FALSE;
struct async_transmit_ioctl *async = user;
@ -1062,8 +1059,7 @@ static NTSTATUS async_transmit_proc( void *user, IO_STATUS_BLOCK *io, NTSTATUS s
}
if (status != STATUS_PENDING)
{
io->Status = status;
io->Information = async->head_cursor + async->file_cursor + async->tail_cursor;
*info = async->head_cursor + async->file_cursor + async->tail_cursor;
release_fileio( &async->io );
}
return status;

View File

@ -69,7 +69,7 @@ static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
return (struct ntdll_thread_data *)&NtCurrentTeb()->GdiTebBatch;
}
typedef NTSTATUS async_callback_t( void *user, IO_STATUS_BLOCK *io, NTSTATUS status );
typedef NTSTATUS async_callback_t( void *user, ULONG_PTR *info, NTSTATUS status );
struct async_fileio
{