diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-10-14 23:14:33 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-10-14 23:14:33 +0400 |
commit | 1dd75c50d5727dcd9330377053dfe673d617fead (patch) | |
tree | c6f6d2d649730df4393715f7c5cec0761e40008e /winsup/cygwin/cygheap.cc | |
parent | 2599a694a6c3b74a9c6424e933d964a4fee06309 (diff) |
* cygheap.cc (init_cygheap::init_installation_root): Install Cygwin's
installation dir as DLL search path, instead of ".".
* cygheap.h (class cwdstuff): Add parameter names in function
declarations for readability.
(cwdstuff::get): Ad inline implementation fetching the CWD as wide char
string.
* dlfcn.cc (dlopen): Add searching for dependent DLLs in DLL
installation dir or CWD, if all else failed.
Add comment to explain scenarios this is accommodating.
Diffstat (limited to 'winsup/cygwin/cygheap.cc')
-rw-r--r-- | winsup/cygwin/cygheap.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index 067aa68dd..7e261ed48 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -170,7 +170,6 @@ init_cygheap::init_installation_root () } } installation_root[1] = L'?'; - RtlInitEmptyUnicodeString (&installation_key, installation_key_buf, sizeof installation_key_buf); RtlInt64ToHexUnicodeString (hash_path_name (0, installation_root), @@ -185,6 +184,15 @@ init_cygheap::init_installation_root () if (!w) api_fatal ("Can't initialize Cygwin installation root dir.\n" "Invalid DLL path"); + + /* Remove "." from DLL search path and install our /bin dir instead. + Note that this change is propagated to child processes so we don't + have to call SetDllDirectory in each process. */ + installation_root[1] = L'\\'; + if (!SetDllDirectoryW (installation_root)) + debug_printf ("Couldn't set %W as DLL directory, %E", installation_root); + installation_root[1] = L'?'; + /* If w < p, the Cygwin DLL resides in the root dir of a drive or network path. In that case, if we strip off yet another backslash, the path becomes invalid. We avoid that here so that the DLL also works in this |