From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ntdll/unix/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index ea2f5d3a670..123e318058b 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1434,7 +1434,7 @@ static void complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, vo io->Information = information; if (event) NtSetEvent( event, NULL ); if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc, (ULONG_PTR)apc_user, iosb_ptr, 0 ); - if (apc_user) add_completion( handle, (ULONG_PTR)apc_user, status, information, FALSE ); + else if (apc_user) add_completion( handle, (ULONG_PTR)apc_user, status, information, FALSE ); }
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ntdll/unix/file.c | 27 ++++++++++++++++----------- dlls/ntdll/unix/socket.c | 28 ++++++++-------------------- dlls/ntdll/unix/unix_private.h | 3 ++- 3 files changed, 26 insertions(+), 32 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c128e8aa369..c9a0b023d23 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5470,7 +5470,7 @@ static unsigned int register_async_file_read( HANDLE handle, HANDLE event, return status; }
-void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) +static void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) { SERVER_START_REQ( add_fd_completion ) { @@ -5484,6 +5484,20 @@ void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info SERVER_END_REQ; }
+/* complete async file I/O, signaling completion in all ways necessary */ +void file_complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, + IO_STATUS_BLOCK *io, NTSTATUS status, ULONG_PTR information ) +{ + ULONG_PTR iosb_ptr = iosb_client_ptr(io); + + io->Status = status; + io->Information = information; + if (event) NtSetEvent( event, NULL ); + if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc, (ULONG_PTR)apc_user, iosb_ptr, 0 ); + else if (apc_user) add_completion( handle, (ULONG_PTR)apc_user, status, information, FALSE ); +} + + static unsigned int set_pending_write( HANDLE device ) { unsigned int status; @@ -6019,10 +6033,7 @@ NTSTATUS WINAPI NtWriteFileGather( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap int result, unix_handle, needs_close; unsigned int options, status; UINT pos = 0, total = 0; - client_ptr_t iosb_ptr = iosb_client_ptr(io); enum server_fd_type type; - ULONG_PTR cvalue = apc ? 0 : (ULONG_PTR)apc_user; - BOOL send_completion = FALSE;
TRACE( "(%p,%p,%p,%p,%p,%p,0x%08x,%p,%p),partial stub!\n", file, event, apc, apc_user, io, segments, (int)length, offset, key ); @@ -6074,24 +6085,18 @@ NTSTATUS WINAPI NtWriteFileGather( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap } }
- send_completion = cvalue != 0; - done: if (needs_close) close( unix_handle ); if (status == STATUS_SUCCESS) { - io->Status = status; - io->Information = total; + file_complete_async( file, event, apc, apc_user, io, status, total ); TRACE("= SUCCESS (%u)\n", total); - if (event) NtSetEvent( event, NULL ); - if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc, (ULONG_PTR)apc_user, iosb_ptr, 0 ); } else { TRACE("= 0x%08x\n", status); if (status != STATUS_PENDING && event) NtResetEvent( event, NULL ); } - if (send_completion) add_completion( file, cvalue, status, total, FALSE ); return status; }
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index 123e318058b..587faf51ccf 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1425,18 +1425,6 @@ static NTSTATUS sock_transmit( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, return status; }
-static void complete_async( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, - IO_STATUS_BLOCK *io, NTSTATUS status, ULONG_PTR information ) -{ - ULONG_PTR iosb_ptr = iosb_client_ptr(io); - - io->Status = status; - io->Information = information; - if (event) NtSetEvent( event, NULL ); - if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc, (ULONG_PTR)apc_user, iosb_ptr, 0 ); - else if (apc_user) add_completion( handle, (ULONG_PTR)apc_user, status, information, FALSE ); -} -
static NTSTATUS do_getsockopt( HANDLE handle, IO_STATUS_BLOCK *io, int level, int option, void *out_buffer, ULONG out_size ) @@ -1563,7 +1551,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc } SERVER_END_REQ;
- complete_async( handle, event, apc, apc_user, io, status, 0 ); + file_complete_async( handle, event, apc, apc_user, io, status, 0 ); return status; }
@@ -1710,7 +1698,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc return STATUS_BUFFER_TOO_SMALL;
status = *(NTSTATUS *)in_buffer; - complete_async( handle, event, apc, apc_user, io, status, 0 ); + file_complete_async( handle, event, apc, apc_user, io, status, 0 ); return status; }
@@ -1736,7 +1724,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc { *(int *)out_buffer = 0; if (needs_close) close( fd ); - complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); return STATUS_SUCCESS; } } @@ -1749,7 +1737,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc } *(int *)out_buffer = value; if (needs_close) close( fd ); - complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); return STATUS_SUCCESS; }
@@ -1788,7 +1776,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc *(int *)out_buffer = !value; } if (needs_close) close( fd ); - complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); return STATUS_SUCCESS; }
@@ -1815,7 +1803,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc if (out_size < ret_size) { freeifaddrs( ifaddrs ); - complete_async( handle, event, apc, apc_user, io, STATUS_BUFFER_TOO_SMALL, 0 ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_BUFFER_TOO_SMALL, 0 ); return STATUS_PENDING; }
@@ -1865,7 +1853,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc }
freeifaddrs( ifaddrs ); - complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, ret_size ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, ret_size ); return STATUS_PENDING; #else FIXME( "Interface list queries are currently not supported on this platform.\n" ); @@ -1920,7 +1908,7 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc }
if (needs_close) close( fd ); - complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); + file_complete_async( handle, event, apc, apc_user, io, STATUS_SUCCESS, 0 ); return STATUS_SUCCESS; }
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index b278ab8df84..fcb3de83a29 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -342,7 +342,8 @@ extern NTSTATUS open_unix_file( HANDLE *handle, const char *unix_name, ACCESS_MA extern NTSTATUS get_device_info( int fd, struct _FILE_FS_DEVICE_INFORMATION *info ); extern void init_files(void); extern void init_cpu_info(void); -extern void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ); +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 NTSTATUS unixcall_wine_dbg_write( void *args );
From: Elizabeth Figura zfigura@codeweavers.com
Thereby also handling completion and APCs. --- dlls/ntdll/unix/tape.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/tape.c b/dlls/ntdll/unix/tape.c index f513e558898..366096bbf4f 100644 --- a/dlls/ntdll/unix/tape.c +++ b/dlls/ntdll/unix/tape.c @@ -580,10 +580,6 @@ NTSTATUS tape_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, if (needs_close) close( fd );
if (!NT_ERROR(status)) - { - io->Status = status; - io->Information = sz; - if (event) NtSetEvent( event, NULL ); - } + file_complete_async( device, event, apc, apc_user, io, status, sz ); return status; }
From: Elizabeth Figura zfigura@codeweavers.com
Thereby also handling completion and APCs. --- dlls/ntdll/unix/cdrom.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/cdrom.c b/dlls/ntdll/unix/cdrom.c index 427e559968f..c92ccc1185d 100644 --- a/dlls/ntdll/unix/cdrom.c +++ b/dlls/ntdll/unix/cdrom.c @@ -3113,10 +3113,6 @@ NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc } if (needs_close) close( fd ); if (!NT_ERROR(status)) - { - io->Status = status; - io->Information = sz; - if (event) NtSetEvent(event, NULL); - } + file_complete_async( device, event, apc, apc_user, io, status, sz ); return status; }
From: Elizabeth Figura zfigura@codeweavers.com
Thereby also handling completion and APCs. --- dlls/ntdll/unix/serial.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/serial.c b/dlls/ntdll/unix/serial.c index a8abee6eeb6..cc3929c7a0b 100644 --- a/dlls/ntdll/unix/serial.c +++ b/dlls/ntdll/unix/serial.c @@ -1457,11 +1457,7 @@ NTSTATUS serial_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE ap if (needs_close) close( fd );
if (!NT_ERROR(status)) - { - io->Status = status; - io->Information = sz; - if (event) NtSetEvent(event, NULL); - } + file_complete_async( device, event, apc, apc_user, io, status, sz ); return status; }
From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/ntdll/unix/file.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index c9a0b023d23..b8fb4f19e13 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -6182,6 +6182,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap IO_STATUS_BLOCK *io, ULONG code, void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size ) { + ULONG_PTR size = 0; NTSTATUS status;
TRACE( "(%p,%p,%p,%p,%p,0x%08x,%p,0x%08x,%p,0x%08x)\n", @@ -6225,7 +6226,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap buffer->StartingVcn.QuadPart = 1; buffer->Extents[0].NextVcn.QuadPart = 0; buffer->Extents[0].Lcn.QuadPart = 0; - io->Information = sizeof(RETRIEVAL_POINTERS_BUFFER); + size = sizeof(RETRIEVAL_POINTERS_BUFFER); status = STATUS_SUCCESS; } else @@ -6259,7 +6260,7 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap memset( info, 0, sizeof(*info) ); memcpy( info->ObjectId, &st.st_dev, sizeof(st.st_dev) ); memcpy( info->ObjectId + 8, &st.st_ino, sizeof(st.st_ino) ); - io->Information = sizeof(*info); + size = sizeof(*info); } else status = STATUS_BUFFER_TOO_SMALL; break; @@ -6267,7 +6268,6 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap
case FSCTL_SET_SPARSE: TRACE("FSCTL_SET_SPARSE: Ignoring request\n"); - io->Information = 0; status = STATUS_SUCCESS; break; default: @@ -6275,7 +6275,8 @@ NTSTATUS WINAPI NtFsControlFile( HANDLE handle, HANDLE event, PIO_APC_ROUTINE ap in_buffer, in_size, out_buffer, out_size ); }
- if (!NT_ERROR(status) && status != STATUS_PENDING) io->Status = status; + if (!NT_ERROR(status) && status != STATUS_PENDING) + file_complete_async( handle, event, apc, apc_context, io, status, size ); return status; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=146490
Your paranoid android.
=== debian11b (64 bit WoW report) ===
dinput: joystick8.c:110: Test failed: Timed out waiting for the child process joystick8.c:5850: Test failed: input 1: ReadFile failed, error 5 joystick8.c:5851: Test failed: input 1: got size 0
dmband: joystick8.c:5749: Test failed: input 0: IOCTL_WINETEST_HID_SET_CONTEXT failed, last error 5 joystick8.c:5749: Test failed: input 0: IOCTL_WINETEST_HID_SEND_INPUT failed, last error 5 joystick8.c:5751: Test failed: input 0: ReadFile failed, error 5 joystick8.c:5752: Test failed: input 0: got size 0
dmime: joystick8.c:5759: Test failed: input 0: WaitForSingleObject returned 0x102 joystick8.c:5760: Test failed: input 0: got 0 WM_INPUT messages joystick8.c:5763: Test failed: input 0: got dwType 0 joystick8.c:5764: Test failed: input 0: got header.dwSize 0 joystick8.c:5766: Test failed: input 0: got hDevice 0000000000000000 joystick8.c:5768: Test failed: input 0: got dwSizeHid 0 joystick8.c:5769: Test failed: input 0: got dwCount 0
Report validation errors: dmband:dmband contains a misplaced failure line for joystick8 dmime:dmime contains a misplaced failure line for joystick8