1
0
mirror of https://github.com/wine-mirror/wine synced 2024-06-29 06:14:34 +00:00

ntdll: Factor filling the IOSB into set_async_direct_result().

This commit is contained in:
Elizabeth Figura 2024-05-28 19:39:23 -05:00 committed by Alexandre Julliard
parent 62df7633e5
commit 5493ff11fa
4 changed files with 15 additions and 29 deletions

View File

@ -1202,15 +1202,13 @@ static NTSTATUS wait_on( HANDLE handle, int fd, HANDLE event, PIO_APC_ROUTINE ap
if (events)
{
status = STATUS_SUCCESS;
io->Status = STATUS_SUCCESS;
io->Information = sizeof(events);
*out_buffer = events;
set_async_direct_result( &wait_handle, STATUS_SUCCESS, sizeof(events), FALSE );
set_async_direct_result( &wait_handle, io, STATUS_SUCCESS, sizeof(events), FALSE );
}
else
{
status = STATUS_PENDING;
set_async_direct_result( &wait_handle, STATUS_PENDING, 0, TRUE );
set_async_direct_result( &wait_handle, io, STATUS_PENDING, 0, TRUE );
}
}

View File

@ -875,12 +875,7 @@ static NTSTATUS sock_recv( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
status = try_recv( fd, async, &information );
if (status == STATUS_DEVICE_NOT_READY && (force_async || !nonblocking))
status = STATUS_PENDING;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, FALSE );
set_async_direct_result( &wait_handle, io, status, information, FALSE );
}
if (status != STATUS_PENDING)
@ -1125,8 +1120,6 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
if (status == STATUS_ALERTED)
{
ULONG_PTR information;
status = try_send( fd, async );
if (status == STATUS_DEVICE_NOT_READY && (force_async || !nonblocking))
status = STATUS_PENDING;
@ -1138,14 +1131,7 @@ static NTSTATUS sock_send( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, voi
if (status == STATUS_DEVICE_NOT_READY && async->sent_len)
status = STATUS_SUCCESS;
information = async->sent_len;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, FALSE );
set_async_direct_result( &wait_handle, io, status, async->sent_len, FALSE );
}
if (status != STATUS_PENDING)
@ -1401,13 +1387,7 @@ static NTSTATUS sock_transmit( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc,
status = STATUS_PENDING;
information = async->head_cursor + async->file_cursor + async->tail_cursor;
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
set_async_direct_result( &wait_handle, status, information, TRUE );
set_async_direct_result( &wait_handle, io, status, information, TRUE );
}
if (status != STATUS_PENDING)

View File

@ -2669,13 +2669,20 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
/* Notify direct completion of async and close the wait handle if it is no longer needed.
*/
void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending )
void set_async_direct_result( HANDLE *async_handle, IO_STATUS_BLOCK *io,
NTSTATUS status, ULONG_PTR information, BOOL mark_pending )
{
unsigned int ret;
/* if we got STATUS_ALERTED, we must have a valid async handle */
assert( *async_handle );
if (!NT_ERROR(status) && status != STATUS_PENDING)
{
io->Status = status;
io->Information = information;
}
SERVER_START_REQ( set_async_direct_result )
{
req->handle = wine_server_obj_handle( *async_handle );

View File

@ -344,7 +344,8 @@ extern void init_files(void);
extern void init_cpu_info(void);
extern void file_complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, NTSTATUS status, ULONG_PTR information );
extern void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULONG_PTR information, BOOL mark_pending );
extern void set_async_direct_result( HANDLE *async_handle, IO_STATUS_BLOCK *io,
NTSTATUS status, ULONG_PTR information, BOOL mark_pending );
extern NTSTATUS unixcall_wine_dbg_write( void *args );
extern NTSTATUS unixcall_wine_server_call( void *args );