summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/autoload.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-01-27 15:43:15 +0100
committerCorinna Vinschen <corinna@vinschen.de>2016-01-27 15:43:15 +0100
commitfcda8810a208b6b76ae95a88feea34ff0046ba1e (patch)
treeaf2b61112528075abdddf61ea29078fdc2867ef4 /winsup/cygwin/autoload.cc
parent78549742de0186223302f84997199a871999aded (diff)
downloadcygnal-fcda8810a208b6b76ae95a88feea34ff0046ba1e.tar.gz
cygnal-fcda8810a208b6b76ae95a88feea34ff0046ba1e.tar.bz2
cygnal-fcda8810a208b6b76ae95a88feea34ff0046ba1e.zip
Don't use LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32). It hangs
Observed running hexchat under X. For some reason the call to LoadLibraryEx(..., LOAD_LIBRARY_SEARCH_SYSTEM32) in dll_load hangs when trying to autoload MsgWaitForMultipleObjectsEx in select.cc after hexchat forks to run DNS calls. Dropping the call and just using full paths as in 2.3.1 fixes the issue. * autoload.cc (dll_load): Drop call to LoadLibraryEx with LOAD_LIBRARY_SEARCH_SYSTEM32 flag. * wincap.h (wincaps::has_load_lib_search_flags): Remove. * wincap.cc (wincaps::has_load_lib_search_flags): Drop handling this flag. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/autoload.cc')
-rw-r--r--winsup/cygwin/autoload.cc35
1 files changed, 13 insertions, 22 deletions
diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc
index 8a337be23..bc13e07df 100644
--- a/winsup/cygwin/autoload.cc
+++ b/winsup/cygwin/autoload.cc
@@ -332,7 +332,6 @@ union retchain
two_addr_t ll;
};
-
/* This function handles the problem described here:
http://www.microsoft.com/technet/security/advisory/2269637.mspx
@@ -349,28 +348,20 @@ static __inline bool
dll_load (HANDLE& handle, PWCHAR name)
{
HANDLE h = NULL;
-
- /* On systems supporting LOAD_LIBRARY_SEARCH flags, try to load
- explicitely from the system dir first. */
- if (wincap.has_load_lib_search_flags ())
- h = LoadLibraryExW (name, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
+ WCHAR dll_path[MAX_PATH];
+
+ /* If that failed, try loading with full path, which sometimes
+ fails for no good reason. */
+ wcpcpy (wcpcpy (dll_path, windows_system_directory), name);
+ h = LoadLibraryW (dll_path);
+ /* If that failed according to the second problem outlined in the
+ comment preceeding this function. */
+ if (!h && handle && wincap.use_dont_resolve_hack ()
+ && GetLastError () == ERROR_INVALID_ADDRESS)
+ h = LoadLibraryExW (dll_path, NULL, DONT_RESOLVE_DLL_REFERENCES);
+ /* Last resort: Try loading just by name. */
if (!h)
- {
- WCHAR dll_path[MAX_PATH];
-
- /* If that failed, try loading with full path, which sometimes
- fails for no good reason. */
- wcpcpy (wcpcpy (dll_path, windows_system_directory), name);
- h = LoadLibraryW (dll_path);
- /* If that failed according to the second problem outlined in the
- comment preceeding this function. */
- if (!h && handle && wincap.use_dont_resolve_hack ()
- && GetLastError () == ERROR_INVALID_ADDRESS)
- h = LoadLibraryExW (dll_path, NULL, DONT_RESOLVE_DLL_REFERENCES);
- /* Last resort: Try loading just by name. */
- if (!h)
- h = LoadLibraryW (name);
- }
+ h = LoadLibraryW (name);
if (!h)
return false;
handle = h;