Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/unix/file.c | 2 +- dlls/ntdll/unix/socket.c | 21 +++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 1 + include/wine/afd.h | 1 + 4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index a2d0a4b1483..21f5d10f3f8 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -5099,7 +5099,7 @@ static NTSTATUS register_async_file_read( HANDLE handle, HANDLE event, return status; }
-static void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) +void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) { SERVER_START_REQ( add_fd_completion ) { diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c index db65752a031..cfc5780b082 100644 --- a/dlls/ntdll/unix/socket.c +++ b/dlls/ntdll/unix/socket.c @@ -1116,6 +1116,17 @@ 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 ) +{ + io->Status = status; + io->Information = information; + if (event) NtSetEvent( event, NULL ); + if (apc) NtQueueApcThread( GetCurrentThread(), (PNTAPCFUNC)apc, (ULONG_PTR)apc_user, (ULONG_PTR)io, 0 ); + if (apc_user) add_completion( handle, (ULONG_PTR)apc_user, status, information, FALSE ); +} + + NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io, ULONG code, void *in_buffer, ULONG in_size, void *out_buffer, ULONG out_size ) { @@ -1249,6 +1260,16 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc break; }
+ case IOCTL_AFD_WINE_COMPLETE_ASYNC: + { + if (in_size != sizeof(NTSTATUS)) + return STATUS_BUFFER_TOO_SMALL; + + status = *(NTSTATUS *)in_buffer; + complete_async( handle, event, apc, apc_user, io, status, 0 ); + break; + } + case IOCTL_AFD_POLL: status = sock_poll( handle, event, apc, apc_user, io, in_buffer, in_size, out_buffer, out_size ); break; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index cf3b8280200..03c45e42997 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -279,6 +279,7 @@ extern NTSTATUS open_unix_file( HANDLE *handle, const char *unix_name, ACCESS_MA ULONG options, void *ea_buffer, ULONG ea_length ) DECLSPEC_HIDDEN; extern void init_files(void) DECLSPEC_HIDDEN; extern void init_cpu_info(void) DECLSPEC_HIDDEN; +extern void add_completion( HANDLE handle, ULONG_PTR value, NTSTATUS status, ULONG info, BOOL async ) DECLSPEC_HIDDEN;
extern void dbg_init(void) DECLSPEC_HIDDEN;
diff --git a/include/wine/afd.h b/include/wine/afd.h index 5074c1f20dd..77801b1fbe3 100644 --- a/include/wine/afd.h +++ b/include/wine/afd.h @@ -97,6 +97,7 @@ struct afd_poll_params #define IOCTL_AFD_WINE_TRANSMIT CTL_CODE(FILE_DEVICE_NETWORK, 207, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE CTL_CODE(FILE_DEVICE_NETWORK, 208, METHOD_BUFFERED, FILE_ANY_ACCESS) #define IOCTL_AFD_WINE_FIONBIO CTL_CODE(FILE_DEVICE_NETWORK, 209, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_AFD_WINE_COMPLETE_ASYNC CTL_CODE(FILE_DEVICE_NETWORK, 210, METHOD_BUFFERED, FILE_ANY_ACCESS)
struct afd_create_params {