Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
4e581163
Commit
4e581163
authored
Aug 25, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use syscalls for the server functions.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0e7f6e0e
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
186 deletions
+30
-186
Makefile.in
dlls/ntdll/Makefile.in
+0
-1
loader.c
dlls/ntdll/loader.c
+2
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+5
-5
server.c
dlls/ntdll/server.c
+0
-139
env.c
dlls/ntdll/unix/env.c
+3
-3
loader.c
dlls/ntdll/unix/loader.c
+0
-5
process.c
dlls/ntdll/unix/process.c
+7
-7
server.c
dlls/ntdll/unix/server.c
+11
-11
thread.c
dlls/ntdll/unix/thread.c
+1
-1
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-6
unixlib.h
dlls/ntdll/unixlib.h
+1
-8
No files found.
dlls/ntdll/Makefile.in
View file @
4e581163
...
...
@@ -34,7 +34,6 @@ C_SRCS = \
rtlbitmap.c
\
rtlstr.c
\
sec.c
\
server.c
\
signal_arm.c
\
signal_arm64.c
\
signal_i386.c
\
...
...
dlls/ntdll/loader.c
View file @
4e581163
...
...
@@ -68,6 +68,8 @@ const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\',
const
WCHAR
syswow64_dir
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
's'
,
'y'
,
's'
,
'w'
,
'o'
,
'w'
,
'6'
,
'4'
,
'\\'
,
0
};
BOOL
is_wow64
=
FALSE
;
/* system search path */
static
const
WCHAR
system_path
[]
=
{
'C'
,
':'
,
'\\'
,
'w'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'2'
,
';'
,
...
...
dlls/ntdll/ntdll.spec
View file @
4e581163
...
...
@@ -1581,11 +1581,11 @@
# or 'wine_' (for user-visible functions) to avoid namespace conflicts.
# Server interface
@ cdecl -norelay wine_server_call(ptr)
@ cdecl wine_server_fd_to_handle(long long long ptr)
@ cdecl wine_server_handle_to_fd(long long ptr ptr)
@ cdecl wine_server_release_fd(long long)
@ cdecl wine_server_send_fd(long)
@ cdecl -
syscall -
norelay wine_server_call(ptr)
@ cdecl
-syscall
wine_server_fd_to_handle(long long long ptr)
@ cdecl
-syscall
wine_server_handle_to_fd(long long ptr ptr)
@ cdecl
-syscall
wine_server_release_fd(long long)
@ cdecl
-syscall
wine_server_send_fd(long)
@ cdecl __wine_make_process_system()
@ cdecl __wine_set_unix_funcs(long ptr)
@ extern __wine_syscall_dispatcher
...
...
dlls/ntdll/server.c
deleted
100644 → 0
View file @
0e7f6e0e
/*
* Wine server communication
*
* Copyright (C) 1998 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winnt.h"
#include "wine/server.h"
#include "wine/debug.h"
#include "ntdll_misc.h"
BOOL
is_wow64
=
FALSE
;
/***********************************************************************
* wine_server_call (NTDLL.@)
*
* Perform a server call.
*
* PARAMS
* req_ptr [I/O] Function dependent data
*
* RETURNS
* Depends on server function being called, but usually an NTSTATUS code.
*
* NOTES
* Use the SERVER_START_REQ and SERVER_END_REQ to help you fill out the
* server request structure for the particular call. E.g:
*| SERVER_START_REQ( event_op )
*| {
*| req->handle = handle;
*| req->op = SET_EVENT;
*| ret = wine_server_call( req );
*| }
*| SERVER_END_REQ;
*/
unsigned
int
CDECL
wine_server_call
(
void
*
req_ptr
)
{
return
unix_funcs
->
server_call
(
req_ptr
);
}
/***********************************************************************
* wine_server_send_fd (NTDLL.@)
*
* Send a file descriptor to the server.
*
* PARAMS
* fd [I] file descriptor to send
*
* RETURNS
* nothing
*/
void
CDECL
wine_server_send_fd
(
int
fd
)
{
unix_funcs
->
server_send_fd
(
fd
);
}
/***********************************************************************
* wine_server_fd_to_handle (NTDLL.@)
*
* Allocate a file handle for a Unix file descriptor.
*
* PARAMS
* fd [I] Unix file descriptor.
* access [I] Win32 access flags.
* attributes [I] Object attributes.
* handle [O] Address where Wine file handle will be stored.
*
* RETURNS
* NTSTATUS code
*/
int
CDECL
wine_server_fd_to_handle
(
int
fd
,
unsigned
int
access
,
unsigned
int
attributes
,
HANDLE
*
handle
)
{
return
unix_funcs
->
server_fd_to_handle
(
fd
,
access
,
attributes
,
handle
);
}
/***********************************************************************
* wine_server_handle_to_fd (NTDLL.@)
*
* Retrieve the file descriptor corresponding to a file handle.
*
* PARAMS
* handle [I] Wine file handle.
* access [I] Win32 file access rights requested.
* unix_fd [O] Address where Unix file descriptor will be stored.
* options [O] Address where the file open options will be stored. Optional.
*
* RETURNS
* NTSTATUS code
*/
int
CDECL
wine_server_handle_to_fd
(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
unsigned
int
*
options
)
{
return
unix_funcs
->
server_handle_to_fd
(
handle
,
access
,
unix_fd
,
options
);
}
/***********************************************************************
* wine_server_release_fd (NTDLL.@)
*
* Release the Unix file descriptor returned by wine_server_handle_to_fd.
*
* PARAMS
* handle [I] Wine file handle.
* unix_fd [I] Unix file descriptor to release.
*
* RETURNS
* nothing
*/
void
CDECL
wine_server_release_fd
(
HANDLE
handle
,
int
unix_fd
)
{
unix_funcs
->
server_release_fd
(
handle
,
unix_fd
);
}
dlls/ntdll/unix/env.c
View file @
4e581163
...
...
@@ -1159,9 +1159,9 @@ void CDECL get_initial_console( HANDLE *handle, HANDLE *std_in, HANDLE *std_out,
{
*
handle
=
*
std_in
=
*
std_out
=
*
std_err
=
0
;
if
(
isatty
(
0
)
||
isatty
(
1
)
||
isatty
(
2
))
*
handle
=
(
HANDLE
)
2
;
/* see kernel32/kernel_private.h */
if
(
!
isatty
(
0
))
server_fd_to_handle
(
0
,
GENERIC_READ
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_in
);
if
(
!
isatty
(
1
))
server_fd_to_handle
(
1
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_out
);
if
(
!
isatty
(
2
))
server_fd_to_handle
(
2
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_err
);
if
(
!
isatty
(
0
))
wine_
server_fd_to_handle
(
0
,
GENERIC_READ
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_in
);
if
(
!
isatty
(
1
))
wine_
server_fd_to_handle
(
1
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_out
);
if
(
!
isatty
(
2
))
wine_
server_fd_to_handle
(
2
,
GENERIC_WRITE
|
SYNCHRONIZE
,
OBJ_INHERIT
,
std_err
);
}
...
...
dlls/ntdll/unix/loader.c
View file @
4e581163
...
...
@@ -1353,11 +1353,6 @@ static struct unix_funcs unix_funcs =
virtual_locked_recvmsg
,
virtual_release_address_space
,
exec_process
,
wine_server_call
,
server_send_fd
,
server_fd_to_handle
,
server_handle_to_fd
,
server_release_fd
,
server_init_process_done
,
wine_nt_to_unix_file_name
,
wine_unix_to_nt_file_name
,
...
...
dlls/ntdll/unix/process.c
View file @
4e581163
...
...
@@ -511,7 +511,7 @@ static int get_unix_curdir( const RTL_USER_PROCESS_PARAMETERS *params )
FILE_DIRECTORY_FILE
|
FILE_SYNCHRONOUS_IO_NONALERT
);
free
(
nt_name
.
Buffer
);
if
(
status
)
return
-
1
;
server_handle_to_fd
(
handle
,
FILE_TRAVERSE
,
&
fd
,
NULL
);
wine_
server_handle_to_fd
(
handle
,
FILE_TRAVERSE
,
&
fd
,
NULL
);
NtClose
(
handle
);
return
fd
;
}
...
...
@@ -548,8 +548,8 @@ static NTSTATUS spawn_process( const RTL_USER_PROCESS_PARAMETERS *params, int so
pid_t
pid
;
char
**
argv
;
server_handle_to_fd
(
params
->
hStdInput
,
FILE_READ_DATA
,
&
stdin_fd
,
NULL
);
server_handle_to_fd
(
params
->
hStdOutput
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
wine_
server_handle_to_fd
(
params
->
hStdInput
,
FILE_READ_DATA
,
&
stdin_fd
,
NULL
);
wine_
server_handle_to_fd
(
params
->
hStdOutput
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
if
(
!
(
pid
=
fork
()))
/* child */
{
...
...
@@ -640,7 +640,7 @@ NTSTATUS CDECL exec_process( UNICODE_STRING *path, UNICODE_STRING *cmdline, NTST
setsockopt
(
socketfd
[
0
],
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
}
#endif
server_send_fd
(
socketfd
[
1
]
);
wine_
server_send_fd
(
socketfd
[
1
]
);
close
(
socketfd
[
1
]
);
SERVER_START_REQ
(
exec_process
)
...
...
@@ -701,8 +701,8 @@ static NTSTATUS fork_and_exec( UNICODE_STRING *path, int unixdir,
fcntl
(
fd
[
1
],
F_SETFD
,
FD_CLOEXEC
);
}
server_handle_to_fd
(
params
->
hStdInput
,
FILE_READ_DATA
,
&
stdin_fd
,
NULL
);
server_handle_to_fd
(
params
->
hStdOutput
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
wine_
server_handle_to_fd
(
params
->
hStdInput
,
FILE_READ_DATA
,
&
stdin_fd
,
NULL
);
wine_
server_handle_to_fd
(
params
->
hStdOutput
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
if
(
!
(
pid
=
fork
()))
/* child */
{
...
...
@@ -861,7 +861,7 @@ NTSTATUS WINAPI NtCreateUserProcess( HANDLE *process_handle_ptr, HANDLE *thread_
}
#endif
server_send_fd
(
socketfd
[
1
]
);
wine_
server_send_fd
(
socketfd
[
1
]
);
close
(
socketfd
[
1
]
);
/* create the process on the server side */
...
...
dlls/ntdll/unix/server.c
View file @
4e581163
...
...
@@ -751,11 +751,11 @@ unsigned int server_queue_process_apc( HANDLE process, const apc_call_t *call, a
/***********************************************************************
* server_send_fd
*
wine_
server_send_fd
*
* Send a file descriptor to the server.
*/
void
CDECL
server_send_fd
(
int
fd
)
void
CDECL
wine_
server_send_fd
(
int
fd
)
{
struct
send_fd
data
;
struct
msghdr
msghdr
;
...
...
@@ -1038,14 +1038,14 @@ done:
/***********************************************************************
* server_fd_to_handle
*
wine_
server_fd_to_handle
*/
NTSTATUS
CDECL
server_fd_to_handle
(
int
fd
,
unsigned
int
access
,
unsigned
int
attributes
,
HANDLE
*
handle
)
NTSTATUS
CDECL
wine_
server_fd_to_handle
(
int
fd
,
unsigned
int
access
,
unsigned
int
attributes
,
HANDLE
*
handle
)
{
NTSTATUS
ret
;
*
handle
=
0
;
server_send_fd
(
fd
);
wine_
server_send_fd
(
fd
);
SERVER_START_REQ
(
alloc_file_handle
)
{
...
...
@@ -1060,11 +1060,11 @@ NTSTATUS CDECL server_fd_to_handle( int fd, unsigned int access, unsigned int at
/***********************************************************************
* server_handle_to_fd
*
wine_
server_handle_to_fd
*
* Retrieve the file descriptor corresponding to a file handle.
*/
NTSTATUS
CDECL
server_handle_to_fd
(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
NTSTATUS
CDECL
wine_
server_handle_to_fd
(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
unsigned
int
*
options
)
{
int
needs_close
;
...
...
@@ -1079,9 +1079,9 @@ NTSTATUS CDECL server_handle_to_fd( HANDLE handle, unsigned int access, int *uni
/***********************************************************************
* server_release_fd
*
wine_
server_release_fd
*/
void
CDECL
server_release_fd
(
HANDLE
handle
,
int
unix_fd
)
void
CDECL
wine_
server_release_fd
(
HANDLE
handle
,
int
unix_fd
)
{
close
(
unix_fd
);
}
...
...
@@ -1519,8 +1519,8 @@ size_t server_init_thread( void *entry_point, BOOL *suspend )
/* create the server->client communication pipes */
if
(
server_pipe
(
reply_pipe
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
if
(
server_pipe
(
ntdll_get_thread_data
()
->
wait_fd
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
server_send_fd
(
reply_pipe
[
1
]
);
server_send_fd
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
wine_
server_send_fd
(
reply_pipe
[
1
]
);
wine_
server_send_fd
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
ntdll_get_thread_data
()
->
reply_fd
=
reply_pipe
[
0
];
close
(
reply_pipe
[
1
]
);
...
...
dlls/ntdll/unix/thread.c
View file @
4e581163
...
...
@@ -187,7 +187,7 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle, ACCESS_MASK access, OBJECT_ATT
free
(
objattr
);
return
STATUS_TOO_MANY_OPENED_FILES
;
}
server_send_fd
(
request_pipe
[
0
]
);
wine_
server_send_fd
(
request_pipe
[
0
]
);
if
(
!
access
)
access
=
THREAD_ALL_ACCESS
;
...
...
dlls/ntdll/unix/unix_private.h
View file @
4e581163
...
...
@@ -121,12 +121,6 @@ extern NTSTATUS CDECL virtual_map_section( HANDLE handle, PVOID *addr_ptr, unsig
extern
ssize_t
CDECL
virtual_locked_recvmsg
(
int
fd
,
struct
msghdr
*
hdr
,
int
flags
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
virtual_release_address_space
(
void
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
server_send_fd
(
int
fd
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
server_fd_to_handle
(
int
fd
,
unsigned
int
access
,
unsigned
int
attributes
,
HANDLE
*
handle
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
server_handle_to_fd
(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
unsigned
int
*
options
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
server_release_fd
(
HANDLE
handle
,
int
unix_fd
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
server_init_process_done
(
void
*
relay
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
exec_process
(
UNICODE_STRING
*
path
,
UNICODE_STRING
*
cmdline
,
NTSTATUS
status
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
unwind_builtin_dll
(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
...
...
dlls/ntdll/unixlib.h
View file @
4e581163
...
...
@@ -28,7 +28,7 @@ struct msghdr;
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 9
4
#define NTDLL_UNIXLIB_VERSION 9
5
struct
unix_funcs
{
...
...
@@ -93,13 +93,6 @@ struct unix_funcs
NTSTATUS
(
CDECL
*
exec_process
)(
UNICODE_STRING
*
path
,
UNICODE_STRING
*
cmdline
,
NTSTATUS
status
);
/* server functions */
unsigned
int
(
CDECL
*
server_call
)(
void
*
req_ptr
);
void
(
CDECL
*
server_send_fd
)(
int
fd
);
NTSTATUS
(
CDECL
*
server_fd_to_handle
)(
int
fd
,
unsigned
int
access
,
unsigned
int
attributes
,
HANDLE
*
handle
);
NTSTATUS
(
CDECL
*
server_handle_to_fd
)(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
unsigned
int
*
options
);
void
(
CDECL
*
server_release_fd
)(
HANDLE
handle
,
int
unix_fd
);
void
(
CDECL
*
server_init_process_done
)(
void
*
relay
);
/* file functions */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment