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
9839bb76
Commit
9839bb76
authored
Feb 09, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Skip dlls of the wrong machine type when searching through the load path.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2062df7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
loader.c
dlls/kernel32/tests/loader.c
+1
-1
loader.c
dlls/ntdll/loader.c
+19
-11
No files found.
dlls/kernel32/tests/loader.c
View file @
9839bb76
...
...
@@ -685,7 +685,7 @@ static NTSTATUS map_image_section( const IMAGE_NT_HEADERS *nt_header, const IMAG
/* some dlls with invalid entry point will crash, but this means we loaded the test dll */
ok
(
!
expect_fallback
,
"%u: got test dll but expected fallback
\n
"
,
line
);
}
else
todo_wine_if
(
!
expect_status
)
else
{
ok
(
ldr_status
==
expect_status
||
broken
(
il_only
&&
!
expect_status
&&
ldr_status
==
STATUS_INVALID_IMAGE_FORMAT
),
...
...
dlls/ntdll/loader.c
View file @
9839bb76
...
...
@@ -1999,12 +1999,6 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam
TRACE
(
"Trying native dll %s
\n
"
,
debugstr_us
(
nt_name
));
if
(
!
is_valid_binary
(
module
,
image_info
))
{
NtUnmapViewOfSection
(
NtCurrentProcess
(),
module
);
return
STATUS_INVALID_IMAGE_FORMAT
;
}
/* perform base relocation, if necessary */
if
((
status
=
perform_relocations
(
module
,
nt
,
image_info
->
map_size
)))
...
...
@@ -2363,6 +2357,12 @@ static NTSTATUS open_dll_file( const WCHAR *name, UNICODE_STRING *nt_name, WINE_
if
(
status
==
STATUS_IMAGE_NOT_AT_BASE
)
status
=
STATUS_SUCCESS
;
NtClose
(
mapping
);
}
if
(
!
status
&&
!
is_valid_binary
(
*
module
,
image_info
))
{
TRACE
(
"%s is for arch %x, continuing search
\n
"
,
debugstr_us
(
nt_name
),
image_info
->
machine
);
NtUnmapViewOfSection
(
NtCurrentProcess
(),
*
module
);
status
=
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
;
}
return
status
;
}
...
...
@@ -2377,6 +2377,7 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING *
struct
stat
*
st
)
{
WCHAR
*
name
;
BOOL
found_image
=
FALSE
;
NTSTATUS
status
=
STATUS_DLL_NOT_FOUND
;
ULONG
len
=
strlenW
(
paths
);
...
...
@@ -2397,15 +2398,20 @@ static NTSTATUS search_dll_file( LPCWSTR paths, LPCWSTR search, UNICODE_STRING *
if
(
len
&&
name
[
len
-
1
]
!=
'\\'
)
name
[
len
++
]
=
'\\'
;
strcpyW
(
name
+
len
,
search
);
status
=
open_dll_file
(
name
,
nt_name
,
pwm
,
module
,
image_info
,
st
);
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
goto
done
;
if
(
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
)
found_image
=
TRUE
;
else
if
(
status
!=
STATUS_DLL_NOT_FOUND
)
goto
done
;
RtlFreeUnicodeString
(
nt_name
);
paths
=
ptr
;
}
/* not found, return file in the system dir to be loaded as builtin */
strcpyW
(
name
,
system_dir
);
strcatW
(
name
,
search
);
if
(
!
RtlDosPathNameToNtPathName_U
(
name
,
nt_name
,
NULL
,
NULL
))
status
=
STATUS_NO_MEMORY
;
if
(
!
found_image
)
{
/* not found, return file in the system dir to be loaded as builtin */
strcpyW
(
name
,
system_dir
);
strcatW
(
name
,
search
);
if
(
!
RtlDosPathNameToNtPathName_U
(
name
,
nt_name
,
NULL
,
NULL
))
status
=
STATUS_NO_MEMORY
;
}
else
status
=
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
;
done:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
name
);
...
...
@@ -2463,6 +2469,8 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
else
status
=
open_dll_file
(
libname
,
nt_name
,
pwm
,
module
,
image_info
,
st
);
if
(
status
==
STATUS_IMAGE_MACHINE_TYPE_MISMATCH
)
status
=
STATUS_INVALID_IMAGE_FORMAT
;
done:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
dllname
);
return
status
;
...
...
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