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
0424f381
Commit
0424f381
authored
Jul 13, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Already initialize the process in the first init_thread request
instead of waiting for the init_process request.
parent
c976db1a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
84 deletions
+82
-84
process.c
dlls/kernel/process.c
+0
-2
server.c
dlls/ntdll/server.c
+3
-0
server_protocol.h
include/wine/server_protocol.h
+4
-4
process.c
server/process.c
+42
-66
process.h
server/process.h
+1
-0
protocol.def
server/protocol.def
+3
-3
thread.c
server/thread.c
+25
-5
trace.c
server/trace.c
+4
-4
No files found.
dlls/kernel/process.c
View file @
0424f381
...
...
@@ -961,8 +961,6 @@ static BOOL process_init(void)
/* Retrieve startup info from the server */
SERVER_START_REQ
(
init_process
)
{
req
->
peb
=
peb
;
req
->
ldt_copy
=
&
wine_ldt_copy
;
if
((
ret
=
!
wine_server_call_err
(
req
)))
{
info_size
=
reply
->
info_size
;
...
...
dlls/ntdll/server.c
View file @
0424f381
...
...
@@ -909,9 +909,12 @@ void server_init_thread( int unix_pid, int unix_tid, void *entry_point )
req
->
unix_pid
=
unix_pid
;
req
->
unix_tid
=
unix_tid
;
req
->
teb
=
NtCurrentTeb
();
req
->
peb
=
NtCurrentTeb
()
->
Peb
;
req
->
entry
=
entry_point
;
req
->
ldt_copy
=
&
wine_ldt_copy
;
req
->
reply_fd
=
reply_pipe
[
1
];
req
->
wait_fd
=
ntdll_get_thread_data
()
->
wait_fd
[
1
];
req
->
debug_level
=
(
TRACE_ON
(
server
)
!=
0
);
ret
=
wine_server_call
(
req
);
NtCurrentTeb
()
->
ClientId
.
UniqueProcess
=
(
HANDLE
)
reply
->
pid
;
NtCurrentTeb
()
->
ClientId
.
UniqueThread
=
(
HANDLE
)
reply
->
tid
;
...
...
include/wine/server_protocol.h
View file @
0424f381
...
...
@@ -252,8 +252,6 @@ struct boot_done_reply
struct
init_process_request
{
struct
request_header
__header
;
void
*
peb
;
void
*
ldt_copy
;
};
struct
init_process_reply
{
...
...
@@ -306,16 +304,18 @@ struct init_thread_request
int
unix_pid
;
int
unix_tid
;
void
*
teb
;
void
*
peb
;
void
*
entry
;
void
*
ldt_copy
;
int
reply_fd
;
int
wait_fd
;
int
debug_level
;
};
struct
init_thread_reply
{
struct
reply_header
__header
;
process_id_t
pid
;
thread_id_t
tid
;
int
boot
;
int
version
;
};
...
...
@@ -4189,6 +4189,6 @@ union generic_reply
struct
set_mailslot_info_reply
set_mailslot_info_reply
;
};
#define SERVER_PROTOCOL_VERSION 18
3
#define SERVER_PROTOCOL_VERSION 18
4
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/process.c
View file @
0424f381
...
...
@@ -303,45 +303,56 @@ inline static struct startup_info *find_startup_info( int unix_pid )
}
/* initialize the current process and fill in the request */
static
size_t
init_process
(
void
)
void
init_process
(
struct
thread
*
thread
)
{
struct
process
*
process
=
current
->
process
;
struct
process
*
process
=
thread
->
process
;
struct
thread
*
parent_thread
=
NULL
;
struct
process
*
parent
=
NULL
;
struct
startup_info
*
info
=
find_startup_info
(
current
->
unix_pid
);
struct
startup_info
*
info
;
if
(
process
->
startup_info
)
return
;
/* already initialized */
if
(
info
)
if
(
(
info
=
find_startup_info
(
thread
->
unix_pid
))
)
{
if
(
info
->
thread
)
{
fatal_protocol_error
(
current
,
"init_process: called twice?
\n
"
);
return
0
;
}
if
(
info
->
thread
)
return
;
/* already initialized */
info
->
thread
=
(
struct
thread
*
)
grab_object
(
thread
);
info
->
process
=
(
struct
process
*
)
grab_object
(
process
);
process
->
startup_info
=
(
struct
startup_info
*
)
grab_object
(
info
);
parent_thread
=
info
->
owner
;
parent
=
parent_thread
->
process
;
process
->
parent
=
(
struct
process
*
)
grab_object
(
parent
);
}
/* set the process flags */
process
->
create_flags
=
info
?
info
->
create_flags
:
0
;
/* set the process flags */
process
->
create_flags
=
info
->
create_flags
;
/* create the handle table */
if
(
info
&&
info
->
inherit_all
)
process
->
handles
=
copy_handle_table
(
process
,
parent
);
else
process
->
handles
=
alloc_handle_table
(
process
,
0
);
if
(
!
process
->
handles
)
return
0
;
if
(
info
->
inherit_all
)
process
->
handles
=
copy_handle_table
(
process
,
parent
);
}
/* retrieve the main exe file */
if
(
info
&&
info
->
exe_file
)
process
->
exe
.
file
=
(
struct
file
*
)
grab_object
(
info
->
exe_file
);
/* create the handle table */
if
(
!
process
->
handles
)
process
->
handles
=
alloc_handle_table
(
process
,
0
);
if
(
!
process
->
handles
)
{
fatal_protocol_error
(
thread
,
"Failed to allocate handle table
\n
"
);
return
;
}
/* connect to the window station and desktop */
connect_process_winstation
(
process
,
NULL
,
0
);
connect_process_desktop
(
process
,
NULL
,
0
);
current
->
desktop
=
process
->
desktop
;
thread
->
desktop
=
process
->
desktop
;
if
(
!
info
)
return
;
/* retrieve the main exe file */
if
(
info
->
exe_file
)
process
->
exe
.
file
=
(
struct
file
*
)
grab_object
(
info
->
exe_file
);
/* thread will be actually suspended in init_done */
if
(
info
->
create_flags
&
CREATE_SUSPENDED
)
thread
->
suspend
++
;
/* set the process console */
if
(
info
&&
!
(
info
->
create_flags
&
(
DETACHED_PROCESS
|
CREATE_NEW_CONSOLE
)))
if
(
!
(
info
->
create_flags
&
(
DETACHED_PROCESS
|
CREATE_NEW_CONSOLE
)))
{
/* FIXME: some better error checking should be done...
* like if hConOut and hConIn are console handles, then they should be on the same
...
...
@@ -350,28 +361,14 @@ static size_t init_process(void)
inherit_console
(
parent_thread
,
process
,
info
->
inherit_all
?
info
->
hstdin
:
0
);
}
if
(
parent
)
{
/* attach to the debugger if requested */
if
(
process
->
create_flags
&
(
DEBUG_PROCESS
|
DEBUG_ONLY_THIS_PROCESS
))
set_process_debugger
(
process
,
parent_thread
);
else
if
(
parent
->
debugger
&&
!
(
parent
->
create_flags
&
DEBUG_ONLY_THIS_PROCESS
))
set_process_debugger
(
process
,
parent
->
debugger
);
if
(
!
(
process
->
create_flags
&
CREATE_NEW_PROCESS_GROUP
))
process
->
group_id
=
parent
->
group_id
;
}
/* thread will be actually suspended in init_done */
if
(
process
->
create_flags
&
CREATE_SUSPENDED
)
current
->
suspend
++
;
/* attach to the debugger if requested */
if
(
process
->
create_flags
&
(
DEBUG_PROCESS
|
DEBUG_ONLY_THIS_PROCESS
))
set_process_debugger
(
process
,
parent_thread
);
else
if
(
parent
->
debugger
&&
!
(
parent
->
create_flags
&
DEBUG_ONLY_THIS_PROCESS
))
set_process_debugger
(
process
,
parent
->
debugger
);
if
(
info
)
{
info
->
process
=
(
struct
process
*
)
grab_object
(
process
);
info
->
thread
=
(
struct
thread
*
)
grab_object
(
current
);
process
->
startup_info
=
(
struct
startup_info
*
)
grab_object
(
info
);
return
info
->
data_size
;
}
return
0
;
if
(
!
(
process
->
create_flags
&
CREATE_NEW_PROCESS_GROUP
))
process
->
group_id
=
parent
->
group_id
;
}
/* destroy a process when its refcount is 0 */
...
...
@@ -969,30 +966,9 @@ DECL_HANDLER(get_startup_info)
/* initialize a new process */
DECL_HANDLER
(
init_process
)
{
if
(
current
->
unix_pid
==
-
1
)
{
fatal_protocol_error
(
current
,
"init_process: init_thread not called yet
\n
"
);
return
;
}
if
(
current
->
process
->
startup_info
)
{
fatal_protocol_error
(
current
,
"init_process: called twice
\n
"
);
return
;
}
if
(
!
req
->
peb
||
(
unsigned
int
)
req
->
peb
%
sizeof
(
int
))
{
fatal_protocol_error
(
current
,
"init_process: bad peb address
\n
"
);
return
;
}
if
(
!
req
->
ldt_copy
||
(
unsigned
int
)
req
->
ldt_copy
%
sizeof
(
int
))
{
fatal_protocol_error
(
current
,
"init_process: bad ldt_copy address
\n
"
);
return
;
}
current
->
process
->
peb
=
req
->
peb
;
current
->
process
->
ldt_copy
=
req
->
ldt_copy
;
reply
->
server_start
=
server_start_ticks
;
reply
->
info_size
=
init_process
();
if
(
current
->
process
->
startup_info
)
reply
->
info_size
=
current
->
process
->
startup_info
->
data_size
;
}
/* signal the end of the process initialization */
...
...
server/process.h
View file @
0424f381
...
...
@@ -104,6 +104,7 @@ extern unsigned int alloc_ptid( void *ptr );
extern
void
free_ptid
(
unsigned
int
id
);
extern
void
*
get_ptid_entry
(
unsigned
int
id
);
extern
struct
thread
*
create_process
(
int
fd
);
extern
void
init_process
(
struct
thread
*
thread
);
extern
struct
thread
*
get_process_first_thread
(
struct
process
*
process
);
extern
struct
process
*
get_process_from_id
(
process_id_t
id
);
extern
struct
process
*
get_process_from_handle
(
obj_handle_t
handle
,
unsigned
int
access
);
...
...
server/protocol.def
View file @
0424f381
...
...
@@ -245,8 +245,6 @@ struct security_descriptor
/* Initialize a process; called from the new process context */
@REQ(init_process)
void* peb; /* addr of PEB */
void* ldt_copy; /* addr of LDT copy */
@REPLY
unsigned int server_start; /* server start time (GetTickCount) */
size_t info_size; /* total size of startup info */
...
...
@@ -283,13 +281,15 @@ struct security_descriptor
int unix_pid; /* Unix pid of new thread */
int unix_tid; /* Unix tid of new thread */
void* teb; /* TEB of new thread (in thread address space) */
void* peb; /* address of PEB (in thread address space) */
void* entry; /* thread entry point (in thread address space) */
void* ldt_copy; /* address of LDT copy (in thread address space) */
int reply_fd; /* fd for reply pipe */
int wait_fd; /* fd for blocking calls pipe */
int debug_level; /* new debug level */
@REPLY
process_id_t pid; /* process id of the new thread's process */
thread_id_t tid; /* thread id of the new thread */
int boot; /* is this the boot thread? */
int version; /* protocol version */
@END
...
...
server/thread.c
View file @
0424f381
...
...
@@ -150,6 +150,12 @@ inline static void init_thread_structure( struct thread *thread )
thread
->
inflight
[
i
].
server
=
thread
->
inflight
[
i
].
client
=
-
1
;
}
/* check if address looks valid for a client-side data structure (TEB etc.) */
static
inline
int
is_valid_address
(
void
*
addr
)
{
return
addr
&&
!
((
unsigned
int
)
addr
%
sizeof
(
int
));
}
/* create a new thread */
struct
thread
*
create_thread
(
int
fd
,
struct
process
*
process
)
{
...
...
@@ -814,7 +820,6 @@ struct token *thread_get_impersonation_token( struct thread *thread )
/* signal that we are finished booting on the client side */
DECL_HANDLER
(
boot_done
)
{
debug_level
=
max
(
debug_level
,
req
->
debug_level
);
if
(
current
==
booting_thread
)
{
booting_thread
=
(
struct
thread
*
)
~
0UL
;
/* make sure it doesn't match other threads */
...
...
@@ -852,6 +857,7 @@ DECL_HANDLER(new_thread)
/* initialize a new thread */
DECL_HANDLER
(
init_thread
)
{
struct
process
*
process
=
current
->
process
;
int
reply_fd
=
thread_get_inflight_fd
(
current
,
req
->
reply_fd
);
int
wait_fd
=
thread_get_inflight_fd
(
current
,
req
->
wait_fd
);
...
...
@@ -879,17 +885,31 @@ DECL_HANDLER(init_thread)
if
(
!
(
current
->
wait_fd
=
create_anonymous_fd
(
&
thread_fd_ops
,
wait_fd
,
&
current
->
obj
)))
return
;
if
(
!
is_valid_address
(
req
->
teb
)
||
!
is_valid_address
(
req
->
peb
)
||
!
is_valid_address
(
req
->
ldt_copy
))
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
}
current
->
unix_pid
=
req
->
unix_pid
;
current
->
unix_tid
=
req
->
unix_tid
;
current
->
teb
=
req
->
teb
;
if
(
current
->
suspend
+
current
->
process
->
suspend
>
0
)
stop_thread
(
current
);
if
(
current
->
process
->
running_threads
>
1
)
if
(
!
process
->
peb
)
/* first thread, initialize the process too */
{
process
->
peb
=
req
->
peb
;
process
->
ldt_copy
=
req
->
ldt_copy
;
init_process
(
current
);
}
else
{
if
(
current
->
suspend
+
process
->
suspend
>
0
)
stop_thread
(
current
);
generate_debug_event
(
current
,
CREATE_THREAD_DEBUG_EVENT
,
req
->
entry
);
}
debug_level
=
max
(
debug_level
,
req
->
debug_level
);
reply
->
pid
=
get_process_id
(
current
->
process
);
reply
->
pid
=
get_process_id
(
process
);
reply
->
tid
=
get_thread_id
(
current
);
reply
->
boot
=
(
current
==
booting_thread
);
reply
->
version
=
SERVER_PROTOCOL_VERSION
;
return
;
...
...
server/trace.c
View file @
0424f381
...
...
@@ -613,8 +613,6 @@ static void dump_boot_done_request( const struct boot_done_request *req )
static
void
dump_init_process_request
(
const
struct
init_process_request
*
req
)
{
fprintf
(
stderr
,
" peb=%p,"
,
req
->
peb
);
fprintf
(
stderr
,
" ldt_copy=%p"
,
req
->
ldt_copy
);
}
static
void
dump_init_process_reply
(
const
struct
init_process_reply
*
req
)
...
...
@@ -658,16 +656,18 @@ static void dump_init_thread_request( const struct init_thread_request *req )
fprintf
(
stderr
,
" unix_pid=%d,"
,
req
->
unix_pid
);
fprintf
(
stderr
,
" unix_tid=%d,"
,
req
->
unix_tid
);
fprintf
(
stderr
,
" teb=%p,"
,
req
->
teb
);
fprintf
(
stderr
,
" peb=%p,"
,
req
->
peb
);
fprintf
(
stderr
,
" entry=%p,"
,
req
->
entry
);
fprintf
(
stderr
,
" ldt_copy=%p,"
,
req
->
ldt_copy
);
fprintf
(
stderr
,
" reply_fd=%d,"
,
req
->
reply_fd
);
fprintf
(
stderr
,
" wait_fd=%d"
,
req
->
wait_fd
);
fprintf
(
stderr
,
" wait_fd=%d,"
,
req
->
wait_fd
);
fprintf
(
stderr
,
" debug_level=%d"
,
req
->
debug_level
);
}
static
void
dump_init_thread_reply
(
const
struct
init_thread_reply
*
req
)
{
fprintf
(
stderr
,
" pid=%04x,"
,
req
->
pid
);
fprintf
(
stderr
,
" tid=%04x,"
,
req
->
tid
);
fprintf
(
stderr
,
" boot=%d,"
,
req
->
boot
);
fprintf
(
stderr
,
" version=%d"
,
req
->
version
);
}
...
...
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