Module: wine Branch: master Commit: 011ce0b2ada2cededa1cab410347836ae3b7cab3 URL: https://source.winehq.org/git/wine.git/?a=commit;h=011ce0b2ada2cededa1cab410...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jul 28 18:09:20 2021 +0200
wow64: Add thunks for the file async I/O syscalls.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wow64/file.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64/struct32.h | 7 +++ dlls/wow64/syscall.h | 5 +++ 3 files changed, 127 insertions(+)
diff --git a/dlls/wow64/file.c b/dlls/wow64/file.c index bf11ee4b2e2..5fb0fe97699 100644 --- a/dlls/wow64/file.c +++ b/dlls/wow64/file.c @@ -32,6 +32,41 @@ WINE_DEFAULT_DEBUG_CHANNEL(wow);
+/********************************************************************** + * wow64_NtCancelIoFile + */ +NTSTATUS WINAPI wow64_NtCancelIoFile( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtCancelIoFile( handle, iosb_32to64( &io, io32 )); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtCancelIoFileEx + */ +NTSTATUS WINAPI wow64_NtCancelIoFileEx( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + IO_STATUS_BLOCK32 *io_ptr = get_ptr( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtCancelIoFileEx( handle, (IO_STATUS_BLOCK *)io_ptr, iosb_32to64( &io, io32 )); + put_iosb( io32, &io ); + return status; +} + + /********************************************************************** * wow64_NtCreateFile */ @@ -120,6 +155,32 @@ NTSTATUS WINAPI wow64_NtLockFile( UINT *args ) }
+/********************************************************************** + * wow64_NtNotifyChangeDirectoryFile + */ +NTSTATUS WINAPI wow64_NtNotifyChangeDirectoryFile( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + HANDLE event = get_handle( &args ); + ULONG apc = get_ulong( &args ); + ULONG apc_param = get_ulong( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + void *buffer = get_ptr( &args ); + ULONG len = get_ulong( &args ); + ULONG filter = get_ulong( &args ); + BOOLEAN subtree = get_ulong( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtNotifyChangeDirectoryFile( handle, event, apc_32to64( apc ), + apc_param_32to64( apc, apc_param ), iosb_32to64( &io, io32 ), + buffer, len, filter, subtree ); + put_iosb( io32, &io ); + return status; +} + + /********************************************************************** * wow64_NtOpenFile */ @@ -318,6 +379,60 @@ NTSTATUS WINAPI wow64_NtReadFileScatter( UINT *args ) }
+/********************************************************************** + * wow64_NtRemoveIoCompletion + */ +NTSTATUS WINAPI wow64_NtRemoveIoCompletion( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + ULONG *key_ptr = get_ptr( &args ); + ULONG *value_ptr = get_ptr( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + LARGE_INTEGER *timeout = get_ptr( &args ); + + IO_STATUS_BLOCK io; + ULONG_PTR key, value; + NTSTATUS status; + + status = NtRemoveIoCompletion( handle, &key, &value, iosb_32to64( &io, io32 ), timeout ); + if (!status) + { + *key_ptr = key; + *value_ptr = value; + } + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtRemoveIoCompletionEx + */ +NTSTATUS WINAPI wow64_NtRemoveIoCompletionEx( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + FILE_IO_COMPLETION_INFORMATION32 *info32 = get_ptr( &args ); + ULONG count = get_ulong( &args ); + ULONG *written = get_ptr( &args ); + LARGE_INTEGER *timeout = get_ptr( &args ); + BOOLEAN alertable = get_ulong( &args ); + + NTSTATUS status; + ULONG i; + FILE_IO_COMPLETION_INFORMATION *info = Wow64AllocateTemp( count * sizeof(*info) ); + + status = NtRemoveIoCompletionEx( handle, info, count, written, timeout, alertable ); + for (i = 0; i < *written; i++) + { + info32[i].CompletionKey = info[i].CompletionKey; + info32[i].CompletionValue = info[i].CompletionValue; + info32[i].IoStatusBlock.Status = info[i].IoStatusBlock.Status; + info32[i].IoStatusBlock.Information = info[i].IoStatusBlock.Information; + } + return status; +} + + /********************************************************************** * wow64_NtSetEaFile */ diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index 168519b18da..258fa9f74c1 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -85,6 +85,13 @@ typedef struct ULONG CompletionKey; } FILE_COMPLETION_INFORMATION32;
+typedef struct +{ + ULONG CompletionKey; + ULONG CompletionValue; + IO_STATUS_BLOCK32 IoStatusBlock; +} FILE_IO_COMPLETION_INFORMATION32; + typedef struct { BOOLEAN ReplaceIfExists; diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 38eca6b744e..1990dc335f3 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -29,6 +29,8 @@ SYSCALL_ENTRY( NtAllocateVirtualMemory ) \ SYSCALL_ENTRY( NtAllocateVirtualMemoryEx ) \ SYSCALL_ENTRY( NtAreMappedFilesTheSame ) \ + SYSCALL_ENTRY( NtCancelIoFile ) \ + SYSCALL_ENTRY( NtCancelIoFileEx ) \ SYSCALL_ENTRY( NtCancelTimer ) \ SYSCALL_ENTRY( NtClearEvent ) \ SYSCALL_ENTRY( NtClearPowerRequest ) \ @@ -75,6 +77,7 @@ SYSCALL_ENTRY( NtLockVirtualMemory ) \ SYSCALL_ENTRY( NtMakeTemporaryObject ) \ SYSCALL_ENTRY( NtMapViewOfSection ) \ + SYSCALL_ENTRY( NtNotifyChangeDirectoryFile ) \ SYSCALL_ENTRY( NtOpenDirectoryObject ) \ SYSCALL_ENTRY( NtOpenEvent ) \ SYSCALL_ENTRY( NtOpenFile ) \ @@ -123,6 +126,8 @@ SYSCALL_ENTRY( NtReleaseKeyedEvent ) \ SYSCALL_ENTRY( NtReleaseMutant ) \ SYSCALL_ENTRY( NtReleaseSemaphore ) \ + SYSCALL_ENTRY( NtRemoveIoCompletion ) \ + SYSCALL_ENTRY( NtRemoveIoCompletionEx ) \ SYSCALL_ENTRY( NtRenameKey ) \ SYSCALL_ENTRY( NtReplaceKey ) \ SYSCALL_ENTRY( NtReplyWaitReceivePort ) \