diff options
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r-- | winsup/cygwin/dcrt0.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index 021703e33..dfdc7d09d 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -695,6 +695,10 @@ dll_crt0_0 () user_data->impure_ptr = _impure_ptr; user_data->impure_ptr_ptr = &_impure_ptr; + DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), + GetCurrentProcess (), &hMainThread, + 0, false, DUPLICATE_SAME_ACCESS); + OpenProcessToken (GetCurrentProcess (), MAXIMUM_ALLOWED, &hProcToken); set_cygwin_privileges (hProcToken); @@ -781,6 +785,8 @@ dll_crt0_1 (void *) small_printf ("cmalloc returns %p\n", cmalloc (HEAP_STR, n)); #endif + ProtectHandle (hMainThread); + cygheap->cwd.init (); /* Initialize pthread mainthread when not forked and it is safe to call new, |