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
e99811ae
Commit
e99811ae
authored
Aug 28, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement SetDefaultDllDirectories.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
66e302f8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
16 deletions
+91
-16
module.c
dlls/kernel32/module.c
+24
-6
path.c
dlls/kernel32/path.c
+0
-10
module.c
dlls/kernel32/tests/module.c
+67
-0
No files found.
dlls/kernel32/module.c
View file @
e99811ae
...
...
@@ -48,6 +48,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(module);
#define NE_FFLAGS_LIBMODULE 0x8000
static
WCHAR
*
dll_directory
;
/* extra path for SetDllDirectoryW */
static
DWORD
default_search_flags
;
/* default flags set by SetDefaultDllDirectories */
static
CRITICAL_SECTION
dlldir_section
;
static
CRITICAL_SECTION_DEBUG
critsect_debug
=
...
...
@@ -58,6 +59,10 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static
CRITICAL_SECTION
dlldir_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
const
DWORD
load_library_search_flags
=
(
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
|
LOAD_LIBRARY_SEARCH_USER_DIRS
|
LOAD_LIBRARY_SEARCH_SYSTEM32
|
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
);
/****************************************************************************
* GetDllDirectoryA (KERNEL32.@)
...
...
@@ -148,6 +153,21 @@ BOOL WINAPI SetDllDirectoryW( LPCWSTR dir )
}
/*************************************************************************
* SetDefaultDllDirectories (KERNEL32.@)
*/
BOOL
WINAPI
SetDefaultDllDirectories
(
DWORD
flags
)
{
if
(
!
flags
||
(
flags
&
~
load_library_search_flags
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
default_search_flags
=
flags
;
return
TRUE
;
}
/****************************************************************************
* DisableThreadLibraryCalls (KERNEL32.@)
*
...
...
@@ -964,16 +984,14 @@ static HMODULE load_library( const UNICODE_STRING *libname, DWORD flags )
NTSTATUS
nts
;
HMODULE
hModule
;
WCHAR
*
load_path
;
static
const
DWORD
unsupported_flags
=
static
const
DWORD
unsupported_flags
=
load_library_search_flags
|
LOAD_IGNORE_CODE_AUTHZ_LEVEL
|
LOAD_LIBRARY_AS_IMAGE_RESOURCE
|
LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE
|
LOAD_LIBRARY_REQUIRE_SIGNED_TARGET
|
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
|
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
|
LOAD_LIBRARY_SEARCH_USER_DIRS
|
LOAD_LIBRARY_SEARCH_SYSTEM32
|
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
;
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
;
if
(
!
(
flags
&
load_library_search_flags
))
flags
|=
default_search_flags
;
if
(
flags
&
unsupported_flags
)
FIXME
(
"unsupported flag(s) used (flags: 0x%08x)
\n
"
,
flags
);
...
...
dlls/kernel32/path.c
View file @
e99811ae
...
...
@@ -2081,13 +2081,3 @@ BOOL WINAPI SetSearchPathMode(DWORD flags)
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
}
/*************************************************************************
* SetDefaultDllDirectories (KERNEL32.@)
*/
BOOL
WINAPI
SetDefaultDllDirectories
(
DWORD
flags
)
{
FIXME
(
"(%x): stub
\n
"
,
flags
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
}
dlls/kernel32/tests/module.c
View file @
e99811ae
...
...
@@ -25,6 +25,7 @@
static
DWORD
(
WINAPI
*
pGetDllDirectoryA
)(
DWORD
,
LPSTR
);
static
DWORD
(
WINAPI
*
pGetDllDirectoryW
)(
DWORD
,
LPWSTR
);
static
BOOL
(
WINAPI
*
pSetDllDirectoryA
)(
LPCSTR
);
static
BOOL
(
WINAPI
*
pSetDefaultDllDirectories
)(
DWORD
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExA
)(
DWORD
,
LPCSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pGetModuleHandleExW
)(
DWORD
,
LPCWSTR
,
HMODULE
*
);
static
BOOL
(
WINAPI
*
pK32GetModuleInformation
)(
HANDLE
process
,
HMODULE
module
,
...
...
@@ -515,6 +516,7 @@ static void init_pointers(void)
MAKEFUNC
(
GetDllDirectoryA
);
MAKEFUNC
(
GetDllDirectoryW
);
MAKEFUNC
(
SetDllDirectoryA
);
MAKEFUNC
(
SetDefaultDllDirectories
);
MAKEFUNC
(
GetModuleHandleExA
);
MAKEFUNC
(
GetModuleHandleExW
);
MAKEFUNC
(
K32GetModuleInformation
);
...
...
@@ -739,6 +741,70 @@ static void testK32GetModuleInformation(void)
ok
(
info
.
EntryPoint
!=
NULL
,
"Expected nonzero entrypoint
\n
"
);
}
static
void
test_SetDefaultDllDirectories
(
void
)
{
HMODULE
mod
;
BOOL
ret
;
if
(
!
pSetDefaultDllDirectories
)
{
win_skip
(
"SetDefaultDllDirectories not available
\n
"
);
return
;
}
mod
=
LoadLibraryA
(
"authz.dll"
);
ok
(
mod
!=
NULL
,
"loading authz failed
\n
"
);
FreeLibrary
(
mod
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_USER_DIRS
);
ok
(
ret
,
"SetDefaultDllDirectories failed err %u
\n
"
,
GetLastError
()
);
mod
=
LoadLibraryA
(
"authz.dll"
);
todo_wine
ok
(
!
mod
,
"loading authz succeeded
\n
"
);
FreeLibrary
(
mod
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_SYSTEM32
);
ok
(
ret
,
"SetDefaultDllDirectories failed err %u
\n
"
,
GetLastError
()
);
mod
=
LoadLibraryA
(
"authz.dll"
);
ok
(
mod
!=
NULL
,
"loading authz failed
\n
"
);
FreeLibrary
(
mod
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
);
ok
(
ret
,
"SetDefaultDllDirectories failed err %u
\n
"
,
GetLastError
()
);
mod
=
LoadLibraryA
(
"authz.dll"
);
todo_wine
ok
(
!
mod
,
"loading authz succeeded
\n
"
);
FreeLibrary
(
mod
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
);
ok
(
ret
,
"SetDefaultDllDirectories failed err %u
\n
"
,
GetLastError
()
);
mod
=
LoadLibraryA
(
"authz.dll"
);
ok
(
mod
!=
NULL
,
"loading authz failed
\n
"
);
FreeLibrary
(
mod
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetDefaultDllDirectories
(
0
);
ok
(
!
ret
,
"SetDefaultDllDirectories succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetDefaultDllDirectories
(
3
);
ok
(
!
ret
,
"SetDefaultDllDirectories succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_APPLICATION_DIR
|
0x8000
);
ok
(
!
ret
,
"SetDefaultDllDirectories succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
);
ok
(
!
ret
||
broken
(
ret
)
/* win7 */
,
"SetDefaultDllDirectories succeeded
\n
"
);
if
(
!
ret
)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR
|
LOAD_LIBRARY_SEARCH_USER_DIRS
);
ok
(
!
ret
||
broken
(
ret
)
/* win7 */
,
"SetDefaultDllDirectories succeeded
\n
"
);
if
(
!
ret
)
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"wrong error %u
\n
"
,
GetLastError
()
);
/* restore some sane defaults */
pSetDefaultDllDirectories
(
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
);
}
START_TEST
(
module
)
{
WCHAR
filenameW
[
MAX_PATH
];
...
...
@@ -768,4 +834,5 @@ START_TEST(module)
testLoadLibraryEx
();
testGetModuleHandleEx
();
testK32GetModuleInformation
();
test_SetDefaultDllDirectories
();
}
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