Module: wine Branch: master Commit: 668b1829200fdbfa91845d089cc37683476e4aa9 URL: https://source.winehq.org/git/wine.git/?a=commit;h=668b1829200fdbfa91845d089...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Jul 28 16:20:48 2021 +0200
wow64: Add thunks for the file I/O syscalls.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/wow64/file.c | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++ dlls/wow64/syscall.h | 7 +++ 2 files changed, 170 insertions(+)
diff --git a/dlls/wow64/file.c b/dlls/wow64/file.c index 361aa1905ee..b1081735ea5 100644 --- a/dlls/wow64/file.c +++ b/dlls/wow64/file.c @@ -74,6 +74,49 @@ NTSTATUS WINAPI wow64_NtDeleteFile( UINT *args ) }
+/********************************************************************** + * wow64_NtFlushBuffersFile + */ +NTSTATUS WINAPI wow64_NtFlushBuffersFile( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtFlushBuffersFile( handle, iosb_32to64( &io, io32 )); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtLockFile + */ +NTSTATUS WINAPI wow64_NtLockFile( 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 ); + LARGE_INTEGER *offset = get_ptr( &args ); + LARGE_INTEGER *count = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + BOOLEAN dont_wait = get_ulong( &args ); + BOOLEAN exclusive = get_ulong( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtLockFile( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ), + iosb_32to64( &io, io32 ), offset, count, key, dont_wait, exclusive ); + put_iosb( io32, &io ); + return status; +} + + /********************************************************************** * wow64_NtOpenFile */ @@ -98,3 +141,123 @@ NTSTATUS WINAPI wow64_NtOpenFile( UINT *args ) put_iosb( io32, &io ); return status; } + + +/********************************************************************** + * wow64_NtReadFile + */ +NTSTATUS WINAPI wow64_NtReadFile( 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 ); + LARGE_INTEGER *offset = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtReadFile( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ), + iosb_32to64( &io, io32 ), buffer, len, offset, key ); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtReadFileScatter + */ +NTSTATUS WINAPI wow64_NtReadFileScatter( 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 ); + FILE_SEGMENT_ELEMENT *segments = get_ptr( &args ); + ULONG len = get_ulong( &args ); + LARGE_INTEGER *offset = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtReadFileScatter( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ), + iosb_32to64( &io, io32 ), segments, len, offset, key ); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtUnlockFile + */ +NTSTATUS WINAPI wow64_NtUnlockFile( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + IO_STATUS_BLOCK32 *io32 = get_ptr( &args ); + LARGE_INTEGER *offset = get_ptr( &args ); + LARGE_INTEGER *count = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtUnlockFile( handle, iosb_32to64( &io, io32 ), offset, count, key ); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtWriteFile + */ +NTSTATUS WINAPI wow64_NtWriteFile( 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 ); + LARGE_INTEGER *offset = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtWriteFile( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ), + iosb_32to64( &io, io32 ), buffer, len, offset, key ); + put_iosb( io32, &io ); + return status; +} + + +/********************************************************************** + * wow64_NtWriteFileGather + */ +NTSTATUS WINAPI wow64_NtWriteFileGather( 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 ); + FILE_SEGMENT_ELEMENT *segments = get_ptr( &args ); + ULONG len = get_ulong( &args ); + LARGE_INTEGER *offset = get_ptr( &args ); + ULONG *key = get_ptr( &args ); + + IO_STATUS_BLOCK io; + NTSTATUS status; + + status = NtWriteFileGather( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ), + iosb_32to64( &io, io32 ), segments, len, offset, key ); + put_iosb( io32, &io ); + return status; +} diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 2b542658f9e..870cb3b77b8 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -61,6 +61,7 @@ SYSCALL_ENTRY( NtEnumerateKey ) \ SYSCALL_ENTRY( NtEnumerateValueKey ) \ SYSCALL_ENTRY( NtFindAtom ) \ + SYSCALL_ENTRY( NtFlushBuffersFile ) \ SYSCALL_ENTRY( NtFlushKey ) \ SYSCALL_ENTRY( NtFlushVirtualMemory ) \ SYSCALL_ENTRY( NtFreeVirtualMemory ) \ @@ -70,6 +71,7 @@ SYSCALL_ENTRY( NtListenPort ) \ SYSCALL_ENTRY( NtLoadKey ) \ SYSCALL_ENTRY( NtLoadKey2 ) \ + SYSCALL_ENTRY( NtLockFile ) \ SYSCALL_ENTRY( NtLockVirtualMemory ) \ SYSCALL_ENTRY( NtMakeTemporaryObject ) \ SYSCALL_ENTRY( NtMapViewOfSection ) \ @@ -109,6 +111,8 @@ SYSCALL_ENTRY( NtQueryTimerResolution ) \ SYSCALL_ENTRY( NtQueryValueKey ) \ SYSCALL_ENTRY( NtQueryVirtualMemory ) \ + SYSCALL_ENTRY( NtReadFile ) \ + SYSCALL_ENTRY( NtReadFileScatter ) \ SYSCALL_ENTRY( NtReadVirtualMemory ) \ SYSCALL_ENTRY( NtReleaseKeyedEvent ) \ SYSCALL_ENTRY( NtReleaseMutant ) \ @@ -136,6 +140,7 @@ SYSCALL_ENTRY( NtSignalAndWaitForSingleObject ) \ SYSCALL_ENTRY( NtTerminateJobObject ) \ SYSCALL_ENTRY( NtUnloadKey ) \ + SYSCALL_ENTRY( NtUnlockFile ) \ SYSCALL_ENTRY( NtUnlockVirtualMemory ) \ SYSCALL_ENTRY( NtUnmapViewOfSection ) \ SYSCALL_ENTRY( NtWaitForDebugEvent ) \ @@ -145,6 +150,8 @@ SYSCALL_ENTRY( NtWow64AllocateVirtualMemory64 ) \ SYSCALL_ENTRY( NtWow64ReadVirtualMemory64 ) \ SYSCALL_ENTRY( NtWow64WriteVirtualMemory64 ) \ + SYSCALL_ENTRY( NtWriteFile ) \ + SYSCALL_ENTRY( NtWriteFileGather ) \ SYSCALL_ENTRY( NtWriteVirtualMemory ) \ SYSCALL_ENTRY( NtYieldExecution )