1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

ntdll: Replace the wine_server_fd_to_handle() syscall by a Unix call.

This commit is contained in:
Alexandre Julliard 2023-02-14 13:51:57 +01:00
parent 8a3ba513ff
commit 6d27bcbe2c
8 changed files with 59 additions and 23 deletions

View file

@ -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, &params );
}
/******************************************************************
* LdrLoadDll (NTDLL.@)
*/

View file

@ -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

View file

@ -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,
};

View file

@ -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 */

View file

@ -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

View file

@ -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,
};

View file

@ -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
*/

View file

@ -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 )