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
608d086f
Commit
608d086f
authored
Nov 07, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move some initializations out of thread_init().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b7db0b52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
34 deletions
+26
-34
loader.c
dlls/ntdll/loader.c
+22
-14
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
thread.c
dlls/ntdll/thread.c
+3
-19
No files found.
dlls/ntdll/loader.c
View file @
608d086f
...
...
@@ -4234,8 +4234,22 @@ void __wine_process_init(void)
UNICODE_STRING
nt_name
;
void
*
(
CDECL
*
init_func
)(
void
);
INITIAL_TEB
stack
;
BOOL
suspend
;
SIZE_T
info_size
;
TEB
*
teb
=
thread_init
();
PEB
*
peb
=
teb
->
Peb
;
thread_init
();
/* setup the server connection */
server_init_process
();
info_size
=
server_init_thread
(
peb
,
&
suspend
);
peb
->
ProcessHeap
=
RtlCreateHeap
(
HEAP_GROWABLE
,
NULL
,
0
,
0
,
NULL
,
NULL
);
peb
->
LoaderLock
=
&
loader_section
;
init_directories
();
init_user_process_params
(
info_size
);
NtCreateKeyedEvent
(
&
keyed_event
,
GENERIC_READ
|
GENERIC_WRITE
,
NULL
,
0
);
/* retrieve current umask */
FILE_umask
=
umask
(
0777
);
...
...
@@ -4263,7 +4277,7 @@ void __wine_process_init(void)
kernel32_start_process
=
init_func
();
wm
=
get_modref
(
NtCurrentTeb
()
->
P
eb
->
ImageBaseAddress
);
wm
=
get_modref
(
p
eb
->
ImageBaseAddress
);
assert
(
wm
);
if
(
wm
->
ldr
.
Flags
&
LDR_IMAGE_IS_DLL
)
{
...
...
@@ -4271,24 +4285,18 @@ void __wine_process_init(void)
exit
(
1
);
}
NtCurrentTeb
()
->
Peb
->
LoaderLock
=
&
loader_section
;
virtual_set_large_address_space
();
/* the main exe needs to be the first in the load order list */
RemoveEntryList
(
&
wm
->
ldr
.
InLoadOrderModuleList
);
InsertHeadList
(
&
NtCurrentTeb
()
->
P
eb
->
LdrData
->
InLoadOrderModuleList
,
&
wm
->
ldr
.
InLoadOrderModuleList
);
InsertHeadList
(
&
p
eb
->
LdrData
->
InLoadOrderModuleList
,
&
wm
->
ldr
.
InLoadOrderModuleList
);
RemoveEntryList
(
&
wm
->
ldr
.
InMemoryOrderModuleList
);
InsertHeadList
(
&
NtCurrentTeb
()
->
P
eb
->
LdrData
->
InMemoryOrderModuleList
,
&
wm
->
ldr
.
InMemoryOrderModuleList
);
InsertHeadList
(
&
p
eb
->
LdrData
->
InMemoryOrderModuleList
,
&
wm
->
ldr
.
InMemoryOrderModuleList
);
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
0
,
0
,
NULL
))
!=
STATUS_SUCCESS
)
{
ERR
(
"Main exe initialization for %s failed, status %x
\n
"
,
debugstr_w
(
wm
->
ldr
.
FullDllName
.
Buffer
),
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
NtCurrentTeb
()
->
Tib
.
StackBase
=
stack
.
StackBase
;
NtCurrentTeb
()
->
Tib
.
StackLimit
=
stack
.
StackLimit
;
NtCurrentTeb
()
->
DeallocationStack
=
stack
.
DeallocationStack
;
virtual_alloc_thread_stack
(
&
stack
,
0
,
0
,
NULL
);
teb
->
Tib
.
StackBase
=
stack
.
StackBase
;
teb
->
Tib
.
StackLimit
=
stack
.
StackLimit
;
teb
->
DeallocationStack
=
stack
.
DeallocationStack
;
server_init_process_done
();
}
dlls/ntdll/ntdll_misc.h
View file @
608d086f
...
...
@@ -79,7 +79,7 @@ extern void DECLSPEC_NORETURN signal_exit_thread( int status ) DECLSPEC_HIDDEN;
extern
void
DECLSPEC_NORETURN
signal_exit_process
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
version_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
debug_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
thread_init
(
void
)
DECLSPEC_HIDDEN
;
extern
TEB
*
thread_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
actctx_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
virtual_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
virtual_init_threading
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/thread.c
View file @
608d086f
...
...
@@ -220,12 +220,11 @@ static void set_process_name( int argc, char *argv[] )
*
* NOTES: The first allocated TEB on NT is at 0x7ffde000.
*/
void
thread_init
(
void
)
TEB
*
thread_init
(
void
)
{
TEB
*
teb
;
void
*
addr
;
BOOL
suspend
;
SIZE_T
size
,
info_size
;
SIZE_T
size
;
LARGE_INTEGER
now
;
NTSTATUS
status
;
struct
ntdll_thread_data
*
thread_data
;
...
...
@@ -299,21 +298,7 @@ void thread_init(void)
signal_init_thread
(
teb
);
virtual_init_threading
();
debug_init
();
/* setup the server connection */
server_init_process
();
info_size
=
server_init_thread
(
peb
,
&
suspend
);
/* create the process heap */
if
(
!
(
peb
->
ProcessHeap
=
RtlCreateHeap
(
HEAP_GROWABLE
,
NULL
,
0
,
0
,
NULL
,
NULL
)))
{
MESSAGE
(
"wine: failed to create the process heap
\n
"
);
exit
(
1
);
}
set_process_name
(
__wine_main_argc
,
__wine_main_argv
);
init_directories
();
init_user_process_params
(
info_size
);
/* initialize time values in user_shared_data */
NtQuerySystemTime
(
&
now
);
...
...
@@ -323,10 +308,9 @@ void thread_init(void)
user_shared_data
->
u
.
TickCount
.
High2Time
=
user_shared_data
->
u
.
TickCount
.
High1Time
;
user_shared_data
->
TickCountLowDeprecated
=
user_shared_data
->
u
.
TickCount
.
LowPart
;
user_shared_data
->
TickCountMultiplier
=
1
<<
24
;
fill_cpu_info
();
NtCreateKeyedEvent
(
&
keyed_event
,
GENERIC_READ
|
GENERIC_WRITE
,
NULL
,
0
)
;
return
teb
;
}
...
...
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