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
4ea07a30
Commit
4ea07a30
authored
Mar 17, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Check the builtin signature when creating a module.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
31816a90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
loader.c
dlls/ntdll/loader.c
+9
-5
No files found.
dlls/ntdll/loader.c
View file @
4ea07a30
...
@@ -1832,6 +1832,9 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -1832,6 +1832,9 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
const
SECTION_IMAGE_INFORMATION
*
image_info
,
const
struct
file_id
*
id
,
const
SECTION_IMAGE_INFORMATION
*
image_info
,
const
struct
file_id
*
id
,
DWORD
flags
,
WINE_MODREF
**
pwm
)
DWORD
flags
,
WINE_MODREF
**
pwm
)
{
{
static
const
char
builtin_signature
[]
=
"Wine builtin DLL"
;
char
*
signature
=
(
char
*
)((
IMAGE_DOS_HEADER
*
)
*
module
+
1
);
BOOL
is_builtin
;
IMAGE_NT_HEADERS
*
nt
;
IMAGE_NT_HEADERS
*
nt
;
WINE_MODREF
*
wm
;
WINE_MODREF
*
wm
;
NTSTATUS
status
;
NTSTATUS
status
;
...
@@ -1842,10 +1845,12 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -1842,10 +1845,12 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
map_size
=
(
nt
->
OptionalHeader
.
SizeOfImage
+
page_size
-
1
)
&
~
(
page_size
-
1
);
map_size
=
(
nt
->
OptionalHeader
.
SizeOfImage
+
page_size
-
1
)
&
~
(
page_size
-
1
);
if
((
status
=
perform_relocations
(
*
module
,
nt
,
map_size
)))
return
status
;
if
((
status
=
perform_relocations
(
*
module
,
nt
,
map_size
)))
return
status
;
is_builtin
=
((
char
*
)
nt
-
signature
>=
sizeof
(
builtin_signature
)
&&
!
memcmp
(
signature
,
builtin_signature
,
sizeof
(
builtin_signature
)
));
/* create the MODREF */
/* create the MODREF */
if
(
!
(
wm
=
alloc_module
(
*
module
,
nt_name
,
(
image_info
->
u
.
s
.
WineBuiltin
)
)))
if
(
!
(
wm
=
alloc_module
(
*
module
,
nt_name
,
is_builtin
)))
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
if
(
id
)
wm
->
id
=
*
id
;
if
(
id
)
wm
->
id
=
*
id
;
if
(
image_info
->
LoaderFlags
)
wm
->
ldr
.
Flags
|=
LDR_COR_IMAGE
;
if
(
image_info
->
LoaderFlags
)
wm
->
ldr
.
Flags
|=
LDR_COR_IMAGE
;
...
@@ -1883,7 +1888,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -1883,7 +1888,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
TRACE
(
"loaded %s %p %p
\n
"
,
debugstr_us
(
nt_name
),
wm
,
*
module
);
TRACE
(
"loaded %s %p %p
\n
"
,
debugstr_us
(
nt_name
),
wm
,
*
module
);
if
(
i
mage_info
->
u
.
s
.
WineB
uiltin
)
if
(
i
s_b
uiltin
)
{
{
if
(
TRACE_ON
(
relay
))
RELAY_SetupDLL
(
*
module
);
if
(
TRACE_ON
(
relay
))
RELAY_SetupDLL
(
*
module
);
}
}
...
@@ -1893,7 +1898,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -1893,7 +1898,7 @@ static NTSTATUS build_module( LPCWSTR load_path, const UNICODE_STRING *nt_name,
}
}
TRACE_
(
loaddll
)(
"Loaded %s at %p: %s
\n
"
,
debugstr_w
(
wm
->
ldr
.
FullDllName
.
Buffer
),
*
module
,
TRACE_
(
loaddll
)(
"Loaded %s at %p: %s
\n
"
,
debugstr_w
(
wm
->
ldr
.
FullDllName
.
Buffer
),
*
module
,
(
image_info
->
u
.
s
.
WineBuiltin
)
?
"builtin"
:
"native"
);
is_builtin
?
"builtin"
:
"native"
);
wm
->
ldr
.
LoadCount
=
1
;
wm
->
ldr
.
LoadCount
=
1
;
*
pwm
=
wm
;
*
pwm
=
wm
;
...
@@ -2319,7 +2324,6 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name,
...
@@ -2319,7 +2324,6 @@ static NTSTATUS load_so_dll( LPCWSTR load_path, const UNICODE_STRING *nt_name,
{
{
SECTION_IMAGE_INFORMATION
image_info
=
{
0
};
SECTION_IMAGE_INFORMATION
image_info
=
{
0
};
image_info
.
u
.
s
.
WineBuiltin
=
1
;
if
((
status
=
build_module
(
load_path
,
&
win_name
,
&
module
,
&
image_info
,
NULL
,
flags
,
&
wm
)))
if
((
status
=
build_module
(
load_path
,
&
win_name
,
&
module
,
&
image_info
,
NULL
,
flags
,
&
wm
)))
{
{
if
(
module
)
NtUnmapViewOfSection
(
NtCurrentProcess
(),
module
);
if
(
module
)
NtUnmapViewOfSection
(
NtCurrentProcess
(),
module
);
...
...
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