From: Elizabeth Figura zfigura@codeweavers.com
Similar helpers are in file.c, and sync.c has nothing to do with file I/O otherwise. --- dlls/ntdll/unix/file.c | 31 +++++++++++++++++++++++++++++++ dlls/ntdll/unix/sync.c | 34 ---------------------------------- 2 files changed, 31 insertions(+), 34 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index b8fb4f19e13..2ce38b34158 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5484,6 +5484,37 @@ static void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULO SERVER_END_REQ; }
+/* notify direct completion of async and close the wait handle if it is no longer needed */ +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 ); + req->status = status; + req->information = information; + req->mark_pending = mark_pending; + ret = wine_server_call( req ); + if (ret == STATUS_SUCCESS) + *async_handle = wine_server_ptr_handle( reply->handle ); + } + SERVER_END_REQ; + + if (ret != STATUS_SUCCESS) + ERR( "cannot report I/O result back to server: %#x\n", ret ); +} + /* 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 ) diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index 326e6e7734e..1d66f0d974f 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -2667,40 +2667,6 @@ NTSTATUS WINAPI NtWaitForAlertByThreadId( const void *address, const LARGE_INTEG
#endif
-/* Notify direct completion of async and close the wait handle if it is no longer needed. - */ -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 ); - req->status = status; - req->information = information; - req->mark_pending = mark_pending; - ret = wine_server_call( req ); - if (ret == STATUS_SUCCESS) - *async_handle = wine_server_ptr_handle( reply->handle ); - } - SERVER_END_REQ; - - if (ret != STATUS_SUCCESS) - ERR( "cannot report I/O result back to server: %08x\n", ret ); - - return; -} - /*********************************************************************** * NtCreateTransaction (NTDLL.@) */