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
295f10aa
Commit
295f10aa
authored
Jun 05, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to find a module from its dlopen handle.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
91afd770
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
16 deletions
+30
-16
loader.c
dlls/ntdll/loader.c
+30
-16
No files found.
dlls/ntdll/loader.c
View file @
295f10aa
...
...
@@ -538,6 +538,28 @@ static WINE_MODREF *find_fileid_module( struct stat *st )
}
/**********************************************************************
* find_so_module
*
* Find a module from its so file handle.
* The loader_section must be locked while calling this function
*/
static
WINE_MODREF
*
find_so_module
(
void
*
handle
)
{
LIST_ENTRY
*
mark
,
*
entry
;
mark
=
&
NtCurrentTeb
()
->
Peb
->
LdrData
->
InLoadOrderModuleList
;
for
(
entry
=
mark
->
Flink
;
entry
!=
mark
;
entry
=
entry
->
Flink
)
{
LDR_MODULE
*
mod
=
CONTAINING_RECORD
(
entry
,
LDR_MODULE
,
InLoadOrderModuleList
);
WINE_MODREF
*
wm
=
CONTAINING_RECORD
(
mod
,
WINE_MODREF
,
ldr
);
if
(
mod
->
Flags
&
LDR_WINE_INTERNAL
&&
mod
->
SectionHandle
==
handle
)
return
wm
;
}
return
NULL
;
}
/*************************************************************************
* find_forwarded_export
*
...
...
@@ -2465,27 +2487,19 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na
if
(
!
info
.
wm
)
{
PLIST_ENTRY
mark
,
entry
;
/* The constructor wasn't called, this means the .so is already
* loaded under a different name. Try to find the wm for it. */
mark
=
&
NtCurrentTeb
()
->
Peb
->
LdrData
->
InLoadOrderModuleList
;
for
(
entry
=
mark
->
Flink
;
entry
!=
mark
;
entry
=
entry
->
Flink
)
if
((
info
.
wm
=
find_so_module
(
handle
)))
{
LDR_MODULE
*
mod
=
CONTAINING_RECORD
(
entry
,
LDR_MODULE
,
InLoadOrderModuleList
);
if
(
mod
->
Flags
&
LDR_WINE_INTERNAL
&&
mod
->
SectionHandle
==
handle
)
{
info
.
wm
=
CONTAINING_RECORD
(
mod
,
WINE_MODREF
,
ldr
);
TRACE
(
"Found %s at %p for builtin %s
\n
"
,
debugstr_w
(
info
.
wm
->
ldr
.
FullDllName
.
Buffer
),
info
.
wm
->
ldr
.
BaseAddress
,
debugstr_us
(
nt_name
)
);
break
;
}
TRACE
(
"Found %s at %p for builtin %s
\n
"
,
debugstr_w
(
info
.
wm
->
ldr
.
FullDllName
.
Buffer
),
info
.
wm
->
ldr
.
BaseAddress
,
debugstr_us
(
nt_name
)
);
if
(
info
.
wm
->
ldr
.
LoadCount
!=
-
1
)
info
.
wm
->
ldr
.
LoadCount
++
;
}
wine_dll_unload
(
handle
);
/* release the libdl refcount */
if
(
!
info
.
wm
)
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
info
.
wm
->
ldr
.
LoadCount
!=
-
1
)
info
.
wm
->
ldr
.
LoadCount
++
;
else
info
.
status
=
STATUS_INVALID_IMAGE_FORMAT
;
wine_dlclose
(
handle
,
NULL
,
0
);
/* release the libdl refcount */
}
else
{
...
...
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