Alexandre Julliard : ntdll: Pass a length pointer instead of an IO_STATUS_BLOCK to the async callbacks.
Alexandre Julliard
julliard at winehq.org
Thu Jul 8 16:43:50 CDT 2021
Module: wine
Branch: master
Commit: 92a66c08ba7546e170b193c0209dd85d3dfc3eb1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=92a66c08ba7546e170b193c0209dd85d3dfc3eb1
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jul 8 16:21:51 2021 +0200
ntdll: Pass a length pointer instead of an IO_STATUS_BLOCK to the async callbacks.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/file.c | 27 +++++++++------------------
dlls/ntdll/unix/server.c | 9 +++++++--
dlls/ntdll/unix/socket.c | 20 ++++++++------------
dlls/ntdll/unix/unix_private.h | 2 +-
4 files changed, 25 insertions(+), 33 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 626a0957644..643daa5ab3f 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -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;
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
index 1d82e806e17..c2efd36ca6f 100644
--- a/dlls/ntdll/unix/server.c
+++ b/dlls/ntdll/unix/server.c
@@ -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:
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index e5abb3828c3..34796dbfd3d 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -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;
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index 3dae2e56258..e7320dbc1af 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -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
{
More information about the wine-cvs
mailing list