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
ab8f0c3e
Commit
ab8f0c3e
authored
Mar 22, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Load builtin dlls through NtMapViewOfSection().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
49f12d65
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
45 deletions
+14
-45
virtual.c
dlls/kernel32/tests/virtual.c
+0
-1
loader.c
dlls/ntdll/loader.c
+14
-44
No files found.
dlls/kernel32/tests/virtual.c
View file @
ab8f0c3e
...
...
@@ -1331,7 +1331,6 @@ static void test_NtAreMappedFilesTheSame(void)
ptr
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
,
0
,
0
,
0
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_READ error %u
\n
"
,
GetLastError
()
);
status
=
pNtAreMappedFilesTheSame
(
ptr
,
GetModuleHandleA
(
"kernel32.dll"
)
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"NtAreMappedFilesTheSame returned %x
\n
"
,
status
);
file2
=
CreateFileA
(
path
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
...
...
dlls/ntdll/loader.c
View file @
ab8f0c3e
...
...
@@ -2316,8 +2316,19 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, const UNICODE_STRING *nt_nam
ViewShare
,
0
,
PAGE_EXECUTE_READ
);
if
(
status
==
STATUS_IMAGE_NOT_AT_BASE
)
status
=
STATUS_SUCCESS
;
if
(
status
)
return
status
;
if
((
*
pwm
=
find_existing_module
(
module
)))
/* already loaded */
{
if
((
*
pwm
)
->
ldr
.
LoadCount
!=
-
1
)
(
*
pwm
)
->
ldr
.
LoadCount
++
;
TRACE
(
"found %s for %s at %p, count=%d
\n
"
,
debugstr_us
(
&
(
*
pwm
)
->
ldr
.
FullDllName
),
debugstr_us
(
nt_name
),
(
*
pwm
)
->
ldr
.
DllBase
,
(
*
pwm
)
->
ldr
.
LoadCount
);
if
(
module
!=
(
*
pwm
)
->
ldr
.
DllBase
)
NtUnmapViewOfSection
(
NtCurrentProcess
(),
module
);
return
STATUS_SUCCESS
;
}
#ifdef _WIN64
if
(
!
status
&&
!
convert_to_pe64
(
module
,
image_info
))
status
=
STATUS_INVALID_IMAGE_FORMAT
;
if
(
!
convert_to_pe64
(
module
,
image_info
))
status
=
STATUS_INVALID_IMAGE_FORMAT
;
#endif
if
(
!
status
)
status
=
build_module
(
load_path
,
nt_name
,
&
module
,
image_info
,
id
,
flags
,
pwm
);
if
(
status
&&
module
)
NtUnmapViewOfSection
(
NtCurrentProcess
(),
module
);
...
...
@@ -2683,49 +2694,8 @@ static NTSTATUS load_dll( const WCHAR *load_path, const WCHAR *libname, const WC
break
;
case
STATUS_SUCCESS
:
/* valid PE file */
if
(
image_info
.
u
.
s
.
WineBuiltin
)
{
switch
(
loadorder
)
{
case
LO_NATIVE_BUILTIN
:
case
LO_BUILTIN
:
case
LO_BUILTIN_NATIVE
:
case
LO_DEFAULT
:
nts
=
load_builtin_dll
(
load_path
,
&
nt_name
,
flags
,
pwm
,
FALSE
);
if
(
nts
==
STATUS_DLL_NOT_FOUND
)
nts
=
load_native_dll
(
load_path
,
&
nt_name
,
mapping
,
&
image_info
,
&
id
,
flags
,
pwm
);
break
;
default:
nts
=
STATUS_DLL_NOT_FOUND
;
break
;
}
break
;
}
if
(
!
(
image_info
.
u
.
s
.
WineFakeDll
))
{
switch
(
loadorder
)
{
case
LO_NATIVE
:
case
LO_NATIVE_BUILTIN
:
nts
=
load_native_dll
(
load_path
,
&
nt_name
,
mapping
,
&
image_info
,
&
id
,
flags
,
pwm
);
break
;
case
LO_BUILTIN
:
nts
=
load_builtin_dll
(
load_path
,
&
nt_name
,
flags
,
pwm
,
FALSE
);
break
;
case
LO_BUILTIN_NATIVE
:
case
LO_DEFAULT
:
nts
=
load_builtin_dll
(
load_path
,
&
nt_name
,
flags
,
pwm
,
loadorder
==
LO_DEFAULT
);
if
(
nts
==
STATUS_DLL_NOT_FOUND
||
nts
==
STATUS_IMAGE_ALREADY_LOADED
)
nts
=
load_native_dll
(
load_path
,
&
nt_name
,
mapping
,
&
image_info
,
&
id
,
flags
,
pwm
);
break
;
default:
nts
=
STATUS_DLL_NOT_FOUND
;
break
;
}
break
;
}
TRACE
(
"%s is a fake Wine dll
\n
"
,
debugstr_us
(
&
nt_name
)
);
/* fall through */
nts
=
load_native_dll
(
load_path
,
&
nt_name
,
mapping
,
&
image_info
,
&
id
,
flags
,
pwm
);
break
;
case
STATUS_DLL_NOT_FOUND
:
/* no file found, try builtin */
switch
(
loadorder
)
...
...
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