diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-10-17 18:36:59 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-10-17 18:36:59 +0400 |
commit | cc5a7d7519f6e18247e2c301dcf48a9b9417caaf (patch) | |
tree | 75e2bf1f81c048eb086cbf5edb6d51fa09c18ca9 /winsup/cygwin/cygheap.h | |
parent | 1f0bd6f96fec4d2ccc89f404e14c309ef30b649a (diff) |
* cygheap.cc (cygheap_fixup_in_child): Call set_dll_dir.
(init_cygheap::init_installation_root): Just memmove contents of
installation_root instead of calling GetModuleFileNameW again.
Copy installation_root to installation_dir before stripping of
"bin" dir. Don't call SetDllDirectory here. Explain what we do.
(setup_cygheap): New function taking over initial cygheap setup
from memory_init. Additionally call set_dll_dir.
* cygheap.h (struct init_cygheap): Add installation_dir member.
(init_cygheap::set_dll_dir): Define.
(setup_cygheap): Declare.
* dcrt0.cc: Throughout drop parameter from memory_init call.
(dll_crt0_0): Call setup_cygheap prior to memory_init.
* dlfcn.cc (dlopen): Change comment to point to the right function.
* shared.cc (memory_init): Drop parameter. Drop cygheap setup.
* shared_info.h (memory_init): Change declaration accordingly.
Diffstat (limited to 'winsup/cygwin/cygheap.h')
-rw-r--r-- | winsup/cygwin/cygheap.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index c2f60e94d..55f26ed36 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -505,6 +505,7 @@ struct init_cygheap: public mini_cygheap unsigned bucket_val[NBUCKETS]; char *buckets[NBUCKETS]; WCHAR installation_root[PATH_MAX]; + WCHAR installation_dir[PATH_MAX]; UNICODE_STRING installation_key; WCHAR installation_key_buf[18]; cygheap_root root; @@ -533,6 +534,15 @@ struct init_cygheap: public mini_cygheap hook_chain hooks; void close_ctty (); void init_installation_root (); + void set_dll_dir () + { + /* Call SetDllDirectory on installation_dir. This removes "." from the + DLL search path and installs our /bin dir instead. + Amazing but true: This setting is propagated to child processes :-) + but only starting with Windows 8 :-( */ + if (!SetDllDirectoryW (installation_dir)) + debug_printf ("SetDllDirectoryW (%W), %E", installation_dir); + } void __reg1 init_tls_list ();; void __reg2 add_tls (_cygtls *); void __reg3 remove_tls (_cygtls *, DWORD); @@ -666,4 +676,5 @@ class cygheap_fdenum : public cygheap_fdmanip void __stdcall cygheap_fixup_in_child (bool); void __stdcall cygheap_init (); +void setup_cygheap (); extern char _cygheap_start[] __attribute__((section(".idata"))); |