* fhandler_tty.cc (fhandler_tty_slave::open): Reset the current windows station

whenever ctty == -1 regardles of whetehr there's a windows station already
assigned.  Close the old windows station in this situation.
* pinfo.cc (_pinfo::set_ctty): Reinstate incrementing of console count when
recording ctty so that the current tty is always around.
This commit is contained in:
Christopher Faylor 2005-11-24 02:34:31 +00:00
parent a39cfda7ba
commit 819dbaebd6
4 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2005-11-23 Christopher Faylor <cgf@timesys.com>
* fhandler_tty.cc (fhandler_tty_slave::open): Reset the current windows
station whenever ctty == -1 regardles of whetehr there's a windows
station already assigned. Close the old windows station in this
situation.
* pinfo.cc (_pinfo::set_ctty): Reinstate incrementing of console count
when recording ctty so that the current tty is always around.
2005-11-18 Christopher Faylor <cgf@timesys.com> 2005-11-18 Christopher Faylor <cgf@timesys.com>
* strptime.cc (_strptime): Fix gcc warnings. * strptime.cc (_strptime): Fix gcc warnings.

View File

@ -413,6 +413,7 @@ LoadDLLfuncEx (LsaRegisterLogonProcess, 12, secur32, 1)
LoadDLLfunc (CharToOemA, 8, user32) LoadDLLfunc (CharToOemA, 8, user32)
LoadDLLfunc (CharToOemBuffA, 12, user32) LoadDLLfunc (CharToOemBuffA, 12, user32)
LoadDLLfunc (CloseClipboard, 0, user32) LoadDLLfunc (CloseClipboard, 0, user32)
LoadDLLfunc (CloseWindowStation, 4, user32)
LoadDLLfunc (CreateWindowExA, 48, user32) LoadDLLfunc (CreateWindowExA, 48, user32)
LoadDLLfunc (CreateWindowStationA, 16, user32) LoadDLLfunc (CreateWindowStationA, 16, user32)
LoadDLLfunc (DefWindowProcA, 16, user32) LoadDLLfunc (DefWindowProcA, 16, user32)

View File

@ -580,7 +580,8 @@ fhandler_tty_slave::open (int flags, mode_t)
&& wincap.pty_needs_alloc_console ()) && wincap.pty_needs_alloc_console ())
{ {
BOOL b; BOOL b;
if (!GetProcessWindowStation ()) HWINSTA horig = GetProcessWindowStation ();
if (myself->ctty == -1)
{ {
HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih); HWINSTA h = CreateWindowStation (NULL, 0, GENERIC_READ | GENERIC_WRITE, &sec_none_nih);
termios_printf ("CreateWindowStation %p, %E", h); termios_printf ("CreateWindowStation %p, %E", h);
@ -589,6 +590,8 @@ fhandler_tty_slave::open (int flags, mode_t)
b = SetProcessWindowStation (h); b = SetProcessWindowStation (h);
termios_printf ("SetProcessWindowStation %d, %E", b); termios_printf ("SetProcessWindowStation %d, %E", b);
} }
if (horig)
CloseWindowStation (horig);
} }
b = AllocConsole (); // will cause flashing if workstation b = AllocConsole (); // will cause flashing if workstation
// stuff fails // stuff fails

View File

@ -365,6 +365,8 @@ _pinfo::set_ctty (tty_min *tc, int flags, fhandler_tty_slave *arch)
if (arch) if (arch)
{ {
arch->usecount++; arch->usecount++;
/* guard ctty arch */
cygheap->manage_console_count ("_pinfo::set_ctty", 1);
report_tty_counts (cygheap->ctty, "ctty", ""); report_tty_counts (cygheap->ctty, "ctty", "");
} }
} }