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
72baffdb
Commit
72baffdb
authored
Feb 02, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Load the main module before the other dlls.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ef4be71a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
loader.c
dlls/ntdll/loader.c
+21
-28
No files found.
dlls/ntdll/loader.c
View file @
72baffdb
...
@@ -4031,29 +4031,6 @@ static NTSTATUS process_init(void)
...
@@ -4031,29 +4031,6 @@ static NTSTATUS process_init(void)
load_global_options
();
load_global_options
();
version_init
();
version_init
();
/* setup the load callback and create ntdll modref */
RtlInitUnicodeString
(
&
nt_name
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
ntdll.dll"
);
NtQueryVirtualMemory
(
GetCurrentProcess
(),
process_init
,
MemoryBasicInformation
,
&
meminfo
,
sizeof
(
meminfo
),
NULL
);
status
=
build_builtin_module
(
params
->
DllPath
.
Buffer
,
&
nt_name
,
meminfo
.
AllocationBase
,
0
,
&
wm
);
assert
(
!
status
);
if
((
status
=
load_dll
(
params
->
DllPath
.
Buffer
,
L"C:
\\
windows
\\
system32
\\
kernel32.dll"
,
NULL
,
0
,
&
wm
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not load kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
RtlInitAnsiString
(
&
func_name
,
"BaseThreadInitThunk"
);
if
((
status
=
LdrGetProcedureAddress
(
wm
->
ldr
.
DllBase
,
&
func_name
,
0
,
(
void
**
)
&
pBaseThreadInitThunk
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not find BaseThreadInitThunk in kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
init_locale
(
wm
->
ldr
.
DllBase
);
if
(
!
(
status
=
load_dll
(
params
->
DllPath
.
Buffer
,
params
->
ImagePathName
.
Buffer
,
NULL
,
if
(
!
(
status
=
load_dll
(
params
->
DllPath
.
Buffer
,
params
->
ImagePathName
.
Buffer
,
NULL
,
DONT_RESOLVE_DLL_REFERENCES
,
&
wm
)))
DONT_RESOLVE_DLL_REFERENCES
,
&
wm
)))
{
{
...
@@ -4115,11 +4092,27 @@ static NTSTATUS process_init(void)
...
@@ -4115,11 +4092,27 @@ static NTSTATUS process_init(void)
}
}
#endif
#endif
/* the main exe needs to be the first in the load order list */
RtlInitUnicodeString
(
&
nt_name
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
ntdll.dll"
);
RemoveEntryList
(
&
wm
->
ldr
.
InLoadOrderLinks
);
NtQueryVirtualMemory
(
GetCurrentProcess
(),
process_init
,
MemoryBasicInformation
,
InsertHeadList
(
&
peb
->
LdrData
->
InLoadOrderModuleList
,
&
wm
->
ldr
.
InLoadOrderLinks
);
&
meminfo
,
sizeof
(
meminfo
),
NULL
);
RemoveEntryList
(
&
wm
->
ldr
.
InMemoryOrderLinks
);
status
=
build_builtin_module
(
params
->
DllPath
.
Buffer
,
&
nt_name
,
meminfo
.
AllocationBase
,
0
,
&
wm
);
InsertHeadList
(
&
peb
->
LdrData
->
InMemoryOrderModuleList
,
&
wm
->
ldr
.
InMemoryOrderLinks
);
assert
(
!
status
);
if
((
status
=
load_dll
(
params
->
DllPath
.
Buffer
,
L"C:
\\
windows
\\
system32
\\
kernel32.dll"
,
NULL
,
0
,
&
wm
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not load kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
RtlInitAnsiString
(
&
func_name
,
"BaseThreadInitThunk"
);
if
((
status
=
LdrGetProcedureAddress
(
wm
->
ldr
.
DllBase
,
&
func_name
,
0
,
(
void
**
)
&
pBaseThreadInitThunk
))
!=
STATUS_SUCCESS
)
{
MESSAGE
(
"wine: could not find BaseThreadInitThunk in kernel32.dll, status %x
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
}
init_locale
(
wm
->
ldr
.
DllBase
);
RtlCreateUserStack
(
0
,
0
,
0
,
0x10000
,
0x10000
,
&
stack
);
RtlCreateUserStack
(
0
,
0
,
0
,
0x10000
,
0x10000
,
&
stack
);
teb
->
Tib
.
StackBase
=
stack
.
StackBase
;
teb
->
Tib
.
StackBase
=
stack
.
StackBase
;
...
...
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