Module: wine Branch: master Commit: 46d0da53b61254d52aa86c6cb524609110cb1213 URL: https://gitlab.winehq.org/wine/wine/-/commit/46d0da53b61254d52aa86c6cb524609...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Feb 14 13:53:15 2023 +0100
ntdll: Replace the wine_server_handle_to_fd() syscall by a Unix call.
---
dlls/ntdll/loader.c | 11 +++++++++++ dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/unix/loader.c | 3 ++- dlls/ntdll/unix/server.c | 28 ++++++++++++++++++++++++++++ dlls/ntdll/unix/unix_private.h | 2 ++ dlls/ntdll/unixlib.h | 9 +++++++++ dlls/wow64/file.c | 14 -------------- dlls/wow64/struct32.h | 2 -- dlls/wow64/syscall.h | 1 - 9 files changed, 53 insertions(+), 19 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 0484be2f381..0689dd0f575 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -3231,6 +3231,17 @@ NTSTATUS CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned i }
+/*********************************************************************** + * wine_server_handle_to_fd (NTDLL.@) + */ +NTSTATUS CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, + unsigned int *options ) +{ + struct wine_server_handle_to_fd_params params = { handle, access, unix_fd, options }; + + return WINE_UNIX_CALL( unix_wine_server_handle_to_fd, ¶ms ); +} + /****************************************************************** * LdrLoadDll (NTDLL.@) */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 48c546566e8..87f4629ee2c 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1690,7 +1690,7 @@ # Server interface @ cdecl -norelay wine_server_call(ptr) @ cdecl wine_server_fd_to_handle(long long long ptr) -@ cdecl -syscall wine_server_handle_to_fd(long long ptr ptr) +@ cdecl wine_server_handle_to_fd(long long ptr ptr)
# Unix interface @ stdcall __wine_unix_call(int64 long ptr) diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 3095054ea08..5cbe57c020a 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_handle_to_fd, wine_unix_to_nt_file_name, };
@@ -2060,6 +2059,7 @@ const unixlib_entry_t __wine_unix_call_funcs[] = unixcall_wine_dbg_write, unixcall_wine_server_call, unixcall_wine_server_fd_to_handle, + unixcall_wine_server_handle_to_fd, unixcall_wine_spawnvp, system_time_precise, }; @@ -2080,6 +2080,7 @@ const unixlib_entry_t __wine_unix_call_wow64_funcs[] = wow64_wine_dbg_write, wow64_wine_server_call, wow64_wine_server_fd_to_handle, + wow64_wine_server_handle_to_fd, wow64_wine_spawnvp, system_time_precise, }; diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c index fa618aa7182..1ce174d421e 100644 --- a/dlls/ntdll/unix/server.c +++ b/dlls/ntdll/unix/server.c @@ -1132,6 +1132,17 @@ NTSTATUS CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int }
+/*********************************************************************** + * unixcall_wine_server_handle_to_fd + */ +NTSTATUS unixcall_wine_server_handle_to_fd( void *args ) +{ + struct wine_server_handle_to_fd_params *params = args; + + return wine_server_handle_to_fd( params->handle, params->access, params->unix_fd, params->options ); +} + + /*********************************************************************** * server_pipe * @@ -1846,4 +1857,21 @@ NTSTATUS wow64_wine_server_fd_to_handle( void *args ) return ret; }
+/********************************************************************** + * wow64_wine_server_handle_to_fd + */ +NTSTATUS wow64_wine_server_handle_to_fd( void *args ) +{ + struct + { + ULONG handle; + unsigned int access; + ULONG unix_fd; + ULONG options; + } const *params32 = args; + + return wine_server_handle_to_fd( ULongToHandle( params32->handle ), params32->access, + ULongToPtr( params32->unix_fd ), ULongToPtr( params32->options )); +} + #endif /* _WIN64 */ diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 55e34a30886..d7d1d0d2ac0 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -286,11 +286,13 @@ 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_server_handle_to_fd( 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_server_handle_to_fd( 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 f85223e1796..22e5663990d 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -39,6 +39,14 @@ struct wine_server_fd_to_handle_params HANDLE *handle; };
+struct wine_server_handle_to_fd_params +{ + HANDLE handle; + unsigned int access; + int *unix_fd; + unsigned int *options; +}; + struct wine_spawnvp_params { char **argv; @@ -65,6 +73,7 @@ enum ntdll_unix_funcs unix_wine_dbg_write, unix_wine_server_call, unix_wine_server_fd_to_handle, + unix_wine_server_handle_to_fd, unix_wine_spawnvp, unix_system_time_precise, }; diff --git a/dlls/wow64/file.c b/dlls/wow64/file.c index 74b27ddba93..3254d69d14a 100644 --- a/dlls/wow64/file.c +++ b/dlls/wow64/file.c @@ -944,20 +944,6 @@ NTSTATUS WINAPI wow64_wine_nt_to_unix_file_name( UINT *args ) }
-/********************************************************************** - * wow64_wine_server_handle_to_fd - */ -NTSTATUS WINAPI wow64_wine_server_handle_to_fd( UINT *args ) -{ - HANDLE handle = get_handle( &args ); - ACCESS_MASK access = get_ulong( &args ); - int *unix_fd = get_ptr( &args ); - unsigned int *options = get_ptr( &args ); - - return wine_server_handle_to_fd( handle, access, unix_fd, options ); -} - - /********************************************************************** * wow64_wine_unix_to_nt_file_name */ diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index 5780fb574a6..76308a7f659 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -21,8 +21,6 @@ #ifndef __WOW64_STRUCT32_H #define __WOW64_STRUCT32_H
-#include "wine/server.h" - typedef struct { ULONG Length; diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index 41abf509569..e91be71ebac 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_handle_to_fd ) \ SYSCALL_ENTRY( wine_unix_to_nt_file_name )
#endif /* __WOW64_SYSCALL_H */