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
7cec3dc2
Commit
7cec3dc2
authored
Sep 28, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the standard code path to load ntdll.dll.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
20e0fd6e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
67 deletions
+4
-67
loader.c
dlls/ntdll/unix/loader.c
+4
-16
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-1
virtual.c
dlls/ntdll/unix/virtual.c
+0
-50
No files found.
dlls/ntdll/unix/loader.c
View file @
7cec3dc2
...
...
@@ -1438,24 +1438,12 @@ found:
static
void
load_ntdll
(
void
)
{
NTSTATUS
status
;
SECTION_IMAGE_INFORMATION
info
;
void
*
module
;
int
fd
;
char
*
name
=
build_path
(
dll_dir
,
"ntdll.dll"
);
char
*
name
=
build_path
(
dll_dir
,
"ntdll.dll.so"
);
if
((
fd
=
open
(
name
,
O_RDONLY
))
!=
-
1
)
{
struct
stat
st
;
fstat
(
fd
,
&
st
);
if
(
!
(
status
=
virtual_map_ntdll
(
fd
,
&
module
)))
add_builtin_module
(
module
,
NULL
,
&
st
);
close
(
fd
);
}
else
{
free
(
name
);
name
=
build_path
(
dll_dir
,
"ntdll.dll.so"
);
status
=
dlopen_dll
(
name
,
&
module
);
}
name
[
strlen
(
name
)
-
3
]
=
0
;
/* remove .so */
status
=
open_builtin_file
(
name
,
&
module
,
&
info
);
if
(
status
)
fatal_error
(
"failed to load %s error %x
\n
"
,
name
,
status
);
free
(
name
);
load_ntdll_functions
(
module
);
...
...
dlls/ntdll/unix/unix_private.h
View file @
7cec3dc2
...
...
@@ -177,7 +177,6 @@ extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct o
extern
void
*
anon_mmap_fixed
(
void
*
start
,
size_t
size
,
int
prot
,
int
flags
)
DECLSPEC_HIDDEN
;
extern
void
*
anon_mmap_alloc
(
size_t
size
,
int
prot
)
DECLSPEC_HIDDEN
;
extern
void
virtual_init
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_map_ntdll
(
int
fd
,
void
**
module
)
DECLSPEC_HIDDEN
;
extern
ULONG_PTR
get_system_affinity_mask
(
void
)
DECLSPEC_HIDDEN
;
extern
void
virtual_get_system_info
(
SYSTEM_BASIC_INFORMATION
*
info
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_create_builtin_view
(
void
*
module
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unix/virtual.c
View file @
7cec3dc2
...
...
@@ -2437,56 +2437,6 @@ void virtual_init(void)
/***********************************************************************
* virtual_map_ntdll
*
* Map ntdll, used instead of virtual_map_section() because some things are not initialized yet.
*/
NTSTATUS
virtual_map_ntdll
(
int
fd
,
void
**
module
)
{
IMAGE_DOS_HEADER
dos
;
IMAGE_NT_HEADERS
nt
;
NTSTATUS
status
;
SIZE_T
size
;
void
*
base
;
unsigned
int
vprot
;
struct
file_view
*
view
;
/* load the headers */
size
=
pread
(
fd
,
&
dos
,
sizeof
(
dos
),
0
);
if
(
size
<
sizeof
(
dos
))
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
dos
.
e_magic
!=
IMAGE_DOS_SIGNATURE
)
return
STATUS_INVALID_IMAGE_FORMAT
;
size
=
pread
(
fd
,
&
nt
,
sizeof
(
nt
),
dos
.
e_lfanew
);
if
(
size
<
sizeof
(
nt
))
return
STATUS_INVALID_IMAGE_PROTECT
;
if
(
nt
.
Signature
!=
IMAGE_NT_SIGNATURE
)
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
nt
.
OptionalHeader
.
Magic
!=
IMAGE_NT_OPTIONAL_HDR_MAGIC
)
return
STATUS_INVALID_IMAGE_FORMAT
;
#ifdef __i386__
if
(
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_I386
)
return
STATUS_INVALID_IMAGE_FORMAT
;
#elif defined(__x86_64__)
if
(
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_AMD64
)
return
STATUS_INVALID_IMAGE_FORMAT
;
#elif defined(__arm__)
if
(
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_ARM
&&
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_THUMB
&&
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_ARMNT
)
return
STATUS_INVALID_IMAGE_FORMAT
;
#elif defined(__aarch64__)
if
(
nt
.
FileHeader
.
Machine
!=
IMAGE_FILE_MACHINE_ARM64
)
return
STATUS_INVALID_IMAGE_FORMAT
;
#endif
base
=
(
void
*
)
nt
.
OptionalHeader
.
ImageBase
;
size
=
ROUND_SIZE
(
0
,
nt
.
OptionalHeader
.
SizeOfImage
);
vprot
=
SEC_IMAGE
|
SEC_FILE
|
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_EXEC
|
VPROT_WRITECOPY
;
status
=
map_view
(
&
view
,
base
,
size
,
FALSE
,
vprot
,
0
);
if
(
status
==
STATUS_CONFLICTING_ADDRESSES
)
ERR
(
"couldn't load ntdll at preferred address %p
\n
"
,
base
);
if
(
status
)
return
status
;
*
module
=
view
->
base
;
return
map_image_into_view
(
view
,
fd
,
base
,
nt
.
OptionalHeader
.
SizeOfHeaders
,
0
,
-
1
,
FALSE
);
}
/***********************************************************************
* get_system_affinity_mask
*/
ULONG_PTR
get_system_affinity_mask
(
void
)
...
...
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