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
d2b70aa5
Commit
d2b70aa5
authored
Apr 22, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a helper function to allocate module dependencies.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
68e675d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
18 deletions
+25
-18
loader.c
dlls/ntdll/loader.c
+25
-18
No files found.
dlls/ntdll/loader.c
View file @
d2b70aa5
...
...
@@ -600,6 +600,27 @@ static WINE_MODREF *find_so_module( void *handle )
/*************************************************************************
* grow_module_deps
*/
static
WINE_MODREF
**
grow_module_deps
(
WINE_MODREF
*
wm
,
int
count
)
{
WINE_MODREF
**
deps
;
if
(
wm
->
alloc_deps
)
deps
=
RtlReAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
wm
->
deps
,
(
wm
->
alloc_deps
+
count
)
*
sizeof
(
*
deps
)
);
else
deps
=
RtlAllocateHeap
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
count
*
sizeof
(
*
deps
)
);
if
(
deps
)
{
wm
->
deps
=
deps
;
wm
->
alloc_deps
+=
count
;
}
return
deps
;
}
/*************************************************************************
* find_forwarded_export
*
* Find the final function pointer for a forwarded function.
...
...
@@ -632,18 +653,8 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
{
if
(
!
imports_fixup_done
&&
current_modref
)
{
WINE_MODREF
**
deps
;
if
(
current_modref
->
alloc_deps
)
deps
=
RtlReAllocateHeap
(
GetProcessHeap
(),
0
,
current_modref
->
deps
,
(
current_modref
->
alloc_deps
+
1
)
*
sizeof
(
*
deps
)
);
else
deps
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
deps
)
);
if
(
deps
)
{
deps
[
current_modref
->
nDeps
++
]
=
wm
;
current_modref
->
deps
=
deps
;
current_modref
->
alloc_deps
++
;
}
WINE_MODREF
**
deps
=
grow_module_deps
(
current_modref
,
1
);
if
(
deps
)
deps
[
current_modref
->
nDeps
++
]
=
wm
;
}
else
if
(
process_attach
(
wm
,
NULL
)
!=
STATUS_SUCCESS
)
{
...
...
@@ -1087,9 +1098,8 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
if
(
!
(
wm
->
ldr
.
Flags
&
LDR_DONT_RESOLVE_REFS
))
return
STATUS_SUCCESS
;
/* already done */
wm
->
ldr
.
Flags
&=
~
LDR_DONT_RESOLVE_REFS
;
if
(
!
grow_module_deps
(
wm
,
1
))
return
STATUS_NO_MEMORY
;
wm
->
nDeps
=
1
;
wm
->
alloc_deps
=
1
;
wm
->
deps
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
WINE_MODREF
*
)
);
prev
=
current_modref
;
current_modref
=
wm
;
...
...
@@ -1144,14 +1154,11 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
while
(
imports
[
nb_imports
].
Name
&&
imports
[
nb_imports
].
FirstThunk
)
nb_imports
++
;
if
(
!
nb_imports
)
return
STATUS_SUCCESS
;
/* no imports */
if
(
!
grow_module_deps
(
wm
,
nb_imports
))
return
STATUS_NO_MEMORY
;
if
(
!
create_module_activation_context
(
&
wm
->
ldr
))
RtlActivateActivationContext
(
0
,
wm
->
ldr
.
ActivationContext
,
&
cookie
);
/* Allocate module dependency list */
wm
->
alloc_deps
=
nb_imports
;
wm
->
deps
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
nb_imports
*
sizeof
(
WINE_MODREF
*
)
);
/* load the imported modules. They are automatically
* added to the modref list of the process.
*/
...
...
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