From f16706de978322fb69a39bae0dd817fb2fdaeaf2 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 18 Dec 2009 20:32:04 +0000 Subject: 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. --- winsup/cygwin/spawn.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'winsup/cygwin/spawn.cc') diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 88b9bf21f..928499614 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -420,9 +420,9 @@ spawn_guts (const char *prog_arg, const char *const *argv, moreinfo->argv = newargv; if (mode != _P_OVERLAY || - !DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, - &moreinfo->myself_pinfo, 0, TRUE, - DUPLICATE_SAME_ACCESS)) + !DuplicateHandle (GetCurrentProcess (), myself.shared_handle (), + GetCurrentProcess (), &moreinfo->myself_pinfo, + 0, TRUE, DUPLICATE_SAME_ACCESS)) moreinfo->myself_pinfo = NULL; else VerifyHandle (moreinfo->myself_pinfo); @@ -445,7 +445,7 @@ spawn_guts (const char *prog_arg, const char *const *argv, si.cb = sizeof (si); - c_flags = GetPriorityClass (hMainProc); + c_flags = GetPriorityClass (GetCurrentProcess ()); sigproc_printf ("priority class %d", c_flags); c_flags |= CREATE_SEPARATE_WOW_VDM | CREATE_UNICODE_ENVIRONMENT; @@ -473,9 +473,9 @@ spawn_guts (const char *prog_arg, const char *const *argv, generating its own pids again? */ if (cygheap->pid_handle) /* already done previously */; - else if (DuplicateHandle (hMainProc, hMainProc, hMainProc, - &cygheap->pid_handle, PROCESS_QUERY_INFORMATION, - TRUE, 0)) + else if (DuplicateHandle (GetCurrentProcess (), GetCurrentProcess (), + GetCurrentProcess (), &cygheap->pid_handle, + PROCESS_QUERY_INFORMATION, TRUE, 0)) ProtectHandleINH (cygheap->pid_handle); else system_printf ("duplicate to pid_handle failed, %E"); @@ -729,8 +729,8 @@ loop: the fields filled out by child.remember do not disappear and so there is not a brief period during which the pid is not available. However, we should try to find another way to do this eventually. */ - DuplicateHandle (hMainProc, child.shared_handle (), pi.hProcess, - NULL, 0, 0, DUPLICATE_SAME_ACCESS); + DuplicateHandle (GetCurrentProcess (), child.shared_handle (), + pi.hProcess, NULL, 0, 0, DUPLICATE_SAME_ACCESS); child->start_time = time (NULL); /* Register child's starting time. */ child->nice = myself->nice; if (!child.remember (mode == _P_DETACH)) -- cgit v1.2.3