Module: wine Branch: master Commit: 6d27bcbe2c97a14c8f9dfc3c3dfeaced0cfb70cb URL: https://gitlab.winehq.org/wine/wine/-/commit/6d27bcbe2c97a14c8f9dfc3c3dfeace...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 14 13:51:57 2023 +0100
ntdll: Replace the wine_server_fd_to_handle() syscall by a Unix call.
---
dlls/ntdll/loader.c | 12 ++++++++++++ dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/unix/loader.c | 3 ++- dlls/ntdll/unix/server.c | 33 +++++++++++++++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 2 ++ dlls/ntdll/unixlib.h | 9 +++++++++ dlls/wow64/file.c | 20 -------------------- dlls/wow64/syscall.h | 1 - 8 files changed, 59 insertions(+), 23 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 0a22ec9a36b..0484be2f381 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3219,6 +3219,18 @@ unsigned int CDECL wine_server_call( void *req_ptr ) }
+/*********************************************************************** + * wine_server_fd_to_handle + */ +NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, + HANDLE *handle ) +{ + struct wine_server_fd_to_handle_params params = { fd, access, attributes, handle }; + + return WINE_UNIX_CALL( unix_wine_server_fd_to_handle, ¶ms ); +} + + /****************************************************************** * LdrLoadDll (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 8fa8d01c7dd..48c546566e8 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1689,7 +1689,7 @@
# Server interface @ cdecl -norelay wine_server_call(ptr) -@ cdecl -syscall wine_server_fd_to_handle(long long long ptr) +@ cdecl wine_server_fd_to_handle(long long long ptr) @ cdecl -syscall wine_server_handle_to_fd(long long ptr ptr)
# Unix interface diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9ff1e5c52cd..3095054ea08 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -358,7 +358,6 @@ static void * const syscalls[] = NtWriteVirtualMemory, NtYieldExecution, wine_nt_to_unix_file_name, - wine_server_fd_to_handle, wine_server_handle_to_fd, wine_unix_to_nt_file_name, }; @@ -2060,6 +2059,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = unwind_builtin_dll, unixcall_wine_dbg_write, unixcall_wine_server_call, + unixcall_wine_server_fd_to_handle, unixcall_wine_spawnvp, system_time_precise, }; @@ -2079,6 +2079,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = wow64_unwind_builtin_dll, wow64_wine_dbg_write, wow64_wine_server_call, + wow64_wine_server_fd_to_handle, wow64_wine_spawnvp, system_time_precise, }; diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index f9b403723fa..fa618aa7182 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1102,6 +1102,17 @@ NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned i }
+/*********************************************************************** + * unixcall_wine_server_fd_to_handle + */ +NTSTATUS unixcall_wine_server_fd_to_handle( void *args ) +{ + struct wine_server_fd_to_handle_params *params = args; + + return wine_server_fd_to_handle( params->fd, params->access, params->attributes, params->handle ); +} + + /*********************************************************************** * wine_server_handle_to_fd * @@ -1813,4 +1824,26 @@ NTSTATUS wow64_wine_server_call( void *args ) return status; }
+/*********************************************************************** + * wow64_wine_server_fd_to_handle + */ +NTSTATUS wow64_wine_server_fd_to_handle( void *args ) +{ + struct + { + int fd; + unsigned int access; + unsigned int attributes; + ULONG handle; + } const *params32 = args; + + ULONG *handle32 = ULongToPtr( params32->handle ); + HANDLE handle; + NTSTATUS ret; + + ret = wine_server_fd_to_handle( params32->fd, params32->access, params32->attributes, &handle ); + *handle32 = HandleToULong( handle ); + return ret; +} + #endif /* _WIN64 */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index e581cde0486..55e34a30886 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -285,10 +285,12 @@ extern void set_async_direct_result( HANDLE *async_handle, NTSTATUS status, ULON
extern NTSTATUS unixcall_wine_dbg_write( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS unixcall_wine_server_call( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS unixcall_wine_server_fd_to_handle( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS unixcall_wine_spawnvp( void *args ) DECLSPEC_HIDDEN; #ifdef _WIN64 extern NTSTATUS wow64_wine_dbg_write( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wine_server_call( void *args ) DECLSPEC_HIDDEN; +extern NTSTATUS wow64_wine_server_fd_to_handle( void *args ) DECLSPEC_HIDDEN; extern NTSTATUS wow64_wine_spawnvp( void *args ) DECLSPEC_HIDDEN; #endif
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index a205c86ac99..f85223e1796 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -31,6 +31,14 @@ struct wine_dbg_write_params unsigned int len; };
+struct wine_server_fd_to_handle_params +{ + int fd; + unsigned int access; + unsigned int attributes; + HANDLE *handle; +}; + struct wine_spawnvp_params { char **argv; @@ -56,6 +64,7 @@ enum ntdll_unix_funcs unix_unwind_builtin_dll, unix_wine_dbg_write, unix_wine_server_call, + unix_wine_server_fd_to_handle, unix_wine_spawnvp, unix_system_time_precise, }; diff --git a/dlls/wow64/file.c b/dlls/wow64/file.c index ebe0e9b3a77..74b27ddba93 100644 --- a/dlls/wow64/file.c +++ b/dlls/wow64/file.c @@ -944,26 +944,6 @@ NTSTATUS WINAPI wow64_wine_nt_to_unix_file_name( UINT *args ) }
-/********************************************************************** - * wow64_wine_server_fd_to_handle - */ -NTSTATUS WINAPI wow64_wine_server_fd_to_handle( UINT *args ) -{ - int fd = get_ulong( &args ); - ACCESS_MASK access = get_ulong( &args ); - ULONG attributes = get_ulong( &args ); - ULONG *handle_ptr = get_ptr( &args ); - - HANDLE handle = 0; - NTSTATUS status; - - *handle_ptr = 0; - status = wine_server_fd_to_handle( fd, access, attributes, &handle ); - put_handle( handle_ptr, handle ); - return status; -} - - /********************************************************************** * wow64_wine_server_handle_to_fd */ diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 8b0416d22c2..41abf509569 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -258,7 +258,6 @@ SYSCALL_ENTRY( NtWriteVirtualMemory ) \ SYSCALL_ENTRY( NtYieldExecution ) \ SYSCALL_ENTRY( wine_nt_to_unix_file_name ) \ - SYSCALL_ENTRY( wine_server_fd_to_handle ) \ SYSCALL_ENTRY( wine_server_handle_to_fd ) \ SYSCALL_ENTRY( wine_unix_to_nt_file_name )