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
7b233f30
Commit
7b233f30
authored
Feb 22, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Map explicitly loaded apiset dlls to their target library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
31e15136
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
module.c
dlls/kernel32/tests/module.c
+2
-4
loader.c
dlls/ntdll/loader.c
+29
-14
No files found.
dlls/kernel32/tests/module.c
View file @
7b233f30
...
...
@@ -708,7 +708,6 @@ static void test_LoadLibraryEx_search_flags(void)
ok
(
!!
mod
,
"Got NULL module, error %u.
\n
"
,
GetLastError
()
);
ok
(
!!
GetModuleHandleA
(
apiset_dll
),
"Got NULL handle.
\n
"
);
shcore
=
GetModuleHandleA
(
"shcore.dll"
);
todo_wine
ok
(
mod
==
shcore
,
"wrong module %p/%p
\n
"
,
mod
,
shcore
);
ret
=
FreeLibrary
(
mod
);
ok
(
ret
,
"FreeLibrary failed, error %u.
\n
"
,
GetLastError
()
);
...
...
@@ -722,7 +721,6 @@ static void test_LoadLibraryEx_search_flags(void)
ok
(
!!
mod
,
"Got NULL module, error %u.
\n
"
,
GetLastError
()
);
ok
(
!!
GetModuleHandleA
(
apiset_dll
),
"Got NULL handle.
\n
"
);
shcore
=
GetModuleHandleA
(
"shcore.dll"
);
todo_wine
ok
(
mod
==
shcore
,
"wrong module %p/%p
\n
"
,
mod
,
shcore
);
ret
=
FreeLibrary
(
mod
);
ok
(
ret
,
"FreeLibrary failed, error %u.
\n
"
,
GetLastError
()
);
...
...
@@ -733,7 +731,6 @@ static void test_LoadLibraryEx_search_flags(void)
strcpy
(
buffer
,
apiset_dll
);
buffer
[
strlen
(
buffer
)
-
5
]
=
'9'
;
mod
=
LoadLibraryExA
(
buffer
,
NULL
,
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
);
todo_wine
ok
(
!!
mod
||
broken
(
!
mod
)
/* win8 */
,
"Got NULL module, error %u.
\n
"
,
GetLastError
()
);
if
(
mod
)
{
...
...
@@ -776,9 +773,10 @@ static void test_LoadLibraryEx_search_flags(void)
ok
(
GetLastError
()
==
ERROR_MOD_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
mod
=
LoadLibraryExA
(
"ext-ms-win-ras-rasapi32-l1-1-0.dll"
,
NULL
,
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
);
todo_wine
/* rasapi32 doesn't have interesting dependencies on wine */
ok
(
!
mod
,
"rasapi32 loaded
\n
"
);
ok
(
GetLastError
()
==
ERROR_MOD_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
()
);
if
(
mod
)
FreeLibrary
(
mod
);
else
ok
(
GetLastError
()
==
ERROR_MOD_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
()
);
mod
=
LoadLibraryA
(
"ext-ms-win-ras-rasapi32-l1-1-0.dll"
);
ok
(
!!
mod
||
broken
(
!
mod
)
/* win7 */
,
"rasapi32 not found %u
\n
"
,
GetLastError
()
);
if
(
mod
)
FreeLibrary
(
mod
);
...
...
dlls/ntdll/loader.c
View file @
7b233f30
...
...
@@ -2830,6 +2830,30 @@ done:
}
/******************************************************************************
* find_apiset_dll
*/
static
NTSTATUS
find_apiset_dll
(
const
WCHAR
*
name
,
WCHAR
**
fullname
)
{
const
API_SET_NAMESPACE
*
map
=
NtCurrentTeb
()
->
Peb
->
ApiSetMap
;
const
API_SET_NAMESPACE_ENTRY
*
entry
;
UNICODE_STRING
str
;
ULONG
len
;
if
(
get_apiset_entry
(
map
,
name
,
wcslen
(
name
),
&
entry
))
return
STATUS_APISET_NOT_PRESENT
;
if
(
get_apiset_target
(
map
,
entry
,
NULL
,
&
str
))
return
STATUS_DLL_NOT_FOUND
;
len
=
wcslen
(
system_dir
)
+
str
.
Length
/
sizeof
(
WCHAR
);
if
(
!
(
*
fullname
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
STATUS_NO_MEMORY
;
wcscpy
(
*
fullname
,
system_dir
);
memcpy
(
*
fullname
+
wcslen
(
system_dir
),
str
.
Buffer
,
str
.
Length
);
(
*
fullname
)[
len
]
=
0
;
return
STATUS_SUCCESS
;
}
/***********************************************************************
* get_env_var
*/
...
...
@@ -2992,17 +3016,6 @@ done:
}
/***********************************************************************
* is_apiset_dll_name
*
*/
static
BOOL
is_apiset_dll_name
(
const
WCHAR
*
name
)
{
static
const
WCHAR
name_prefix
[]
=
L"api-ms-win-"
;
return
!
wcsnicmp
(
name
,
name_prefix
,
ARRAY_SIZE
(
name_prefix
)
-
1
);
}
/***********************************************************************
* find_dll_file
*
* Find the file (or already loaded module) for a given dll name.
...
...
@@ -3024,7 +3037,11 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI
if
(
!
contains_path
(
libname
))
{
status
=
find_actctx_dll
(
libname
,
&
fullname
);
status
=
find_apiset_dll
(
libname
,
&
fullname
);
if
(
status
==
STATUS_DLL_NOT_FOUND
)
goto
done
;
if
(
status
)
status
=
find_actctx_dll
(
libname
,
&
fullname
);
if
(
status
==
STATUS_SUCCESS
)
{
TRACE
(
"found %s for %s
\n
"
,
debugstr_w
(
fullname
),
debugstr_w
(
libname
)
);
...
...
@@ -3044,8 +3061,6 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, UNI
if
(
RtlDetermineDosPathNameType_U
(
libname
)
==
RELATIVE_PATH
)
{
status
=
search_dll_file
(
load_path
,
libname
,
nt_name
,
pwm
,
mapping
,
image_info
,
id
);
if
(
status
==
STATUS_DLL_NOT_FOUND
&&
load_path
&&
is_apiset_dll_name
(
libname
))
status
=
search_dll_file
(
NULL
,
libname
,
nt_name
,
pwm
,
mapping
,
image_info
,
id
);
if
(
status
==
STATUS_DLL_NOT_FOUND
)
status
=
find_builtin_without_file
(
libname
,
nt_name
,
pwm
,
mapping
,
image_info
,
id
);
}
...
...
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