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
b8e8cb66
Commit
b8e8cb66
authored
Dec 11, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a heuristic to detect dlls that are wrongly marked as using native subsystem.
parent
441f515d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
2 deletions
+39
-2
loader.c
dlls/ntdll/loader.c
+39
-2
No files found.
dlls/ntdll/loader.c
View file @
b8e8cb66
...
...
@@ -682,6 +682,44 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
/*************************************************************************
* is_dll_native_subsystem
*
* Check if dll is a proper native driver.
* Some dlls (corpol.dll from IE6 for instance) are incorrectly marked as native
* while being perfectly normal DLLs. This heuristic should catch such breakages.
*/
static
BOOL
is_dll_native_subsystem
(
HMODULE
module
,
const
IMAGE_NT_HEADERS
*
nt
,
LPCWSTR
filename
)
{
static
const
WCHAR
ntdllW
[]
=
{
'n'
,
't'
,
'd'
,
'l'
,
'l'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
kernel32W
[]
=
{
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
const
IMAGE_IMPORT_DESCRIPTOR
*
imports
;
DWORD
i
,
size
;
WCHAR
buffer
[
16
];
if
(
nt
->
OptionalHeader
.
Subsystem
!=
IMAGE_SUBSYSTEM_NATIVE
)
return
FALSE
;
if
(
nt
->
OptionalHeader
.
SectionAlignment
<
getpagesize
())
return
TRUE
;
if
((
imports
=
RtlImageDirectoryEntryToData
(
module
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_IMPORT
,
&
size
)))
{
for
(
i
=
0
;
imports
[
i
].
Name
;
i
++
)
{
const
char
*
name
=
get_rva
(
module
,
imports
[
i
].
Name
);
DWORD
len
=
strlen
(
name
);
if
(
len
*
sizeof
(
WCHAR
)
>=
sizeof
(
buffer
))
continue
;
ascii_to_unicode
(
buffer
,
name
,
len
+
1
);
if
(
!
strcmpiW
(
buffer
,
ntdllW
)
||
!
strcmpiW
(
buffer
,
kernel32W
))
{
TRACE
(
"%s imports %s, assuming not native
\n
"
,
debugstr_w
(
filename
),
debugstr_w
(
buffer
)
);
return
FALSE
;
}
}
}
return
TRUE
;
}
/*************************************************************************
* alloc_module
*
* Allocate a WINE_MODREF structure and add it to the process list
...
...
@@ -715,8 +753,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
else
p
=
wm
->
ldr
.
FullDllName
.
Buffer
;
RtlInitUnicodeString
(
&
wm
->
ldr
.
BaseDllName
,
p
);
if
(
nt
->
OptionalHeader
.
Subsystem
!=
IMAGE_SUBSYSTEM_NATIVE
&&
(
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
))
if
((
nt
->
FileHeader
.
Characteristics
&
IMAGE_FILE_DLL
)
&&
!
is_dll_native_subsystem
(
hModule
,
nt
,
p
))
{
wm
->
ldr
.
Flags
|=
LDR_IMAGE_IS_DLL
;
if
(
nt
->
OptionalHeader
.
AddressOfEntryPoint
)
...
...
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