* fhandler_console.cc (fhandler_console::dup): Allocate space for

savebuf on Cygwin heap.
        (fhandler_console::char_command): Ditto. Use correct values for size.
This commit is contained in:
Corinna Vinschen 2001-06-05 17:59:46 +00:00
parent 149da470f3
commit 235661a37f
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,9 @@
Tue Jun 5 19:56:00 2001 Corinna Vinschen <corinna@vinschen.de>
* fhandler_console.cc (fhandler_console::dup): Allocate space for
savebuf on Cygwin heap.
(fhandler_console::char_command): Ditto. Use correct values for size.
2001-06-05 Egor Duda <deo@logos-m.ru> 2001-06-05 Egor Duda <deo@logos-m.ru>
* security.h (NTWriteEA): Change prototype. * security.h (NTWriteEA): Change prototype.

View File

@ -624,7 +624,7 @@ fhandler_console::dup (fhandler_base *child)
fhc->savebufsiz = savebufsiz; fhc->savebufsiz = savebufsiz;
if (savebuf) if (savebuf)
{ {
fhc->savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * fhc->savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) * memcpy (fhc->savebuf, savebuf, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
@ -1174,12 +1174,12 @@ fhandler_console::char_command (char c)
if (!GetConsoleScreenBufferInfo (get_output_handle (), &now)) if (!GetConsoleScreenBufferInfo (get_output_handle (), &now))
break; break;
savebufsiz.X = now.srWindow.Right - now.srWindow.Left; savebufsiz.X = now.srWindow.Right - now.srWindow.Left + 1;
savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top; savebufsiz.Y = now.srWindow.Bottom - now.srWindow.Top + 1;
if (savebuf) if (savebuf)
free (savebuf); cfree (savebuf);
savebuf = (PCHAR_INFO) malloc (sizeof (CHAR_INFO) * savebuf = (PCHAR_INFO) cmalloc (HEAP_1_BUF, sizeof (CHAR_INFO) *
savebufsiz.X * savebufsiz.Y); savebufsiz.X * savebufsiz.Y);
ReadConsoleOutputA (get_output_handle (), savebuf, ReadConsoleOutputA (get_output_handle (), savebuf,
@ -1199,7 +1199,7 @@ fhandler_console::char_command (char c)
WriteConsoleOutputA (get_output_handle (), savebuf, WriteConsoleOutputA (get_output_handle (), savebuf,
savebufsiz, cob, &now.srWindow); savebufsiz, cob, &now.srWindow);
free (savebuf); cfree (savebuf);
savebuf = NULL; savebuf = NULL;
savebufsiz.X = savebufsiz.Y = 0; savebufsiz.X = savebufsiz.Y = 0;
} }