Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
a77ef5c4
Commit
a77ef5c4
authored
Oct 22, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Add a separate request to exec a new process.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7d1cef54
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
13 deletions
+76
-13
process.c
dlls/kernel32/process.c
+1
-2
server_protocol.h
include/wine/server_protocol.h
+18
-1
process.c
server/process.c
+33
-10
protocol.def
server/protocol.def
+8
-0
request.h
server/request.h
+6
-0
trace.c
server/trace.c
+10
-0
No files found.
dlls/kernel32/process.c
View file @
a77ef5c4
...
@@ -2228,9 +2228,8 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_
...
@@ -2228,9 +2228,8 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_
{
{
wine_server_send_fd
(
socketfd
[
1
]
);
wine_server_send_fd
(
socketfd
[
1
]
);
close
(
socketfd
[
1
]
);
close
(
socketfd
[
1
]
);
SERVER_START_REQ
(
new
_process
)
SERVER_START_REQ
(
exec
_process
)
{
{
req
->
create_flags
=
flags
;
req
->
socket_fd
=
socketfd
[
1
];
req
->
socket_fd
=
socketfd
[
1
];
req
->
exe_file
=
wine_server_obj_handle
(
hFile
);
req
->
exe_file
=
wine_server_obj_handle
(
hFile
);
req
->
cpu
=
pe_info
->
cpu
;
req
->
cpu
=
pe_info
->
cpu
;
...
...
include/wine/server_protocol.h
View file @
a77ef5c4
...
@@ -745,6 +745,20 @@ struct new_process_reply
...
@@ -745,6 +745,20 @@ struct new_process_reply
struct
exec_process_request
{
struct
request_header
__header
;
int
socket_fd
;
obj_handle_t
exe_file
;
cpu_type_t
cpu
;
};
struct
exec_process_reply
{
struct
reply_header
__header
;
};
struct
get_new_process_info_request
struct
get_new_process_info_request
{
{
struct
request_header
__header
;
struct
request_header
__header
;
...
@@ -5632,6 +5646,7 @@ struct terminate_job_reply
...
@@ -5632,6 +5646,7 @@ struct terminate_job_reply
enum
request
enum
request
{
{
REQ_new_process
,
REQ_new_process
,
REQ_exec_process
,
REQ_get_new_process_info
,
REQ_get_new_process_info
,
REQ_new_thread
,
REQ_new_thread
,
REQ_get_startup_info
,
REQ_get_startup_info
,
...
@@ -5928,6 +5943,7 @@ union generic_request
...
@@ -5928,6 +5943,7 @@ union generic_request
struct
request_max_size
max_size
;
struct
request_max_size
max_size
;
struct
request_header
request_header
;
struct
request_header
request_header
;
struct
new_process_request
new_process_request
;
struct
new_process_request
new_process_request
;
struct
exec_process_request
exec_process_request
;
struct
get_new_process_info_request
get_new_process_info_request
;
struct
get_new_process_info_request
get_new_process_info_request
;
struct
new_thread_request
new_thread_request
;
struct
new_thread_request
new_thread_request
;
struct
get_startup_info_request
get_startup_info_request
;
struct
get_startup_info_request
get_startup_info_request
;
...
@@ -6222,6 +6238,7 @@ union generic_reply
...
@@ -6222,6 +6238,7 @@ union generic_reply
struct
request_max_size
max_size
;
struct
request_max_size
max_size
;
struct
reply_header
reply_header
;
struct
reply_header
reply_header
;
struct
new_process_reply
new_process_reply
;
struct
new_process_reply
new_process_reply
;
struct
exec_process_reply
exec_process_reply
;
struct
get_new_process_info_reply
get_new_process_info_reply
;
struct
get_new_process_info_reply
get_new_process_info_reply
;
struct
new_thread_reply
new_thread_reply
;
struct
new_thread_reply
new_thread_reply
;
struct
get_startup_info_reply
get_startup_info_reply
;
struct
get_startup_info_reply
get_startup_info_reply
;
...
@@ -6512,6 +6529,6 @@ union generic_reply
...
@@ -6512,6 +6529,6 @@ union generic_reply
struct
terminate_job_reply
terminate_job_reply
;
struct
terminate_job_reply
terminate_job_reply
;
};
};
#define SERVER_PROTOCOL_VERSION 56
7
#define SERVER_PROTOCOL_VERSION 56
8
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/process.c
View file @
a77ef5c4
...
@@ -1112,16 +1112,6 @@ DECL_HANDLER(new_process)
...
@@ -1112,16 +1112,6 @@ DECL_HANDLER(new_process)
return
;
return
;
}
}
if
(
!
req
->
info_size
)
/* create an orphaned process */
{
if
((
process
=
create_process
(
socket_fd
,
NULL
,
0
,
sd
)))
{
create_thread
(
-
1
,
process
,
NULL
);
release_object
(
process
);
}
return
;
}
/* build the startup info for a new process */
/* build the startup info for a new process */
if
(
!
(
info
=
alloc_object
(
&
startup_info_ops
)))
if
(
!
(
info
=
alloc_object
(
&
startup_info_ops
)))
{
{
...
@@ -1238,6 +1228,39 @@ DECL_HANDLER(new_process)
...
@@ -1238,6 +1228,39 @@ DECL_HANDLER(new_process)
release_object
(
info
);
release_object
(
info
);
}
}
/* execute a new process, replacing the existing one */
DECL_HANDLER
(
exec_process
)
{
struct
process
*
process
;
int
socket_fd
=
thread_get_inflight_fd
(
current
,
req
->
socket_fd
);
if
(
socket_fd
==
-
1
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
}
if
(
fcntl
(
socket_fd
,
F_SETFL
,
O_NONBLOCK
)
==
-
1
)
{
set_error
(
STATUS_INVALID_HANDLE
);
close
(
socket_fd
);
return
;
}
if
(
shutdown_stage
)
{
set_error
(
STATUS_SHUTDOWN_IN_PROGRESS
);
close
(
socket_fd
);
return
;
}
if
(
!
is_cpu_supported
(
req
->
cpu
))
{
close
(
socket_fd
);
return
;
}
if
(
!
(
process
=
create_process
(
socket_fd
,
NULL
,
0
,
NULL
)))
return
;
create_thread
(
-
1
,
process
,
NULL
);
release_object
(
process
);
}
/* Retrieve information about a newly started process */
/* Retrieve information about a newly started process */
DECL_HANDLER
(
get_new_process_info
)
DECL_HANDLER
(
get_new_process_info
)
{
{
...
...
server/protocol.def
View file @
a77ef5c4
...
@@ -754,6 +754,14 @@ struct rawinput_device
...
@@ -754,6 +754,14 @@ struct rawinput_device
@END
@END
/* Execute a process, replacing the current one */
@REQ(exec_process)
int socket_fd; /* file descriptor for process socket */
obj_handle_t exe_file; /* file handle for main exe */
cpu_type_t cpu; /* CPU that the new process will use */
@END
/* Retrieve information about a newly started process */
/* Retrieve information about a newly started process */
@REQ(get_new_process_info)
@REQ(get_new_process_info)
obj_handle_t info; /* info handle returned from new_process_request */
obj_handle_t info; /* info handle returned from new_process_request */
...
...
server/request.h
View file @
a77ef5c4
...
@@ -113,6 +113,7 @@ static inline void set_reply_data_ptr( void *data, data_size_t size )
...
@@ -113,6 +113,7 @@ static inline void set_reply_data_ptr( void *data, data_size_t size )
/* ### make_requests begin ### */
/* ### make_requests begin ### */
DECL_HANDLER
(
new_process
);
DECL_HANDLER
(
new_process
);
DECL_HANDLER
(
exec_process
);
DECL_HANDLER
(
get_new_process_info
);
DECL_HANDLER
(
get_new_process_info
);
DECL_HANDLER
(
new_thread
);
DECL_HANDLER
(
new_thread
);
DECL_HANDLER
(
get_startup_info
);
DECL_HANDLER
(
get_startup_info
);
...
@@ -408,6 +409,7 @@ typedef void (*req_handler)( const void *req, void *reply );
...
@@ -408,6 +409,7 @@ typedef void (*req_handler)( const void *req, void *reply );
static
const
req_handler
req_handlers
[
REQ_NB_REQUESTS
]
=
static
const
req_handler
req_handlers
[
REQ_NB_REQUESTS
]
=
{
{
(
req_handler
)
req_new_process
,
(
req_handler
)
req_new_process
,
(
req_handler
)
req_exec_process
,
(
req_handler
)
req_get_new_process_info
,
(
req_handler
)
req_get_new_process_info
,
(
req_handler
)
req_new_thread
,
(
req_handler
)
req_new_thread
,
(
req_handler
)
req_get_startup_info
,
(
req_handler
)
req_get_startup_info
,
...
@@ -740,6 +742,10 @@ C_ASSERT( FIELD_OFFSET(struct new_process_reply, info) == 8 );
...
@@ -740,6 +742,10 @@ C_ASSERT( FIELD_OFFSET(struct new_process_reply, info) == 8 );
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
pid
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
pid
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
handle
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
new_process_reply
,
handle
)
==
16
);
C_ASSERT
(
sizeof
(
struct
new_process_reply
)
==
24
);
C_ASSERT
(
sizeof
(
struct
new_process_reply
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
exec_process_request
,
socket_fd
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
exec_process_request
,
exe_file
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
exec_process_request
,
cpu
)
==
20
);
C_ASSERT
(
sizeof
(
struct
exec_process_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_request
,
info
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_request
,
info
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_new_process_info_request
)
==
16
);
C_ASSERT
(
sizeof
(
struct
get_new_process_info_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_reply
,
success
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_new_process_info_reply
,
success
)
==
8
);
...
...
server/trace.c
View file @
a77ef5c4
...
@@ -1246,6 +1246,13 @@ static void dump_new_process_reply( const struct new_process_reply *req )
...
@@ -1246,6 +1246,13 @@ static void dump_new_process_reply( const struct new_process_reply *req )
fprintf
(
stderr
,
", handle=%04x"
,
req
->
handle
);
fprintf
(
stderr
,
", handle=%04x"
,
req
->
handle
);
}
}
static
void
dump_exec_process_request
(
const
struct
exec_process_request
*
req
)
{
fprintf
(
stderr
,
" socket_fd=%d"
,
req
->
socket_fd
);
fprintf
(
stderr
,
", exe_file=%04x"
,
req
->
exe_file
);
dump_cpu_type
(
", cpu="
,
&
req
->
cpu
);
}
static
void
dump_get_new_process_info_request
(
const
struct
get_new_process_info_request
*
req
)
static
void
dump_get_new_process_info_request
(
const
struct
get_new_process_info_request
*
req
)
{
{
fprintf
(
stderr
,
" info=%04x"
,
req
->
info
);
fprintf
(
stderr
,
" info=%04x"
,
req
->
info
);
...
@@ -4529,6 +4536,7 @@ static void dump_terminate_job_request( const struct terminate_job_request *req
...
@@ -4529,6 +4536,7 @@ static void dump_terminate_job_request( const struct terminate_job_request *req
static
const
dump_func
req_dumpers
[
REQ_NB_REQUESTS
]
=
{
static
const
dump_func
req_dumpers
[
REQ_NB_REQUESTS
]
=
{
(
dump_func
)
dump_new_process_request
,
(
dump_func
)
dump_new_process_request
,
(
dump_func
)
dump_exec_process_request
,
(
dump_func
)
dump_get_new_process_info_request
,
(
dump_func
)
dump_get_new_process_info_request
,
(
dump_func
)
dump_new_thread_request
,
(
dump_func
)
dump_new_thread_request
,
(
dump_func
)
dump_get_startup_info_request
,
(
dump_func
)
dump_get_startup_info_request
,
...
@@ -4821,6 +4829,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
...
@@ -4821,6 +4829,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
static
const
dump_func
reply_dumpers
[
REQ_NB_REQUESTS
]
=
{
static
const
dump_func
reply_dumpers
[
REQ_NB_REQUESTS
]
=
{
(
dump_func
)
dump_new_process_reply
,
(
dump_func
)
dump_new_process_reply
,
NULL
,
(
dump_func
)
dump_get_new_process_info_reply
,
(
dump_func
)
dump_get_new_process_info_reply
,
(
dump_func
)
dump_new_thread_reply
,
(
dump_func
)
dump_new_thread_reply
,
(
dump_func
)
dump_get_startup_info_reply
,
(
dump_func
)
dump_get_startup_info_reply
,
...
@@ -5113,6 +5122,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
...
@@ -5113,6 +5122,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
static
const
char
*
const
req_names
[
REQ_NB_REQUESTS
]
=
{
static
const
char
*
const
req_names
[
REQ_NB_REQUESTS
]
=
{
"new_process"
,
"new_process"
,
"exec_process"
,
"get_new_process_info"
,
"get_new_process_info"
,
"new_thread"
,
"new_thread"
,
"get_startup_info"
,
"get_startup_info"
,
...
...
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