summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dcrt0.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-12-18 20:32:04 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-12-18 20:32:04 +0000
commitf16706de978322fb69a39bae0dd817fb2fdaeaf2 (patch)
tree057ab687428b320ffe92db406a7767039756e398 /winsup/cygwin/dcrt0.cc
parent333a47d316455824fb63bf35938a1c8ea870b84b (diff)
downloadcygnal-f16706de978322fb69a39bae0dd817fb2fdaeaf2.tar.gz
cygnal-f16706de978322fb69a39bae0dd817fb2fdaeaf2.tar.bz2
cygnal-f16706de978322fb69a39bae0dd817fb2fdaeaf2.zip
Throughout, replace hMainProc with GetCurrentProcess/NtCurrentProcess
according to context. Throughout, replace hMainThread with GetCurrentThread/NtCurrentThread according to context. * dcrt0.cc (dll_crt0_0): Drop duplication of GetCurrentProcess to hMainProc. Drop duplication of GetCurrentThread to hMainThread. * dtable.cc (dtable::stdio_init): Remove useless comment. * globals.cc (hMainProc): Remove. (hMainThread): Remove. * ntdll.h (NtCurrentProcess): Define. (NtCurrentThread: Define.
Diffstat (limited to 'winsup/cygwin/dcrt0.cc')
-rw-r--r--winsup/cygwin/dcrt0.cc18
1 files changed, 4 insertions, 14 deletions
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 1816f2e7f..021703e33 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -609,7 +609,8 @@ child_info_spawn::handle_spawn ()
cygheap_fixup_in_child (true);
memory_init (false);
if (!moreinfo->myself_pinfo ||
- !DuplicateHandle (hMainProc, moreinfo->myself_pinfo, hMainProc, &h, 0,
+ !DuplicateHandle (GetCurrentProcess (), moreinfo->myself_pinfo,
+ GetCurrentProcess (), &h, 0,
FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE))
h = NULL;
myself.thisproc (h);
@@ -660,7 +661,7 @@ disable_dep ()
}
if (dep_system_policy < OptIn)
return;
- if (!GetProcessDEPPolicy (hMainProc, &ppolicy, &perm))
+ if (!GetProcessDEPPolicy (GetCurrentProcess (), &ppolicy, &perm))
{
debug_printf ("GetProcessDEPPolicy: %E");
return;
@@ -694,15 +695,7 @@ dll_crt0_0 ()
user_data->impure_ptr = _impure_ptr;
user_data->impure_ptr_ptr = &_impure_ptr;
- if (!DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (),
- GetCurrentProcess (), &hMainProc, 0, FALSE,
- DUPLICATE_SAME_ACCESS))
- hMainProc = GetCurrentProcess ();
-
- DuplicateHandle (hMainProc, GetCurrentThread (), hMainProc,
- &hMainThread, 0, false, DUPLICATE_SAME_ACCESS);
-
- OpenProcessToken (hMainProc, MAXIMUM_ALLOWED, &hProcToken);
+ OpenProcessToken (GetCurrentProcess (), MAXIMUM_ALLOWED, &hProcToken);
set_cygwin_privileges (hProcToken);
device::init ();
@@ -788,9 +781,6 @@ dll_crt0_1 (void *)
small_printf ("cmalloc returns %p\n", cmalloc (HEAP_STR, n));
#endif
- ProtectHandle (hMainProc);
- ProtectHandle (hMainThread);
-
cygheap->cwd.init ();
/* Initialize pthread mainthread when not forked and it is safe to call new,