Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b89f8884
Commit
b89f8884
authored
Feb 10, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Feb 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Skip unused import descriptors when loading libraries.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
49051392
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
loader.c
dlls/ntdll/loader.c
+16
-5
No files found.
dlls/ntdll/loader.c
View file @
b89f8884
...
...
@@ -564,7 +564,7 @@ static FARPROC find_named_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *
* Import the dll specified by the given import descriptor.
* The loader_section must be locked while calling this function.
*/
static
WINE_MODREF
*
import_dll
(
HMODULE
module
,
const
IMAGE_IMPORT_DESCRIPTOR
*
descr
,
LPCWSTR
load_path
)
static
BOOL
import_dll
(
HMODULE
module
,
const
IMAGE_IMPORT_DESCRIPTOR
*
descr
,
LPCWSTR
load_path
,
WINE_MODREF
**
pwm
)
{
NTSTATUS
status
;
WINE_MODREF
*
wmImp
;
...
...
@@ -586,6 +586,13 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
else
import_list
=
thunk_list
;
if
(
!
import_list
->
u1
.
Ordinal
)
{
WARN
(
"Skipping unused import %s
\n
"
,
name
);
*
pwm
=
NULL
;
return
TRUE
;
}
while
(
len
&&
name
[
len
-
1
]
==
' '
)
len
--
;
/* remove trailing spaces */
if
(
len
*
sizeof
(
WCHAR
)
<
sizeof
(
buffer
))
...
...
@@ -597,7 +604,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
else
/* need to allocate a larger buffer */
{
WCHAR
*
ptr
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
!
ptr
)
return
NULL
;
if
(
!
ptr
)
return
FALSE
;
ascii_to_unicode
(
ptr
,
name
,
len
);
ptr
[
len
]
=
0
;
status
=
load_dll
(
load_path
,
ptr
,
0
,
&
wmImp
);
...
...
@@ -612,7 +619,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
else
ERR
(
"Loading library %s (which is needed by %s) failed (error %x).
\n
"
,
name
,
debugstr_w
(
current_modref
->
ldr
.
FullDllName
.
Buffer
),
status
);
return
NULL
;
return
FALSE
;
}
/* unprotect the import address table since it can be located in
...
...
@@ -693,7 +700,8 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d
done:
/* restore old protection of the import address table */
NtProtectVirtualMemory
(
NtCurrentProcess
(),
&
protect_base
,
&
protect_size
,
protect_old
,
&
protect_old
);
return
wmImp
;
*
pwm
=
wmImp
;
return
TRUE
;
}
...
...
@@ -901,8 +909,11 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
status
=
STATUS_SUCCESS
;
for
(
i
=
0
;
i
<
nb_imports
;
i
++
)
{
if
(
!
(
wm
->
deps
[
i
]
=
import_dll
(
wm
->
ldr
.
BaseAddress
,
&
imports
[
i
],
load_path
)))
if
(
!
import_dll
(
wm
->
ldr
.
BaseAddress
,
&
imports
[
i
],
load_path
,
&
wm
->
deps
[
i
]
))
{
wm
->
deps
[
i
]
=
NULL
;
status
=
STATUS_DLL_NOT_FOUND
;
}
}
current_modref
=
prev
;
if
(
wm
->
ldr
.
ActivationContext
)
RtlDeactivateActivationContext
(
0
,
cookie
);
...
...
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